darktable 3.0.0rc2 how OpenCL is used

Some background, I am using a Hackintosh with i7-8700k and AMD RX-570 graphics card. OSX the operating system optimizes itself based on something known as SMBIOS (which identifies the model of the device) with something known as ig-platformid and device id. which identifies further the cpu and graphics components. So with the same system different ways the graphic component is used.

my problem is that when I use one device id where the system identifies 2 GPUs one the intel HD630 which is part of the i7-8700k CPU (both shown separately in activity monitor) and my AMD RX-570. Darktable didn’t use anyone of them. I then used the script provided on this forum using darktable-cltest in a loop to compile the OpenCL component and started darktable from the terminal using -d OpenCL flag where it showed that all components were compiled but immediately the computer would restart and Darktable would not start. afterwards each time I tried to start darktable the computer would restart.

All other programs like GPU benchmarks, capture one pro would work properly and use both the GPUs properly even video playback software like quicktime vlc would use the GPU for decoding H265 video files.

now when I again changed the device id which was working previously where it was utilizing the AMD GPU darktable has stopped using it and now every thing is done by CPU.

Can someone please guide me what is going wrong.

What version of OSX, what version of the AMD GPU driver, what version of the OpenCL driver, and what version of darktable?

The fact that trying to run the darktable-cltest crashes your whole operating system is not good. Probably some driver is incompatible.

Why run a hacked version of the operating on unsupported hardware? You could run Linux on that hardware just fine and not have these issues

Hackintosh is known to be unstable. Switch to Linux and be happy.

that’s not a solution! as mentioned all other software works, I am ready to experiment if someone guides me how the inner working of darktable works in respect of openCL

I want to submit my -cltest log but it gives an error that the number of words allowed is exceeded.

How to submit ?

Put it in a text file and attach it.

But…

ok will do that but how to put it in a scrollable text box?

for information -cltest is successful it identifies intel 630 GPU as 0 and AMD RX-570 as 1. initially there are many warnings but in the end part it builds all the different darktable modules for both device 0 and 1 and all are successful. It makes the OpenCL setting multiple GPU.

But Darktable reboots the machine when opened! Will attach the log once I go home in the evening. Also have tried many programs like graphics editor, video players, encoders and all are working, Notably Capture one 12 and luxmark v3.1 GPU benchmark program uses both the GPUs simultaneously.

I am a Hackintosher as well, yet still I am a newbie. But maybe my input will help you in some way.
Try it without any ig-platform-id and device-id. Especially under MacOS Mojave your CPU and GPU (and the hardware acceleration of both) should work out-of-the-box. But even under MacOS High Sierra it should work out-of-the box.

I had similar problems (crashes, restarts) using darktable with MacOS High Sierra 10.13.6 (with i3-8100 and NVIDIA GTX 1060), but eventually it worked without using ig-platform-id and device-id in config.plist at all.

I stopped using the graphics card because the NVIDIA web driver for MacOS caused darktable to generate some faulty previews. Under Linux (dualboot, i.e. same hardware) darktable works like a charm.

For testing purposes I upgraded to MacOS Mojave on the same machine, without the NVIDIA graphics card built in (due to lack of NVIDIA drivers for Mojave). darktable enables OpenCL for the iGPU of the i3-8100 CPU and everything works fine. No crashes, no restarts. Still without using any ig-platform-id and device-id in config.plist of my EFI.

Good luck, I know hackintoshing can be a hassle.

Thanks for your answer,
I am on Catalina 10.15.1 and there are many changes to the video encoder decoder code, (VDA) things which were working in High Sierra and Mojave are not working, SMBIOS and ig-platform-id plays a role in this.

It is not that DT is not working, if I use a headless ig-platform-id it will only use AMD GPU and everything works. (which probably what I will use as of now till I find some solution) My query here was to understand how OpenCL is used in DT to find a solution.

cltest.log.zip (13.0 KB)

Attached is my cltest log file you will notice that

0.059745 [opencl_init] kernel loading time: 0.0093
0.059751 [opencl_init] OpenCL successfully initialized.
0.059752 [opencl_init] here are the internal numbers and names of OpenCL devices available to darktable:
0.059754 [opencl_init] 0 ‘KBL Graphics’
0.059755 [opencl_init] 1 ‘AMD Radeon RX 570 Compute Engine’
0.059757 [opencl_init] FINALLY: opencl is AVAILABLE on this system.
0.059758 [opencl_init] initial status of opencl enabled flag is OFF.

But when I run DT with OpenCL ON it REBOOTS the machine! I understand about Hackintosh being unstable etc… but it is as stable as a real iMac can be. All the programs which uses OpenCL other than DT works, Capture One (uses both GPUs), FCP, Compressor, an open source OpenCL benchmark program Luxmark http://www.luxmark.info even uses both the Intel GPU and AMD GPU together and gives a benchmark index which is more than AMD GPU alone. The source code is also available there,
My request to the developers at least go through the benchmark source to see if DT can benefit and also if there is something wrong DT should not Reboot the machine but should be able to handle the error and shutOff openCL and only use CPU or gracefully exit without rebooting the machine.

Perhaps C1’s openCL troubleshooting can help, specifically rebuilding the OpenCL kernels: https://support.captureone.com/hc/en-us/articles/360002404937-Troubleshooting-OpenCL

That is a very big ask of the developers. Also there are only a few Mac developers on the DT, maybe like two.

1 Like

How trouble shooting C1 is relevant here? It is working perfectly and uses both GPUs or Either one depending on what GPU/GPUs I enable. It builds the hardware acceleration part on the fly.

The link I sent has code for windows,OS X and Linux which can be of more help specifically the code part which identifies the GPUs available in the system and how to use it.

Running darktable on a macbook pro ist quite stable - unless some segfaults in the development phase it never messed up the whole system forcing it to reboot.

Remove darktable’s openCL kernels and see if they’ll rebuild. I don’t know how, but its probably similar to C1 openCL kernel location.

Yes your asking someone to spend their free/volunteer time reading source code that is foreign to them and compare it to darktable’s source, so you can run darktable on a platform that nobody else supports… That’s a huge ask. I’m trying to set your expectations to something reasonable.

1 Like

I am not going to argue any further but there is something wrong in the code which makes the system reboot and I am only requesting to look into it. DT is a good program and it is because people are passionate enough to make it better. I have pointed to a direction which I feel can help,I can wrong so be it. I have said what I have to.
I’ll use DT without openCl but will not change my settings because DT is crashing and I am getting better performance in all my other used programs.