opencl support for darktable

Thanks for that first link - I saw a 3 year old article specifically about darktable but didn’t get around to searching the site for more recent articles.

Whatever card I get has to work well today. I don’t mind staying on Ubuntu 18, using old drivers etc as long as darktable is fast and stable. Perhaps i’m over worrying about it but I know how flaky these things can be and I lack the optimism that I’ll report problems to amd/nvidia/msi/darktable devs and people will stop what they’re doing and fix them, so I can’t imagine buying a card which is not currently working well.

This is on a 2Gb GeForce GTX 770. The issue I had was that if I opened darktable and started editing, stopped for 20 seconds or so, then started again, the driver reported an error and darktable fell back to cpu. I still get errors occasionally on the older (340xx-series) driver but much less frequently - perhaps every day or two, and then it usually takes two or three restarts of darktable before the error stops.

Edit: Full disclosure - I don’t use my NVidia card for graphics, just for OpenCL. I use my onboard intel card for graphics because I just had too many issues with the NVidia one. However, the fact that it works fine on an older driver suggests that my issues probably aren’t related to this.

the proprietary drivers als also in the repo, just not the newest.
you can have the newest driver from nvidia directly but you might not be able to install it and it might not work well, the (prprietary) drivers form the repo are recommended.

yesterday I installed a .run from Nvidia, installation was a bit complicated because I had to kill X and opencl was terribly slow with that driver

edit: If you are buildig a completely new PC with new components, you might not even be able to boot Ubuntu 18 on it.

“If you are buildig a completely new PC with new components, you might not even be able to boot Ubuntu 18 on it.”

Why wouldn’t I be able to run Ubuntu 18? It’s the most recent LTS version of Ubuntu and I’ve never had trouble running it on many devices.

I bought a new laptop a few months ago and I can only boot Linux systems on it that have at least the 5.2 kernel.

1 Like

Dell T3500 + Quadro FX 1800 that can’t do OpenCL + Xeon W3550 + 24GB ram. And performance wise it’s ok-ish, but that’s OLD system. and best bet for OpenCL I have currently is nvidia card in likes of 1060 or 1070.
And no - i’m not happy with performance but its “acceptable” only counting the fact that exporting large (~400 images) collections takes like half a day :wink:
With OpenCL future I’m not sure, but I honestly think full-amd is the way to go.

Well maybe even in this year we will see Intel DG1 (discreet graphics) and we may have third player here. At least intel graphic driver is fully in kernel. Not sure if OpenCL will be better than it is now.

Going back to AMD, I’m running on 5.x kernel line and ROCm’s OpenCL does not work. I’ve installed Pro driver and get back OpenCL back (I have Radeon RX 470).

If you want an NVidia RTX-series card, you need to seriously consider not running an LTS release. On my new laptop, NVidia power management was completely and totally broken/useless even with the backports drivers until upgrading to 19.10.

18.04 with backports - 40-50W at idle
19.10 - 10-15W or less

It seems like for darktable, nvidia is your best bet. Given the number of crash reports I’ve been seeing for months from people running AMD GPUs, AMD’s opencl drivers on Linux seem to be highly unstable - to the point where I’m surprised that darktable hasn’t blacklisted them yet.

NVidia’s drivers seem to be both stable AND have a fairly stable ABI (meaning that running cached kernels rarely causes problems).

Intel NEO is fairly stable (IF you run their official releases which provide documentation on which platforms did and did not pass the Khronos certification tests, in general only Atom users are at risk of having something listed as “not passing”, because most of the other platforms that are listed as not passing are almost always not available to the general public yet.) However there is a known issue of the ABI changing frequently enough that if you cache compiled kernels and don’t invalidate after a driver upgrade, Bad Things can happen. Unfortunately some distros report the driver version as 1.0.0 regardless of what it actually is.

1 Like

Agreed. Ubuntu 20.04 might be a good option though, when it is out. But I am not really a Ubuntu fan.

1 Like

Yeah ROCm won’t work with RX 470 (as it won’t with 980 and my cpu due to PCIe 3.0 not being present/not having PCIe atomics), more details here: https://rocm.github.io/hardware.html

Can confirm, my gen8 i7 laptop is pulling opencl on neo (and has integrated radeon card that can go opengl but can’t opencl)

I was using ROCm with Radeon RX 470 and documentation says it is supported.

The problem is as I understand that ROCm does not support kernel 5.3 yet.

ROCm works with the upstream kernel since 4.x. It works without any issues with a 5.x kernel.

I have a RX 470 an it works like a charm. darktable-cltest output:

0.352489 [opencl_init] device 0 'gfx803' supports image sizes of 16384 x 16384                                                                                                               
0.352492 [opencl_init] device 0 'gfx803' allows GPU memory allocations of up to 6963MB
[opencl_init] device 0: gfx803                                                                                                                                                               
     GLOBAL_MEM_SIZE:          8192MB                                                                                                                                                        
     MAX_WORK_GROUP_SIZE:      256                                                                                                                                                           
     MAX_WORK_ITEM_DIMENSIONS: 3                                                                                                                                                             
     MAX_WORK_ITEM_SIZES:      [ 1024 1024 1024 ]                                                                                                                                            
     DRIVER_VERSION:           3019.0 (HSA1.1,LC)                                                                                                                                            
     DEVICE_VERSION:           OpenCL 1.2
1 Like

It’s supported with a caveat (taken from https://rocm.github.io/hardware.html):

Note that these GPUs all require a host CPU and platform with PCIe 3.0 with support for PCIe atomics

(emphasis mine)

as evidenced by @asn it’s workable combination.

If yoy have lspci v3.5.3 or above you can check if you have PCIe 3.0 atomics via:

  1. dmesg | grep kfd which will tell you if your platform rejects atomics or not
  2. sudo lspci -vvv will tell you if atomics capabilities exists in your hw
  3. lspci -tv will tell you how your connections are routed in case atomics capabilities exist but your mobo may not direct atomics to cpu because those are optional and not mandatory for PCIe 3.0

Ultimatelly a full PCIe 3.0 route has to be present between your GPU and CPU.

above links taken from https://www.reddit.com/r/ROCm/comments/ba6tvq/atomics_on_my_hardware/ekoogqt/ - see the thread for more details.

1 Like

Thanks for that.
I’ve asked a question about ROCm here on this forum.
Notice that ROCm’s OpenCL was working like charm! Now I’ve only

ERROR: clGetDeviceIDs(-1)

and that’s it.
After removing ROCm and instlling AMDGPU-PRO 19.50 OpenCL works again.

Thanks to everyone who helped here. It looks like a gtx-1660 is the one to go for. Amazon do the “Gigabyte GeForce GTX 1660 SUPER GAMING OC 6G” variety which has newer ram at a faster speed than some of the earlier 1660’s. Current spec is here: https://uk.pcpartpicker.com/list/7HLXYH.

1 Like

Hah; I just picked up the very similar MSI GeForce GTX 1660 SUPER GAMING X, and on initial test it works perfectly with Darktable and opencl (on Fedora 31).

I’ve just installed ROCm on openSUSE Tumbleweed as they provide a zypper repo in the meantime. Works just fine with Kernel 5.4.14.

2 Likes

I like Opensuse Tumbleweed KDE (plasma), but so far only Arch (aur opencl-amd) and Ununtu (Rocm / amdgpu-pro) that have Opencl (AMD), I will do the test with the Rocm Repository , thanks for the tip

To install ROCm with OpenCL and OpenCL Image support, you have do the following five steps:

  1. Add the 2.10.0 repo to your package manager (3.0 doesn’t work). To do that for zypper on openSUSE create the following file:

    /etc/zypp/repos.d/rocm.repo

    [rocm]
    name=Radeon Open Compute
    enabled=1
    autorefresh=0
    baseurl=http://repo.radeon.com/rocm/zyp/2.10.0/
    type=rpm-md
    
  2. Install the required packages using:

    zypper in rocm-opencl hsa-ext-rocr-dev
    
  3. Create /etc/ld.so.conf.d/rocm-opencl.conf with the following content:

    /opt/rocm/hsa/lib/
    /opt/rocm/lib
    /opt/rocm/lib64
    /opt/rocm/opencl/lib/x86_64
    
  4. To load the new paths into the linker run: ldconfig

  5. And last but not least create an OpenCL ICD file using:

    echo libamdocl64.so > /etc/OpenCL/vendors/amdocl64.icd
    

I’m on Kernel 5.4.14.

3 Likes

There are some interesting points about that here.

1 Like