OpenCL support frequently de-activates in Linux - how can I prevent this?

I can’t help with prevention but you can use the below to avoid rebooting as I was experiencing similar issues after resuming my computer from suspend.

You need to exit darktable before running the commands. This works for me on Ubuntu 20.04.

sudo rmmod nvidia_uvm
sudo modprobe nvidia_uvm

See Darktable disabled opencl - way to restart without rebooting ?

1 Like

My thanks and apologies for being stupid enough not to have found this earlier solution.

A further dumb question if I may: where is ‘opencl config’ located ? A search of my system cannot find anything of the form opencl.config

Ooops; got it now.

I can’t say I’ve noticed an issue with OpenCL being deactivated in Linux Mint 20.1

I’m using an Nvidia GTX1660 with 460 nvidia drivers

It only happens for me after resuming from suspend and even then it’s not all the time.

From a fresh boot or after running the two commands it works always fine.

Hmm, that’s interesting: as I said, I have this problem on every Mint 20.1 update - including that of today, which updated the Chrome browser. Of course the ‘startgpu’ alias that is discussed earlier in this thread works most effectively, but one still has to close dt, run the command and re-open dt.

Clearly there is something that makes di in my installation of Mint 20.1 much more susceptible to package updates than yours. Got any advice on where I should look to see if I can reduce that effect? I’m using nVidia driver 460.39-0

1 Like

What hardware are you using? Does your i7 processor include GPU on board, as well as your Nvidia GTX 645?

I very much doubt if my i7 has an onboard GPU -it’s a 1st generation, Lynnfield Core i7-860, irst released in 2009. I see no mention of display support in the specification on Wikipedia. Intel’s web-site specification starts only at the 2nd generation!

What I have found that is ‘different’ to the details given in the 3.4 manual in the section ‘setting up opencl’ is that almost all of the packages which need to be installed are absent in my installation - in which OpenCL works fine until there is a Linux update.

One package, which I thought was particularly important and notable for its absence is ‘nvidia-opencl-icd-xxx’. I just don’t see how OpenCL can work without this package. The latest version for Mint 20.1 is 340. I installed this; it deleted 14 other packages and broke OpenCL in dt comprehensively. Fortunately I had taken a note of those 14 packages and recovered OpenCL support by re-installing them.

So, now I have OpenCL working without this apparently important package installed on my system. How can that be?

I do have one potential explanation for the repeated need to run ‘startgpu’: the content of nvidia.icd (in /etc/OpenCL/vendors/) had been modified (by the 0.5-witted writer of this post) to point directly to a specific version of libnvidia-opencl.so. - so this needed to be changed each time the Nvidia display driver was updated by Mint. I have now reset that file’s content to libnvidia-opencl.so.1 which is a symlink to the appropriate library file. I hope this removes much of the need to run the ‘startgpu’ command.

I never installed any thing in addition to the Nvidia drivers through the device manager on Linux mint. Perhaps that is the issue, you installing that Nvidia-opencl-icd-xxx lib which conflicts with the Nvidia drivers?

Yes, apparently it does - but I thought it was also developed by nVidia!. However, having removed it my OpenCL is now working correctly - although there hasn’t been a Mint update since the debacle of installing that icd lib, so I don’t know if the startgpu command is still required (and, yes, I have discovered that it doesn’t survive across a reboot without additional editing of .bashrc).

I updated my system today. Last time I updated was around a week or so ago.

No issues with darktable and opencl.

Could I ask how your portfolio of installed packages compares with that in the dt 3.4 user manual page “Special Topics/opencl/setting up opencl” ?

1 Like

Here are the ones I am using. I haven’t had any trouble with openCL for several months:

  • nvidia
  • nvidia-settings
  • nvidia-utils
  • opencl-nvidia
  • ocl-icd
  • opencl-nvidia

These are the package names on Arch Linux.

Blockquote
sudo apt list --installed | grep ‘nvidia’
[sudo] password for brian:
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
libnvidia-cfg1-460/focal-updates,focal-security,now 460.39-0ubuntu0.20.04.1 amd64 [installed]
libnvidia-common-460/focal-updates,focal-updates,focal-security,focal-security,now 460.39-0ubuntu0.20.04.1 all [installed]
libnvidia-compute-460/focal-updates,focal-security,now 460.39-0ubuntu0.20.04.1 amd64 [installed]
libnvidia-compute-460/focal-updates,focal-security,now 460.39-0ubuntu0.20.04.1 i386 [installed,automatic]
libnvidia-decode-460/focal-updates,focal-security,now 460.39-0ubuntu0.20.04.1 amd64 [installed]
libnvidia-decode-460/focal-updates,focal-security,now 460.39-0ubuntu0.20.04.1 i386 [installed,automatic]
libnvidia-encode-460/focal-updates,focal-security,now 460.39-0ubuntu0.20.04.1 amd64 [installed]
libnvidia-encode-460/focal-updates,focal-security,now 460.39-0ubuntu0.20.04.1 i386 [installed,automatic]
libnvidia-extra-460/focal-updates,focal-security,now 460.39-0ubuntu0.20.04.1 amd64 [installed]
libnvidia-fbc1-460/focal-updates,focal-security,now 460.39-0ubuntu0.20.04.1 amd64 [installed]
libnvidia-fbc1-460/focal-updates,focal-security,now 460.39-0ubuntu0.20.04.1 i386 [installed,automatic]
libnvidia-gl-460/focal-updates,focal-security,now 460.39-0ubuntu0.20.04.1 amd64 [installed]
libnvidia-gl-460/focal-updates,focal-security,now 460.39-0ubuntu0.20.04.1 i386 [installed,automatic]
libnvidia-ifr1-460/focal-updates,focal-security,now 460.39-0ubuntu0.20.04.1 amd64 [installed]
libnvidia-ifr1-460/focal-updates,focal-security,now 460.39-0ubuntu0.20.04.1 i386 [installed,automatic]
nvidia-compute-utils-460/focal-updates,focal-security,now 460.39-0ubuntu0.20.04.1 amd64 [installed]
nvidia-dkms-460/focal-updates,focal-security,now 460.39-0ubuntu0.20.04.1 amd64 [installed]
nvidia-driver-460/focal-updates,focal-security,now 460.39-0ubuntu0.20.04.1 amd64 [installed]
nvidia-kernel-common-460/focal-updates,focal-security,now 460.39-0ubuntu0.20.04.1 amd64 [installed,automatic]
nvidia-kernel-source-460/focal-updates,focal-security,now 460.39-0ubuntu0.20.04.1 amd64 [installed,automatic]
nvidia-prime-applet/ulyssa,ulyssa,now 1.2.6 all [installed]
nvidia-prime/focal-updates,focal-updates,now 0.8.15.3~0.20.04.1 all [installed,automatic]
nvidia-settings/focal-updates,now 440.82-0ubuntu0.20.04.1 amd64 [installed,automatic]
nvidia-utils-460/focal-updates,focal-security,now 460.39-0ubuntu0.20.04.1 amd64 [installed,automatic]
xserver-xorg-video-nvidia-460/focal-updates,focal-security,now 460.39-0ubuntu0.20.04.1 amd64 [installed,automatic]

No opencl-nvidia, or ocl-icd installed on my system, but nvidia-compute instead.

Somewhere around version 390 NVIDIA changed the packaging from the “opencl-nvidia, ocl-icd, etc.” to the “compute, etc.” packages (I have exactly the same packages you show). In any modern Ubuntu based distribution (> 20.04, at least) you get the new packages, they’re actually installed as dependencies of the nvidia-driver package. So by installing the proprietary NVIDIA driver you should get OpenCL out of the box.

1 Like

Hi,
Thanks for this helpful guidance; I ran the same command on my system and found about 5 times as many hits as you have on your system, even though we are both running Mint 20.1, with nVidia proprietary driver 460.39. I have attempted to upload a plain text file showing the output from the apt list command which, hopefully, shows that I have many ‘earlier’ files (packages ?) on my system. I don’t know enough about Linux/Mint to know if I could delete them, or indeed how as many of these ‘package’ names are not found by Synaptic Package Manager.

I know this isn’t the appropriate forum on which to seek advice about if/how I can delete any of these, but …

And, yes, I have long since installed the proprietary nVidia driver.
opencl packages-1.txt (87.5 KB)

Interestingly, I experienced OpenCL getting deactivated, after waking my system from suspend.

Linux Mint 20.1 Cinnamon, Nvidia GTX1660, Nvidia drivers 460.73.01

that’s actually typical. AFAIK you have to re-load nvidia drivers after suspend for them to re-initialize all the necessary stuff. Easiest way to do that is via reboot :wink:

1 Like

Right. Although it should be mentioned that for many people it just works as nvidia drivers, the linux os stack and probably bios behave correctly. I had the above issue on my previous pc, the current system doesn’t have this issue at all.

1 Like

I also have this problem, usually on Debian testing, sometimes on Arch. However, for me, it is enough if I just restart darktable. I.e. opencl deactivates if system goes to suspend and darktable is running.

1 Like

Yes,I think that was the issue, I had suspended my system while darktable was running. No issues with suspend if I exit darktable beforehand.