Using AMD Open Source and the amdgpu-pro OpenCL driver for image processing

This is a cross-post from my blog.

I have a AMD grahpics card and use the great Open Source driver which comes with my Linux distribution. However for image processing I want the OpenCL support of my graphics card. Currently that’s only provided by the amdgpu-pro driver. However it is possible to just extract the files needed for OpenCL and use them. Here is how to do this:

  • Go to
  • Select Desktop Graphics
  • Select your product family: e.g. RX series
  • Select your produt e.g. RX 4xx
  • Choose a platform, SLED or RHEL and download the package


For extracting the required libraries, I use Midnight Commander (mc). You can use them to browse the RPMs. From the following RPM you need to copy the mentioned libraries to /opt/amdgpu-pro/lib64/

  • noarch/ids-amdgpu-pro-1.0.0-492261.noarch.rpm

    amdgpu.ids              -> /opt/amdgpu-pro/share/libdrm/
  • x86_64/libopencl-amdgpu-pro-17.40-492261.x86_64.rpm            -> /opt/amdgpu-pro/lib64/          -> /opt/amdgpu-pro/lib64/
  • x86_64/libopencl-amdgpu-pro-icd-17.40-492261.x86_64.rpm

    amdocl64.icd            -> /etc/OpenCL/vendors      -> /opt/amdgpu-pro/lib64/          -> /opt/amdgpu-pro/lib64/
  • x86_64/libdrm-amdgpu-pro-2.4.82-492261.x86_64.rpm             -> /opt/amdgpu-pro/lib64/         -> /opt/amdgpu-pro/lib64/      -> /opt/amdgpu-pro/lib64/  -> /opt/amdgpu-pro/lib64/      -> /opt/amdgpu-pro/lib64/  -> /opt/amdgpu-pro/lib64/             -> /opt/amdgpu-pro/lib64/         -> /opt/amdgpu-pro/lib64/


Now you can run e.g darktable with the following command and enjoy OpenCL support:

LD_LIBRARY_PATH=/opt/amdgpu-pro/lib64 darktable



What kernel version are you using? On what distro? Have you tried those new in kernel drivers that are in recent kernels?

I’m running Kernel 4.15.6 on openSUSE Tumbleweed. I’m running the AMD Kernel Open Source driver shipped with that Kernel.

However there is no AMD OpenCL implementation in Mesa (clover) with the imaging support needed by darktable and others. So instead of the Mesa OpenCL driver you need to use just the OpenCL bits from the proprietary driver.

For clover there is only some unfinished work here:

So we need to wait for ROCm from AMD which will include an Open Source OpenCL driver …

I got ROCm OpenCL working. Will try write the steps down soon.


Right now, I’m using AMDGPU PRO 18.20 (early preview version)[1].

I installed it in Ubuntu 18.04(kernel 4.15.0-*) with the command: ./amdgpu-pro-install --headless --opencl=legacy



1 Like

@asn is ROCm any better than AMDGPU PRO 18.20 for darktable (and Gimp)? I’ve just upgraded my hardware and bought used Radeon RX 480 8GB. I have Ubuntu 18.04.2 with kernel 4.18. I have a dilemma what to use. Have you got those steps wrote done anywhere? Thanks.

My steps to install ROCm:

ls -l
total 49892
-rw-r--r-- 1 asn users   669496 Mar 20 09:32 hsa-ext-rocr-dev-1.1.9-55-gbac2a9b4-Linux.rpm
-rw-r--r-- 1 asn users   352744 Mar 20 09:31 hsa-rocr-dev-1.1.9-55-gbac2a9b4-Linux.rpm
-rw-r--r-- 1 asn users    53576 Mar 20 09:31 hsakmt-roct-1.0.9-121-g876627e-Linux.rpm
-rw-r--r-- 1 asn users 50002776 Mar 20 09:32 rocm-opencl-1.2.0-2019030851.x86_64.rpm
$ rpm -vhU *.rpm

@asn :slight_smile:
I will try ROCm. There is a repo for Ubuntu so it shouldn’t be difficult.

I tried last night both ROCm and AMPGPU PRO 18.50 and have the same issue with kernel driver for Ubuntu 18.04.2 (4.18). I was able to compile the driver amdgpu but after that darktable or clinfo segfaults.
Now I see that you don’t use rock-dkms at all. You use opensource kernel driver?

I tried to install amdgpu-pro with options --headless and --opencl=legacy,pal.

Unfortunately there is an open issue with ROCm and darktable ( with Local contrast module. This module is often used by me with the local laplacian (default) so I will try amdgpu-pro driver till it’s fixed.
This is anyway strange since I have the impression that ROCm is using part of the amdgpu-pro code anyway.
[Update] I have read the discussion on redmine ( Disabling in darktable seems to be a good workaround for now when using ROCm.

I did a similar thing on Fedora and Debian. The opencl-amdgpu-pro, libopencl-amdgpu-pro and clinfo-amdgpu pro RPMs were the only ones needed on F29 for OpenCL. You no longer need the dkms RPMs with the newer drivers. I tried to update it on Debian and it still needed the dkms for some reason and didn’t like the 4.19 kernel in Buster/Testing for some reason. The older Testing kernel it didn’t complain about. Put and nVidia card back in that machine for now but the main workstation is running Vega 56, amdgpu mesa and amdgpu-pro OpenCL just fine.

It doesn’t like the 4.18 in Ubuntu either. Clinfo and darktable-cltest crashes with the kernel amdgpu driver.
I figured out what it the problem with dkms and was able to compile the pro kernel driver but I’m not sure if this is sufficient. Haven’t tried the compiled driver yet.

Kernel 4.18 should be supported in next ROCm release from what I learnt.

I’m running ROCm with the upstream Kernel without any issues since Kernel 4.18! The upstream Kernel amdgpu driver is supported since ROCm 1.8.0.

I’m on Kernel 5.0.6 with latest ROCm without any issues.

Tried ROCm with the packages that you listed. For ubuntu the list is:


It looks like opencl is working. clinfo returns proper data.
However first launch of darkatble-cltest showed something like this in logs:

5.113568 [opencl_init] benchmarking results: 0.080698 seconds for fastest GPU versus 0.085221 seconds for CPU.
5.113582 [opencl_init] due to a slow GPU the opencl flag has been set to OFF.

After re-enabling the OpenCL support everything is fine.
Well almost fine. The issue with the Local contrast module is really turning images into kind of mosaic. Had to disable this cl file.
Thank you @asn for your support!

ROCm 2.3 with Ubuntu 18.04.2 support has been released! The rock-dkms compiles the modules nicely now.

@asn I tried to extract the OpenCL library from the 19.10 driver like you described in the original post, but Darktable crashes for me with a segfault in ROCm is not yet an option for me, since my Vega M is not yet supported by ROCm.

Could you give me a hint for how to debug my problem? I think I might be missing another binary, possibly.

Thank you for sharing your work on this!

I’m trying to move to ROCm as the latest amdgpu-pro drivers now have some pretty strict OS checks and only install on RHEL/Cent for RPM based distros. Looks like they went back to requiring the kernel modules too.

At any rate I installed those four RPMs on Fedora and clinfo/rocminfo sees my devices but Darktable still reports OpenCL is not available.