Can all kernels use OpenCL?

I recently bought a new GPU, CUDA NVIDIA GeForce RTX 4080 SUPER. I noticed that darktable still uses plenty of CPU when modifying pictures. I benchmarked it to see why.

All kernels are processed and blended on the GPU, except the last, “gamma”, which also has the longest processing time:

darktable -d opencl -d perf:
[dev_pixelpipe] took 0.025 secs (0.017 CPU) [export] processed `rawprepare' on GPU, blended on GPU
...
[dev_pixelpipe] took 0.092 secs (0.434 CPU) [export] processed `gamma' on CPU, blended on CPU

Is this expected? Overall OpenCL appears to work without any warnings or errors.

Yes, expected. The gamma module does not have an OpenCL code path so it runs only on CPU.

2 Likes

wouldnt a better answer then be: “All modules which have an OpenCL implementation can run on the GPU. for the rest we fallback to the CPU”

is there an overview in the documentation which modules come with OpenCL?

you can find them in the share/darktable/kernel path of the installation or darktable/data/kernels at master · darktable-org/darktable · GitHub

That is not documentation.

There are many modules that have opencl Code only available for some settings. Demosaic for example handles the Default algos plus Others but not all.

Also some modules get an Update later implementing an opencl path. The new color Equalizer is so far cpu-only, after finalizing code we will likely implement the opencl Code.

2 Likes

That processing time is less than a tenth of a second, though:

[dev_pixelpipe] took 0.092 secs (0.434 CPU) [export] processed `gamma' on CPU, blended on CPU

Not something I’d really want to be maintaining in the user manual. The advantage of looking at the code is it’s at least likely to be up to date

I hope this question doesn’t slide off topic too much here. Many DT users would not have a dedicated graphics card in their laptops. When modules like the new color equalizer are updated to implement opencl code will these modules still work at the current speed they are with cpu-only but users with GPUs will see an improvement? Or will the processing speed drop for those who only have a CPU? Just curious?

Of course cpu performance wont drop

Thanks for the answer. I presumed that but sometimes my presumptions are very wrong. The New color equalizer is a nice module. I presume it is an upgrade to the color zones module an has found a definite place in my most used modules list.

Why will someone go to the trouble of making a module slower on purpose?

That, and I don’t think it’s relevant for the manual, or the user: knowing if a module has a GPU path doesn’t change its use, and there’s nothing a user can do about it anyway.

I guess a user who understands why the openCL code is useful (beyond “it’s faster” (*)), can also figure out from the code if there is such code for a given module…


*: even that’s not always true… fast CPU with low-level GPU can mean the CPU path is faster, due to overhead associated with use of the GPU: memory transfers, possibly tiling with overlap, … Modern CPUs can have many cores and use vector instructions, which treat several data items in parallel.

2 Likes

Thanks for all replies. I was concerned something was not configured properly.

Yes, not a big deal.

1 Like