How to make my AMD GPU work with the Flatpak version of darktable?

Hi!

Processing settings are set like this:

Running flatpak run --command=darktable-cltest org.darktable.Darktable gives me:

darktable 5.0.0
Copyright (C) 2012-2024 Johannes Hanika and other contributors.

Compile options:
  Bit depth              -> 64 bit
  Debug                  -> DISABLED
  SSE2 optimizations     -> ENABLED
  OpenMP                 -> ENABLED
  OpenCL                 -> ENABLED
  Lua                    -> ENABLED  - API version 9.4.0
  Colord                 -> ENABLED
  gPhoto2                -> ENABLED
  GMIC                   -> ENABLED  - Compressed LUTs are supported
  GraphicsMagick         -> ENABLED
  ImageMagick            -> DISABLED
  libavif                -> ENABLED
  libheif                -> ENABLED
  libjxl                 -> ENABLED
  LibRaw                 -> ENABLED  - Version 0.22.0-Devel202403
  OpenJPEG               -> ENABLED
  OpenEXR                -> ENABLED
  WebP                   -> ENABLED

See https://www.darktable.org/resources/ for detailed documentation.
See https://github.com/darktable-org/darktable/issues/new/choose to report bugs.

     0.2473 [dt_get_sysresource_level] switched to 1 as `default'
     0.2473   total mem:       31822MB
     0.2473   mipmap cache:    3977MB
     0.2473   available mem:   15911MB
     0.2473   singlebuff:      248MB
     0.2477 [opencl_init] opencl disabled via darktable preferences
     0.2477 [dt_dlopencl_init] could not find default opencl runtime library 'libOpenCL'
     0.2477 [dt_dlopencl_init] could not find default opencl runtime library 'libOpenCL.so'
     0.2478 [opencl_init] opencl library 'libOpenCL.so.1' found on your system and loaded, preference 'default path'
     0.2712 [opencl_init] found 1 platform
     0.2713 [check platform] platform 'rusticl' with key 'clplatform_rusticl' is NOT active
[opencl_init] found 0 device
     0.2713 [opencl_init] FINALLY: opencl PREFERENCE=OFF is NOT AVAILABLE and NOT ENABLED.

I see nothing about my AMD Radeon RX 6700 XT there. Is it not being used?

It seems that darktable-cltest could find the rusticl driver installed. However, Radeon is not enabled by default for rusticl. You can enable it by setting the environment variable RUSTICL_ENABLE=radeonsi, i.e. run RUSTICL_ENABLE=radeonsi flatpak run --command=darktable-cltest org.darktable.Darktable and see what it says.

That says, I have the exact same GPU. Unfortunately, for me the rusticl driver detects my card (with the environment variable set) but then panics and darktable fails to start. Donā€™t know if the MESA/rusticl version used by the flatpak is buggy - rusticl is quite new still and has only recently started working well for darktable (for me at least).

Iā€™ve had much better luck in the past running darktable inside a distrobox (Iā€™m running Aeon Desktop and using the Tumbleweed based distrobox image). rusticl seems to work there. Iā€™m just using darktable from the repos, and maybe installed rusticl separately. Just checked and it still works fine after updating everything to latest versions.

The crash with the flatpak seems to be during kernel compilation:

[dt_opencl_device_init]
OpenCL Mesa platform `Mesa/X.org' --> `AMD Radeon RX 6700 XT'
   DEVICE:                   0: 'AMD Radeon RX 6700 XT (radeonsi, navi22, LLVM 19.1.7, DRM 3.59, 6.13.0-1-default)'
   CONF KEY:                 cldevice_v5_rusticlamdradeonrx6700xt
   PLATFORM, VENDOR & ID:    rusticl, Mesa:Mesa/X.org, ID=4098
   CANONICAL NAME:           rusticlamdradeonrx6700xt
   DRIVER VERSION:           24.3.4 (git-769e51468b)
   DEVICE VERSION:           OpenCL 3.0 
   DEVICE_TYPE:              GPU, dedicated mem
   GLOBAL MEM SIZE:          12288 MB
   MAX MEM ALLOC:            2048 MB
   MAX IMAGE SIZE:           16384 x 16384
   MAX WORK GROUP SIZE:      1024
   MAX WORK ITEM DIMENSIONS: 3
   MAX WORK ITEM SIZES:      [ 1024 1024 1024 ]
   ASYNC PIXELPIPE:          NO
   PINNED MEMORY TRANSFER:   NO
   AVOID ATOMICS:            NO
   MICRO NAP:                250
   ROUNDUP WIDTH & HEIGHT    16x16
   CHECK EVENT HANDLES:      128
   TILING ADVANTAGE:         0.000
   DEFAULT DEVICE:           NO
   KERNEL BUILD DIRECTORY:   /app/share/darktable/kernels
   KERNEL DIRECTORY:         /home/sakari/.var/app/org.darktable.Darktable/cache/darktable/cached_v5_kernels_for_rusticlAMDRadeonRX6700XT_2434git769e51468b
   CL COMPILER OPTION:       
   CL COMPILER COMMAND:      -w   -DAMD=1 -I"/app/share/darktable/kernels"
thread '<unnamed>' panicked at core/src/panicking.rs:221:5:
panic in a function that cannot unwind
stack backtrace:
   0:     0x7f0ad9c0a827 - <unknown>
   1:     0x7f0ad9c3418b - <unknown>
   2:     0x7f0ad9c164af - <unknown>
   3:     0x7f0ad9c0a673 - <unknown>
   4:     0x7f0ad9c19905 - <unknown>
   5:     0x7f0ad9c195f6 - <unknown>
   6:     0x7f0ad9c19e2e - <unknown>
   7:     0x7f0ad9c0ac85 - <unknown>
   8:     0x7f0ad9c0aa49 - <unknown>
   9:     0x7f0ad9c19ad4 - <unknown>
  10:     0x7f0ad9ac34b5 - <unknown>
  11:     0x7f0ad9ac3542 - <unknown>
  12:     0x7f0ad9ac3686 - <unknown>
  13:     0x7f0ad9bbfbce - <unknown>
  14:     0x7f0aea6c94b4 - clBuildProgram
  15:     0x7f0af27baa5e - <unknown>
  16:     0x7f0af27be2a3 - dt_opencl_init
  17:     0x7f0af2725dfa - dt_init
  18:     0x55b72eec71b5 - <unknown>
  19:     0x7f0af242b188 - <unknown>
  20:     0x7f0af242b24b - __libc_start_main
  21:     0x55b72eec7205 - <unknown>
  22:                0x0 - <unknown>
thread caused non-unwinding panic. aborting.

(run with darktable-cltest RUST_BACKTRACE=full). Might be worth reporting to upstream.

Canā€™t you use the official AppImage?

Edit: text below is not relevant, see Sakariā€™s response instead.

That would use your distroā€™s installed drivers. FlatPak needs its own drivers.
Darktable Flatpak doesn't recognise OpenCL even with -d opencl flag Ā· Issue #68 Ā· flathub/org.darktable.Darktable Ā· GitHub

Actually, for @mikae1ā€™s hardware, everything needed seems to be inside the flatpak, but kernel compilation crashes. See my reply above.

2 Likes

I have not heard any reports of this working.

Thanks! Iā€™ll give it a try tomorrow.

AMD GPU acceleration in the Flatpak version of darktable?

Sure, last resort. :slightly_smiling_face: I prefer Flatpaks.

Correct. Iā€™d love to be wrong and see it working.

I have Radeon RX 6600 and in order to use OpenCL I installed on Fedora the following rocm packages, not rusticl. DT with OpenCL works really well so far.

rocm-runtime-6.2.1-2.fc41.x86_64
rocminfo-6.2.1-1.fc41.x86_64
rocm-device-libs-18-10.rocm6.2.1.fc41.x86_64
rocm-comgr-18-10.rocm6.2.1.fc41.x86_64
rocm-opencl-6.2.1-5.fc41.x86_64
rocm-clinfo-6.2.1-5.fc41.x86_64

Though I compile DT from sources.

Yes the issue here is flatpak.

RUSTICL_ENABLE=radeonsi flatpak run --command=darktable-cltest org.darktable.Darktable

darktable 5.0.0
Copyright (C) 2012-2024 Johannes Hanika and other contributors.

Compile options:
  Bit depth              -> 64 bit
  Debug                  -> DISABLED
  SSE2 optimizations     -> ENABLED
  OpenMP                 -> ENABLED
  OpenCL                 -> ENABLED
  Lua                    -> ENABLED  - API version 9.4.0
  Colord                 -> ENABLED
  gPhoto2                -> ENABLED
  GMIC                   -> ENABLED  - Compressed LUTs are supported
  GraphicsMagick         -> ENABLED
  ImageMagick            -> DISABLED
  libavif                -> ENABLED
  libheif                -> ENABLED
  libjxl                 -> ENABLED
  LibRaw                 -> ENABLED  - Version 0.22.0-Devel202403
  OpenJPEG               -> ENABLED
  OpenEXR                -> ENABLED
  WebP                   -> ENABLED

See https://www.darktable.org/resources/ for detailed documentation.
See https://github.com/darktable-org/darktable/issues/new/choose to report bugs.

     0.2681 [dt_get_sysresource_level] switched to 1 as `default'
     0.2681   total mem:       31822MB
     0.2681   mipmap cache:    3977MB
     0.2681   available mem:   15911MB
     0.2681   singlebuff:      248MB
     0.2766 [opencl_init] opencl disabled via darktable preferences
     0.2766 [dt_dlopencl_init] could not find default opencl runtime library 'libOpenCL'
     0.2767 [dt_dlopencl_init] could not find default opencl runtime library 'libOpenCL.so'
     0.2767 [opencl_init] opencl library 'libOpenCL.so.1' found on your system and loaded, preference 'default path'
     0.5748 [opencl_init] found 1 platform
     0.5749 [check platform] platform 'rusticl' with key 'clplatform_rusticl' is NOT active
[opencl_init] found 0 device
     0.5749 [opencl_init] FINALLY: opencl PREFERENCE=OFF is NOT AVAILABLE and NOT ENABLED.

RUST_BACKTRACE=full flatpak run --command=darktable-cltest org.darktable.Darktable

darktable 5.0.0
Copyright (C) 2012-2024 Johannes Hanika and other contributors.

Compile options:
  Bit depth              -> 64 bit
  Debug                  -> DISABLED
  SSE2 optimizations     -> ENABLED
  OpenMP                 -> ENABLED
  OpenCL                 -> ENABLED
  Lua                    -> ENABLED  - API version 9.4.0
  Colord                 -> ENABLED
  gPhoto2                -> ENABLED
  GMIC                   -> ENABLED  - Compressed LUTs are supported
  GraphicsMagick         -> ENABLED
  ImageMagick            -> DISABLED
  libavif                -> ENABLED
  libheif                -> ENABLED
  libjxl                 -> ENABLED
  LibRaw                 -> ENABLED  - Version 0.22.0-Devel202403
  OpenJPEG               -> ENABLED
  OpenEXR                -> ENABLED
  WebP                   -> ENABLED

See https://www.darktable.org/resources/ for detailed documentation.
See https://github.com/darktable-org/darktable/issues/new/choose to report bugs.

     0.2398 [dt_get_sysresource_level] switched to 1 as `default'
     0.2398   total mem:       31822MB
     0.2398   mipmap cache:    3977MB
     0.2398   available mem:   15911MB
     0.2398   singlebuff:      248MB
     0.2401 [opencl_init] opencl disabled via darktable preferences
     0.2402 [dt_dlopencl_init] could not find default opencl runtime library 'libOpenCL'
     0.2402 [dt_dlopencl_init] could not find default opencl runtime library 'libOpenCL.so'
     0.2403 [opencl_init] opencl library 'libOpenCL.so.1' found on your system and loaded, preference 'default path'
     0.2629 [opencl_init] found 1 platform
     0.2629 [check platform] platform 'rusticl' with key 'clplatform_rusticl' is NOT active
[opencl_init] found 0 device
     0.2630 [opencl_init] FINALLY: opencl PREFERENCE=OFF is NOT AVAILABLE and NOT ENABLED.

I tried Darktable-5.0.0-x86_64.AppImage from GitHub and it shows:

No OpenCL support? Iā€™m on Aurora (basically Fedora Kinoite).

You can run darktable-cltest on you Linux, too (not in the FlatPak).

I use NVidia, so I donā€™t follow what drivers one needs for AMD. It used to be the case that (a part of) the proprietary driver was needed, but then I heard rustic got improved a lot. Iā€™m sure fellow AMD users will be able to help. But maybe youā€™ll need rocm? See
How to make my AMD GPU work with the Flatpak version of darktable? - #8 by tankist02 and
Opencl Rx580 Linux Mint 21.3 amdgpu - #11 by tankist02

Thanks!

How do I do that with an AppImage?

Tick the rusticl box in darktable preferences and add RUSTICL_ENABLE=radeonsi as an env variable when running darktable-cltest.

This can be done in one of two ways:

  • The executable name can be specified as the first command line argument. If there is an executable with that name inside the AppImage, it will be run instead of the default one. So, just specify darktable-cltest as the first argument when running AppImage

  • You can create a symlink to the AppImage file and run it via the symlink. If inside the AppImage there is an executable with a name that matches the symlink name, it will be launched instead of the default one. That is, you can simply run the AppImage via a symlink named darktable-cltest.

1 Like

Good question. :slight_smile:

What I tried:

kofa@eagle:/tmp$ ./Darktable-5.0.0-x86_64.AppImage --appimage-mount
/tmp/.mount_DarktanJD53M

So, now the contents are mounted at /tmp/.mount_DarktanJD53M.
darktable-cltest can then be run using

kofa@eagle:/tmp$  /tmp/.mount_DarktanJD53M/usr/bin/darktable-cltest 
darktable 5.0.0
Copyright (C) 2012-2024 Johannes Hanika and other contributors.

Compile options:
  Bit depth              -> 64 bit
  [...]  Debug                  -> DISABLED

/usr/lib/x86_64-linux-gnu/gvfs/libgvfscommon.so: undefined symbol: g_task_set_static_name
Failed to load module: /usr/lib/x86_64-linux-gnu/gio/modules/libgvfsdbus.so
     1.8115 [dt_get_sysresource_level] switched to 2 as `large'
     1.8115   total mem:       64212MB
     1.8115   mipmap cache:    8026MB
     1.8115   available mem:   43895MB
     1.8115   singlebuff:      1003MB
     1.8238 [opencl_init] opencl library 'libOpenCL' found on your system and loaded, preference 'default path'
     1.8575 [opencl_init] found 1 platform
[opencl_init] found 1 device

[dt_opencl_device_init]
   DEVICE:                   0: 'NVIDIA GeForce GTX 1060 6GB'
   CONF KEY:                 cldevice_v5_nvidiacudanvidiageforcegtx10606gb
   PLATFORM, VENDOR & ID:    NVIDIA CUDA, NVIDIA Corporation, ID=4318
   CANONICAL NAME:           nvidiacudanvidiageforcegtx10606gb
   DRIVER VERSION:           550.127.08
   DEVICE VERSION:           OpenCL 3.0 CUDA, SM_20 SUPPORT
   DEVICE_TYPE:              GPU, dedicated mem
   GLOBAL MEM SIZE:          6064 MB
   MAX MEM ALLOC:            1516 MB
   MAX IMAGE SIZE:           16384 x 32768
   MAX WORK GROUP SIZE:      1024
   MAX WORK ITEM DIMENSIONS: 3
   MAX WORK ITEM SIZES:      [ 1024 1024 64 ]
   ASYNC PIXELPIPE:          NO
   PINNED MEMORY TRANSFER:   NO
   AVOID ATOMICS:            NO
   MICRO NAP:                250
   ROUNDUP WIDTH & HEIGHT    16x16
   CHECK EVENT HANDLES:      0
   TILING ADVANTAGE:         0.000
   DEFAULT DEVICE:           NO
   KERNEL BUILD DIRECTORY:   /tmp/.mount_DarktanJD53M/usr/share/darktable/kernels
   KERNEL DIRECTORY:         /home/kofa/.cache/darktable/cached_v5_kernels_for_NVIDIACUDANVIDIAGeForceGTX10606GB_55012708
   CL COMPILER OPTION:       -cl-fast-relaxed-math
   CL COMPILER COMMAND:      -w -cl-fast-relaxed-math  -DNVIDIA_SM_20=1 -DNVIDIA=1 -I"/tmp/.mount_DarktanJD53M/usr/share/darktable/kernels"
   KERNEL LOADING TIME:       5.5726 sec
[opencl_init] OpenCL successfully initialized. internal numbers and names of available devices:
[opencl_init]           0       'NVIDIA CUDA NVIDIA GeForce GTX 1060 6GB'
     7.5125 [opencl_init] FINALLY: opencl PREFERENCE=ON is AVAILABLE and ENABLED.
[...]

But then this runs with the native OSā€™s packages, not the packaged ones.

I donā€™t know if thereā€™s another way.

Thanks!

./darktable.AppImage darktable-cltest
Setting $HOME to /var/home/username/AppImages/darktable.AppImage.home
darktable 5.0.0
Copyright (C) 2012-2024 Johannes Hanika and other contributors.

Compile options:
  Bit depth              -> 64 bit
  Debug                  -> DISABLED
  SSE2 optimizations     -> ENABLED
  OpenMP                 -> ENABLED
  OpenCL                 -> ENABLED
  Lua                    -> ENABLED  - API version 9.4.0
  Colord                 -> ENABLED
  gPhoto2                -> ENABLED
  GMIC                   -> ENABLED  - Compressed LUTs are supported
  GraphicsMagick         -> ENABLED
  ImageMagick            -> DISABLED
  libavif                -> ENABLED
  libheif                -> ENABLED
  libjxl                 -> ENABLED
  LibRaw                 -> ENABLED  - Version 0.22.0-Devel202403
  OpenJPEG               -> ENABLED
  OpenEXR                -> ENABLED
  WebP                   -> ENABLED

See https://www.darktable.org/resources/ for detailed documentation.
See https://github.com/darktable-org/darktable/issues/new/choose to report bugs.

     0.2852 [dt_get_sysresource_level] switched to 1 as `default'
     0.2852   total mem:       31822MB
     0.2852   mipmap cache:    3977MB
     0.2852   available mem:   15911MB
     0.2852   singlebuff:      248MB
     0.2922 [dt_dlopencl_init] could not find default opencl runtime library 'libOpenCL'
     0.2922 [dt_dlopencl_init] could not find default opencl runtime library 'libOpenCL.so'
     0.2924 [opencl_init] opencl library 'libOpenCL.so.1' found on your system and loaded, preference 'default path'
     0.2924 [opencl_init] 0 platforms detected, error: Unknown OpenCL error
     0.2924 [opencl_init] FINALLY: opencl PREFERENCE=ON is NOT AVAILABLE and NOT ENABLED.
     0.4914 [iop_lens]: could not load Lensfun database in `/tmp/.mount_darktayd7dqM/usr/share/lensfun/version_1'!
     0.4914 [iop_lens]: could not load Lensfun database in `/tmp/.mount_darktayd7dqM/usr/share/lensfun'!

The above worked :arrow_heading_up::slightly_smiling_face:

2 Likes

See now my message was confusing. I never got GPU acceleration for the AppImage working. What I mean worked was running ./darktable.AppImage darktable-cltest.

Clues on how to get GPU acceleration working based on the below output?

./darktable.AppImage darktable-cltest
Setting $HOME to /var/home/username/AppImages/darktable.AppImage.home
darktable 5.0.1
Copyright (C) 2012-2025 Johannes Hanika and other contributors.

Compile options:
  Bit depth              -> 64 bit
  Debug                  -> DISABLED
  SSE2 optimizations     -> ENABLED
  OpenMP                 -> ENABLED
  OpenCL                 -> ENABLED
  Lua                    -> ENABLED  - API version 9.4.0
  Colord                 -> ENABLED
  gPhoto2                -> ENABLED
  GMIC                   -> ENABLED  - Compressed LUTs are supported
  GraphicsMagick         -> ENABLED
  ImageMagick            -> DISABLED
  libavif                -> ENABLED
  libheif                -> ENABLED
  libjxl                 -> ENABLED
  LibRaw                 -> ENABLED  - Version 0.22.0-Devel202403
  OpenJPEG               -> ENABLED
  OpenEXR                -> ENABLED
  WebP                   -> ENABLED

See https://www.darktable.org/resources/ for detailed documentation.
See https://github.com/darktable-org/darktable/issues/new/choose to report bugs.

     0.2841 [dt_get_sysresource_level] switched to 1 as `default'
     0.2842   total mem:       31822MB
     0.2842   mipmap cache:    3977MB
     0.2842   available mem:   15911MB
     0.2842   singlebuff:      248MB
     0.2896 [opencl_init] opencl disabled via darktable preferences
     0.2897 [dt_dlopencl_init] could not find default opencl runtime library 'libOpenCL'
     0.2897 [dt_dlopencl_init] could not find default opencl runtime library 'libOpenCL.so'
     0.2899 [opencl_init] opencl library 'libOpenCL.so.1' found on your system and loaded, preference 'default path'
     0.2899 [opencl_init] 0 platforms detected, error: Unknown OpenCL error
     0.2899 [opencl_init] FINALLY: opencl PREFERENCE=OFF is NOT AVAILABLE and NOT ENABLED.

This part does not look promising:

     0.2896 [opencl_init] opencl disabled via darktable preferences
     0.2897 [dt_dlopencl_init] could not find default opencl runtime library 'libOpenCL'
     0.2897 [dt_dlopencl_init] could not find default opencl runtime library 'libOpenCL.so'
     0.2899 [opencl_init] opencl library 'libOpenCL.so.1' found on your system and loaded, preference 'default path'
     0.2899 [opencl_init] 0 platforms detected, error: Unknown OpenCL error
     0.2899 [opencl_init] FINALLY: opencl PREFERENCE=OFF is NOT AVAILABLE and NOT ENABLED.

But Iā€™m not sure where I should start look for a solution.

Hereā€™s what preferences say:

What I get from the output posted above:

  • openCL support is compiled in
  • ā€œopencl disabled via darktable preferencesā€
  • the program does find an openCL runtime ( ā€˜libOpenCL.so.1ā€™ )
  • then it reports an ā€œUnknown OpenCL errorā€

(The two lines ā€œcould not find default opencl runtime libraryā€ appear because several possible names are tried. )

There are also openCL options in darktablerc (~/.config/darktable/darktablerc on my home-compiled setup), one of which is (for me) opencl=TRUE

Note that @kofa mounted the appimage as a filesystem. That should allow you to see whatā€™s packed in there (and perhaps get it to run using system libraries).

Thanks! That was set to FALSE. I set it to true and started darktable and was met by this error message:

I closed darktable and opened darktablerc. Now it said FALSE again.

I set it to true once again and ran darktable-cltest:

     0.2851 [dt_dlopencl_init] could not find default opencl runtime library 'libOpenCL'
     0.2851 [dt_dlopencl_init] could not find default opencl runtime library 'libOpenCL.so'
     0.2853 [opencl_init] opencl library 'libOpenCL.so.1' found on your system and loaded, preference 'default path'
     0.2853 [opencl_init] 0 platforms detected, error: Unknown OpenCL error
     0.2853 [opencl_init] FINALLY: opencl PREFERENCE=ON is NOT AVAILABLE and NOT ENABLED.

Okay! Any idea what I should look for?

First look to see if your opencl drivers are properly installed in your OS.