Darktable OpenCL performance with NVidia GTX1650 Super

Thanks! I appreciate it. I’ll give these settings a go and see how it turns out.

Interesting, I thought that bashrc settings (I read the manual in the past) can affect how Darktable initializes and treats the “top layer” of the OpenCL API, but it can not affect the amount of memory which OpenCL offers for processing - I would think that allowing to change this limit via a public interface is not very safe and reasonable. I may be wrong though. @Frank_Lepore, could you please report if you have successfully changed the amount of memory available?
Also, please notice that in the tweaks from @dim, the “opencl_memory_requirement” is set twice, which is not necessary and may be confusing.

I have to admit that I gave up and got back to the Radeon GPU - simply because the Nvidia was cca 30% slower in my tests (and it’s not sure if increasing the amount of max memory allocations would improve the performance). but I still am curious if one can change the amount of memory available.

1 Like

I make a mistake, i have done a quick copy-paste, my bad, without other consequences that is a redundancy. The mistake is evident! To improve the performance, you need to tweak the darktablerc’s parameters as explain in " OpenCL performance optimization" which are different from a nvidia to an amd graphic card. Not only the amount of memory, which differs as the total amount of memory & the brand! You mentioned a public interface, which one?!

you have to test each parameters, one by one & backuped the original darktablerc before

I do apologize dim, definitely did not want to make you mad with my comment :wink:
With the public interface I meant the one on top of the OpenCL stack - i.e. the one which is used by Darktable (or any OpenCL based application). It was not meant as “public to Darktable users”, I was trying to look at it from the view of the OpenCL developers. Like “the memory allocation parameter might be something which is set internally and shall not be messed with, hence we will not allow the applications on top of OpenCL to change it.”

1 Like

No offense at all! I want to reassure you & i’m curious!

I have an intermittent problem that I don’t see discussed in this thread or in the above referenced article. I will be using openCL, successfully, but I go back and re-check, and it is off. Nothing notifies me, I just think to re-check it. Sometimes it is still working, and sometimes not. I may have seen others mention this, too.

I’m running a new PC with an nVidia RTX 2060 card, on Arch Linux. I had the same problem on openSUSE Linux, too.

We need more details about your configuration: laptop or not, archlinux version, kernel, graphic driver version, packages opencl related installed, and run in a terminal: darktable-cltest or darktable -d opencl

1 Like

When I had a similar issue the only thing that worked was downgrading to one of the legacy-series nVidia drivers.

Desktop PC, AMD 3900X, ASUS TUF X570 motherboard, 16 GB RAM

Arch is a rolling release, always up-to-date. Kernel 5.8.7. nVidia 450.66, opencl-nvidia 450.66-1, ocl-icd 2.2.12-4

darktable -d opencl

(darktable:2113): libsecret-CRITICAL **: 19:44:36.207: secret_service_load_collections_sync: assertion ‘paths != NULL’ failed
0.076897 [opencl_init] opencl related configuration options:
0.076901 [opencl_init]
0.076903 [opencl_init] opencl: 1
0.076904 [opencl_init] opencl_scheduling_profile: ‘default’
0.076905 [opencl_init] opencl_library: ‘’
0.076908 [opencl_init] opencl_memory_requirement: 768
0.076910 [opencl_init] opencl_memory_headroom: 400
0.076913 [opencl_init] opencl_device_priority: ‘/!0,///!0,*’
0.076914 [opencl_init] opencl_mandatory_timeout: 200
0.076916 [opencl_init] opencl_size_roundup: 16
0.076917 [opencl_init] opencl_async_pixelpipe: 0
0.076919 [opencl_init] opencl_synch_cache: active module
0.076922 [opencl_init] opencl_number_event_handles: 25
0.076923 [opencl_init] opencl_micro_nap: 1000
0.076926 [opencl_init] opencl_use_pinned_memory: 0
0.076928 [opencl_init] opencl_use_cpu_devices: 0
0.076930 [opencl_init] opencl_avoid_atomics: 0
0.076932 [opencl_init]
0.077051 [opencl_init] found opencl runtime library ‘libOpenCL’
0.077063 [opencl_init] opencl library ‘libOpenCL’ found on your system and loaded
0.108340 [opencl_init] found 1 platform
0.108356 [opencl_init] found 1 device
0.108537 [opencl_init] device 0 GeForce RTX 2060' has sm_20 support. 0.108672 [opencl_init] device 0 GeForce RTX 2060’ supports image sizes of 32768 x 32768
0.108674 [opencl_init] device 0 GeForce RTX 2060' allows GPU memory allocations of up to 1482MB [opencl_init] device 0: GeForce RTX 2060 GLOBAL_MEM_SIZE: 5931MB MAX_WORK_GROUP_SIZE: 1024 MAX_WORK_ITEM_DIMENSIONS: 3 MAX_WORK_ITEM_SIZES: [ 1024 1024 64 ] DRIVER_VERSION: 450.66 DEVICE_VERSION: OpenCL 1.2 CUDA 0.187766 [opencl_init] options for OpenCL compiler: -w -DNVIDIA_SM_20=1 -DNVIDIA=1 -I"/usr/share/darktable/kernels" 0.188581 [opencl_init] compiling program demosaic_ppg.cl’ …
0.189547 [opencl_load_program] loaded cached binary program from file ‘/home/tim/.cache/darktable/cached_kernels_for_GeForceRTX2060_45066/demosaic_ppg.cl.bin’ MD5: ‘a639d79d954ba682d8c8508916a9728a’
0.189552 [opencl_load_program] successfully loaded program from ‘/usr/share/darktable/kernels/demosaic_ppg.cl’ MD5: ‘a639d79d954ba682d8c8508916a9728a’
0.192011 [opencl_build_program] successfully built program
0.192016 [opencl_build_program] BUILD STATUS: 0
0.192018 BUILD LOG:
0.192019

I think we need to better understand what you mean by “…it is off”. Do you mean that the setting in the preferences has simply changed itself from “checked” to “unchecked”? Or do you mean that in the preference settings the opencl options become “greyed out”?

Maybe the nvidia drivers are no longer loaded, eg. due to a suspend/wake-up operation? When the opencl has “turned itself off”, what sort of output do you get from the nvidia-smi command?

I mean the openCL settings in darktable are unselected and unselectable, and then if I go to a terminal and run clinfo, it responds that there are 0 platforms. openCL will be working, then openCL itself seems to crash.

My response to @dim shows it in a working state.

I think the problem is with openCL itself, not darktable. I was just wondering whether anyone else has encountered it. Apparently, @elstoc has.

Right, that’s what I suspected. I’ve seen the same thing happen on my laptop with GTX1650 running Manjaro (based on Arch Linux). It doesn’t seem to be frequent, and I haven’t go to the bottom of why it happens yet.

1 Like

I had the same issue.
In my case I could figure out that hibernation instead of a complete shudown lead to the described failure of OpenCL.
Do you always shut down your desktop?

I think the same @Weigemalt . The nvidia drivers are know to have some issues with power management

In my case it didn’t require shutdown or hibernation. All I needed to do to consistently reproduce the issue was to stop editing for 20-30 seconds. The next time I touched a slider I got a toast message saying that there were problems with openCL and darktable was falling back to CPU. Needed a restart to get openCL back again.

1 Like

I think that @betazoid had/have the same problem and blamed the change from the discrete to the integrated graphic card.

Maybe I’m mis-remembering in that case sorry @betazoid for the mention

You need to compare compute performance not overall GPU ranking.

Specs say that AMD RX 570 should have 325 GFlops vs. Nvidia GTX 1650 has just 138 GFlops at FP64. So your findings seems to be in line with the specs.

2 Likes

Thanks for the input. But is this really the only parameter that matters?
(And now i remembered that Darktable operates on 32-bit floats, where RX 570 still wins, but only by cca 11%)

I have experienced it that way, too. I could be in a darktable session, check opencl, and it is using it. A little while later, I check again, and it is gone.