AMD OpenCL Ubuntu 22.04 not working with Darktable

Hi.

I thought I succeeded in installing OpenCL on AMD on Ubuntu 22.04. At least, clinfo -l writes:

Platform #0: AMD Accelerated Parallel Processing

However, it doesn’t work in darktable. When started with -d opencl -d perf flags, it writes:

[opencl_init] opencl related configuration options:
[opencl_init] opencl: ON
[opencl_init] opencl_scheduling_profile: 'default'
[opencl_init] opencl_library: 'default path'
[opencl_init] opencl_device_priority: '*/!0,*/*/*'
[opencl_init] opencl_mandatory_timeout: 200
[opencl_init] opencl_synch_cache: false
[opencl_init] opencl library 'libOpenCL' found on your system and loaded
[opencl_init] found 1 platform
[opencl_init] could not get device id: CL_DEVICE_NOT_FOUND
[opencl_init] found 0 device
[opencl_init] FINALLY: opencl is NOT AVAILABLE on this system.
[opencl_init] initial status of opencl enabled flag is OFF.

Can you help me to make it run?

I’m using Ubuntu 22.04, kernel 5.15.0-46-generic, AMD Radeon RX 550 Series.

Many thanks.
Michal

Hi Michal, as far as I know, ATI drivers lacks OpenCL image support in linux (at least a year ago), required by darktable.
MESA drivers developers are working to add this feature in their code, but I don’t know if this is released, yet.
This is the link to a branch in github containing their work: https://github.com/vedranmiletic/mesa/tree/r600-image-support.
Michele

On Tumbleweed I had to additionally install ROCm stuff, then opencl worked fine.

1 Like

@apostel338 Could you possibly elaborate on which rocm files should I install? There are quite many of them. Thanks.

I’m sorry that I can’t exactly tell. I’ve left linux for a while now and haven’t used it much. But I think rocm-opencl is all I needed (and its dependencies). I probably also added my user to video + render group.

If starting from scratch, try this:

  1. Download and install the latest Radeon installer package for Ubuntu from AMD.
  2. Open a terminal and run:

amdgpu-install -y --usecase=opencl --no-dkms

sudo usermod -a -G render $LOGNAME

  1. Restart your computer

This should give you a minimal and open source only installation of AMD OpenCL that works with darktable.

Alternatively, if you’re sure you have already installed the latest version of AMD OpenCL correctly, you may just need to run one of the following and then restart your computer:

sudo usermod -a -G render $LOGNAME

or

sudo usermod -a -G video $LOGNAME

The terminal output you posted indicates that OpenCL may be installed, but it can’t see your graphics card ("[opencl_init] found 0 device").

I get this error

Number of platforms                               1
  Platform Name                                   AMD Accelerated Parallel Processing
  Platform Vendor                                 Advanced Micro Devices, Inc.
  Platform Version                                OpenCL 2.1 AMD-APP (3452.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]              
  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

Pity, I got the same result as Raj: Number of devices: 0.

st 24. 8. 2022 v 5:47 odesílatel Raj via discuss.pixls.us <noreply@discuss.pixls.us> napsal:

I am getting the same. Linux Mint 20.3 here with AMD A4-7210 APU with AMD Radeon R3 Graphics × 4

I followed @inquisitvepand’s instructions. Darktable starts with

$ darktable -d opencl -d perf
[opencl_init] opencl related configuration options:
[opencl_init] opencl: ON
[opencl_init] opencl_scheduling_profile: ‘default’
[opencl_init] opencl_library: ‘default path’
[opencl_init] opencl_device_priority: ‘/!0,//
[opencl_init] opencl_mandatory_timeout: 200
[opencl_init] opencl_synch_cache: false
[opencl_init] opencl library ‘libOpenCL’ found on your system and loaded
[opencl_init] found 1 platform
[opencl_init] could not get device id: CL_DEVICE_NOT_FOUND
[opencl_init] found 0 device
[opencl_init] FINALLY: opencl is NOT AVAILABLE on this system.
[opencl_init] initial status of opencl enabled flag is OFF.

I have installed Intel Neo driver for my i7 8700 inbuilt 630 GPU and opencl is available but am not sure about its performance. Will do some testing.

In the meantime I request all DT users using AMD card and using Ubuntu 22.04 or equivalent distros for help.
By the way everything was working with Ubuntu 20.04 and previous AMD driver for this Distro.

Ok, I just upgraded the GPU in my desktop system and I might be able to help a bit. I am by no means a GPU expert, nor a darktable developer. I’m just a retired computer programmer/programming manager with a long history of digging into inscrutable technical documentation and trying to make sense of it all…

For the record, I am currently using Ubuntu 22.04. I was using a Radeon RX 580 in my desktop and it worked well with OpenCL under 20.04.

However, with my upgrade to 22.04, I decided to upgrade my GPU. I replaced the RX 580 today with a Radeon RX 6650 XT. I used inquisitivepanda’s instructions for the install and they worked for ME. BUT my new GPU is a current model - not an older model like my RX 580.

My RX 580 - like Michal Kvasnička’s RX 550 - is an older GPU architecture and so you need to change the amdgpu-install command a bit. So, when you’re installing the AMD software, you HAVE TO make sure what generation your GPU is. In the case of the RX 550/580, it’s older than Vega 10, and here’s what AMD says about that in the install instructions:

There are two OpenCL implementations available:
. ROCr: Provides support for Vega 10 and newer hardware.
. Legacy: Provides support for hardware older than Vega 10.

So to install OpenCL for a legacy product like the RX 550/580, you need to specify:
–opencl=legacy
in your command line.

It also appears that Rajkhand’s A4-7210 would also be a legacy product. But…

GPU drivers and related software like OpenCL are fearsomely complex. And while it’s not official by any means, if you look at:
Wikipedia’s List of AMD graphics processing units
You will notice that the line indicating ‘AMD Support’ goes back only so far. Older stuff MAY NOT work with the legacy OpenCL driver - I really don’t know.

1 Like

Forgive my ignorance, but where do you add that option to the command line given

amdgpu-install -y --usecase=opencl --no-dkms
??

The amdgpu-install command has a lot of options, which you can see with command:
amdgpu-install --help

And there is also the command:
amdgpu-install --list-usecase
which gives you a list of all the use cases

The --list-usecase command returns the following tidbit (along with all the possible use-cases):

If --usecase option is not present, the default selection is
"dkms,graphics,opencl,hip"

So, you should be able to issue the command:
amdgpu-install -y --usecase=graphics,hip --opencl=legacy --no-dkms

Which I think would be the equivalent of the command you quoted, while allowing you to specify the legacy OpenCL driver. HOWEVER, I have not tried this myself. I don’t have a desktop with a GPU that needs a legacy OpenCL driver.

=-=-=-=-=-=-=-
When I installed the 20.04 version of amdgpu-install a couple of years ago the documentation had a lot of discussion about the --usecase= parameters. In the current version, --usecase= item isn’t even mentioned - meaning that most people will get the default values, which are listed above.

The --opencl=legacy option - I believe - requires the operator to accept an end-user license agreement (EULA) for the licensed software that’s being installed. I believe the -y switch automatically accepts the EULA for you. The non-legacy version is open source, so no EULA is needed.

Hope this helps.

Appreciate the help, but it didn’t work. I did get it to install after reading on AMDs website. I think I installed way more than I needed, not to worry however. Oh and yes, it did pop up a text box to get me to accept the EULA.

Unfortunately Darktable still cannot use opencl on my system (same startup message)

Getting following error
ERROR: using '--no-dkms' with '--opencl=legacy' is not supported
can someone explain meaning of --no-dkms and why it is required?

This works for me on ubuntu 22.04 with my AMD RX-570

amdgpu-install -y --usecase=graphics --opencl=legacy

If you have error for unmet dependency see https://askubuntu.com/questions/1417418/unmet-dependencies-ubuntu-22-04-amdgpu-hip-support

[opencl_init] OpenCL successfully initialized.
[opencl_init] here are the internal numbers and names of OpenCL devices available to darktable:
[opencl_init]		0	'Intel(R) UHD Graphics 630 [0x3e92]'
[opencl_init]		1	'Ellesmere'
[opencl_init] FINALLY: opencl is AVAILABLE on this system.
[opencl_init] initial status of opencl enabled flag is ON.
[opencl_init] set scheduling profile to default.
[dt_opencl_update_priorities] these are your device priorities:
[dt_opencl_update_priorities] 		image	preview	export	thumbs	preview2
[dt_opencl_update_priorities]		1	0	1	0	0
[dt_opencl_update_priorities]		-1	-1	0	1	1
[dt_opencl_update_priorities] show if opencl use is mandatory for a given pixelpipe:
[dt_opencl_update_priorities] 		image	preview	export	thumbs	preview2
[dt_opencl_update_priorities]		1	0	1	1	1
[opencl_synchronization_timeout] synchronization timeout set to 200
[dt_opencl_update_priorities] these are your device priorities:
[dt_opencl_update_priorities] 		image	preview	export	thumbs	preview2
[dt_opencl_update_priorities]		1	0	1	0	0
[dt_opencl_update_priorities]		-1	-1	0	1	1
[dt_opencl_update_priorities] show if opencl use is mandatory for a given pixelpipe:
[dt_opencl_update_priorities] 		image	preview	export	thumbs	preview2
[dt_opencl_update_priorities]		1	0	1	1	1
[opencl_synchronization_timeout] synchronization timeout set to 200
1 Like

Hi.

I tried amdgpu-install -y --usecase=graphics --opencl=legacy but got the following error (sorry for the Czech):

E: Nelze najít balík clinfo-amdgpu-pro
E: Nelze najít balík opencl-legacy-amdgpu-pro-icd

In words, apt cannot find these two packages. How have you solved this problem? These two packages aren’t mentioned in the link @Rajkhand mentioned.

Best wishes,
Michal

so 27. 8. 2022 v 8:45 odesílatel Raj via discuss.pixls.us <noreply@discuss.pixls.us> napsal:

In my case I never had this error. As I am not an expert for many days I was experimenting, installing/uninstalling various things, but am not sure why today I was able to get success so I am sending you my terminal History file of all the trial and errors of past many days. I only got success in line 917.
Hope some expert can analyze and shade some light

sudo apt-get install ./amdgpu-install_22.20.50200-1_all.deb
  733  sudo apt-get update
  734  amdgpu-install -y --opencl=rocr,legacy
  735  amdgpu-install -y --opencl=rocr,legacy
  736  glxinfo
  737  sudo apt install mesa-utils -y
  738  glxinfo | grep "OpenGL version"
  739  sudo add-apt-repository ppa:oibaf/graphics-drivers -y
  740  sudo apt update
  741  sudo apt upgrade -y
  742  glxinfo | grep "OpenGL version"
  743  amdgpu-install -y --opencl=rocr,legacy
  744  darktable -d all
  745  openCLON.sh
  746  apt download rocm-llvm
  747  ar x rocm-llvm_14.0.0.22204.50200-65_amd64.deb
  748  tar xf control.tar.xz
  749  gedit control
  750  tar c postinst prerm control | xz -c > control.tar.xz
  751  ar rcs rocm-llvm_14.0.0.22204.50200-65_amd64.deb debian-binary control.tar.xz data.tar.xz
  752  sudo apt-get install libstdc++-10-dev libgcc-10-dev
  753  sudo dpkg -i rocm-llvm_14.0.0.22204.50200-65_amd64.deb
  754  sudo apt install rocm-core
  755  sudo amdgpu-install --opencl=legacy,rocr -y
  756  dpkg -s ti-opencl
  757  clinfo
  758  sudo apt-get update
  759  sudo apt-get -y install intel-gpu-tools
  760  sudo apt autoremove
  761  clinfo
  762  glxinfo -B
  763  clear
  764  glxinfo -B
  765  sudo lshw -c video
  766  clinfo
  767  clear
  768  sudo apt-get update
  769  sudo apt-get -y install intel-opencl-icd
  770  clinfo
  771  clear glxinfo -B
  772  clear
  773  glxinfo -B
  774  sudo lshw -c video
  775  clear
  776  ls -l /dev/dri/render*
  777  clinfo
  778  sudo lshw -c video
  779  darktable --disable-opencl
  780  ./amdgpu-pro-install --uninstall
  781  sudo apt autoremove
  782  clinfo -l
  783  sudo apt-get update
  784  sudo apt-get upgrade
  785  clinfo
  786  clinfo -l
  787  whoami
  788  sudo gpasswd -a $USER render
  789  clinfo -l
  790  sudo usermod -a -G video $LOGNAME 
  791  groups
  792  clinfo -l
  793  strace -f -s 255 -o log.txt clinfo
  794  clinfo
  795  strace -f -s 255 -o log.txt clinfo
  796  darktable -cltest
  797  darktable -d opencl
  798  cd ~/Music
  799  ls
  800  sudo dpkg-reconfigure amdgpu-dkms
  801  dpkg --info
  802  sudo amdgpu-install --uninstall
  803  clinfo
  804  strace -f -s 255 -o log.txt clinfo
  805  clear dpkg
  806  cd ..
  807  clear
  808  dpkg
  809  dpkg -l
  810  sudo apt-get remove intel-opencl-icd
  811  sudo apt-get -y autoremove --purge intel-opencl-icd
  812  dpkg -l
  813  clear
  814  darktable -d opencl
  815  apt policy
  816  ls -l /etc/OpenCL/vendors/
  817  echo $LOGNAME
  818  amdgpu-install -h
  819  amdgpu-install --list-usecase
  820  clinfo
  821  clinfo -l
  822  darktable -d all
  823  clear
  824  darktable -cltest
  825  darktable -d opencl
  826  amdgpu-install -y --usecase=opencl --no-dkms
  827  darktable -d opencl
  828  sudo usermod -a -G render $LOGNAME
  829  sudo usermod -a -G video $LOGNAME
  830  clinfo
  831  amdgpu-uninstall
  832  clinfo
  833  amdgpu-install -h
  834  amdgpu-install --list-usecase
  835  amdgpu-install --usercase=opencl
  836  amdgpu-install --usecase=opencl
  837  clinfo
  838  s -l /dev/dri/render*
  839  ls -l /dev/dri/render*
  840  dpkg -L amdgpu-install
  841  amdgpu-uninstall
  842  sudo ppa-purge ppa:oibaf/graphics-drivers -y
  843  sudo apt update && sudo apt upgrade -y
  844  apt --fix-broken install
  845  sudo apt --fix-broken install
  846  dpkg -r rocm-llvm
  847  sudo dpkg -r rocm-llvm
  848  cd AMD
  849  sudo apt install ./rocm-llvm_14.0.0.22204.50200-65_amd64.deb
  850  sudo apt update && sudo apt upgrade -y
  851  sudo apt autoremove
  852  sudo amdgpu-install --opencl=rocr -y
  853  clinfo
  854  /opt/rocm/opencl/bin/clinfo
  855  sudo clinfo
  856  clear
  857  sudo lshw -C display
  858  sudo usermod -a -G video $LOGNAME
  859  sudo usermod -a -G render $LOGNAME
  860  sudo clinfo
  861  rocminfo
  862  wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.11702.1/intel-igc-core_1.0.11702.1_amd64.1.deb
  863  wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.11702.1/intel-igc-opencl_1.0.11702.1_amd64.deb
  864  wget https://github.com/intel/compute-runtime/releases/download/22.33.23949/intel-level-zero-gpu-dbgsym_1.3.23949_amd64.ddeb
  865  wget https://github.com/intel/compute-runtime/releases/download/22.33.23949/intel-level-zero-gpu_1.3.23949_amd64.deb
  866  wget https://github.com/intel/compute-runtime/releases/download/22.33.23949/intel-opencl-icd-dbgsym_22.33.23949_amd64.ddeb
  867  wget https://github.com/intel/compute-runtime/releases/download/22.33.23949/intel-opencl-icd_22.33.23949_amd64.deb
  868  wget https://github.com/intel/compute-runtime/releases/download/22.33.23949/libigdgmm12_22.1.3_amd64.deb
  869  sudo dpkg -i *.deb
  870  clinfo
  871  clinfo
  872  amdgpu-install usecase=opencl,graphics -y
  873  amdgpu-install -usecase=opencl,graphics -y
  874  amdgpu-install -h
  875  amdgpu-install --usecase=opencl,graphics -y
  876  darktable -d opencl
  877  clear
  878  sudo /opt/rocm/bin/rocminfo
  879  dmesg | grep -i amdgpu
  880  sudo dmesg | grep -i amdgpu
  881  amdgpu-uninstall
  882  lshw
  883  clear
  884  ls /etc/OpenCL/vendors/
  885  lscpi -k
  886  lspci -k
  887  clinfo
  888  clear
  889  clinfo
  890  darktable -d opencl
  891  clear
  892  darktable -d opencl
  893  sudo apt-get install -f
  894  sudo apt autoremove
  895  darktable -d pref
  896  darktable -d perf
  897  darktable -d opencl,perf
  898  darktable -d opencl -d perf
  899  amdgpu-install -h
  900  amdgpu-install -y --usecase=graphics,hip --opencl=legacy --no-dkms
  901  amdgpu-install -y --usecase=graphics,hip --opencl=legacy 
  902  clinfo
  903  amdgpu-uninstall
  904  amdgpu-install --uninstall
  905  sudo apt autoremove
  906  dpkg -l | grep "mkvtoolnix"
  907  sudo apt-get update
  908  apt-get -h
  909  sudo apt-get clean
  910  sudo nano '/etc/apt/sources.list.d/mkvtoolnix.download.list' 
  911  sudo nano '/etc/apt/sources.list.d/mkvtoolnix.download.list.distUpgrade' 
  912  sudo nano '/etc/apt/sources.list.d/mkvtoolnix.download.list.save' 
  913  sudo apt-get update
  914  clear
  915  python -V
  916  python3 -V
  917  amdgpu-install -y --usecase=graphics --opencl=legacy 
  918  clinfo
  919  darktable -d opencl
  920  echo 'deb http://download.opensuse.org/repositories/graphics:/darktable:/master/xUbuntu_22.04/ /' | sudo tee /etc/apt/sources.list.d/graphics:darktable:master.list
  921  curl -fsSL https://download.opensuse.org/repositories/graphics:darktable:master/xUbuntu_22.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/graphics_darktable_master.gpg > /dev/null
  922  sudo apt update
  923  df -h
  924  sudo apt update
  925  apt list --upgradable
  926  sudo apt-get upgrade
  927  sudo apt install timeshift
  928  df
  929  echo $HISTFILE
  930  history
raj@:~$

Hope this helps you

There’s this from the archives, with several different ways to install OpenCL from ROCm: How to install AMD ROCm for OpenCL support

I hope someone finds this helpful.

DKMS refers to Linux’s Dynamic Kernel Module Support. The error message is saying that a dynamically loaded kernel module is required for legacy OpenCL support.

I’m not on a Linux machine at the moment, but you should be able to find the tools to build kernel modules pretty readily.