[solved] darktable 3.8.1 for macOS seems to be missing OpenCL kernel files

I was looking to see if I could activate OpenCL on my old MacBook Pro laptops under darktable 3.8.1. No luck. Well, I expected that with the 2011 machine. But the 2016 machine certainly has a capable enough GPU. Nope - darktable-cltest says “FINALLY: OpenCL is NOT AVAILABLE on this system.” The error messages said it couldn’t compile kernels, and complained of not being able to open ‘colorspace.h’.

So I go to my Mac Pro (2013) “trashcan”, which was running OpenCL very nicely under darktable 3.8.0. But no, darktable-cltest gets the same results (excerpted here):

0.130873 [opencl_init] device 1 `AMD Radeon HD - FirePro D500 Compute Engine' supports image sizes of 16384 x 16384
0.130885 [opencl_init] device 1 `AMD Radeon HD - FirePro D500 Compute Engine' allows GPU memory allocations of up to 768MB
[opencl_init] device 1: AMD Radeon HD - FirePro D500 Compute Engine 
     CANONICAL_NAME:           amdrade
     GLOBAL_MEM_SIZE:          3072MB
     MAX_WORK_GROUP_SIZE:      256
     MAX_WORK_ITEM_DIMENSIONS: 3
     MAX_WORK_ITEM_SIZES:      [ 256 256 256 ]
     DRIVER_VERSION:           1.2 (Jan 10 2022 21:29:11)
     DEVICE_VERSION:           OpenCL 1.2 
0.131902 [opencl_init] options for OpenCL compiler: -w -cl-fast-relaxed-math  -DUNKNOWN=1 -I/Applications/darktable.app/Contents/share/darktable/kernels
0.131958 [opencl_fopen_stat] could not open file `/Applications/darktable.app/Contents/share/darktable/kernels/rgb_norms.h'!
0.131965 [opencl_md5sums] could not open file `/Applications/darktable.app/Contents/share/darktable/kernels/rgb_norms.h'!
0.131992 [opencl_fopen_stat] could not open file `/Applications/darktable.app/Contents/share/darktable/kernels/noise_generator.h'!
0.131996 [opencl_md5sums] could not open file `/Applications/darktable.app/Contents/share/darktable/kernels/noise_generator.h'!
0.132004 [opencl_fopen_stat] could not open file `/Applications/darktable.app/Contents/share/darktable/kernels/color_conversion.h'!
0.132009 [opencl_md5sums] could not open file `/Applications/darktable.app/Contents/share/darktable/kernels/color_conversion.h'!
0.132018 [opencl_fopen_stat] could not open file `/Applications/darktable.app/Contents/share/darktable/kernels/colorspaces.cl'!
0.132023 [opencl_md5sums] could not open file `/Applications/darktable.app/Contents/share/darktable/kernels/colorspaces.cl'!
0.132029 [opencl_fopen_stat] could not open file `/Applications/darktable.app/Contents/share/darktable/kernels/colorspace.h'!
0.132065 [opencl_md5sums] could not open file `/Applications/darktable.app/Contents/share/darktable/kernels/colorspace.h'!
0.132082 [opencl_fopen_stat] could not open file `/Applications/darktable.app/Contents/share/darktable/kernels/common.h'!
0.132087 [opencl_md5sums] could not open file `/Applications/darktable.app/Contents/share/darktable/kernels/common.h'!
0.132093 [opencl_init] could not open `/Applications/darktable.app/Contents/share/darktable/kernels/programs.conf'!

Wait a minute… it can’t open files in the darktable bundle? So I cd down into the app:

Hematite:darktable chucko$ pwd
/Applications/darktable.app/Contents/share/darktable
Hematite:darktable chucko$ ls -al
total 0
drwx------  2 chucko  admin   64 Feb 26 21:18 .
drwx------  4 chucko  admin  128 Feb 26 21:18 ..
Hematite:darktable chucko$ 

The OpenCL kernel sources aren’t there at all! How come no one noticed this?

I’ll file a ticket against this.

Filed as #11233.

Because we don’t have that many Mac users who test things prior to release and there are like 2 Mac devs.

There are weekly-ish builds for Mac of master if you want to help test.

Seeing that this happened with a release build, and a minor release at that, maybe I could help with QA of release images before they go public?

Hi, take a look at this current OSX Build - #424 by zurdo were there are regular updates of Mac builds that can be tested

Somehow darktable was using the wrong path for its OpenCL files. Reinstalling it fixed the problem. Bug report has been closed.

There is, unfortunately, a known bug in macOS which can prevent OpenCL from working on the first try. Re-running darktable-cltest until it succeeds seems to be the workaround, and is working for me.

Known issue: OSX: compiling kernels for opencl for packaged darktable.app needs several attempts · Issue #2810 · darktable-org/darktable · GitHub
you can use a script to do the annoying steps - it’s in the issue discussion. fortunately you just need to run it once after updating darktable

1 Like

Hello,
I’ve tested the latest release 3.8.1, and the one you posted 2 days ago (3.9.0+556).
Both lead to the same output :

0.039753 [opencl_init] opencl related configuration options:
0.039768 [opencl_init] 
0.039770 [opencl_init] opencl: 1
0.039771 [opencl_init] opencl_scheduling_profile: 'default'
0.039773 [opencl_init] opencl_library: '/System/Library/Frameworks/OpenCL.framework/Versions/Current/Libraries/libcldcpuengine.dylib'
0.039775 [opencl_init] opencl_memory_requirement: 768
0.039792 [opencl_init] opencl_memory_headroom: 300
0.039793 [opencl_init] opencl_device_priority: '*/!0,*/*/*'
0.039795 [opencl_init] opencl_mandatory_timeout: 200
0.039797 [opencl_init] opencl_size_roundup: 16
0.039799 [opencl_init] opencl_async_pixelpipe: 0
0.039800 [opencl_init] opencl_synch_cache: false
0.039802 [opencl_init] opencl_number_event_handles: 25
0.039803 [opencl_init] opencl_micro_nap: 1000
0.039805 [opencl_init] opencl_use_pinned_memory: 0
0.039807 [opencl_init] opencl_use_cpu_devices: 0
0.039808 [opencl_init] opencl_avoid_atomics: 0
0.039809 [opencl_init] 
0.039966 [opencl_init] found opencl runtime library '/System/Library/Frameworks/OpenCL.framework/Versions/Current/Libraries/libcldcpuengine.dylib'
0.040032 [opencl_init] could not load all required symbols from library
0.040038 [opencl_init] no working opencl library found. Continue with opencl disabled
0.040039 [opencl_init] FINALLY: opencl is NOT AVAILABLE on this system.
0.040040 [opencl_init] initial status of opencl enabled flag is OFF.

I’m running Monterey 12.2.1.
I’m not quite sure what I could do to try and fix this. Any ideas would be welcome :slight_smile:
Thanks !

Where does the opencl_library entry results from?
At least in my darktable installation that’s an empty string

I’m not sure I understand your question. This is the output of /Applications/darktable.app/Contents/MacOS/darktable -d opencl.

Edit : you meant in darktablerc file ? It is indeed set to opencl_library=/System/Library/Frameworks/OpenCL.framework/Versions/Current/Libraries/libcldcpuengine.dylib.

I’ll try to set it to nothing then and see how it goes. No idea how it got to that path…

Did you ever edit .config/darktable/darktablerc?
I wonder why there’s
opencl_library: '/System/Library/Frameworks/OpenCL.framework/Versions/Current/Libraries/libcldcpuengine.dylib'

at least this library doesn’t seem to be appropriate since missing symbols are reported

Problem solved !
Once I set back the OpenCL_library= and executed darktable -d OpenCL again, it recompiled all the kernels and It launched properly with openCL enabled.

Yes at some point I did to mess up with dpi settings - back in the time where ligthtable was terribly slow for high dpi screens. So I haven’t touched it in a while… I would even think it should have gone back to default…
Literally no idea how that path ended up there.

Thanks for the help :slight_smile: