How to use OpenCL on Ubuntu 16.04

on May 24th, 2016 by Hades | No Comments »

There have been many issues reported when installing Ubuntu 16.04 and the latest beta (which is also the future release).

I’ve installed it myself to see what’s going on.

Here we go:

  • Make sure to install Ubuntu 16.04 server as minimal as possible. No X11, no drivers, etc.

There’s ultimately just one package you need:

  • ocl-icd-libopencl1

Additionally, if you compile from GitHub source (otherwise you can skip this):

  • opencl-headers

And that’s it for the base. Now, depending on your hardware you need to install:

For NVidia’s GPU:

  • nvidia-361
  • nvidia-opencl-icd-361

The default depencies of additional 350+ packages shocked me. You totally do not need them.
If you install those packages, you really want to do it like this:

$ apt-get install --no-install-recommends nvidia-361 nvidia-opencl-icd-361

Tripple check you did not install any other packages that begin with nvidia-*

For AMD’s GPU:

You typically do _not_ want to install Ubuntu 16.04 because AMD stopped updating catalyst driver, also for the future. The latest Ubuntu that supports Catalyst is 15.10. AMD user have to decide to either switch Windows or use the OSS drivers. However, they are multiple times slower than Catalyst. If you absolutely want to stick to linux you need to switch to nvidia or wait and pray for better drivers. You have been warned.

  • mesa-opencl-icd


Support is part of catalyst, which you can’t install anymore. Therefore your last escape is to use pocl, which also does not exist as a Ubuntu package. You need to clone it from GitHub and compile it yourself.

For Intel’s GPU:

  • beignet-opencl-icd

For Intel CPU:

There’s no ubuntu package, you need to install Intel’s OpenCL SDK yourself (which is great!)