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

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

2 Likes

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

Regards

[1] https://support.amd.com/en-us/kb-articles/Pages/Radeon-Software-for-Linux-18.20-Early-Preview-Release-Notes.aspx

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.

@asn
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 (Darktable opencl results are wrong with rocm (compared to amdgpu-pro and others) · Issue #704 · RadeonOpenCompute/ROCm · GitHub) 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 (https://redmine.darktable.org/issues/12423). Disabling locallaplacian.cl 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:

hsakmt-roct_1.0.9-121-g876627e_amd64.deb
hsakmt-roct-dev_1.0.9-121-g876627e_amd64.deb
hsa-ext-rocr-dev_1.1.9-55-gbac2a9b_amd64.deb
hsa-rocr-dev_1.1.9-55-gbac2a9b_amd64.deb
rocm-opencl_1.2.0-2019030702_amd64.deb

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 libamdocl-orca64.so. 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.

Hi @ash,
I just installed RX590 and I tried to follow your steps on Ubuntu 19.10. Unfortunately not all expected files are in the files as described neither in amdgpu-pro-19.50-967960-sle-15.tar.xz nor in amdgpu-pro-19.50-967956-rhel-8.1.tar.xz.

The Ubuntu installation insists to install only on Ubuntu 18.04 which is on not much help.

I was just wandering if I can try the files you already have extracted on Ubuntu 19.10, if you don’t mind sharing there files.

Thanks

Take a look at:

I recently updated my AMDGPU-pro drivers (previously installed in a messy way) using this script: bash implementation of opencl-amd AUR package, Install opencl amdgpu amdgpu-pro opencl only. Supports ubuntu and others with standard prefix · GitHub

Script is simple enough to read what’s it doing but read all comments first (and ignore those that say “The Absolute Perfect Guide for Installing Opencl on Ubuntu/Linux Mint/Debian buster”).

If you need help let me know, I’m happy to help :slight_smile:

Cheers!

I put together how I could get 18.04.4 to work with files from the amdgpu-pro script.
Maybe it works for you as well

https://discuss.pixls.us/t/install-opencl-from-amdgpu-pro-under-ubuntu-non-supported-version/17528

1 Like

Why not the script? Doing things by hand is prone to errors. :man_shrugging:

in the other thread i already got pointed in the right direction.
Sorry, didn’t have a look on your script so far

So the answer to our problems was “–no-dkms” :slightly_smiling_face:
Thanks!