<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>io.zwets.it</title>
    <description>Marco van Zwetselaar&apos;s IT domain</description>
    <link>https://io.zwets.it/</link>
    <atom:link href="https://io.zwets.it/feed.xml" rel="self" type="application/rss+xml" />
    <pubDate>Tue, 18 Nov 2025 11:56:27 +0300</pubDate>
    <lastBuildDate>Tue, 18 Nov 2025 11:56:27 +0300</lastBuildDate>
    <generator>Jekyll v3.10.0</generator>
    
      <item>
        <title>Bioinformatician without Borders</title>
        <description>&lt;p&gt;After ten years at &lt;a href=&quot;https://www.kcri.ac.tz&quot;&gt;Kilimanjaro Clinical Research Institute&lt;/a&gt;,
I am excited to embark on a new venture: &lt;a href=&quot;https://zwets.it&quot;&gt;Zwets IT&lt;/a&gt; takes off!&lt;/p&gt;

&lt;p&gt;As of today I am available for hire as an independent contractor in bioinformatics,
based in The Netherlands, but open for bioinformatics work around the world.&lt;/p&gt;

&lt;p&gt;Despite some colourful suggestions for company names by friends and colleagues,
I’ve gone with pragmatic: Zwets IT (&lt;a href=&quot;https://zwets.it&quot;&gt;https://zwets.it&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;It was a close call for &lt;em&gt;The Flying Bioinformatician&lt;/em&gt;, &lt;em&gt;Nomadic Bioinformatics&lt;/em&gt;,
and, especially, &lt;em&gt;«Bio-informaticien sans Frontières»&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;More about me &lt;a href=&quot;https://io.zwets.it/about&quot;&gt;here&lt;/a&gt;, in &lt;a href=&quot;https://io.zwets.it/cv.pdf&quot;&gt;my CV&lt;/a&gt;,
on &lt;a href=&quot;https://www.linkedin.com/in/zwets/&quot;&gt;LinkedIn&lt;/a&gt;, or reach out at &lt;a href=&quot;https://zwets.it&quot;&gt;Zwets IT&lt;/a&gt;.&lt;/p&gt;

</description>
        <pubDate>Wed, 01 Mar 2023 00:00:00 +0300</pubDate>
        <link>https://io.zwets.it/2023/03/01/bioinformatician-without-borders/</link>
        <guid isPermaLink="true">https://io.zwets.it/2023/03/01/bioinformatician-without-borders/</guid>
        
        
      </item>
    
      <item>
        <title>GTDB and MinHash - a little revolution</title>
        <description>&lt;p&gt;Being a bioinformatician at heart, I can’t help but feel that a little
revolution is happening at the confluence of two recent developments in
microbial genomics and bioinformatics.&lt;/p&gt;

&lt;p&gt;The first is the advent of the &lt;a href=&quot;https://gtdb.ecogenomic.org/&quot;&gt;GTDB&lt;/a&gt;, a
phylogenetically consistent bacterial and archaeal taxonomy.  Boldy going
where we didn’t go before, &lt;a href=&quot;https://dx.doi.org/10.1038/nbt.4229&quot;&gt;Parks c.s.&lt;/a&gt;
throw off the shackles of pre-genomic microbiology in favour of taxonomic
assignment based on degrees of genomic similarity.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;em&gt;Update&lt;/em&gt; I just pushed &lt;a href=&quot;https://github.com/zwets/gtdb-taxo&quot;&gt;gtdb-taxo&lt;/a&gt;,
a command-line search tool and browser for the GTDB taxonomy, to GitHub.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The second development is the rise of MinHash, a computational approach
designed 20 years ago for &lt;a href=&quot;https://dx.doi.org/10.1109/SEQUEN.1997.666900&quot;&gt;massive scale document comparison&lt;/a&gt;,
and introduced to genomics by &lt;a href=&quot;https://dx.doi.org/10.1101/029827&quot;&gt;Ondov c.s.&lt;/a&gt;
in the &lt;a href=&quot;https://github.com/marbl/Mash&quot;&gt;Mash&lt;/a&gt; tool.  Mash and its various
descendants (see the recent &lt;a href=&quot;https://doi.org/10.1186/s13059-019-1875-0&quot;&gt;Dashing paper&lt;/a&gt;
for an overview) have enabled the efficient many-to-many comparison of large
genome collections.&lt;/p&gt;

&lt;p&gt;It’s exciting to see the possibilities opened up by these developments, and
an absolute joy to work in a field where these little revolutions still happen.&lt;/p&gt;

</description>
        <pubDate>Sat, 14 Dec 2019 00:00:00 +0300</pubDate>
        <link>https://io.zwets.it/2019/12/14/gtdb-and-minhash-revolution/</link>
        <guid isPermaLink="true">https://io.zwets.it/2019/12/14/gtdb-and-minhash-revolution/</guid>
        
        
      </item>
    
      <item>
        <title>Introducing kcst</title>
        <description>&lt;p&gt;Finally got around to getting &lt;a href=&quot;https://io.zwets.it/kcst&quot;&gt;kcst&lt;/a&gt; in publishable shape.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kcst&lt;/code&gt; predicts species and MLST for bacterial genome assemblies, and does it fast: it
takes less than a second for the average assembly.
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kcst&lt;/code&gt; comes with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;khc&lt;/code&gt; (&lt;em&gt;k-mer hit counter&lt;/em&gt;), a fast and accurate tool to compute
sequence similarity between a query sequence and a set of subject sequences.&lt;/p&gt;

&lt;p&gt;Homepage is here: &lt;a href=&quot;https://io.zwets.it/kcst&quot;&gt;https://io.zwets.it/kcst&lt;/a&gt;, and &lt;a href=&quot;https://github.com/zwets/kcst&quot;&gt;here is the code&lt;/a&gt;.&lt;/p&gt;

</description>
        <pubDate>Thu, 11 Oct 2018 00:00:00 +0300</pubDate>
        <link>https://io.zwets.it/2018/10/11/introducing-kcst/</link>
        <guid isPermaLink="true">https://io.zwets.it/2018/10/11/introducing-kcst/</guid>
        
        
      </item>
    
      <item>
        <title>Evidence-based daughter</title>
        <description>&lt;p&gt;Tonight I carried my youngest daughter (Vicky, 5 yo) from the car to our
house.  As I shut the car she said “Careful! I’m always worried that I
get my fingers caught between the door.”&lt;/p&gt;

&lt;p&gt;It actually happened twice over the past two weeks.  The usual accident:
a sibling closing the door while she was still getting out.  Three fingers
stuck at the hinge side … owww!&lt;/p&gt;

&lt;p&gt;We were lucky.  Land Rover hinges have plenty of play, so it was painful
but she still has all her fingers.&lt;/p&gt;

&lt;p&gt;Vicky continued: “I’m worried because, you know, it hurts to get your
fingers stuck.  Three fingers hurts a lot.  One finger doesn’t hurt so
much.  Two fingers I don’t know.  I haven’t tried.”&lt;/p&gt;

</description>
        <pubDate>Fri, 30 Dec 2016 00:00:00 +0300</pubDate>
        <link>https://io.zwets.it/2016/12/30/evidence-based-daughter/</link>
        <guid isPermaLink="true">https://io.zwets.it/2016/12/30/evidence-based-daughter/</guid>
        
        
      </item>
    
      <item>
        <title>Architectural Decision Making</title>
        <description>&lt;p&gt;When working as an enterprise architect, I used to profess that optimal
decisions in IT do not exist.  There are as many independent valuations of
a solution as there are stakeholders in the decision.  Stakeholders take
viewpoints, and each viewpoint defines a different set of priorities in
terms of which alternatives are evaluated.&lt;/p&gt;

&lt;p&gt;But this doesn’t at all mean that architectural considerations become a
matter of taste, or must be the subject of endless debate&lt;sup id=&quot;fnref:1&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:1&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;, as often
happens.  I define “architectural decisions” loosely as: decisions in IT
which have a large impact over a wide scope.  They take place at every
level from IT strategy down to developer teams.&lt;/p&gt;

&lt;p&gt;In my experience, a very productive approach to shared architectural
decision making is to split the discussion into two decoupled levels:
evidence and utility.  I have successfully used this in workshops to
achieve “the best” architectural decisions, even in environments where
opinions were strongly divided.&lt;/p&gt;

&lt;h4 id=&quot;evidence&quot;&gt;Evidence&lt;/h4&gt;

&lt;p&gt;On the evidence level, the goal is to establish agreed-upon objective
conclusions based on evidence.  E.g.: “Alternative A takes X less time to
build, whereas B is Y times more reliable”.  The quantities X and Y
needn’t be exact, but must be supported by evidence and be uncontested by
any party.&lt;/p&gt;

&lt;p&gt;Any argument which cannot (in principle) be substantiated by facts is
disallowed in this phase.  For instance, a statement “alternative C is
better because it follows service-oriented principles” is tabled until
“better” is quantified, and “service-oriented principles” are qualified.&lt;/p&gt;

&lt;p&gt;This phase turns out to be both valuable and enjoyable for participants.
It is all about engineering, and everyone is working together toward a
shared goal, namely to establish measurable, objective truths about the
competing alternatives.  Almost as a side effect, a lot of insight is
gained that will be useful for the eventual design of the solution.&lt;/p&gt;

&lt;h4 id=&quot;utility&quot;&gt;Utility&lt;/h4&gt;

&lt;p&gt;On the “utility” level, the goal is to elicit viewpoints potentially held
by stakeholders, and the probable valuation of the alternatives given
their frames of reference (objectives, constraints, priorities).  In
decision theory this would be called determining the utility functions.
Note to self: in very complex decision processes,
&lt;a href=&quot;https://www.coursera.org/learn/probabilistic-graphical-models-2-inference&quot;&gt;probabilistic graphical modeling&lt;/a&gt;
a useful tool?&lt;/p&gt;

&lt;p&gt;Again, the discussion is not about deciding the optimal alternative, or
what is the superior viewpoint.  The goal is to make all valid viewpoints
explicit, so as to understand how alternatives are rated differently by
different people.  Participants are expected to not argue for their
own view, but also to come up with the reasoning of other stakeholders.&lt;/p&gt;

&lt;p&gt;It is especially during this phase that differences between factions are
resolved.  They might not sway their opinion just yet, but gaining an
understanding of where other people “are coming from” as well as an
awareness of one’s own biases are the much more important benefits.
In fact, even when the goal of this phase is not to obtain consensus, it
tends to bring parties much closer together.&lt;/p&gt;

&lt;h4 id=&quot;decision&quot;&gt;Decision&lt;/h4&gt;

&lt;p&gt;It would seem that the above activities, however pleasant they may have
been, haven’t brought us further.  At the end of the analysis we have
collected objective facts and a shared understanding of the different
valuations, but what is the decision going to be?&lt;/p&gt;

&lt;p&gt;The final decision will be made by the person with the responsibility
and authority to do this.  That person’s viewpoint will be known at this
point (or else a major stakeholder was overlooked in the previous phase!),
but this does not mean that his/her viewpoint necessarily determines the
outcome.  It behooves the decision taker, now that all viewpoints are
known, to consider these in making ‘the right decision’.&lt;/p&gt;

&lt;p&gt;What is interesting is that during the process, the single decision maker
becomes less relevant.  From the shared understanding of the knowledge that
has been gained in the process, and from the (intuitive) knowledge that
people have about the distribution of influence within the organisation,
most people present in the second workshop will already know what the
outcome must be.  Not only that, they will also better &lt;em&gt;understand&lt;/em&gt; the
outcome, even if it was not their (a priori) preference.&lt;/p&gt;

&lt;p&gt;In that sense, there ís an optimum outcome of architectural decisions:
it is the one which is maximally evidence-based, and creates the most
shared understanding of the outcome.&lt;/p&gt;

&lt;h3 id=&quot;credits&quot;&gt;Credits&lt;/h3&gt;

&lt;p&gt;The above is not just theory.  I was positively surprised by its results
(and the fun had and insights gained by all participants) when I first
trialed it at a client where I was consulting.  I later repeated it and
refined the way the workshops worked, but then 
&lt;a href=&quot;https://io.zwets.it/about/&quot;&gt;left architecture consulting for genomics&lt;/a&gt;. 
I was recently reminded that I should document this &lt;em&gt;somewhere&lt;/em&gt;.  Hence
this post.&lt;/p&gt;

&lt;p&gt;The seeds for these ideas came from an obscure but well-researched and
thought-out Ph.D. thesis that I stumbled upon when searching for a &lt;em&gt;tool&lt;/em&gt;
for documenting architectural decisions.  The thesis [citation needed] 
had been written by [citation needed] during an internship at IBM
(Vienna?).  The tool itself never made it to deployment, as it was a 700MB
download which included a full unreleased version of WebSphere Server 
which I couldn’t get to work. :)&lt;/p&gt;

&lt;hr /&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;I don’t remember who coined it, but I love the proposed collective noun (as in: “a pride of lions” and “a flock of seagulls”) for architects: an &lt;em&gt;argument&lt;/em&gt; of architects. &lt;a href=&quot;#fnref:1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
        <pubDate>Fri, 28 Oct 2016 00:00:00 +0300</pubDate>
        <link>https://io.zwets.it/2016/10/28/architectural-decision-making/</link>
        <guid isPermaLink="true">https://io.zwets.it/2016/10/28/architectural-decision-making/</guid>
        
        
      </item>
    
      <item>
        <title>OpenCL on a dual graphics Dell M4800</title>
        <description>&lt;p&gt;This post documents how I got OpenCL working on Ubuntu 16.04 on my dual (hybrid) graphics Dell M4800
workstation.  The machine has an integrated Intel HD Graphics 4600 GPU, and a discrete AMD/ATI FirePro M5100.&lt;/p&gt;

&lt;h2 id=&quot;background&quot;&gt;Background&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;http://caffe.berkelyvision.org&quot;&gt;Caffe&lt;/a&gt; can transparently switch between CPU and GPU for its computations.
Caffe’s &lt;a href=&quot;https://github.com/BVLC/caffe&quot;&gt;master branch&lt;/a&gt; is bound to NVidia.
Its &lt;a href=&quot;https://github.com/BVLC/caffe/tree/opencl&quot;&gt;OpenCL branch&lt;/a&gt; is in development and should support all
vendors through the OpenCL standard.&lt;/p&gt;

&lt;p&gt;I prefer to keep my Ubuntu 16.04 plain vanilla, that is stick with packages available in the distro.
I avoid PPAs, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sudo make install&lt;/code&gt; and certainly &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sudo ./run-installer.sh&lt;/code&gt;.&lt;sup id=&quot;fnref:1&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:1&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;  My worry was that
installing OpenCL would involve a lot of the latter, but it turned out that &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;apt-get install&lt;/code&gt; goes
a long way.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;tl;dr&lt;/strong&gt; version: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sudo apt-get install ocl-icd-libopencl1 beignet-opencl-icd mesa-opencl-icd&lt;/code&gt;
makes both GPUs available as OpenCL devices.  The CPU can be added quite easily.  Below is my
install log. YMMV.&lt;/p&gt;

&lt;h2 id=&quot;exploring-the-gpus&quot;&gt;Exploring the GPUs&lt;/h2&gt;

&lt;p&gt;My Dell M4800 has dual Intel/AMD graphics:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;lspci &lt;span class=&quot;nt&quot;&gt;-nn&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;grep &lt;/span&gt;VGA
00:02.0 VGA compatible controller &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;0300]: Intel Corporation 4th Gen Core Processor Integrated Graphics Controller &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;8086:0416] &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;rev 06&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
01:00.0 VGA compatible controller &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;0300]: Advanced Micro Devices, Inc. &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;AMD/ATI] Venus XT &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;Radeon HD 8870M / R9 M270X/M370X] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;1002:6821] &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;rev ff&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The AMD in the Dell M4800 is a FirePro M5100:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;c&quot;&gt;# 1002 and 6821 from lspci -nn are vendor and device id; 1028 is subvendor Dell (pciutils)&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sed&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-ne&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;/^1002/,/^[0-9]/p&apos;&lt;/span&gt; /usr/share/misc/pci.ids | &lt;span class=&quot;nb&quot;&gt;sed&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-ne&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;/^\t6821/,/^\t[0-9]/p&apos;&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;grep &lt;/span&gt;1028
      1028 05cc  FirePro M5100
      1028 15cc  FirePro M5100
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Ubuntu suggests no proprietary drivers for my GPUs:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;ubuntu-drivers list
intel-microcode		&lt;span class=&quot;c&quot;&gt;# Driver for the CPU, not the GPU&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The DRM driver modules are &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;i915&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;radeon&lt;/code&gt; which come with the kernel:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;lsmod | &lt;span class=&quot;nb&quot;&gt;grep &lt;/span&gt;drm_kms_helper
drm_kms_helper        147456  2 i915,radeon
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;dpkg &lt;span class=&quot;nt&quot;&gt;-S&lt;/span&gt; i915.ko radeon.ko | &lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;uname&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;
linux-image-extra-4.4.0-34-generic: /lib/modules/4.4.0-34-generic/kernel/drivers/gpu/drm/i915/i915.ko
linux-image-extra-4.4.0-34-generic: /lib/modules/4.4.0-34-generic/kernel/drivers/gpu/drm/radeon/radeon.ko
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The Intel integrated GPU (IGD) is powered on, the AMD discrete GPU (DIS) is idle:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo cat&lt;/span&gt; /sys/kernel/debug/vgaswitcheroo/switch
0:DIS: :DynOff:0000:01:00.0
1:IGD:+:Pwr:0000:00:02.0
2:DIS-Audio: :Off:0000:01:00.1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;(Note: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vga_switcheroo&lt;/code&gt; is the legacy kludge for hybrid graphics systems exposed by the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;radeon&lt;/code&gt; module.)&lt;/p&gt;

&lt;h2 id=&quot;installing-opencl&quot;&gt;Installing OpenCL&lt;/h2&gt;

&lt;p&gt;Installing OpenCL involves three layers:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;The API library and implementation loader (ICD Loader)&lt;/li&gt;
  &lt;li&gt;One or more vendor-specific platform implementations (ICDs, installable client drivers)&lt;/li&gt;
  &lt;li&gt;Any DRM/DRI hardware device drivers required by the ICDs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The top layer is provided by Ubuntu package &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ocl-icd-libopencl1&lt;/code&gt;.  This package contains
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;libOpenCL&lt;/code&gt;, the API library against which OpenCL applications are linked.  It also provides
the ICD Loader, the machinery that dynamically loads ICDs.  ICDs (installable client drivers)
implement the vendor-specific interaction with the hardware.&lt;/p&gt;

&lt;p&gt;It is convenient to also install the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;clinfo&lt;/code&gt; utility which queries the API library about
available platforms:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;clinfo ocl-icd-libopencl1
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;clinfo
Number of platforms   0   &lt;span class=&quot;c&quot;&gt;# We haven&apos;t installed ICDs yet&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Each ICD is defined by a file with extension &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.icd&lt;/code&gt; in directory &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/OpenCL/vendors&lt;/code&gt;.  The
first line in the ICD file specifies the path to a shared library.  The ICD Loader &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dlopen&lt;/code&gt;s
this library when the platform is requested.  Environment variables control the order of the
platforms, the default platform, and the debugging level.  For instance, to run an application
on a specific platform, set &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;OCL_ICD_VENDORS=&amp;lt;icd-file-name&amp;gt;&lt;/code&gt;.  See &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;man libOpenCL&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;installing-icds&quot;&gt;Installing ICDs&lt;/h2&gt;

&lt;p&gt;Ubuntu provides ICDs for Intel and Nvidia GPUs.  AMD is supported via the Mesa ICD, which
implements OpenCL atop the open source DRM/DRI drivers:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;apt-cache search &lt;span class=&quot;s1&quot;&gt;&apos;^opencl-icd$&apos;&lt;/span&gt;  &lt;span class=&quot;c&quot;&gt;# virtual package provided by all ICDs&lt;/span&gt;
beignet-opencl-icd - OpenCL library &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;Intel GPUs
mesa-opencl-icd - free implementation of the OpenCL API &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; ICD runtime
nvidia-opencl-icd-304 - NVIDIA OpenCL ICD
... more nvidia versions ...

&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;apt-cache show beignet-opencl-icd
... supports the integrated GPUs of Ivy Bridge, Bay Trail, Haswell and Broadwell processors

&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;apt-cache depends mesa-opencl-icd  &lt;span class=&quot;c&quot;&gt;# cards supported by the mesa ICD&lt;/span&gt;
... r600, amdgcn, amdgpu1, radeon1, nouveau2 ...
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Install the Intel and Mesa ICDs to obtain the respective platforms:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;beignet-opencl-icd mesa-opencl-icd
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;clinfo &lt;span class=&quot;nt&quot;&gt;-l&lt;/span&gt;
Platform 0: Intel Gen OCL Driver
 &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; Device 0: Intel&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;R&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; HD Graphics Haswell GT2 Mobile
Platform 1: Clover
 &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; Device 0: AMD CAPE VERDE &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;DRM 2.43.0, LLVM 3.8.0&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;It is that simple.  Two OpenCL devices ready to rock.  Run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;clinfo&lt;/code&gt; without
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-l&lt;/code&gt; for a detailed overview of the platforms and the features of each device.&lt;/p&gt;

&lt;h2 id=&quot;smoke-testing&quot;&gt;Smoke Testing&lt;/h2&gt;

&lt;p&gt;Andreas Klöckner’s wiki has an &lt;a href=&quot;https://wiki.tiker.net/OpenCLHowTo&quot;&gt;OpenCL HOWTO&lt;/a&gt; and
&lt;a href=&quot;https://wiki.tiker.net/WelcomePage&quot;&gt;lots more&lt;/a&gt; on OpenCL, CUDA, PyOpenCL, and the like.
His &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cl-demo&lt;/code&gt; application is perfect for a smoke test:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git clone &lt;span class=&quot;s1&quot;&gt;&apos;https://github.com/hpc12/tools&apos;&lt;/span&gt; hpc12-tools
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;hpc12-tools
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;make
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;./cl-demo 1000000 10
Choose platform:
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;0] Intel
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;1] Mesa
Enter choice: 0
Choose device:
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;0] Intel&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;R&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; HD Graphics Haswell GT2 Mobile
Enter choice: 0
... output ...
0.000824 s
14.566110 GB/s
GOOD
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Good. Repeat for the Mesa/Clover platform:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;./cl-demo 1000000 10
... omitted &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;brevity ...
0.001086 s
11.053539 GB/s
GOOD
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Good!  We have a working OpenCL system supporting both graphics cards, and needed only &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;apt-get install&lt;/code&gt;
with no out-of-distro repositories.  The “nice to have” to add is OpenCL &lt;strong&gt;CPU&lt;/strong&gt; support.&lt;/p&gt;

&lt;h2 id=&quot;installing-cpu-support&quot;&gt;Installing CPU support&lt;/h2&gt;

&lt;p&gt;Unfortunately there isn’t currently in Ubuntu an OpenCL ICD for CPUs.  One used to come with
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fglrx&lt;/code&gt;, supporting AMD and Intel CPUs, but that package was dropped in Ubuntu 16.04.
Installing one is easy though.  There are two options.&lt;/p&gt;

&lt;h4 id=&quot;intels-cpu-driver&quot;&gt;Intel’s CPU driver&lt;/h4&gt;

&lt;p&gt;Intel’s “OpenCL™ Runtime for Intel® Core™ and Intel® Xeon® Processors” can be downloaded from their
&lt;a href=&quot;https://software.intel.com/en-us/articles/opencl-drivers&quot;&gt;OpenCL™ Drivers and Runtimes for Intel® Architecture&lt;/a&gt; page.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://bitbucket.org/snippets/bkchr/EkeMg&quot;&gt;Here&lt;/a&gt; is a way to turn the installer into a .deb
(thus reducing the risk of overwriting files from other packages).  Also, note the comment at
the bottom of that page mentioning that &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;install.sh&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;install_GUI.sh&lt;/code&gt; should just work now
that Intel officially supports the driver on Ubuntu.  I haven’t tested this.&lt;/p&gt;

&lt;h4 id=&quot;amds-cpu-driver&quot;&gt;AMD’s CPU driver&lt;/h4&gt;

&lt;p&gt;AMD’s CPU driver, which supports both AMD and Intel CPUs, comes ‘for free’ with their GPU driver.
If you want to install &lt;em&gt;just&lt;/em&gt; the CPU driver (and stick to mesa over radeon on the GPU), then this
works:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Download and unpack the
&lt;a href=&quot;http://support.amd.com/en-us/kb-articles/Pages/AMD-Radeon-GPU-PRO-Linux-Beta-Driver%e2%80%93Release-Notes.aspx&quot;&gt;AMDGPU-Pro&lt;/a&gt;,
beta driver (more on this below) and install &lt;em&gt;only&lt;/em&gt; the ICD package:&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;wget &lt;span class=&quot;s1&quot;&gt;&apos;https://www2.ati.com/drivers/linux/ubuntu/amdgpu-pro-16.60-379184.tar.xz&apos;&lt;/span&gt;
  &lt;span class=&quot;c&quot;&gt;# note: link was current on 2017-03-01, check the AMDGPU-Pro page for latest&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;tar &lt;/span&gt;Jxvf amdgpu-pro_16.60-379184.tar.xz
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;amdgpu-pro-driver
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;dpkg &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; amdgpu-pro-opencl-icd_&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;_amd64.deb
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This installs:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# The OpenCL ICD definition file for the AMD GPU platform
/etc/OpenCL/vendors/amdocl64.icd

# The libraries implementing the platform and its CPU and GPU devices.
# The GPU won&apos;t show up unless we install the DRI/DRM libraries, driver and firmware.
/usr/lib/x86_64-linux-gnu/amdgpu-pro/libamdocl12cl64.so
/usr/lib/x86_64-linux-gnu/amdgpu-pro/libamdocl64.so
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We need to manually create one file to add the installed libraries to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ld&lt;/code&gt; path:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;EOF&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt; | sudo sh -c &apos;cat &amp;gt; /etc/ld.so.conf.d/local-amdgpu.conf&apos; &amp;amp;&amp;amp; sudo ldconfig
# Added manually; can be removed when package amdgpu-pro-opencl-icd is uninstalled
/usr/lib/x86_64-linux-gnu/amdgpu-pro
&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;EOF
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This would have been done by &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amdgpu-pro-core&lt;/code&gt; but we don’t want to install that
package because it also adds &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/modprobe.d/amdgpu-blacklist-radeon.conf&lt;/code&gt; which
does what its name says, and we don’t want to blacklist the radeon module.&lt;/p&gt;

&lt;p&gt;And here we are:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;clinfo &lt;span class=&quot;nt&quot;&gt;-l&lt;/span&gt;
Platform 0: Intel Gen OCL Driver
 &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; Device 0: Intel&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;R&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; HD Graphics Haswell GT2 Mobile
Platform 1: Clover
 &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; Device 0: AMD CAPE VERDE &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;DRM 2.43.0, LLVM 3.8.0&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
Platform 2: AMD Accelerated Parallel Processing
 &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; Device 0: Intel&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;R&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; Core&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;TM&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; i7-4910MQ CPU @ 2.90GHz
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;All processing devices on my workstation made available using only debs (plus a mostly
harmless manual configuration change).&lt;/p&gt;

&lt;h2 id=&quot;installing-proprietary-gpu-support&quot;&gt;Installing proprietary GPU support&lt;/h2&gt;

&lt;p&gt;From here on it’s optimisation only.  We have a working OpenCL system which makes available
both GPUs and the CPU.  All software used is open source (AMDGPU-PRO will be in Ubuntu once
it leaves beta). Inquisitive minds may wonder if the proprietary drivers have more to offer,
certainly for the AMD GPU which currently operates via the generic Mesa layer.&lt;/p&gt;

&lt;h4 id=&quot;intels-gpu-driver&quot;&gt;Intel’s GPU driver&lt;/h4&gt;

&lt;p&gt;Intel’s “OpenCL™ 2.0 Driver+Runtime for Intel® HD, Iris™, and Iris™ Pro Graphics for Linux”
is available from their
&lt;a href=&quot;https://software.intel.com/en-us/articles/opencl-drivers&quot;&gt;OpenCL™ Drivers and Runtimes for Intel® Architecture&lt;/a&gt;
page.  I haven’t tested this and stick with the open source driver.  It allegedly [citation
needed] is at least as good, and Intel devs are putting lots of effort into it.  Kudos!&lt;/p&gt;

&lt;h4 id=&quot;amds-amdgpu-pro-driver&quot;&gt;AMD’s AMDGPU-PRO driver&lt;/h4&gt;

&lt;p&gt;AMDGPU-PRO will supersede Catalyst (fglrx), which was dropped from Ubuntu 16.04.  It will have
a GPL kernel module (but proprietary firmware) and be supported on Ubuntu.  It is currently
available in beta, but works only for a handful of models.  More on it
&lt;a href=&quot;http://www.pcworld.com/article/3075837/linux/amds-gaming-optimized-amdgpu-pro-driver-for-linux-is-in-beta.html&quot;&gt;here&lt;/a&gt;,
and
&lt;a href=&quot;http://support.amd.com/en-us/kb-articles/Pages/AMD-Radeon-GPU-PRO-Linux-Beta-Driver%e2%80%93Release-Notes.aspx&quot;&gt;on AMDGPU-PRO’s official page&lt;/a&gt;,
which has installation instructions and model compatibility lists.&lt;/p&gt;

&lt;p&gt;Installing the beta packages requires care.  Though allegedly tailored for Ubuntu 16.04, the
AMDGPU-PRO packages have multiple packaging errors, such as failing to declare conflicts with
existing packages, leaving you with a stuck APT.
Details in &lt;a href=&quot;#appendix-i-amdgpu-pro-install-notes&quot;&gt;Appendix I&lt;/a&gt; below.&lt;/p&gt;

&lt;h4 id=&quot;amds-catalyst-fglrx-driver&quot;&gt;AMD’s Catalyst (fglrx) driver&lt;/h4&gt;

&lt;p&gt;As AMDGPU-PRO doesn’t (yet) support my FirePro M5100, I tried the Catalyst Pro (workstation)
driver.  The Catalyst driver can be
&lt;a href=&quot;http://support.amd.com/en-us/kb-articles/Pages/XServerLessDriver.aspx&quot;&gt;built “headless”&lt;/a&gt;,
meaning that you can build and install just the OpenCL part, without going for the whole
graphics stack:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;c&quot;&gt;# Omitting installation steps for the build-dependencies (devscripts, dh-modaliases, ...)&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;unzip 15.302.2301-linux-retail_end_user.zip  &lt;span class=&quot;c&quot;&gt;# This is the &quot;Pro&quot; version for my FirePro, YMMV&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;fglrx-15.302.2301
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo&lt;/span&gt; ./amd-driver-installer-15.302.2301-x86.x86_64.run &lt;span class=&quot;nt&quot;&gt;--buildpkg&lt;/span&gt; Ubuntu/xenial &lt;span class=&quot;nt&quot;&gt;--NoXServer&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This builds &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fglrx-core_15.302-0ubuntu1_amd64.deb&lt;/code&gt;, but not without a fair share of issues:
the kernel module fails to build against current kernels; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;clinfo&lt;/code&gt; runs once and segfaults ever
after (an old bug resurfacing due to AMD forgetting to add &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/ati/amdpcsdb.default&lt;/code&gt; to the
package); and, like AMDGPU-PRO, the package conflicts with the Ubuntu 16.04 OpenCL packages.  Sigh.&lt;/p&gt;

&lt;p&gt;Still, with some patching &lt;a href=&quot;https://github.com/zwets/amd-opencl-patches&quot;&gt;documented here&lt;/a&gt;
I managed to install the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fglrx&lt;/code&gt; driver &lt;em&gt;and&lt;/em&gt; got full OpenCL support:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;clinfo &lt;span class=&quot;nt&quot;&gt;-l&lt;/span&gt;
Platform &lt;span class=&quot;c&quot;&gt;#0: AMD Accelerated Parallel Processing&lt;/span&gt;
 +-- Device &lt;span class=&quot;c&quot;&gt;#0: Capeverde&lt;/span&gt;
 &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; Device &lt;span class=&quot;c&quot;&gt;#1: Intel(R) Core(TM) i7-4910MQ CPU @ 2.90GHz&lt;/span&gt;
Platform &lt;span class=&quot;c&quot;&gt;#1: Intel Gen OCL Driver&lt;/span&gt;
 &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; Device &lt;span class=&quot;c&quot;&gt;#0: Intel(R) HD Graphics Haswell GT2 Mobile&lt;/span&gt;
Platform &lt;span class=&quot;c&quot;&gt;#2: Clover&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;My joy however lasted until the moment I unplugged my laptop from AC.  Uptime on battery
plummeted from the usual 4 to 5 hours to 1:30, &lt;em&gt;while I’m not even using the card&lt;/em&gt;.
There’s probably a way to switch it off, but I’m not inclined to spend hours again to
find the next workaround for AMD’s failure to get things right.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt; I have since installed TLP, which works fabulously and gets me 6 to 7 hours on
battery.  Haven’t yet checked though if it also manages to kill the power to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fglrx&lt;/code&gt;,
as I somehow guess I already know the answer.&lt;/p&gt;

&lt;h4 id=&quot;oibafs-drivers&quot;&gt;Oibaf’s drivers&lt;/h4&gt;

&lt;p&gt;An &lt;a href=&quot;http://askubuntu.com/a/815592/134479&quot;&gt;answer on AskUbuntu&lt;/a&gt; suggests
&lt;a href=&quot;https://launchpad.net/~oibaf/+archive/ubuntu/graphics-drivers&quot;&gt;Oibaf’s drivers&lt;/a&gt;
as a promising alternative for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fglrx&lt;/code&gt;.  I haven’t looked at these yet.&lt;/p&gt;

&lt;h2 id=&quot;installing-the-intel-and-amd-sdks&quot;&gt;Installing the Intel and AMD SDKs&lt;/h2&gt;

&lt;p&gt;AMD distributes the
&lt;a href=&quot;http://developer.amd.com/tools-and-sdks/opencl-zone/amd-accelerated-parallel-processing-app-sdk/&quot;&gt;AMD Accelerated Parallel Processing (APP) SDK&lt;/a&gt;,
and Intel has its
&lt;a href=&quot;https://software.intel.com/en-us/articles/opencl-drivers&quot;&gt;Intel SDK for OpenCL Applications&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I’m not using these as I’m currently only interested in OpenCL as a &lt;em&gt;user&lt;/em&gt;, not as a developer.
Maybe more on the SDKs in the future.&lt;/p&gt;

&lt;h2 id=&quot;more-to-explore&quot;&gt;More to Explore&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;StarPU&lt;/li&gt;
  &lt;li&gt;erlang-cl, pyopencl&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://arrayfire.com/why-arrayfire/&quot;&gt;ArrayFire&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;…&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;appendix-i-amdgpu-pro-install-notes&quot;&gt;Appendix I: AMDGPU-PRO install notes&lt;/h2&gt;

&lt;p&gt;The organisation of the AMDGPU-PRO debian packages (downloadable from the
&lt;a href=&quot;http://support.amd.com/en-us/kb-articles/Pages/AMD-Radeon-GPU-PRO-Linux-Beta-Driver%e2%80%93Release-Notes.aspx&quot;&gt;official page&lt;/a&gt;)
is promising: there is a main &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amdgpu-pro&lt;/code&gt; package which depends on &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amdgpu-pro-computing&lt;/code&gt;
and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amdgpu-pro-graphics&lt;/code&gt;, separating the headless from the gamers.&lt;/p&gt;

&lt;p&gt;However AMD need to fix the packaging before AMDGPU-PRO can leave beta.
Currently (release 16.30.3-315407) the packages conflict (without declaring
‘Conflicts’) with packages in Ubuntu and so fail halfway installation,
leaving you with a stuck APT.&lt;/p&gt;

&lt;p&gt;These things need fixing in the AMDGPU-PRO (Beta) Debian packages&lt;sup id=&quot;fnref:2&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:2&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amdgpu-pro-computing&lt;/code&gt; depends on &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amdgpu-pro-clinfo&lt;/code&gt;, which conflicts with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;clinfo&lt;/code&gt; as it replaces the
clinfo tool (by one that has lots less functionality).  Solution:&lt;/p&gt;

    &lt;ul&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amdgpu-pro-computing&lt;/code&gt; should &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Depends: clinfo | amdgpu-pro-clinfo&lt;/code&gt; (or better: &lt;em&gt;Recommends&lt;/em&gt;, unless
  the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;clinfo&lt;/code&gt; utility is indispensable for the proper functioning of the package).&lt;/li&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amdgpu-pro-clinfo&lt;/code&gt; must &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Conflicts: clinfo&lt;/code&gt;.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amdgpu-pro-clinfo&lt;/code&gt; depends on &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amdgpu-pro-libopencl1&lt;/code&gt;, which conflicts with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ocl-icd-libopencl1&lt;/code&gt;
as it replaces the libOpenCL library.  Solution:&lt;/p&gt;

    &lt;ul&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amdgpu-pro-clinfo&lt;/code&gt; should &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Depends: ocl-icd-libopencl1 | amdgpu-pro-libopencl1&lt;/code&gt;.  In fact, is
  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amdgpu-pro-libopencl1&lt;/code&gt; needed at all?  The libOpenCL library is part of the common OpenCL infrastructure
  (the top layer &lt;a href=&quot;#installing-opencl&quot;&gt;described above&lt;/a&gt;) and needn’t be provided by vendor ICDs.&lt;/li&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amdgpu-pro-libopencl1&lt;/code&gt; must &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Conflicts: ocl-icd-libopencl1&lt;/code&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amdgpu-pro-computing&lt;/code&gt; depends on &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amdgpu-pro-libopencl-dev&lt;/code&gt;, which conflicts with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ocl-icd-opencl-dev&lt;/code&gt;
as it replaces the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;libOpenCL.so&lt;/code&gt; symlink.  It shouldn’t do this as that symlink file is part of the common
OpenCL infrastructure.  Solution:&lt;/p&gt;

    &lt;ul&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amdgpu-pro-computing&lt;/code&gt; should &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Depends: ocl-icd-opencl-dev | amdgpu-pro-libopencl-dev&lt;/code&gt;,
  or leave out the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amdgpu-pro-libopencl-dev&lt;/code&gt; altogether (for same reasons as explained above).&lt;/li&gt;
      &lt;li&gt;Moreover, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amdgpu-pro-computing&lt;/code&gt; probably shouldn’t depend on the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-dev&lt;/code&gt; library but rather on the
  &lt;em&gt;runtime&lt;/em&gt; library &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ocl-icl-libopencl1&lt;/code&gt;, as the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-dev&lt;/code&gt; package is a &lt;em&gt;build&lt;/em&gt; dependency.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amdgpu-pro-opencl-icd&lt;/code&gt; is missing the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/ld.so.conf.d/amdgpu.conf&lt;/code&gt; file.  This file is provided
by &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amdgpu-pro-core&lt;/code&gt;, which however also blacklists the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;radeon&lt;/code&gt; driver
(as described &lt;a href=&quot;#amd-s-cpu-driver&quot;&gt;above&lt;/a&gt;), thus preventing a ‘CPU-only’ install. Solution:&lt;/p&gt;

    &lt;ul&gt;
      &lt;li&gt;Move the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ld.so.conf.d/amdgpu.conf&lt;/code&gt; to package &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amdgpu-pro-opencl-icd&lt;/code&gt; as it should logically be
  installed together with the libraries in that package.  The package provides the CPU device.&lt;/li&gt;
      &lt;li&gt;Create a new &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amdgpu-pro-opencl-gpu-icd&lt;/code&gt; package to provide the GPU device, and make that
  package (as well as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amdgpu-pro-graphics&lt;/code&gt;) depend on the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;core&lt;/code&gt; package which has the driver
  and the radeon blacklist.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;appendix-ii-graphics-switching&quot;&gt;Appendix II: graphics switching&lt;/h2&gt;

&lt;p&gt;This section is about Open&lt;em&gt;GL&lt;/em&gt; rather than OpenCL.  I include it to document the simplicity
of switching to the discrete GPU for rendering.  All it requires is setting the environment
variable &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DRI_PRIME&lt;/code&gt;.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; moved to the appendix because it is off-topic.  Also, after a number of
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;apt-get update&lt;/code&gt;s the Gallium rendering gives a black window and its framerate is actually
lower (11000) than that for Mesa (12900).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;xrandr &lt;span class=&quot;nt&quot;&gt;--listproviders&lt;/span&gt;
Providers: number : 3
Provider 0: &lt;span class=&quot;nb&quot;&gt;id&lt;/span&gt;: 0x72 cap: 0x9, Source Output, Sink Offload crtcs: 4 outputs: 5 associated providers: 2 name:Intel
Provider 1: &lt;span class=&quot;nb&quot;&gt;id&lt;/span&gt;: 0x49 cap: 0x6, Sink Output, Source Offload crtcs: 6 outputs: 4 associated providers: 2 name:VERDE @ pci:0000:01:00.0
Provider 2: &lt;span class=&quot;nb&quot;&gt;id&lt;/span&gt;: 0x49 cap: 0x6, Sink Output, Source Offload crtcs: 6 outputs: 4 associated providers: 2 name:VERDE @ pci:0000:01:00.0

&lt;span class=&quot;nv&quot;&gt;$ DRI_PRIME&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0 glxgears &lt;span class=&quot;nt&quot;&gt;-info&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-E&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;(GL_RENDERER|FPS)&apos;&lt;/span&gt;
GL_RENDERER   &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; Mesa DRI Intel&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;R&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; Haswell Mobile        &lt;span class=&quot;c&quot;&gt;# Intel renders&lt;/span&gt;
305 frames &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;5.0 seconds &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 60.871 FPS                  &lt;span class=&quot;c&quot;&gt;# at rate synced with monitor&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$ DRI_PRIME&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;1 glxgears &lt;span class=&quot;nt&quot;&gt;-info&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-E&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;(GL_RENDERER|FPS)&apos;&lt;/span&gt;
GL_RENDERER   &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; Gallium 0.4 on AMD CAPE VERDE &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;DRM 2.43.0, LLVM 3.8.0&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
70041 frames &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;5.0 seconds &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 14008.121 FPS             &lt;span class=&quot;c&quot;&gt;# AMD renders ... faster&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$ DRI_PRIME&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;2 glxgears &lt;span class=&quot;nt&quot;&gt;-info&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-E&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;(GL_RENDERER|FPS)&apos;&lt;/span&gt;
GL_RENDERER   &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; Mesa DRI Intel&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;R&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; Haswell Mobile 	&lt;span class=&quot;c&quot;&gt;# Surprise: Intel renders&lt;/span&gt;
53971 frames &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;5.0 seconds &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 10793.093 FPS		&lt;span class=&quot;c&quot;&gt;# without the syncing&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;When &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DRI_PRIME&lt;/code&gt; is 0 or unset, the Intel is selected.  Its rendering frequency is 60Hz,
synchronised with the monitor refresh rate.  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DRI_PRIME=1&lt;/code&gt; selects the AMD discrete card.
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DRI_PRIME=2&lt;/code&gt; (for some reason) selects the Intel, but without synchronised rendering.&lt;/p&gt;

&lt;p&gt;I was surprised to see the high frame rate on the IGD.  In fact, with current package
versions, the IGD actually wins.  Just because it is an integrated GPU, doesn’t mean that
it can’t be used for computing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; According to
&lt;a href=&quot;http://askubuntu.com/questions/593098/hybrid-graphic-card-drivers-amd-radeon-hd-8570-intel-hd-graphics-4000/620756#620756&quot;&gt;this page&lt;/a&gt;
it is required to do &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;xrandr --setprovideroffloadsink 0x49 0x72&lt;/code&gt; (where the hex numbers are
the card IDs from the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;xrandr --listproviders&lt;/code&gt; output) to make &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DRI_PRIME&lt;/code&gt; work,
but I get the exact same results when I don’t.  (&lt;a href=&quot;https://wiki.archlinux.org/index.php/PRIME&quot;&gt;May be related to DRI3?&lt;/a&gt;)&lt;/p&gt;

&lt;h6 id=&quot;footnotes&quot;&gt;Footnotes&lt;/h6&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;For out-of-distro software or cutting-edge versions I use &lt;a href=&quot;https://guix.gnu.org/&quot;&gt;GNU Guix&lt;/a&gt; which perfectly isolates these without being the kludge that containers are. &lt;a href=&quot;#fnref:1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:2&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;AMD: if you’re reading this, I’m happy to work with you to sort this out. &lt;a href=&quot;#fnref:2&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
        <pubDate>Thu, 18 Aug 2016 00:00:00 +0300</pubDate>
        <link>https://io.zwets.it/2016/08/18/opencl-on-a-dual-graphics-dell-m4800/</link>
        <guid isPermaLink="true">https://io.zwets.it/2016/08/18/opencl-on-a-dual-graphics-dell-m4800/</guid>
        
        
      </item>
    
      <item>
        <title>Total Perspective Vortex</title>
        <description>&lt;p&gt;As a child I read about the Milky Way but never saw it.  I didn’t 
realise that living at latitude 52N in a country where the sky is
always lit, meant that I couldn’t easily see it.
Last week, looking up at the pitch-black midnight sky from a beach
on the desolate Northeastern Tanzanian coast, I was suddenly aware that
that long and narrow cloud stretching out over the sky, wasn’t a cloud
after all.&lt;/p&gt;

&lt;p&gt;It was the Milky Way, and it’s actually milky.  It’s a diffuse cloud
of uncountably many tiny lights!  I used to think that I had a good
sense of how incredibly many stars there are out there, but this
just blew the lid off my perspective.  Here I was on a mostly harmless
little planet orbiting its star, looking at the other 100,000,000,000
stars in our galaxy.&lt;/p&gt;

&lt;p&gt;Once you’ve grasped that perspective on Earth’s sheer tininess 
and somewhat come to terms with our galactical insignificance, let’s
put that perspective in perspective: the 100,000,000,000 stars
you see are only &lt;em&gt;our&lt;/em&gt; galaxy.  There are 200,000,000,000 galaxies
just like it.&lt;/p&gt;

&lt;p&gt;Having seen Earth in its place relative to the universe as a whole,
take a look at the place of us humans vis-a-vis all other life on Earth.
A number of web sites catalogue the so-called &lt;em&gt;Tree of Life&lt;/em&gt;, the
evolutionary tree branching out into all known (and many more unknown)
species.  &lt;a href=&quot;http://onezoom.org/&quot;&gt;OneZoom&lt;/a&gt; does this in a very pretty
way.&lt;/p&gt;

&lt;p&gt;Spend some time &lt;a href=&quot;http://www.onezoom.org/life.html&quot;&gt;navigating the tree&lt;/a&gt;,
then try to find us, homo sapiens.  You probably won’t, it’s a &lt;a href=&quot;http://www.onezoom.org/life.html?init=zoom#Homininae&quot;&gt;long
way down&lt;/a&gt;.
Welcome to the Evolutionary Total Perspective Vortex.&lt;/p&gt;

</description>
        <pubDate>Mon, 11 Jul 2016 00:00:00 +0300</pubDate>
        <link>https://io.zwets.it/2016/07/11/total-perspective-vortex/</link>
        <guid isPermaLink="true">https://io.zwets.it/2016/07/11/total-perspective-vortex/</guid>
        
        
      </item>
    
      <item>
        <title>The Automator</title>
        <description>&lt;p&gt;In the early days of commercial IT in the Netherlands, before English became the standard vocabulary in the field that was later to be called “IT”, the Dutch language had its own word for IT.  IT was called &lt;em&gt;automation&lt;/em&gt; (automatisering) and people working in automation were called &lt;em&gt;automators&lt;/em&gt; (automatiseerders).&lt;/p&gt;

&lt;p&gt;The words now sound old-fashioned and have gotten into disuse to the extent that my children would conjure up an image of &lt;a href=&quot;https://www.imdb.com/character/ch0000931/&quot;&gt;Schwarzenegger&lt;/a&gt; or &lt;a href=&quot;https://www.imdb.com/character/ch0111656/&quot;&gt;Doofenschmirz&lt;/a&gt; if I would tell them I am an &lt;strong&gt;automator&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I like the term “automation” for our field of work.  It stresses the &lt;em&gt;purpose&lt;/em&gt; of what we do rather than the means we use.  I am very much an automator.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;The first time around explore, the second time recognise repetition, the third time automate.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Much of what I keep in my &lt;a href=&quot;https://github.com/zwets&quot;&gt;public repositories&lt;/a&gt; are shell scripts wrapping tedious, error-prone, or repetitious operations.  I initially wrote these for my own use, but I’ve tried to make them useful for others&lt;sup id=&quot;fnref:1&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:1&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.  They are operationalised documentation.  When you need to keep notes anyway&lt;sup id=&quot;fnref:2&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:2&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;, it pays to put in the extra effort to condense all &lt;abbr title=&quot;Need To Knows&quot;&gt;NTK&lt;/abbr&gt; into an executable script.  It’s like having unit tests for your notes.&lt;/p&gt;

&lt;h6 id=&quot;footnotes&quot;&gt;Footnotes&lt;/h6&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;&lt;a href=&quot;https://github.com/zwets/taxo&quot;&gt;taxo&lt;/a&gt; to search and browse the NCBI taxonomy, &lt;a href=&quot;https://io.zwets.it/unfasta&quot;&gt;unfasta&lt;/a&gt; for natural handling of FASTA in command line pipes and filters, and a collection of scripts built on top of BLAST in &lt;a href=&quot;https://github.com/zwets/blast-galley&quot;&gt;blast-galley&lt;/a&gt; to e.g. &lt;a href=&quot;https://github.com/zwets/blast-galley/blob/master/gene-cutter&quot;&gt;cut genes out of an unannotated assembly&lt;/a&gt; or do simple &lt;a href=&quot;https://github.com/zwets/blast-galley/blob/master/in-silico-pcr.sh&quot;&gt;in-silico PCR&lt;/a&gt;. &lt;a href=&quot;#fnref:1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:2&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;You don’t?  I’d hold off the cheers until you cross the age of forty. &lt;a href=&quot;#fnref:2&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
        <pubDate>Wed, 03 Feb 2016 00:00:00 +0300</pubDate>
        <link>https://io.zwets.it/2016/02/03/the-automator/</link>
        <guid isPermaLink="true">https://io.zwets.it/2016/02/03/the-automator/</guid>
        
        
      </item>
    
      <item>
        <title>Introducing Unfasta</title>
        <description>&lt;p&gt;&lt;a href=&quot;http://github.com/zwets/unfasta&quot;&gt;Unfasta&lt;/a&gt; is a suite of command-line utilities for working with sequence data.&lt;/p&gt;

&lt;p&gt;The rationale behind unfasta is to have the ability to process genomic sequence data using simple standard utilities like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;grep&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cut&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;head&lt;/code&gt;, in the common &lt;a href=&quot;http://www.dossier-andreas.net/software_architecture/pipe_and_filter.html&quot;&gt;pipes and filters style&lt;/a&gt; of Unix and GNU.&lt;/p&gt;

&lt;p&gt;For instance,&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# Compute the GC content of all sequences in a FASTA file&lt;/span&gt;
uf &lt;span class=&quot;s1&quot;&gt;&apos;file.fa&apos;&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;sed&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;2~2p&apos;&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;tr&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-dc&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;GC&apos;&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;wc&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;In that pipeline,&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;uf&lt;/code&gt; reads a FASTA file and outputs it in ‘unfasta’ format, collapsing sequence data to single lines;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sed -n 2~2p&lt;/code&gt; filters every second line from its input, thus dropping the header lines;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tr -dc GC&lt;/code&gt; drops from its input all characters except &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;G&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C&lt;/code&gt;;&lt;/li&gt;
  &lt;li&gt;and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wc -c&lt;/code&gt; counts the number of characters it reads, then writes this to standard output.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Pipelines are a simple and powerful way to process large streams of data, but the FASTA format is the party pooper.  By allowing sequences to span multiple lines, FASTA defies processing by line-oriented standard tools.  Even a seemingly obvious &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fgrep -q &apos;GAATCATCTTTA&apos;&lt;/code&gt; fails with a false negative in 10-15% of cases.  Unfasta originated from frustration over this missed opportunity.&lt;/p&gt;

&lt;p&gt;Unfasta resolves the issue by converting FASTA format to ‘unfasta format’ when it enters the pipeline.  The unfasta format is FASTA without line breaks in the sequence data.  Note that &lt;a href=&quot;https://github.com/zwets/unfasta/blob/master/README.md#unfasta-is-fasta&quot;&gt;unfasta files are still valid FASTA files&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Some examples to illustrate my case:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# Extract all deflines using sed or awk&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sed&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; 1~2p
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;awk&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;NR%2==1&apos;&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# Extract the data for the 3rd and 12th sequence&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sed&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; 7,25p

&lt;span class=&quot;c&quot;&gt;# Extract the header and sequence data for identifier &apos;gi|22888&apos;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sed&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;/&amp;gt;gi|22888[^0-9]/,+1p&apos;&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# Extract the bases at positions 952-1238 in the first sequence&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sed&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; 2p | &lt;span class=&quot;nb&quot;&gt;cut&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-b&lt;/span&gt; 952-1238

&lt;span class=&quot;c&quot;&gt;# Extract a 500 base fragment at position 135&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;tail&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; +135 | &lt;span class=&quot;nb&quot;&gt;head&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; 500	&lt;span class=&quot;c&quot;&gt;# or: cut -b 135-$((134+500))&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# How long are the Borrelia sequences?&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;awk&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;/Borrelia/ { getline; print length; }&apos;&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# Does any sequence contain fragment &apos;ACGTATAGCGGC&apos;? &lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;fgrep &lt;span class=&quot;nt&quot;&gt;-q&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;ACGTATAGCGGC&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Yes&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;No&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Obviously the law of conservation of misery applies as you now need to memorise nutty &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sed&lt;/code&gt; commands.  But that can be mitigated by wrapping the complexity in little self-explanatory shell scripts, which is what I did in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;unfasta&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Some examples (all assume FASTA arriving on &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;stdin&lt;/code&gt;):&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# The starting point is &apos;uf&apos;, which turns line-broken FASTA into unbroken FASTA&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;uf &lt;span class=&quot;nt&quot;&gt;--help&lt;/span&gt;
  ... concise but &lt;span class=&quot;nb&quot;&gt;complete &lt;/span&gt;description ...

&lt;span class=&quot;c&quot;&gt;# All uf-utils are shell scripts, so there&apos;s always the source&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;which uf&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;
  ... skip 60 lines of boilerplate to see a ...
  ... handful of simple lines &lt;span class=&quot;k&quot;&gt;do &lt;/span&gt;the actual work ...

&lt;span class=&quot;c&quot;&gt;# How many sequences?&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;zcat seqs.fsa.gz | uf | uf-headers | &lt;span class=&quot;nb&quot;&gt;wc&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-l&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# Is the input good, and what are the base counts?&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;uf | uf-valid &lt;span class=&quot;nt&quot;&gt;--dna&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; | uf-freqs  &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;NODE_1_length_388420_cov_15.7201
  388420 &lt;span class=&quot;nv&quot;&gt;A&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;117181 &lt;span class=&quot;nv&quot;&gt;C&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;82016 &lt;span class=&quot;nv&quot;&gt;G&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;72519 &lt;span class=&quot;nv&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;116704
  ...
  &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;TOTALS
  4101446 &lt;span class=&quot;nv&quot;&gt;A&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;1255608 &lt;span class=&quot;nv&quot;&gt;C&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;811259 &lt;span class=&quot;nv&quot;&gt;G&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;785749 &lt;span class=&quot;nv&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;1248830

&lt;span class=&quot;c&quot;&gt;# Select only the first sequence, or the one whose defline matches a regex&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;uf | uf-select 1
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;uf | uf-select &lt;span class=&quot;s1&quot;&gt;&apos;Acinetobacter&apos;&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# Various ways of cutting from a sequence&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;uf | uf-cut 1200/1000   &lt;span class=&quot;c&quot;&gt;# Select 1kbp starting at position 1200&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;uf | uf-cut 5:-5        &lt;span class=&quot;c&quot;&gt;# Trim four elements off of both ends&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;uf | uf-circut &lt;span class=&quot;nt&quot;&gt;-50&lt;/span&gt;:50   &lt;span class=&quot;c&quot;&gt;# Select 100b around the start of a circular sequence&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;uf | uf-circut 100:99   &lt;span class=&quot;c&quot;&gt;# Rotate to start at base 100 (= wrappingly select all)&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# Process just the content of each sequence, temporarily removing the FASTA deflines&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;uf file.fna | uf-bare | ..processing.. | uf-dress &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt; &amp;lt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;uf file.fna | uf-headers&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# More at&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git clone &lt;span class=&quot;s1&quot;&gt;&apos;https://github.com/zwets/unfasta&apos;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Unfasta won’t work for everyone.  It does for me because I work in bash most of the time, and have used the GNU toolset for ages.  Over the years I have written software in at least a dozen ‘proper’ programming languages, but when it comes to string processing nothing beats piping together a one-liner in bash.&lt;/p&gt;

&lt;p&gt;If you recognise this, then you know already.  If not, spend some time with &lt;a href=&quot;https://github.com/jlevy/the-art-of-command-line&quot;&gt;the Art of the Command Line&lt;/a&gt; and find enlightenment.&lt;/p&gt;

&lt;p&gt;Find &lt;a href=&quot;http://github.com/zwets/unfasta&quot;&gt;Unfasta on GitHub&lt;/a&gt;.&lt;/p&gt;

</description>
        <pubDate>Fri, 22 Jan 2016 00:00:00 +0300</pubDate>
        <link>https://io.zwets.it/2016/01/22/introducing-unfasta/</link>
        <guid isPermaLink="true">https://io.zwets.it/2016/01/22/introducing-unfasta/</guid>
        
        
      </item>
    
      <item>
        <title>Static sites the next big thing</title>
        <description>&lt;p&gt;It says so in the email I just received.&lt;/p&gt;

&lt;div class=&quot;language-email highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;From&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;na&quot;&gt; Simon St. Laurent &amp;lt;oreilly@post.oreilly.com&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;Date&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;na&quot;&gt; Wed,  6 Jan 2016 03:06:03 -0800&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;Subject&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;na&quot;&gt; Free ebook: why static sites are the next big thing&lt;/span&gt;

Hi Marco,

Given the choice between static and dynamic websites, why wouldn&apos;t you choose
to serve custom, dynamically generated content to each visitor to your site?
Yet to the surprise of many, static websites are coming back. Having been
ridiculed for years, they now fulfill a vital need for bloggers and others
who simply want to disseminate information.

Static site generators — the new breed of tools for creating static sites — 
simplify the once-tedious process of building and deploying these basic sites.
Get the lowdown on these tools and see what&apos;s behind the return of the static
site with Static Site Generators, a new report by Brian Rinaldi.

Get the free copy.

Simon St. Laurent
Strategic Content Director
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Right when I’m getting serious with &lt;a href=&quot;http://jekyllrb.com&quot;&gt;Jekyll&lt;/a&gt;.  There, skipped HTML 2 through 5 but now I’m back ahead of the pack.  For completeness: the free copy referred to can be &lt;a href=&quot;http://conferences.oreilly.com/fluent/javascript-html-us/public/content/static-site-generators&quot;&gt;got here&lt;/a&gt;.&lt;/p&gt;

</description>
        <pubDate>Wed, 06 Jan 2016 00:00:00 +0300</pubDate>
        <link>https://io.zwets.it/2016/01/06/static-sites-the-next-big-thing/</link>
        <guid isPermaLink="true">https://io.zwets.it/2016/01/06/static-sites-the-next-big-thing/</guid>
        
        
      </item>
    
  </channel>
</rss>
