OpenCL not available

I updated my openSUSE Tumbleweed system. Both DT and Nvidia were updated. After the update, openCL is no longer available:

darktable -d opencl
darktable 5.3.0~git997.09b8299f-13488.1
Copyright (C) 2012-2025 Johannes Hanika and other contributors.

Compile options:
  Bit depth              -> 64 bit
  Exiv2                  -> 0.28.3
  Lensfun                -> 0.3.4
  Debug                  -> DISABLED
  SSE2 optimizations     -> ENABLED
  OpenMP                 -> ENABLED
  OpenCL                 -> ENABLED
  Lua                    -> ENABLED  - API version 9.6.0
  Colord                 -> ENABLED
  gPhoto2                -> ENABLED
  OSMGpsMap              -> ENABLED  - map view is available
  GMIC                   -> ENABLED  - Compressed LUTs are supported
  GraphicsMagick         -> DISABLED
  ImageMagick            -> DISABLED
  libavif                -> ENABLED
  libheif                -> ENABLED
  libjxl                 -> ENABLED
  LibRaw                 -> ENABLED  - Version 0.21.4-Release
  OpenJPEG               -> ENABLED
  OpenEXR                -> ENABLED
  WebP                   -> ENABLED

See https://www.darktable.org/resources/ for detailed documentation.
See https://github.com/darktable-org/darktable/issues/new/choose to report bugs.

     0.0001 [dt starting]
 darktable -d opencl
     0.3690 [opencl_init] opencl disabled via darktable preferences
     0.3694 [dt_dlopencl_init] could not find default opencl runtime library 'libOpenCL'
     0.3695 [dt_dlopencl_init] could not find default opencl runtime library 'libOpenCL.so'
     0.3703 [opencl_init] opencl library 'libOpenCL.so.1' found on your system and loaded, preference 'default path'
     0.4036 [opencl_init] found 1 platform
[opencl_init] found 1 device

[dt_opencl_device_init]
   DEVICE:                   0: 'NVIDIA GeForce GTX 1660'
   CONF KEY:                 cldevice_v5_nvidiacudanvidiageforcegtx1660
   PLATFORM, VENDOR & ID:    NVIDIA CUDA, NVIDIA Corporation, ID=4318
   CANONICAL NAME:           nvidiacudanvidiageforcegtx1660
   DRIVER VERSION:           470.256.02
   DEVICE VERSION:           OpenCL 3.0 CUDA, SM_20 SUPPORT
   DEVICE_TYPE:              GPU, dedicated mem
   GLOBAL MEM SIZE:          5943 MB
   MAX MEM ALLOC:            1486 MB
   MAX IMAGE SIZE:           32768 x 32768
   MAX CONSTANT BUFFER:      64 KB
   ADDRESS ALIGN:            512
   MAX WORK GROUP SIZE:      1024
   MAX WORK ITEM DIMENSIONS: 3
   MAX WORK ITEM SIZES:      [ 1024 1024 64 ]
   ASYNC PIXELPIPE:          NO
   PINNED MEMORY TRANSFER:   NO
   AVOID ATOMICS:            NO
   MICRO NAP:                250
   ROUNDUP WIDTH & HEIGHT    16x16
   CHECK EVENT HANDLES:      128
   TILING ADVANTAGE:         0.000
   DEFAULT DEVICE:           NO
   *** could not create context *** CL_OUT_OF_RESOURCES
[opencl_init] no suitable devices found.
     0.5482 [opencl_init] FINALLY: opencl PREFERENCE=OFF is NOT AVAILABLE and NOT ENABLED.

I am not sure why I am out of resources, nor where to look for more information.

The manual mentions one possible cause:

f. number of event handles
default 128
Event handles are used by darktable to monitor the success/failure of kernels and provide profiling info even if the pixelpipe is executed asynchronously. The number of event handles is a limited resource of your OpenCL driver – while they can be recycled, there is a limited number that can be used at the same time. Unfortunately, there is no way to find out what the resource limits are for a given device (this is due to darktable using the OpenCL V.1.2 API to support all platforms), so darktable uses a conservative guess of 128 by default. On most current devices and drivers you can expect a number of up to 1024 to be safe (for sure if your driver / card reports OpenCL V.2.0 or larger) leading to a slightly better OpenCL performance. If your driver runs out of free handles you will experience failing OpenCL kernels with error message CL_OUT_OF_RESOURCES or even crashes or system freezes. (If you are running into this problem, please open a github issue)
(darktable user manual - memory & performance tuning)

*** could not create context *** CL_OUT_OF_RESOURCES

Try restarting the OS and or delete the cl kernel files from .config/darktable

I reduced the number of event handles, and I also ran dt with different resource models. Neither of these made any difference.

I have restarted the OS, I don’t seem to have any openCL kernel files in the dt config directory. I did clear out the cache for both dt and nvidia.

It didn’t make any difference though.

Your drivera are very old, but I don’t know if that’s normal for that card. Maybe post the output of dt CL test using -verbose

I only get a couple of extra lines.

I am presuming you mean the Nvidia driver. I am running version 470, this was automatically chosen when I did the install. I have the option of version 580, I will try installing this tomorrow and see what happens.

Can it be a caching issue, @epeeist?

It took a little bit of doing, as well as upgrading my nvidia drivers to version 580, I had to force the reinstall of the kernel. I forced the reinstall of libopenCL as well, just to make sure.

This has fixed the problem, though I do note that Nvidia are rolling out version 590…

4 Likes

I think the problem is that the contents of the repository containing nvidia drivers is controlled by Nvidia, and that the update program, zypper, cannot determine that the GL05 driver set has been obsoleted by the GL06 driver set.

I’ll report this on the openSUSE bug site.

Similar problem on arch - that gave the right hint: I have the 580 nvidia-drivers, but had 510 nvidia-opencl.
I just had to replace the 510 version with 580. Now it works.
(just in case anyone else has similar problems)

Fedora thru rpm fusion updates the nvidia drivers at least once a month.

1 Like

openSUSE Tumbleweed does the same. As I said though, I think the naming conventions in the nvidia repository isn’t compatible with the update program.

For a normal program I get the name of the program and the installed version number (plus an available version number, if the program can be updated).

For nvidia, the name changes, i.e. the broken version of the driver was named nvidia-glG05, with an associated version number.

The version that installed to fix the problem was named nvidia-gl-G06, again with its own version number.

As far as zypper (the update program) is concerned, these are two separate products.