AMD OpenCL Ubuntu 22.04 not working with Darktable

[dt_opencl_device_init]
DEVICE: 0: ‘AMD Radeon ™ R9 390 Series (hawaii, LLVM 13.0.1, DRM 3.48, 5.15.0-52-generic)’, NEW
CANONICAL NAME: amdradeontmr9390serieshawaiillvm1301drm348515052generic
PLATFORM NAME & VENDOR: Clover, Mesa
DRIVER VERSION: 22.0.5
DEVICE VERSION: OpenCL 1.1 Mesa 22.0.5
DEVICE_TYPE: GPU
*** The OpenCL driver doesn’t provide image support. See also ‘clinfo’ output ***
[opencl_init] no suitable devices found.
[opencl_init] FINALLY: opencl is NOT AVAILABLE on this system.
[opencl_init] initial status of opencl enabled flag is OFF.
[imageio_load_module_format] failed to open `avif’: (null)

clinfo
dlerror: libamdocl-orca64.so: cannot open shared object file: No such file or directory
Number of platforms 2
Platform Name Clover
Platform Vendor Mesa
Platform Version OpenCL 1.1 Mesa 22.0.5
Platform Profile FULL_PROFILE
Platform Extensions cl_khr_icd
Platform Extensions function suffix MESA

Platform Name AMD Accelerated Parallel Processing
Platform Vendor Advanced Micro Devices, Inc.
Platform Version OpenCL 2.1 AMD-APP (3486.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 Clover
Number of devices 1
Device Name AMD Radeon ™ R9 390 Series (hawaii, LLVM 13.0.1, DRM 3.48, 5.15.0-52-generic)
Device Vendor AMD
Device Vendor ID 0x1002
Device Version OpenCL 1.1 Mesa 22.0.5
Device Numeric Version 0x401000 (1.1.0)
Driver Version 22.0.5
Device OpenCL C Version OpenCL C 1.1
Device Type GPU
Device Profile FULL_PROFILE
Device Available Yes
Compiler Available Yes
Max compute units 44
Max clock frequency 1080MHz
Max work item dimensions 3
Max work item sizes 256x256x256
Max work group size 256
Preferred work group size multiple (kernel) 64
Preferred / native vector sizes
char 16 / 16
short 8 / 8
int 4 / 4
long 2 / 2
half 0 / 0 (n/a)
float 4 / 4
double 2 / 2 (cl_khr_fp64)
Half-precision Floating-point support (n/a)
Single-precision Floating-point support (core)
Denormals No
Infinity and NANs Yes
Round to nearest Yes
Round to zero No
Round to infinity No
IEEE754-2008 fused multiply-add No
Support is emulated in software No
Correctly-rounded divide and sqrt operations No
Double-precision Floating-point support (cl_khr_fp64)
Denormals Yes
Infinity and NANs Yes
Round to nearest Yes
Round to zero Yes
Round to infinity Yes
IEEE754-2008 fused multiply-add Yes
Support is emulated in software No
Address bits 64, Little-Endian
Global memory size 16779091968 (15.63GiB)
Error Correction support No
Max memory allocation 6871947673 (6.4GiB)
Unified memory for Host and Device No
Minimum alignment for any data type 128 bytes
Alignment of base address 32768 bits (4096 bytes)
Global Memory cache type None
Image support No
Local memory type Local
Local memory size 32768 (32KiB)
Max number of constant args 16
Max constant buffer size 67108864 (64MiB)
Max size of kernel argument 1024
Queue properties
Out-of-order execution No
Profiling Yes
Profiling timer resolution 0ns
Execution capabilities
Run OpenCL kernels Yes
Run native kernels No
ILs with version (n/a)
Built-in kernels with version (n/a)
Device Extensions cl_khr_byte_addressable_store cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_fp64 cl_khr_extended_versioning
Device Extensions with Version cl_khr_byte_addressable_store 0x400000 (1.0.0)
cl_khr_global_int32_base_atomics 0x400000 (1.0.0)
cl_khr_global_int32_extended_atomics 0x400000 (1.0.0)
cl_khr_local_int32_base_atomics 0x400000 (1.0.0)
cl_khr_local_int32_extended_atomics 0x400000 (1.0.0)
cl_khr_int64_base_atomics 0x400000 (1.0.0)
cl_khr_int64_extended_atomics 0x400000 (1.0.0)
cl_khr_fp64 0x400000 (1.0.0)
cl_khr_extended_versioning 0x400000 (1.0.0)

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] Success [MESA]
clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT) Success (1)
Platform Name Clover
Device Name AMD Radeon ™ R9 390 Series (hawaii, LLVM 13.0.1, DRM 3.48, 5.15.0-52-generic)
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU) Success (1)
Platform Name Clover
Device Name AMD Radeon ™ R9 390 Series (hawaii, LLVM 13.0.1, DRM 3.48, 5.15.0-52-generic)
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) Success (1)
Platform Name Clover
Device Name AMD Radeon ™ R9 390 Series (hawaii, LLVM 13.0.1, DRM 3.48, 5.15.0-52-generic)

I upgraded from ubuntu 20.04 ( amd gpu working well) to 22.04 to be able to use Displaycal to have a color graded system and ended up with an unusable amd gpu!

Isn’t this totally an Ubuntu issue? Or maybe you installed it wrongly?

I considered an error from my part during installation of amdgpu drivers. Installed the drivers in the first place during safemode, thought that maybe it had a problem during installation since opencl didn’t worked on DT, uninstalled the driver and tried to re-install since then.
amdgpu-install --opencl=legacy
Hit:1 Index of /ubuntu jammy InRelease
Hit:2 fr.archive.ubuntu.com / ubuntu.lafibre.info focal-updates InRelease
Get:3 Index of /ubuntu jammy-updates InRelease [114 kB]
Hit:4 fr.archive.ubuntu.com / ubuntu.lafibre.info focal-backports InRelease
Get:5 Index of /ubuntu focal-security InRelease [114 kB]
Hit:6 Index of /deadsnakes/ppa/ubuntu jammy InRelease
Hit:7 Index of /amdgpu/5.3/ubuntu/ jammy InRelease
Get:8 Index of /ubuntu jammy-backports InRelease [99,8 kB]
Hit:9 Index of /rocm/apt/latest/ ubuntu InRelease
Get:10 Index of /ubuntu jammy-security InRelease [110 kB]
Fetched 438 kB in 3s (132 kB/s)
Reading package lists… Done
W: Conflicting distribution: Index of /rocm/apt/latest/ ubuntu InRelease (expected ubuntu but got focal)
N: Skipping acquire of configured file ‘main/binary-i386/Packages’ as repository ‘Index of /rocm/apt/latest/ ubuntu InRelease’ doesn’t support architecture ‘i386’
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
E: Unable to locate package clinfo-amdgpu-pro
E: Unable to locate package opencl-legacy-amdgpu-pro-icd

amdgpu-install --opencl=rocr
Hit:1 Index of /ubuntu jammy InRelease
Hit:2 fr.archive.ubuntu.com / ubuntu.lafibre.info focal-updates InRelease
Hit:3 Index of /ubuntu jammy-updates InRelease
Get:4 Index of /ubuntu focal-security InRelease [114 kB]
Hit:5 fr.archive.ubuntu.com / ubuntu.lafibre.info focal-backports InRelease
Get:6 Index of /ubuntu jammy-backports InRelease [99,8 kB]
Hit:7 Index of /deadsnakes/ppa/ubuntu jammy InRelease
Hit:8 Index of /amdgpu/5.3/ubuntu/ jammy InRelease
Hit:9 Index of /rocm/apt/latest/ ubuntu InRelease
Hit:10 Index of /ubuntu jammy-security InRelease
Fetched 214 kB in 3s (69,5 kB/s)
Reading package lists… Done
W: Conflicting distribution: Index of /rocm/apt/latest/ ubuntu InRelease (expected ubuntu but got focal)
N: Skipping acquire of configured file ‘main/binary-i386/Packages’ as repository ‘Index of /rocm/apt/latest/ ubuntu InRelease’ doesn’t support architecture ‘i386’
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
linux-headers-5.15.0-52-generic is already the newest version (5.15.0-52.58).
amdgpu-dkms is already the newest version (1:5.18.2.22.40.50300-1483871.22.04).
rocm-opencl-runtime is already the newest version (5.3.0.50300-63~20.04).
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
rocm-hip-runtime : Depends: rocminfo (= 1.0.0.50300-63~20.04) but 5.0.0-1 is to be installed
E: Unable to correct problems, you have held broken packages.

You downloaded a deb file, but it seems lik you should’ve added a repo to get the other packages. Or you grabbed a deb for the wrong version of your distro.

amdgpu-install -y --usecase=graphics --opencl=legacy
Hit:1 Index of /ubuntu jammy InRelease
Get:2 Index of /ubuntu jammy-updates InRelease [114 kB]
Hit:3 Index of /deadsnakes/ppa/ubuntu jammy InRelease
Hit:4 Index of /amdgpu/22.20.3/ubuntu/ jammy InRelease
Hit:5 Index of /rocm/apt/5.2.3/ ubuntu InRelease
Get:6 Index of /ubuntu jammy-backports InRelease [99,8 kB]
Get:7 Index of /ubuntu jammy-security InRelease [110 kB]
Fetched 324 kB in 6s (58,8 kB/s)
Reading package lists… Done
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
linux-headers-5.15.0-52-generic is already the newest version (5.15.0-52.58).
linux-modules-extra-5.15.0-52-generic is already the newest version (5.15.0-52.58).
The following packages were automatically installed and are no longer required:
libelf-dev libncurses-dev libtinfo-dev
Use ‘sudo apt autoremove’ to remove them.
The following additional packages will be installed:
amdgpu-core amdgpu-dkms-firmware amdgpu-pro-core gst-omx-amdgpu libdrm-amdgpu-amdgpu1 libdrm-amdgpu-common
libdrm-amdgpu-radeon1 libdrm2-amdgpu libegl1-amdgpu-mesa libegl1-amdgpu-mesa-drivers libgbm1-amdgpu
libgl1-amdgpu-mesa-dri libgl1-amdgpu-mesa-glx libglapi-amdgpu-mesa libllvm14.0.50203-amdgpu libwayland-amdgpu-client0
libwayland-amdgpu-egl1 libwayland-amdgpu-server0 libxatracker2-amdgpu mesa-amdgpu-omx-drivers mesa-amdgpu-va-drivers
mesa-amdgpu-vdpau-drivers ocl-icd-libopencl1-amdgpu-pro xserver-xorg-amdgpu-video-amdgpu
Recommended packages:
libtxc-dxtn-s2tc0 | libtxc-dxtn0
E: Can’t find a source to download version ‘1.0.0.1-1271047’ of ‘gst-omx-amdgpu:amd64’

Yes, on Fedora Linux 36 (and now on Fedora Linux 37), I think all I had to do was rpm-ostree install rocm-opencl (I’m on Silverblue); which would be dnf install rocm-opencl on standard Fedora Linux Workstation.

I’ve since been playing around with some machine learning stuff (with PyTorch using ROCm) and have installed more ROCm packages, so now I have all of: rocm-clinfo rocm-opencl rocm-opencl-devel rocm-runtime-devel rocm-smi rocminfo installed. but for darktable, I’m pretty sure all you need is rocm-opencl, which is in the main Fedora repos. If you do need anything else, it’d be from that list (and might be rocm-opencl-devel if just rocm-opencl doesn’t work for you).

You don’t need to mess with any special third party installer or external packages on Fedora, in other words. There are also special coprs (similar to PPAs) with additional rocm things, such as mystro256/rocm-opencl Copr and , but they’re no longer needed to get opencl working in darktable.

It’s mainly thanks to the people on the HC SIG (Heterogeneous Computing Special Interest Group) @ SIGs/HC - Fedora Project Wiki — and especially Jeremy Newton (aka: Mystro256) for the main ROCm support.

I’m not aware of anything similar as Fedora’s SIGs for Ubuntu. However, both Fedora and Debian have made efforts for packaging ROCm (article from 2021; since then F36 got ROCm support a little after post-launch and F37 has it too) — and Arch has been doing this for a while too. Ubuntu might benefit from Debian’s packaging effort someday.

I agree, this seems to be a problem with the current kernel. I’ll try to work around it…
Thanks for your insight.

Thank you brother, I had a problem with the DaVinci Resolve program, your comment helped me a lot :heart::heart:

1 Like

All I can add is that latest amdgpu-opencl doesn’t work for Polaris GPUs on arch either, so it’s a driver issue on ubuntu as well I guess. Downgrading on arch made it work again.
https://aur.archlinux.org/packages/opencl-amd

I have another question regarding the different behavior of the 2 main brand gpu’s on darktable:

  1. GPU optimization
  2. Performance
    3.Stability

Witch do you recommend?
I already own an AMD r390x 8gb, and i know that vram is king in this kind of work-tasks.
Looking to invest in a more recent gpu to optimize performance. Even if i was happy with the r390x, WHEN opencl worked! Darktable without opencl is really slow, after a few modules exporting takes about 5 to 10mns!

(I know that AMD has a problem with local contrast calculations)
Thanks for your advice.

nVidia never gets flack for how it works. The only flack is that their driver is closed source.

I have a gtx 1050 4gb and it makes darktable very usable on my aging Haswell desktop.

2 Likes

Does it still with diffuse and sharpen? Never had any issue

“This is the first time photopanda has posted — let’s welcome them to our community!”

This is a lie! :wink:

Aurelien Pierre did mention that AMD gpu’s had a problem with local contrast modules, at what level i cannot say.

Please don’t ask me the reason but this works 100%. (There are few errors at installation time!)
Driver = amdgpu-install_22.20.50203-1_all.deb

amdgpu-install --usecase=graphics --opencl=legacy --accept-eula --no-32

for my rx-570 on Ubuntu Ubuntu 22.04.1 LTS
kernel 5.15.0-53-generic

2 Likes

useful link
AMD Available drivers

Ubuntu recently upgraded the kernel and the previous version amdgpu-install_22.20.50203-1_all.deb was giving dkms error but was working. But there is a newer version at 22.20.4 in the above link which installs properly without any errors
for Ubuntu 22.04 the link amdgpu-install_22.20.50204-1_all.deb
If you follow the above link you can find drivers for bionic & focal too.
I thought this information will be useful to many users.

1 Like

Unfortunately for me it still gives errors related to rocm packages and unmet dependencies.
Going to retry this method.

Your R9 390 is an old card and ROCm is not available, so openCL=legacy, use the command

amdgpu-install --usecase=graphics --opencl=legacy --accept-eula --no-32

But before this first uninstall the driver

amdgpu-install --uninstall
dpkg -r amdgpu-install
dpkg --purge amdgpu-install

then
Repair Ubuntu

then install the latest driver .deb file linked in previous post. Then install the driver with the command given above. IMHO you have tried many things and some how disturbed something.

In my case I have followed the above steps and now my system is stable and everything works.

1 Like