How to enable OpenCL/OpenCL ROCm for AMD RX 570/580 on Ubuntu 23.04

According to

https://docs.amd.com/bundle/Hardware_and_Software_Reference_Guide/page/Hardware_and_Software_Support.html

GFX8 GPUs are “enabled in the ROCm software, though full support is not guaranteed”.

Some things to verify:

  • Is there AMD ocl in /etc/OpenCL/vendors/?
  • Does clinfo -l show your GPU

Both Yes

clinfo
Number of platforms                               1
  Platform Name                                   AMD Accelerated Parallel Processing
  Platform Vendor                                 Advanced Micro Devices, Inc.
  Platform Version                                OpenCL 2.1 AMD-APP (3558.0)
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd cl_amd_event_callback 
  Platform Extensions function suffix             AMD
  Platform Host timer resolution                  1ns

  Platform Name                                   AMD Accelerated Parallel Processing
Number of devices                                 0

NULL platform behavior
  clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...)  No platform
  clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)   No platform
  clCreateContext(NULL, ...) [default]            No platform
  clCreateContext(NULL, ...) [other]              <error: no devices in non-default plaforms>
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL)  No devices found in platform

No GPU device available.

Verify that you are a member of video and render groups.

I am member of both the groups

raj@:~$ members video
raj
raj@:~$ members render
raj

This usually only installs the required tools, but you still need to run those tools in order to install the desired driver setup.
In my case I set up OpenCL support with my AMD RX5700XT as follows:
sudo amdgpu-install --usecase=graphics,opencl --opencl=rocr
At least I’m abel to utilize OpenCL in darktable with this setup.

You installed it in the past with the proprietary opencl libraries, did you try that way(link below) ?

I’m telling you so because I had a RX580 and it worked great with mesa + amd proprietary opencl libraries.

I used
sudo amdgpu-install --usecase=graphics,opencl --no-dkms --no-32 --accept-eula
But that also didn’t work. I think the latest ROCm doesn’t support RX-570

@rgo Yes that worked for me on Ubuntu 22.04 but as DT is no longer updating for Ubuntu 22.04 and it will not be supported for the upcoming 4.4, The DT developer wants to give something cutting edge which not possible in Ubuntu 22.04 but still using OpenCL which the inventor Apple has already years ago deprecated! I upgraded to Ubuntu 23.04 and officially AMD has no official supported drivers for it. Specially OpenCL=legacy requires supported kernel and AMD DKMS, which will fail in Ubuntu 23.04.

As of now I am using DT with Intel NEO driver which are available in 23.04 (which by the way has no impact on speed). The rustcl mesa drivers though enables OpenCL but it is not used by DT as it has no image support!!!

So now I have no clue what to do. Someone suggested that I should switch to some other distro like Arch and it’s like getting myself adopted by a new family at this age!

Well, changing all that code that makes DT fast(i.e. OpenCL) is not that easy. You can try vkdt, that uses vulkan and a totally different paradigm (nodes graph).

It seems that rusticl is able to run darktable: Mesa's "Rusticl" Implementation Now Manages To Handle Darktable OpenCL - Phoronix

Thing is that Mesa 22.3 has it included but not enabled by default. You need to compile it yourself (read somewhere). It’s a pity :sweat:

You could try

sudo amdgpu-install --opencl=legacy --no-dkms

in case that still brings in support for RX570.

Which Intel GPU? For supported Intel GPUs all that is needed (for OpenCL) is:

apt install intel-opencl-icd

(it will pull all other necessary packages).

I am sure you know this for a fact but if not it seems like the latest code from the dev is still being built for 22.04 so are you 100% sure it is not going to run as 4.4 on 22.04 Ubuntu??

Opencl=legacy and no-dkms are mutually exclusive

I have already installed intel-opencl-icd

I think it will not be as master branch for ubuntu 22.04 has no updates after 4.3-1231 or similar for others it is some 2629 and being updated mostly once or twice a week.
By the way I have again shifted to macOS as DT is faster than what I am using on Ubuntu without rx-570 opencl and is the current build thanks to @MStraeten

This migth be the latest amdgpu-pro, which still supports RX570:
https://www.amd.com/en/support/kb/release-notes/rn-amdgpu-unified-linux-22-40

please see the version for 22.04 it is stuck at 4.3.0-git1231 while the rest are at git-2441 and 2435 and there are no updates for the past 1+ months there is a thread regarding this in this forum.

are the OBS repo for darktable dead?

1 Like

May be still worth the try…

it totally screws up the kernel and the system will not be able to boot. I have tried it and have to restore my system from partition image which I periodically create using Disks app after booting from the install USB.

Raj, are you wiling to try my method
(which, among other things, means
that you will NOT be using Ubuntu)?

Have fun!
Claes in Lund, Sweden

It doesn’t do anything with kernel, if you are not using their dkms.
It’s just few libraries and documentation in those legacy packages…

@Claes I have now switched over to Garuda Gnome. I also managed to enable OpenCL for my RX-580. :blush:
There were some hiccups but some how I solved most of the problems.

I am really happy with this migration. Thanks for pushing me in this direction. I hope you wanted me to go on this path??

1 Like

Splendid, @Rajkhand :-)))))))

I hope you wanted me to go on this path??

In that direction, yes!
But actually on a slightly different path; viz. Endeavour OS,
because that is the distro that I presently know the best.
The main thing is of course that you managed to solve most of
your problems.

Have fun!
Claes in Lund, Sweden