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

My Linux (Mint 20.1) config for running dt is an 11 year old 1st generation Intel Core i7 with an equally old nVidia GTX 645 card - so hardware OpenCL support makes quite a difference for me. But I find that after every Linux update - no matter how un-connected with the display sub-system - dt reports a problem with OpenCL and disables it. It usually takes me a while to figure out why things are so slow, then I have to re-boot Mint for dt to start with OpenCL enabled. While I accept that this is nothing more than a slight inconvenience, bearing in mind that Mint sometimes updates 3 or 4 times a week, I would like to know if there is some way of making dt less susceptible to these Mint updates.

Or, in other words, what have I done wrong in my Mint configuration and/or my dt install ?

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