flathub / org.darktable.Darktable

https://flathub.org/apps/details/org.darktable.Darktable
5 stars 14 forks source link

Darktable Flatpak doesn't recognise OpenCL even with -d opencl flag #68

Open KristijanZic opened 3 years ago

KristijanZic commented 3 years ago

I'm having the same issue as https://github.com/flatpak/flatpak/issues/3900?_pjax=%23js-repo-pjax-container on Ubuntu 20.04.1, Threadripper 1900x, Vega 64 Liquid, amdgpu-pro 20.40 driver installed with --opencl=pal flag.

$ flatpak run org.darktable.Darktable -d opencl
Gtk-Message: 22:53:19.115: Failed to load module "canberra-gtk-module"
Gtk-Message: 22:53:19.118: Failed to load module "canberra-gtk-module"
0.096296 [opencl_init] opencl related configuration options:
0.096305 [opencl_init] 
0.096307 [opencl_init] opencl: 1
0.096309 [opencl_init] opencl_scheduling_profile: 'default'
0.096314 [opencl_init] opencl_library: ''
0.096321 [opencl_init] opencl_memory_requirement: 768
0.096327 [opencl_init] opencl_memory_headroom: 400
0.096330 [opencl_init] opencl_device_priority: '*/!0,*/*/*/!0,*'
0.096335 [opencl_init] opencl_mandatory_timeout: 200
0.096339 [opencl_init] opencl_size_roundup: 16
0.096343 [opencl_init] opencl_async_pixelpipe: 0
0.096347 [opencl_init] opencl_synch_cache: active module
0.096349 [opencl_init] opencl_number_event_handles: 25
0.096352 [opencl_init] opencl_micro_nap: 1000
0.096357 [opencl_init] opencl_use_pinned_memory: 0
0.096360 [opencl_init] opencl_use_cpu_devices: 0
0.096363 [opencl_init] opencl_avoid_atomics: 0
0.096364 [opencl_init] 
0.096442 [opencl_init] could not find opencl runtime library 'libOpenCL'
0.096474 [opencl_init] could not find opencl runtime library 'libOpenCL.so'
0.097122 [opencl_init] found opencl runtime library 'libOpenCL.so.1'
0.097143 [opencl_init] opencl library 'libOpenCL.so.1' found on your system and loaded
0.268473 [opencl_init] found 1 platform
0.268497 [opencl_init] found 1 device
0.268521 [opencl_init] discarding device 0 `Radeon RX Vega (VEGA10, DRM 3.40.0, 5.4.0-52-generic, LLVM 10.0.1)' - The OpenCL driver doesn't provide image support. See also 'clinfo' output.
0.268526 [opencl_init] no suitable devices found.
0.268528 [opencl_init] FINALLY: opencl is NOT AVAILABLE on this system.
0.268531 [opencl_init] initial status of opencl enabled flag is OFF.

The result in the GUI is that OpenCL checkbox and label are grayed out

Screenshot from 2020-10-27 22-58-43

neofetch
OS: Ubuntu 20.04.1 LTS x86_64 
Kernel: 5.4.0-52-generic 
Uptime: 1 hour, 4 mins 
Packages: 1857 (dpkg), 50 (flatpak), 33 (snap) 
Shell: bash 5.0.17 
Resolution: 1920x1200 
DE: GNOME 
WM: Mutter 
WM Theme: Adwaita 
Theme: Adwaita-dark [GTK2/3] 
Icons: Yaru [GTK2/3] 
Terminal: gnome-terminal 
CPU: AMD Ryzen Threadripper 1900X (16) @ 3.800GHz
GPU: AMD ATI Radeon RX Vega 64
Memory: 3598MiB / 15930MiB 
$ clinfo
Number of platforms                               1
  Platform Name                                   AMD Accelerated Parallel Processing
  Platform Vendor                                 Advanced Micro Devices, Inc.
  Platform Version                                OpenCL 2.1 AMD-APP (3180.7)
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd cl_amd_event_callback cl_amd_offline_devices 
  Platform Host timer resolution                  1ns
  Platform Extensions function suffix             AMD

  Platform Name                                   AMD Accelerated Parallel Processing
Number of devices                                 1
  Device Name                                     gfx900
  Device Vendor                                   Advanced Micro Devices, Inc.
  Device Vendor ID                                0x1002
  Device Version                                  OpenCL 2.0 AMD-APP (3180.7)
  Driver Version                                  3180.7 (PAL,HSAIL)
  Device OpenCL C Version                         OpenCL C 2.0 
  Device Type                                     GPU
  Device Board Name (AMD)                         Radeon RX Vega
  Device Topology (AMD)                           PCI-E, 44:00.0
  Device Profile                                  FULL_PROFILE
  Device Available                                Yes
  Compiler Available                              Yes
  Linker Available                                Yes
  Max compute units                               64
  SIMD per compute unit (AMD)                     4
  SIMD width (AMD)                                16
  SIMD instruction width (AMD)                    1
  Max clock frequency                             1107MHz
  Graphics IP (AMD)                               9.0
  Device Partition                                (core)
    Max number of sub-devices                     64
    Supported partition types                     None
    Supported affinity domains                    (n/a)
  Max work item dimensions                        3
  Max work item sizes                             1024x1024x1024
  Max work group size                             256
  Preferred work group size (AMD)                 256
  Max work group size (AMD)                       1024
  Preferred work group size multiple              64
  Wavefront width (AMD)                           64
  Preferred / native vector sizes                 
    char                                                 4 / 4       
    short                                                2 / 2       
    int                                                  1 / 1       
    long                                                 1 / 1       
    half                                                 1 / 1        (cl_khr_fp16)
    float                                                1 / 1       
    double                                               1 / 1        (cl_khr_fp64)
  Half-precision Floating-point support           (cl_khr_fp16)
    Denormals                                     No
    Infinity and NANs                             No
    Round to nearest                              No
    Round to zero                                 No
    Round to infinity                             No
    IEEE754-2008 fused multiply-add               No
    Support is emulated in software               No
  Single-precision Floating-point support         (core)
    Denormals                                     No
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 Yes
    Round to infinity                             Yes
    IEEE754-2008 fused multiply-add               Yes
    Support is emulated in software               No
    Correctly-rounded divide and sqrt operations  Yes
  Double-precision Floating-point support         (cl_khr_fp64)
    Denormals                                     Yes
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 Yes
    Round to infinity                             Yes
    IEEE754-2008 fused multiply-add               Yes
    Support is emulated in software               No
  Address bits                                    64, Little-Endian
  Global memory size                              8573157376 (7.984GiB)
  Global free memory (AMD)                        8306688 (7.922GiB)
  Global memory channels (AMD)                    64
  Global memory banks per channel (AMD)           4
  Global memory bank width (AMD)                  256 bytes
  Error Correction support                        No
  Max memory allocation                           7059013632 (6.574GiB)
  Unified memory for Host and Device              No
  Shared Virtual Memory (SVM) capabilities        (core)
    Coarse-grained buffer sharing                 Yes
    Fine-grained buffer sharing                   Yes
    Fine-grained system sharing                   No
    Atomics                                       No
  Minimum alignment for any data type             128 bytes
  Alignment of base address                       2048 bits (256 bytes)
  Preferred alignment for atomics                 
    SVM                                           0 bytes
    Global                                        0 bytes
    Local                                         0 bytes
  Max size for global variable                    6353112064 (5.917GiB)
  Preferred total size of global vars             8573157376 (7.984GiB)
  Global Memory cache type                        Read/Write
  Global Memory cache size                        16384 (16KiB)
  Global Memory cache line size                   64 bytes
  Image support                                   Yes
    Max number of samplers per kernel             16
    Max size for 1D images from buffer            134217728 pixels
    Max 1D or 2D image array size                 2048 images
    Base address alignment for 2D image buffers   256 bytes
    Pitch alignment for 2D image buffers          256 pixels
    Max 2D image size                             16384x16384 pixels
    Max 3D image size                             2048x2048x2048 pixels
    Max number of read image args                 128
    Max number of write image args                64
    Max number of read/write image args           64
  Max number of pipe args                         16
  Max active pipe reservations                    16
  Max pipe packet size                            2764046336 (2.574GiB)
  Local memory type                               Local
  Local memory size                               65536 (64KiB)
  Local memory syze per CU (AMD)                  65536 (64KiB)
  Local memory banks (AMD)                        32
  Max number of constant args                     8
  Max constant buffer size                        7059013632 (6.574GiB)
  Preferred constant buffer size (AMD)            16384 (16KiB)
  Max size of kernel argument                     1024
  Queue properties (on host)                      
    Out-of-order execution                        No
    Profiling                                     Yes
  Queue properties (on device)                    
    Out-of-order execution                        Yes
    Profiling                                     Yes
    Preferred size                                262144 (256KiB)
    Max size                                      8388608 (8MiB)
  Max queues on device                            1
  Max events on device                            1024
  Prefer user sync for interop                    Yes
  Number of P2P devices (AMD)                     0
  P2P devices (AMD)                               
  Profiling timer resolution                      1ns
  Profiling timer offset since Epoch (AMD)        1603832704990059755ns (Tue Oct 27 22:05:04 2020)
  Execution capabilities                          
    Run OpenCL kernels                            Yes
    Run native kernels                            No
    Thread trace supported (AMD)                  Yes
    Number of async queues (AMD)                  4
    Max real-time compute queues (AMD)            1
    Max real-time compute units (AMD)             0
  printf() buffer size                            4194304 (4MiB)
  Built-in kernels                                (n/a)
  Device Extensions                               cl_khr_fp64 cl_amd_fp64 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_fp16 cl_khr_gl_sharing cl_khr_gl_depth_images cl_amd_device_attribute_query cl_amd_vec3 cl_amd_printf cl_amd_media_ops cl_amd_media_ops2 cl_amd_popcnt cl_khr_image2d_from_buffer cl_khr_subgroups cl_khr_gl_event cl_khr_depth_images cl_khr_mipmap_image cl_khr_mipmap_image_writes cl_amd_copy_buffer_p2p 

NULL platform behavior
  clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...)  No platform
  clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)   No platform
  clCreateContext(NULL, ...) [default]            No platform
  clCreateContext(NULL, ...) [other]              Success [AMD]
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT)  Success (1)
    Platform Name                                 AMD Accelerated Parallel Processing
    Device Name                                   gfx900
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU)  Success (1)
    Platform Name                                 AMD Accelerated Parallel Processing
    Device Name                                   gfx900
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL)  Success (1)
    Platform Name                                 AMD Accelerated Parallel Processing
    Device Name                                   gfx900

Screenshot of the deb version of Darktable Screenshot from 2020-10-27 23-29-45

hfiguiere commented 3 years ago

I guess we need to build opencl

hfiguiere commented 3 years ago

or maybe it just doesn't work with AMD.

(I don't have that kind of hardware)

eszlari commented 3 years ago

I guess this needs to be fixed in the runtime, so maybe you should open this issue there:

https://gitlab.com/freedesktop-sdk/freedesktop-sdk/-/issues

eszlari commented 3 years ago

It works here with my Nvidia card.

amdgpu-pro 20.40 driver

Since you are using the proprietary driver, something similar (extra-data) to the Nvidia driver needs to be done.

Alternatively, freedesktop-sdk would need to bundle ROCm I guess.

KristijanZic commented 3 years ago

I've tested it on a different intel based machine with OpenCL, it still doesn't work (but it works with deb package):

neofetch
OS: Ubuntu 20.04.1 LTS x86_64 
Host: Inspiron 13-7359 
Kernel: 5.4.0-52-generic 
Uptime: 6 hours, 39 mins 
Packages: 2221 (dpkg), 93 (flatpak), 41 (snap)
Shell: bash 5.0.17 
Resolution: 1920x1080 
DE: GNOME 
WM: Mutter 
WM Theme: Adwaita 
Theme: Adwaita-dark [GTK2/3] 
Icons: Yaru [GTK2/3] 
Terminal: gnome-terminal 
CPU: Intel i7-6500U (4) @ 3.100GHz 
GPU: Intel Skylake GT2 [HD Graphics 520] 
Memory: 5993MiB / 7818MiB 
$ flatpak run org.darktable.Darktable -d opencl
Gtk-Message: 14:42:23.736: Failed to load module "canberra-gtk-module"
Gtk-Message: 14:42:23.741: Failed to load module "canberra-gtk-module"
0.235603 [opencl_init] opencl related configuration options:
0.235627 [opencl_init] 
0.235632 [opencl_init] opencl: 1
0.235636 [opencl_init] opencl_scheduling_profile: 'default'
0.235640 [opencl_init] opencl_library: ''
0.235645 [opencl_init] opencl_memory_requirement: 768
0.235661 [opencl_init] opencl_memory_headroom: 400
0.235666 [opencl_init] opencl_device_priority: '*/!0,*/*/*/!0,*'
0.235671 [opencl_init] opencl_mandatory_timeout: 200
0.235675 [opencl_init] opencl_size_roundup: 16
0.235678 [opencl_init] opencl_async_pixelpipe: 0
0.235681 [opencl_init] opencl_synch_cache: active module
0.235686 [opencl_init] opencl_number_event_handles: 25
0.235690 [opencl_init] opencl_micro_nap: 1000
0.235694 [opencl_init] opencl_use_pinned_memory: 0
0.235698 [opencl_init] opencl_use_cpu_devices: 0
0.235702 [opencl_init] opencl_avoid_atomics: 0
0.235705 [opencl_init] 
0.235884 [opencl_init] could not find opencl runtime library 'libOpenCL'
0.235970 [opencl_init] could not find opencl runtime library 'libOpenCL.so'
0.237315 [opencl_init] found opencl runtime library 'libOpenCL.so.1'
0.237337 [opencl_init] opencl library 'libOpenCL.so.1' found on your system and loaded
0.614108 [opencl_init] found 1 platform
0.614244 [opencl_init] could not get device id size: -1
0.614284 [opencl_init] found 0 device
0.614300 [opencl_init] FINALLY: opencl is NOT AVAILABLE on this system.
0.614311 [opencl_init] initial status of opencl enabled flag is OFF.
which: no git in (/app/bin:/usr/bin)
$ clinfo
Number of platforms                               1
  Platform Name                                   Intel(R) OpenCL HD Graphics
  Platform Vendor                                 Intel(R) Corporation
  Platform Version                                OpenCL 2.1 
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_byte_addressable_store cl_khr_fp16 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_icd cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_intel_subgroups cl_intel_required_subgroup_size cl_intel_subgroups_short cl_khr_spir cl_intel_accelerator cl_intel_driver_diagnostics cl_khr_priority_hints cl_khr_throttle_hints cl_khr_create_command_queue cl_intel_subgroups_char cl_intel_subgroups_long cl_khr_fp64 cl_khr_subgroups cl_khr_il_program cl_intel_spirv_device_side_avc_motion_estimation cl_intel_spirv_media_block_io cl_intel_spirv_subgroups cl_khr_spirv_no_integer_wrap_decoration cl_intel_unified_shared_memory_preview cl_khr_mipmap_image cl_khr_mipmap_image_writes cl_intel_planar_yuv cl_intel_packed_yuv cl_intel_motion_estimation cl_intel_device_side_avc_motion_estimation cl_intel_advanced_motion_estimation cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_image2d_from_buffer cl_khr_depth_images cl_intel_media_block_io cl_khr_3d_image_writes cl_intel_va_api_media_sharing 
  Platform Host timer resolution                  1ns
  Platform Extensions function suffix             INTEL

  Platform Name                                   Intel(R) OpenCL HD Graphics
Number of devices                                 1
  Device Name                                     Intel(R) Gen9 HD Graphics NEO
  Device Vendor                                   Intel(R) Corporation
  Device Vendor ID                                0x8086
  Device Version                                  OpenCL 2.1 NEO 
  Driver Version                                  20.28.17293
  Device OpenCL C Version                         OpenCL C 2.0 
  Device Type                                     GPU
  Device Profile                                  FULL_PROFILE
  Device Available                                Yes
  Compiler Available                              Yes
  Linker Available                                Yes
  Max compute units                               24
  Max clock frequency                             1050MHz
  Device Partition                                (core)
    Max number of sub-devices                     0
    Supported partition types                     None
    Supported affinity domains                    (n/a)
  Max work item dimensions                        3
  Max work item sizes                             256x256x256
  Max work group size                             256
  Preferred work group size multiple              32
  Max sub-groups per work group                   32
  Sub-group sizes (Intel)                         8, 16, 32
  Preferred / native vector sizes                 
    char                                                16 / 16      
    short                                                8 / 8       
    int                                                  4 / 4       
    long                                                 1 / 1       
    half                                                 8 / 8        (cl_khr_fp16)
    float                                                1 / 1       
    double                                               1 / 1        (cl_khr_fp64)
  Half-precision Floating-point support           (cl_khr_fp16)
    Denormals                                     Yes
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 Yes
    Round to infinity                             Yes
    IEEE754-2008 fused multiply-add               Yes
    Support is emulated in software               No
  Single-precision Floating-point support         (core)
    Denormals                                     Yes
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 Yes
    Round to infinity                             Yes
    IEEE754-2008 fused multiply-add               Yes
    Support is emulated in software               No
    Correctly-rounded divide and sqrt operations  Yes
  Double-precision Floating-point support         (cl_khr_fp64)
    Denormals                                     Yes
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 Yes
    Round to infinity                             Yes
    IEEE754-2008 fused multiply-add               Yes
    Support is emulated in software               No
  Address bits                                    64, Little-Endian
  Global memory size                              6558941184 (6.108GiB)
  Error Correction support                        No
  Max memory allocation                           3279470592 (3.054GiB)
  Unified memory for Host and Device              Yes
  Shared Virtual Memory (SVM) capabilities        (core)
    Coarse-grained buffer sharing                 Yes
    Fine-grained buffer sharing                   No
    Fine-grained system sharing                   No
    Atomics                                       No
  Minimum alignment for any data type             128 bytes
  Alignment of base address                       1024 bits (128 bytes)
  Preferred alignment for atomics                 
    SVM                                           64 bytes
    Global                                        64 bytes
    Local                                         64 bytes
  Max size for global variable                    65536 (64KiB)
  Preferred total size of global vars             3279470592 (3.054GiB)
  Global Memory cache type                        Read/Write
  Global Memory cache size                        524288 (512KiB)
  Global Memory cache line size                   64 bytes
  Image support                                   Yes
    Max number of samplers per kernel             16
    Max size for 1D images from buffer            204966912 pixels
    Max 1D or 2D image array size                 2048 images
    Base address alignment for 2D image buffers   4 bytes
    Pitch alignment for 2D image buffers          4 pixels
    Max 2D image size                             16384x16384 pixels
    Max planar YUV image size                     16384x16352 pixels
    Max 3D image size                             16384x16384x2048 pixels
    Max number of read image args                 128
    Max number of write image args                128
    Max number of read/write image args           128
  Max number of pipe args                         16
  Max active pipe reservations                    1
  Max pipe packet size                            1024
  Local memory type                               Local
  Local memory size                               65536 (64KiB)
  Max number of constant args                     8
  Max constant buffer size                        3279470592 (3.054GiB)
  Max size of kernel argument                     1024
  Queue properties (on host)                      
    Out-of-order execution                        Yes
    Profiling                                     Yes
  Queue properties (on device)                    
    Out-of-order execution                        Yes
    Profiling                                     Yes
    Preferred size                                131072 (128KiB)
    Max size                                      67108864 (64MiB)
  Max queues on device                            1
  Max events on device                            1024
  Prefer user sync for interop                    Yes
  Profiling timer resolution                      83ns
  Execution capabilities                          
    Run OpenCL kernels                            Yes
    Run native kernels                            No
    Sub-group independent forward progress        Yes
    IL version                                    SPIR-V_1.2 
    SPIR versions                                 1.2 
  printf() buffer size                            4194304 (4MiB)
  Built-in kernels                                block_motion_estimate_intel;block_advanced_motion_estimate_check_intel;block_advanced_motion_estimate_bidirectional_check_intel;
  Motion Estimation accelerator version (Intel)   2
    Device-side AVC Motion Estimation version     1
      Supports texture sampler use                Yes
      Supports preemption                         No
  Device Extensions                               cl_khr_byte_addressable_store cl_khr_fp16 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_icd cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_intel_subgroups cl_intel_required_subgroup_size cl_intel_subgroups_short cl_khr_spir cl_intel_accelerator cl_intel_driver_diagnostics cl_khr_priority_hints cl_khr_throttle_hints cl_khr_create_command_queue cl_intel_subgroups_char cl_intel_subgroups_long cl_khr_fp64 cl_khr_subgroups cl_khr_il_program cl_intel_spirv_device_side_avc_motion_estimation cl_intel_spirv_media_block_io cl_intel_spirv_subgroups cl_khr_spirv_no_integer_wrap_decoration cl_intel_unified_shared_memory_preview cl_khr_mipmap_image cl_khr_mipmap_image_writes cl_intel_planar_yuv cl_intel_packed_yuv cl_intel_motion_estimation cl_intel_device_side_avc_motion_estimation cl_intel_advanced_motion_estimation cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_image2d_from_buffer cl_khr_depth_images cl_intel_media_block_io cl_khr_3d_image_writes cl_intel_va_api_media_sharing 

NULL platform behavior
  clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...)  Intel(R) OpenCL HD Graphics
  clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)   Success [INTEL]
  clCreateContext(NULL, ...) [default]            Success [INTEL]
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT)  Success (1)
    Platform Name                                 Intel(R) OpenCL HD Graphics
    Device Name                                   Intel(R) Gen9 HD Graphics NEO
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU)  Success (1)
    Platform Name                                 Intel(R) OpenCL HD Graphics
    Device Name                                   Intel(R) Gen9 HD Graphics NEO
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL)  Success (1)
    Platform Name                                 Intel(R) OpenCL HD Graphics
    Device Name                                   Intel(R) Gen9 HD Graphics NEO

ICD loader properties
  ICD loader Name                                 OpenCL ICD Loader
  ICD loader Vendor                               OCL Icd free software
  ICD loader Version                              2.2.11
  ICD loader Profile                              OpenCL 2.1

Screenshot from 2020-10-28 14-48-12

paperdigits commented 3 years ago

You can see what's been done for the nvidia opencl driver: https://github.com/flatpak/freedesktop-sdk-images/pull/79 https://github.com/flatpak/freedesktop-sdk-images/pull/78

eszlari commented 3 years ago

You can see what's been done for the nvidia opencl driver: flatpak/freedesktop-sdk-images#79 flatpak/freedesktop-sdk-images#78

These links are outdated.

Current source locations: https://github.com/flathub/org.freedesktop.Platform.GL.nvidia https://gitlab.com/freedesktop-sdk/freedesktop-sdk

KristijanZic commented 3 years ago

I've reported the issue here: https://gitlab.com/freedesktop-sdk/freedesktop-sdk/-/issues/1181

KristijanZic commented 3 years ago

This is an output from My Threadripper + Vega 64 machine also mentioned in the above thread:

I've installed clinfo flatpak instead of using host's clinfo like this:

$ flatpak install org.freedesktop.Platform.ClInfo
Looking for matches…
Remotes found with refs similar to ‘org.freedesktop.Platform.ClInfo’:

   1) ‘flathub’ (system)
   2) ‘flathub-beta’ (system)

Which do you want to use (0 to abort)? [0-2]: 1

org.freedesktop.Platform.ClInfo permissions:
    ipc   wayland   x11   dri

        ID                              Branch Op Remote  Download
 1. [✓] org.freedesktop.Platform.ClInfo 20.08  i  flathub 54,9 kB / 69,3 kB

Installation complete.
$ flatpak run org.freedesktop.Platform.ClInfo
Number of platforms                               1
  Platform Name                                   Clover
  Platform Vendor                                 Mesa
  Platform Version                                OpenCL 1.1 Mesa 20.2.3 (git-8440307a61)
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd
  Platform Extensions function suffix             MESA

  Platform Name                                   Clover
Number of devices                                 1
  Device Name                                     Radeon RX Vega (VEGA10, DRM 3.40.0, 5.4.0-54-generic, LLVM 10.0.1)
  Device Vendor                                   AMD
  Device Vendor ID                                0x1002
  Device Version                                  OpenCL 1.1 Mesa 20.2.3 (git-8440307a61)
  Driver Version                                  20.2.3
  Device OpenCL C Version                         OpenCL C 1.1 
  Device Type                                     GPU
  Device Profile                                  FULL_PROFILE
  Device Available                                Yes
  Compiler Available                              Yes
  Max compute units                               64
  Max clock frequency                             1750MHz
  Max work item dimensions                        3
  Max work item sizes                             256x256x256
  Max work group size                             256
=== CL_PROGRAM_BUILD_LOG ===
<built-in>:1:10: fatal error: 'clc/clc.h' file not found
  Preferred work group size multiple (kernel)     <getWGsizes:1445: create kernel : error -46>
  Preferred / native vector sizes                 
    char                                                16 / 16      
    short                                                8 / 8       
    int                                                  4 / 4       
    long                                                 2 / 2       
    half                                                 0 / 0        (n/a)
    float                                                4 / 4       
    double                                               2 / 2        (cl_khr_fp64)
  Half-precision Floating-point support           (n/a)
  Single-precision Floating-point support         (core)
    Denormals                                     No
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 No
    Round to infinity                             No
    IEEE754-2008 fused multiply-add               No
    Support is emulated in software               No
    Correctly-rounded divide and sqrt operations  No
  Double-precision Floating-point support         (cl_khr_fp64)
    Denormals                                     Yes
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 Yes
    Round to infinity                             Yes
    IEEE754-2008 fused multiply-add               Yes
    Support is emulated in software               No
  Address bits                                    64, Little-Endian
  Global memory size                              16704106496 (15.56GiB)
  Error Correction support                        No
  Max memory allocation                           6871947673 (6.4GiB)
  Unified memory for Host and Device              No
  Minimum alignment for any data type             128 bytes
  Alignment of base address                       32768 bits (4096 bytes)
  Global Memory cache type                        None
  Image support                                   No
  Local memory type                               Local
  Local memory size                               32768 (32KiB)
  Max number of constant args                     16
  Max constant buffer size                        2147483392 (2GiB)
  Max size of kernel argument                     1024
  Queue properties                                
    Out-of-order execution                        No
    Profiling                                     Yes
  Profiling timer resolution                      0ns
  Execution capabilities                          
    Run OpenCL kernels                            Yes
    Run native kernels                            No
  Device Extensions                               cl_khr_byte_addressable_store cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_fp64

NULL platform behavior
  clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...)  Clover
  clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)   Success [MESA]
  clCreateContext(NULL, ...) [default]            Success [MESA]
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT)  Success (1)
    Platform Name                                 Clover
    Device Name                                   Radeon RX Vega (VEGA10, DRM 3.40.0, 5.4.0-54-generic, LLVM 10.0.1)
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU)  Success (1)
    Platform Name                                 Clover
    Device Name                                   Radeon RX Vega (VEGA10, DRM 3.40.0, 5.4.0-54-generic, LLVM 10.0.1)
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL)  Success (1)
    Platform Name                                 Clover
    Device Name                                   Radeon RX Vega (VEGA10, DRM 3.40.0, 5.4.0-54-generic, LLVM 10.0.1)

ICD loader properties
  ICD loader Name                                 OpenCL ICD Loader
  ICD loader Vendor                               OCL Icd free software
  ICD loader Version                              2.2.12
  ICD loader Profile                              OpenCL 2.2

This is the output when running Darktable flatpak:

$ flatpak run org.darktable.Darktable -d opencl
Gtk-Message: 23:23:02.492: Failed to load module "canberra-gtk-module"
Gtk-Message: 23:23:02.493: Failed to load module "canberra-gtk-module"
[init] the database lock file contains a pid that seems to be alive in your system: 2
[init] database is locked, probably another process is already using it
trying to open the images in the running instance
ERROR: can't acquire database lock, aborting.
aresminos@desktop:~$ flatpak run org.darktable.Darktable -d opencl
Gtk-Message: 23:23:42.669: Failed to load module "canberra-gtk-module"
Gtk-Message: 23:23:42.669: Failed to load module "canberra-gtk-module"
0.055867 [opencl_init] opencl related configuration options:
0.055881 [opencl_init] 
0.055883 [opencl_init] opencl: 1
0.055885 [opencl_init] opencl_scheduling_profile: 'default'
0.055887 [opencl_init] opencl_library: ''
0.055890 [opencl_init] opencl_memory_requirement: 768
0.055892 [opencl_init] opencl_memory_headroom: 400
0.055894 [opencl_init] opencl_device_priority: '*/!0,*/*/*/!0,*'
0.055896 [opencl_init] opencl_mandatory_timeout: 200
0.055898 [opencl_init] opencl_size_roundup: 16
0.055902 [opencl_init] opencl_async_pixelpipe: 0
0.055904 [opencl_init] opencl_synch_cache: active module
0.055906 [opencl_init] opencl_number_event_handles: 25
0.055909 [opencl_init] opencl_micro_nap: 1000
0.055913 [opencl_init] opencl_use_pinned_memory: 0
0.055915 [opencl_init] opencl_use_cpu_devices: 0
0.055916 [opencl_init] opencl_avoid_atomics: 0
0.055918 [opencl_init] 
0.056020 [opencl_init] could not find opencl runtime library 'libOpenCL'
0.056054 [opencl_init] could not find opencl runtime library 'libOpenCL.so'
0.056191 [opencl_init] found opencl runtime library 'libOpenCL.so.1'
0.056211 [opencl_init] opencl library 'libOpenCL.so.1' found on your system and loaded
0.160656 [opencl_init] found 1 platform
0.160679 [opencl_init] found 1 device
0.160704 [opencl_init] discarding device 0 `Radeon RX Vega (VEGA10, DRM 3.40.0, 5.4.0-54-generic, LLVM 10.0.1)' - The OpenCL driver doesn't provide image support. See also 'clinfo' output.
0.160710 [opencl_init] no suitable devices found.
0.160711 [opencl_init] FINALLY: opencl is NOT AVAILABLE on this system.
0.160714 [opencl_init] initial status of opencl enabled flag is OFF.
1,606040 [pixelpipe_process] [thumbnail] using device -1
1,741348 [pixelpipe_process] [thumbnail] using device -1
paperdigits commented 3 years ago

[opencl_init] discarding device 0 `Radeon RX Vega (VEGA10, DRM 3.40.0, 5.4.0-54-generic, LLVM 10.0.1)' - The OpenCL driver doesn't provide image support. See also 'clinfo' output.

Doh, the openCL driver isn't built for imaging.

On December 12, 2020 2:26:16 PM PST, "Kristijan Žic" notifications@github.com wrote:

This is an output from My Threadripper + Vega 64 machine also mentioned in the above thread:>

I've installed it like this:>


$ flatpak install org.freedesktop.Platform.ClInfo>
Looking for matches…>
Remotes found with refs similar to ‘org.freedesktop.Platform.ClInfo’:>

1) ‘flathub’ (system)>
2) ‘flathub-beta’ (system)>

Which do you want to use (0 to abort)? [0-2]: 1>

org.freedesktop.Platform.ClInfo permissions:>
ipc   wayland   x11   dri>

ID                              Branch Op Remote  Download>
1. [✓] org.freedesktop.Platform.ClInfo 20.08  i  flathub 54,9 kB / 69,3
kB>

Installation complete.>
```>

```>
$ flatpak run org.freedesktop.Platform.ClInfo>
Number of platforms                               1>
Platform Name                                   Clover>
Platform Vendor                                 Mesa>
Platform Version                                OpenCL 1.1 Mesa 20.2.3
(git-8440307a61)>
Platform Profile                                FULL_PROFILE>
Platform Extensions                             cl_khr_icd>
Platform Extensions function suffix             MESA>

Platform Name                                   Clover>
Number of devices                                 1>
Device Name                                     Radeon RX Vega (VEGA10,
DRM 3.40.0, 5.4.0-54-generic, LLVM 10.0.1)>
Device Vendor                                   AMD>
Device Vendor ID                                0x1002>
Device Version                                  OpenCL 1.1 Mesa 20.2.3
(git-8440307a61)>
Driver Version                                  20.2.3>
Device OpenCL C Version                         OpenCL C 1.1 >
Device Type                                     GPU>
Device Profile                                  FULL_PROFILE>
Device Available                                Yes>
Compiler Available                              Yes>
Max compute units                               64>
Max clock frequency                             1750MHz>
Max work item dimensions                        3>
Max work item sizes                             256x256x256>
Max work group size                             256>
=== CL_PROGRAM_BUILD_LOG ===>
<built-in>:1:10: fatal error: 'clc/clc.h' file not found>
Preferred work group size multiple (kernel)     <getWGsizes:1445:
create kernel : error -46>>
Preferred / native vector sizes                 >
char                                                16 / 16      >
short                                                8 / 8       >
int                                                  4 / 4       >
long                                                 2 / 2       >
half                                                 0 / 0       
(n/a)>
float                                                4 / 4       >
double                                               2 / 2       
(cl_khr_fp64)>
Half-precision Floating-point support           (n/a)>
Single-precision Floating-point support         (core)>
Denormals                                     No>
Infinity and NANs                             Yes>
Round to nearest                              Yes>
Round to zero                                 No>
Round to infinity                             No>
IEEE754-2008 fused multiply-add               No>
Support is emulated in software               No>
Correctly-rounded divide and sqrt operations  No>
Double-precision Floating-point support         (cl_khr_fp64)>
Denormals                                     Yes>
Infinity and NANs                             Yes>
Round to nearest                              Yes>
Round to zero                                 Yes>
Round to infinity                             Yes>
IEEE754-2008 fused multiply-add               Yes>
Support is emulated in software               No>
Address bits                                    64, Little-Endian>
Global memory size                              16704106496 (15.56GiB)>
Error Correction support                        No>
Max memory allocation                           6871947673 (6.4GiB)>
Unified memory for Host and Device              No>
Minimum alignment for any data type             128 bytes>
Alignment of base address                       32768 bits (4096
bytes)>
Global Memory cache type                        None>
Image support                                   No>
Local memory type                               Local>
Local memory size                               32768 (32KiB)>
Max number of constant args                     16>
Max constant buffer size                        2147483392 (2GiB)>
Max size of kernel argument                     1024>
Queue properties                                >
Out-of-order execution                        No>
Profiling                                     Yes>
Profiling timer resolution                      0ns>
Execution capabilities                          >
Run OpenCL kernels                            Yes>
Run native kernels                            No>
Device Extensions                              
cl_khr_byte_addressable_store cl_khr_global_int32_base_atomics
cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics
cl_khr_local_int32_extended_atomics cl_khr_int64_base_atomics
cl_khr_int64_extended_atomics cl_khr_fp64>

NULL platform behavior>
clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...)  Clover>
clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)   Success [MESA]>
clCreateContext(NULL, ...) [default]            Success [MESA]>
clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT)  Success (1)>
Platform Name                                 Clover>
Device Name                                   Radeon RX Vega (VEGA10,
DRM 3.40.0, 5.4.0-54-generic, LLVM 10.0.1)>
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  No devices found in
platform>
clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU)  Success (1)>
Platform Name                                 Clover>
Device Name                                   Radeon RX Vega (VEGA10,
DRM 3.40.0, 5.4.0-54-generic, LLVM 10.0.1)>
clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR)  No devices
found in platform>
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM)  No devices found
in platform>
clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL)  Success (1)>
Platform Name                                 Clover>
Device Name                                   Radeon RX Vega (VEGA10,
DRM 3.40.0, 5.4.0-54-generic, LLVM 10.0.1)>

ICD loader properties>
ICD loader Name                                 OpenCL ICD Loader>
ICD loader Vendor                               OCL Icd free software>
ICD loader Version                              2.2.12>
ICD loader Profile                              OpenCL 2.2>
```>

This is the output when running Darktable flatpak:>
```>
$ flatpak run org.darktable.Darktable -d opencl>
Gtk-Message: 23:23:02.492: Failed to load module "canberra-gtk-module">
Gtk-Message: 23:23:02.493: Failed to load module "canberra-gtk-module">
[init] the database lock file contains a pid that seems to be alive in
your system: 2>
[init] database is locked, probably another process is already using
it>
trying to open the images in the running instance>
ERROR: can't acquire database lock, aborting.>
aresminos@desktop:~$ flatpak run org.darktable.Darktable -d opencl>
Gtk-Message: 23:23:42.669: Failed to load module "canberra-gtk-module">
Gtk-Message: 23:23:42.669: Failed to load module "canberra-gtk-module">
0.055867 [opencl_init] opencl related configuration options:>
0.055881 [opencl_init] >
0.055883 [opencl_init] opencl: 1>
0.055885 [opencl_init] opencl_scheduling_profile: 'default'>
0.055887 [opencl_init] opencl_library: ''>
0.055890 [opencl_init] opencl_memory_requirement: 768>
0.055892 [opencl_init] opencl_memory_headroom: 400>
0.055894 [opencl_init] opencl_device_priority: '*/!0,*/*/*/!0,*'>
0.055896 [opencl_init] opencl_mandatory_timeout: 200>
0.055898 [opencl_init] opencl_size_roundup: 16>
0.055902 [opencl_init] opencl_async_pixelpipe: 0>
0.055904 [opencl_init] opencl_synch_cache: active module>
0.055906 [opencl_init] opencl_number_event_handles: 25>
0.055909 [opencl_init] opencl_micro_nap: 1000>
0.055913 [opencl_init] opencl_use_pinned_memory: 0>
0.055915 [opencl_init] opencl_use_cpu_devices: 0>
0.055916 [opencl_init] opencl_avoid_atomics: 0>
0.055918 [opencl_init] >
0.056020 [opencl_init] could not find opencl runtime library
'libOpenCL'>
0.056054 [opencl_init] could not find opencl runtime library
'libOpenCL.so'>
0.056191 [opencl_init] found opencl runtime library 'libOpenCL.so.1'>
0.056211 [opencl_init] opencl library 'libOpenCL.so.1' found on your
system and loaded>
0.160656 [opencl_init] found 1 platform>
0.160679 [opencl_init] found 1 device>
0.160704 [opencl_init] discarding device 0 `Radeon RX Vega (VEGA10, DRM
3.40.0, 5.4.0-54-generic, LLVM 10.0.1)' - The OpenCL driver doesn't
provide image support. See also 'clinfo' output.>
0.160710 [opencl_init] no suitable devices found.>
0.160711 [opencl_init] FINALLY: opencl is NOT AVAILABLE on this
system.>
0.160714 [opencl_init] initial status of opencl enabled flag is OFF.>
1,606040 [pixelpipe_process] [thumbnail] using device -1>
1,741348 [pixelpipe_process] [thumbnail] using device -1>
```>

-- >
You are receiving this because you commented.>
Reply to this email directly or view it on GitHub:>
https://github.com/flathub/org.darktable.Darktable/issues/68#issuecomment-743913797
KristijanZic commented 3 years ago

@paperdigits can we move to discussing the issue at freedesktop-sdk gitlab?: https://gitlab.com/freedesktop-sdk/freedesktop-sdk/-/issues/1181

I feel like we aren't going to achieve anything here. Please, do comment there also.

matze commented 3 years ago

[opencl_init] discarding device 0 `Radeon RX Vega (VEGA10, DRM 3.40.0, 5.4.0-54-generic, LLVM 10.0.1)' - The OpenCL driver doesn't provide image support. See also 'clinfo' output.

Yes, to be expected with AMD and the Mesa OpenCL clover driver which lacks image support. However, there is work ongoing to use the same infrastructure used to compile OpenGL shaders also for OpenCL kernels but God only knows when this will be ready. Until then, pulling out OpenCL libraries from the amdgpu-pro driver (Navi10 GPUs) or using ROCm (Non-Navi 10) works. No idea, if it's straightforward to re-bundle them and add a dependency …

bjoernhohe commented 2 years ago

have seen the same issue on my Intel HD620 on elementary 6 - when I use the Flatpak version OpenCL is not available with the PPA version it works as expected

OS: elementary OS 6 Odin x86_64 Host: 11AD000UGE ThinkCentre M90n-1 Kernel: 5.11.0-27-generic Packages: 1679 (dpkg), 24 (flatpak) Shell: bash 5.0.17 Resolution: 2560x1440 DE: Pantheon WM: Mutter(Gala) CPU: Intel i3-8145U (4) @ 3.900GHz GPU: Intel UHD Graphics 620 Memory: 1515MiB / 7826MiB

paperdigits commented 2 years ago

Have you installed the flatpak that enables opencl for Intel? I'm not even sure if one exists.

On September 1, 2021 11:11:19 PM PDT, bjoern @.***> wrote:

have seen the same issue on my Intel HD620 on elementary 6 - when I use the Flatpak version OpenCL is not available with the PPA version it works as expected

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/flathub/org.darktable.Darktable/issues/68#issuecomment-911239405

bjoernhohe commented 2 years ago

The following gfx related stuff is installed

Flatpak list
Mesa                                            org.freedesktop.Platform.GL.default        
Mesa                                            org.freedesktop.Platform.GL.default                 
Intel                                           org.freedesktop.Platform.VAAPI.Intel                              
openh264                                        org.freedesktop.Platform.openh264
bjoernhohe commented 2 years ago

Don't know if it helps but today I tried it with Ubuntu 21.04 and the darktable snap and it is having the same issue

paperdigits commented 2 years ago

Can you post the output of flatpak run org.darktable.Darktable -d all please

On September 2, 2021 2:08:49 PM PDT, bjoern @.***> wrote:

The following stuff is installed

Flatpak list
Mesa                                            org.freedesktop.Platform.GL.default        
Mesa                                            org.freedesktop.Platform.GL.default                 
Intel                                           org.freedesktop.Platform.VAAPI.Intel                              
openh264                                        org.freedesktop.Platform.openh264

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/flathub/org.darktable.Darktable/issues/68#issuecomment-912058480

paperdigits commented 2 years ago

The snap package is already known not to support openCL, so it doesn't help.

On September 2, 2021 2:14:27 PM PDT, bjoern @.***> wrote:

Don't know if it helps but today I tried it with Ubuntu 21.04 and the darktable snap and it is having the same issue

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/flathub/org.darktable.Darktable/issues/68#issuecomment-912062256

hfiguiere commented 2 years ago

I don't think darktable support openCL on Intel GPU. The documentation only mention AMD or Nvidia.

bjoernhohe commented 2 years ago

Works fine when using the PPA instead of flat pack and is noticeably faster

paperdigits commented 2 years ago

Yes, the PPA package has no sandbox and thus darktable can see the openCL Intel driver.

The flatpak needs a flatpak version of the Intel OpenCL driver. I am not sure if one even exists so you should start by see if one does. If it does, then install it.

On September 4, 2021 10:38:08 AM PDT, bjoern @.***> wrote:

Works fine when using the PPA instead of flat pack and is noticeably faster

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/flathub/org.darktable.Darktable/issues/68#issuecomment-913011166

archerallstars commented 2 years ago

I'm also having the same issue. I'm on Intel iGPU.

Yes, OpenCL is available as a flatpak version. Here's my GPU-Viewer (flatpak version) info:

Screenshot from 2022-07-24 01-36-23

It's OpenCL 1.1. I believe Darktable will only work with OpenCL 1.2 ++.

paperdigits commented 2 years ago

From the manual:

A few on-CPU implementations of OpenCL also exist, coming as drivers provided by INTEL or AMD. We have observed that they do not provide any speed gain versus our hand-optimized CPU code. Therefore darktable simply discards these devices by default. This behavior can be changed by setting the configuration variable opencl_use_cpu_devices (in $HOME/.config/darktablerc) to TRUE.

https://docs.darktable.org/usermanual/3.8/en/special-topics/opencl/problems-solutions/

On July 23, 2022 10:42:30 PM PDT, Archer Allstars @.***> wrote:

I'm also having the same issue. I'm on Intel iGPU.

Yes, OpenCL is available as a flatpak version. Here's my GPU-Viewer (flatpak version) info:

Screenshot from 2022-07-24 01-36-23

It's OpenCL 1.1. I believe Darktable will only work with OpenCL 1.2 ++.

-- Reply to this email directly or view it on GitHub: https://github.com/flathub/org.darktable.Darktable/issues/68#issuecomment-1193251845 You are receiving this because you were mentioned.

Message ID: @.***>

marcolaux commented 2 years ago

From the manual: A few on-CPU implementations of OpenCL also exist, coming as drivers provided by INTEL or AMD. We have observed that they do not provide any speed gain versus our hand-optimized CPU code. Therefore darktable simply discards these devices by default. This behavior can be changed by setting the configuration variable opencl_use_cpu_devices (in $HOME/.config/darktablerc) to TRUE. https://docs.darktable.org/usermanual/3.8/en/special-topics/opencl/problems-solutions/

This is sadly for no use as Darktable does not see the drivers in the first place and says it has no image support

Flatpaks can't seem to access the custom OpenCL drivers that are installed on the host globally.

clinfo on the host uses the correct library while the flatpak (and also the clinfo flatpak) can't access it.

Host:

clinfo | grep Device
  Platform Vendor                                 Advanced Micro Devices, Inc.
  Device Name                                     gfx1032
  Device Vendor                                   Advanced Micro Devices, Inc.
  Device Vendor ID                                0x1002
  Device Version                                  OpenCL 2.0 
  Device OpenCL C Version                         OpenCL C 2.0 
  Device Type                                     GPU
  Device Board Name (AMD)                         (n/a)
  Device PCI-e ID (AMD)                           0x73ef
  Device Topology (AMD)                           PCI-E, 0000:03:00.0
  Device Profile                                  FULL_PROFILE
  Device Available                                Yes
  Device Partition                                (core)
  Unified memory for Host and Device              No
  Device Extensions                               cl_khr_fp64 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_fp16 cl_khr_gl_sharing cl_amd_device_attribute_query cl_amd_media_ops cl_amd_media_ops2 cl_khr_image2d_from_buffer cl_khr_subgroups cl_khr_depth_images cl_amd_copy_buffer_p2p cl_amd_assembly_program

flatpak:

flatpak run org.freedesktop.Platform.ClInfo | grep Device
=== CL_PROGRAM_BUILD_LOG ===
fatal error: cannot open file '/usr/lib/x86_64-linux-gnu/GL/default/share/clc/gfx1030-amdgcn-mesa-mesa3d.bc': No such file or directory
  Device Name                                     AMD DIMGREY_CAVEFISH (DRM 3.46.0, 5.18.18-200.fc36.x86_64, LLVM 12.0.1)
  Device Vendor                                   AMD
  Device Vendor ID                                0x1002
  Device Version                                  OpenCL 1.1 Mesa 21.3.9 (git-78c96ae5b6)
  Device Numeric Version                          0x401000 (1.1.0)
  Device OpenCL C Version                         OpenCL C 1.1 
  Device Type                                     GPU
  Device Profile                                  FULL_PROFILE
  Device Available                                Yes
  Unified memory for Host and Device              No
  Device Extensions                               cl_khr_byte_addressable_store cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_fp64 cl_khr_extended_versioning

(ignore the fatal error: cannot open file '/usr/lib/x86_64-linux-gnu/GL/default/share/clc/gfx1030-amdgcn-mesa-mesa3d.bc': No such file or directory part - this has nothing to do with this issue)

I have this setup on Fedora:

❯ ls -al /etc/OpenCL/vendors/
.rw-r--r--@ 19 root 21 Aug 11:59 amdocl64.icd

❯ cat /etc/OpenCL/vendors/amdocl64.icd 
libamdocl64.so.5.2

❯ ls -al /usr/lib64/libamdocl64.so.5.2*
lrwxrwxrwx@   20 root 21 Aug 11:36 /usr/lib64/libamdocl64.so.5.2 -> libamdocl64.so.5.2.1
.rwxr-xr-x@ 1,6M root  1 Jan  1970 /usr/lib64/libamdocl64.so.5.2.1

I tried to add an LD_PRELOAD to the flatpak but it cannot be loaded:

❯ flatpak --user override --env=LD_PRELOAD=/usr/lib64/libamdocl64.so.5.2 org.freedesktop.Platform.ClInfo
❯ flatpak run org.freedesktop.Platform.ClInfo | grep Image
ERROR: ld.so: object '/usr/lib64/libamdocl64.so.5.2' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.

Darktable then suffers from the same restrictions.

jchnkl commented 1 year ago

Hi,

I've been struggling with the same issue. By accident I stumbled upon flatpak's permission system which I wasn't aware of previously. Since I found it quite cumbersome to figure out flatpak's permission system on the CLI I just installed Flatseal (com.github.tchx84.Flatseal) which offers a nice GUI for flatpak apps.

Long story short, I enabled the following permissions (marked with the exclamation mark in the triangle) and now I have flatpak darktable running with OpenCL.

image image image

skoufaki commented 1 year ago

Try installing the Freedesktop runtimes. both the Platform and Sdk

ID | Description -- | -- org.freedesktop.Platform | Runtime org.freedesktop.Sdk | SDK

https://docs.flatpak.org/en/latest/available-runtimes.html

etrigan63 commented 1 year ago

Hi,

I've been struggling with the same issue. By accident I stumbled upon flatpak's permission system which I wasn't aware of previously. Since I found it quite cumbersome to figure out flatpak's permission system on the CLI I just installed Flatseal (com.github.tchx84.Flatseal) which offers a nice GUI for flatpak apps.

Long story short, I enabled the following permissions (marked with the exclamation mark in the triangle) and now I have flatpak darktable running with OpenCL.

image image image

Tried that. Did not work with AMDGPU. Works fine when installed from the extra repo (Arch).

paperdigits commented 1 year ago

Can you please list out all installed flatpaks?

On July 25, 2023 1:40:54 PM PDT, Carlos Echenique @.***> wrote:

Hi,

I've been struggling with the same issue. By accident I stumbled upon flatpak's permission system which I wasn't aware of previously. Since I found it quite cumbersome to figure out flatpak's permission system on the CLI I just installed Flatseal (com.github.tchx84.Flatseal) which offers a nice GUI for flatpak apps.

Long story short, I enabled the following permissions (marked with the exclamation mark in the triangle) and now I have flatpak darktable running with OpenCL.

image image image

Tried that. Did not work with AMDGPU. Works fine when installed from the extra repo (Arch).

-- Reply to this email directly or view it on GitHub: https://github.com/flathub/org.darktable.Darktable/issues/68#issuecomment-1650528591 You are receiving this because you were mentioned.

Message ID: @.***>

etrigan63 commented 1 year ago
guru  ~   16:41    flatpak list
Name                                        Application ID                                Version        Branch           Installation
PDF Arranger                                com.github.jeromerobert.pdfarranger           1.9.2          stable           system
Flatseal                                    com.github.tchx84.Flatseal                    2.0.2          stable           system
PrusaSlicer                                 com.prusa3d.PrusaSlicer                       2.6.0          stable           system
Bottles                                     com.usebottles.bottles                        51.6           stable           system
Podman Desktop                              io.podman_desktop.PodmanDesktop               1.2.1          stable           system
FileZilla                                   org.filezillaproject.Filezilla                3.65.0         stable           system
TAP-plugins                                 org.freedesktop.LinuxAudio.Plugins.TAP        1.0.1          22.08            system
SWH                                         org.freedesktop.LinuxAudio.Plugins.swh        0.4.17         22.08            system
Freedesktop Platform                        org.freedesktop.Platform                      21.08.19       21.08            system
Freedesktop Platform                        org.freedesktop.Platform                      22.08.12.1     22.08            system
Mesa                                        org.freedesktop.Platform.GL.default           21.3.9         21.08            system
Mesa                                        org.freedesktop.Platform.GL.default           23.1.1         22.08            system
Mesa (Extra)                                org.freedesktop.Platform.GL.default           23.1.1         22.08-extra      system
Mesa                                        org.freedesktop.Platform.GL32.default         23.1.1         22.08            system
ffmpeg-full                                 org.freedesktop.Platform.ffmpeg-full                         22.08            system
i386                                        org.freedesktop.Platform.ffmpeg_full.i386                    22.08            system
openh264                                    org.freedesktop.Platform.openh264             2.1.0          2.0              system
openh264                                    org.freedesktop.Platform.openh264             2.1.0          2.2.0            system
Freedesktop SDK                             org.freedesktop.Sdk                           22.08.12.1     22.08            system
GNOME Application Platform version 43       org.gnome.Platform                                           43               system
GNOME Application Platform version 44       org.gnome.Platform                                           44               system
i386                                        org.gnome.Platform.Compat.i386                               43               system
Document Scanner                            org.gnome.SimpleScan                          44.0           stable           system
Adwaita theme                               org.kde.KStyle.Adwaita                                       5.15-22.08       system
KDE Application Platform                    org.kde.Platform                                             5.15-22.08       system
Kdenlive                                    org.kde.kdenlive                              23.04.3        stable           system
Parabolic                                   org.nickvision.tubeconverter                  2023.7.2       stable           system
Standard Notes                              org.standardnotes.standardnotes               3.167.7        stable           system
VLC                                         org.videolan.VLC                              3.0.18         stable           system
Bluray Java menus (BDJ) plugin for VLC      org.videolan.VLC.Plugin.bdj                                  3-22.08          system
MakeMKV plugin for VLC                      org.videolan.VLC.Plugin.makemkv               1.17.4         3-22.08          system
DXVK                                        org.winehq.Wine.DLLs.dxvk                     2.2            stable-22.08     system
Gecko                                       org.winehq.Wine.gecko                                        stable-22.08     system
Mono                                        org.winehq.Wine.mono                                         stable-22.08     system
paperdigits commented 1 year ago

Can you run

flatpak uninstall --unused

And see if that removes any of the duplicate Mesa?

On July 25, 2023 2:10:24 PM PDT, Carlos Echenique @.***> wrote:

guru  ~   16:41    flatpak list
Name                                        Application ID                                Version        Branch           Installation
PDF Arranger                                com.github.jeromerobert.pdfarranger           1.9.2          stable           system
Flatseal                                    com.github.tchx84.Flatseal                    2.0.2          stable           system
PrusaSlicer                                 com.prusa3d.PrusaSlicer                       2.6.0          stable           system
Bottles                                     com.usebottles.bottles                        51.6           stable           system
Podman Desktop                              io.podman_desktop.PodmanDesktop               1.2.1          stable           system
FileZilla                                   org.filezillaproject.Filezilla                3.65.0         stable           system
TAP-plugins                                 org.freedesktop.LinuxAudio.Plugins.TAP        1.0.1          22.08            system
SWH                                         org.freedesktop.LinuxAudio.Plugins.swh        0.4.17         22.08            system
Freedesktop Platform                        org.freedesktop.Platform                      21.08.19       21.08            system
Freedesktop Platform                        org.freedesktop.Platform                      22.08.12.1     22.08            system
Mesa                                        org.freedesktop.Platform.GL.default           21.3.9         21.08            system
Mesa                                        org.freedesktop.Platform.GL.default           23.1.1         22.08            system
Mesa (Extra)                                org.freedesktop.Platform.GL.default           23.1.1         22.08-extra      system
Mesa                                        org.freedesktop.Platform.GL32.default         23.1.1         22.08            system
ffmpeg-full                                 org.freedesktop.Platform.ffmpeg-full                         22.08            system
i386                                        org.freedesktop.Platform.ffmpeg_full.i386                    22.08            system
openh264                                    org.freedesktop.Platform.openh264             2.1.0          2.0              system
openh264                                    org.freedesktop.Platform.openh264             2.1.0          2.2.0            system
Freedesktop SDK                             org.freedesktop.Sdk                           22.08.12.1     22.08            system
GNOME Application Platform version 43       org.gnome.Platform                                           43               system
GNOME Application Platform version 44       org.gnome.Platform                                           44               system
i386                                        org.gnome.Platform.Compat.i386                               43               system
Document Scanner                            org.gnome.SimpleScan                          44.0           stable           system
Adwaita theme                               org.kde.KStyle.Adwaita                                       5.15-22.08       system
KDE Application Platform                    org.kde.Platform                                             5.15-22.08       system
Kdenlive                                    org.kde.kdenlive                              23.04.3        stable           system
Parabolic                                   org.nickvision.tubeconverter                  2023.7.2       stable           system
Standard Notes                              org.standardnotes.standardnotes               3.167.7        stable           system
VLC                                         org.videolan.VLC                              3.0.18         stable           system
Bluray Java menus (BDJ) plugin for VLC      org.videolan.VLC.Plugin.bdj                                  3-22.08          system
MakeMKV plugin for VLC                      org.videolan.VLC.Plugin.makemkv               1.17.4         3-22.08          system
DXVK                                        org.winehq.Wine.DLLs.dxvk                     2.2            stable-22.08     system
Gecko                                       org.winehq.Wine.gecko                                        stable-22.08     system
Mono                                        org.winehq.Wine.mono                                         stable-22.08     system

-- Reply to this email directly or view it on GitHub: https://github.com/flathub/org.darktable.Darktable/issues/68#issuecomment-1650564439 You are receiving this because you were mentioned.

Message ID: @.***>

etrigan63 commented 1 year ago

flatpak uninstall --unused

These runtimes in installation 'system' are pinned and won't be removed; see flatpak-pin(1): runtime/org.videolan.VLC.Plugin.bdj/x86_64/3-22.08 runtime/org.videolan.VLC.Plugin.makemkv/x86_64/3-22.08 Nothing unused to uninstall

etrigan63 commented 1 year ago

I manually removed the extra Mesa and darktable put it back in.

paperdigits commented 1 year ago

Did you try and start darktable after the removal?

On July 25, 2023 2:21:27 PM PDT, Carlos Echenique @.***> wrote:

I manually removed the extra Mesa and darktable put it back in.

-- Reply to this email directly or view it on GitHub: https://github.com/flathub/org.darktable.Darktable/issues/68#issuecomment-1650577755 You are receiving this because you were mentioned.

Message ID: @.***>

etrigan63 commented 1 year ago

darktable flatpak was uninstalled at that point. When I reinstalled it, it put it back in. Also, a bunch of other apps (podman, etc) need the MESA-extra flatpak.

etrigan63 commented 1 year ago

For the record, the rocm-opencl-runtime causes darktable to crash with an LLVM error. If I install opencl-amd darktable runs normally. The flatpak cannot detect either of them reporting that only OpenCL 1.1 is available and the other reports that OpenCL 2.0 is available.

paperdigits commented 1 year ago

OpenCL 1.1 is not enough and flatpak is not able to use system level drivers, the drivers need to be flatpak'd. This is covered earlier in this thread.

On July 25, 2023 2:55:30 PM PDT, Carlos Echenique @.***> wrote:

For the record, the rocm-opencl-runtime causes darktable to crash with an LLVM error. If I install opencl-amd darktable runs normally. The flatpak cannot detect either of them reporting that only OpenCL 1.1 is available and the other reports that OpenCL 2.0 is available.

-- Reply to this email directly or view it on GitHub: https://github.com/flathub/org.darktable.Darktable/issues/68#issuecomment-1650614120 You are receiving this because you were mentioned.

Message ID: @.***>

bengtfalke commented 1 year ago

Are there any progress in this?

archerallstars commented 1 year ago

@bengtfalke

I don't think there will be any progress soon. OpenCL and Flatpak won't work well together, see: issue #1504 and issue #1181 on the upstream repo.

It's not just Darktable that's not working with OpenCL in Flatpak. I can't seem to enable OpenCL in LibreOffice on the Flatpak version at all.

I have OpenCL 3.0 on my system, while it's 1.1 in Flatpak. I don't think there will be any OpenCL app that works correctly in Flatpak.

paperdigits commented 1 year ago

This is a bit misleading. OpenCL is only failing for AMD GPUs, nVidia works fine once you install the flatpak version of the nVidia driver.

But this has mostly held true for a long time for OpenCL: if you want (mostly) working drivers and OpenCL, you have to bite the bullet and buy nVidia.

AMD, for a while, was flip-flopping on if they even wanted to support OpenCL at all in rocm. 🤡

On August 11, 2023 9:48:22 AM PDT, Archer Allstars @.***> wrote:

@bengtfalke

I don't think there will be any progress soon. OpenCL and Flatpak won't work well together, see: issue #1504 and issue #1181 on the upstream repo.

It's not just Darktable that's not working with OpenCL in Flatpak. I can't seem to enable OpenCL in LibreOffice on the Flatpak version at all.

-- Reply to this email directly or view it on GitHub: https://github.com/flathub/org.darktable.Darktable/issues/68#issuecomment-1675084138 You are receiving this because you were mentioned.

Message ID: @.***>

crepererum commented 1 year ago

It's also failing for Intel (or it least it was the last time I've tested) and their drivers are rather solid. I think the reason that Nvidia works here is because it's such a special snowflake and already got special treatment. As the upstream tickets say: it's mostly a question of extending this treatment to other drivers and package them correctly.

superuser-miguel commented 6 months ago

Is there any movement on getting this working?

paperdigits commented 6 months ago

You should ask in the upstream ticket, there is nothing the darktable package can do to make this work.

On February 13, 2024 11:17:58 AM PST, Miguel @.***> wrote:

Is there any movement on getting this working?

-- Reply to this email directly or view it on GitHub: https://github.com/flathub/org.darktable.Darktable/issues/68#issuecomment-1942220936 You are receiving this because you were mentioned.

Message ID: @.***>

lorn10 commented 3 months ago

@superuser-miguel

By the way this issue here is also affecting other "close to the hardware" OpenCL apps like LuxMark.

Perhaps someone should really try to build a Darktable AppImage which wouldn't be hampered by any "no access to the system libraries because of safety concerns" design limitation :wink:

This works almost perfectly fine for the PSX1 emulator PCSX-Redux. Ergo there should really exist a legal way also for Flatpak apps to access the system libraries. 🤡

paperdigits commented 3 months ago

"Solve this with yet another packaging format" is exactly why the upstream darktable project doesn't distribute any official packages for Linux ;)

On May 26, 2024 7:02:38 AM PDT, lorn10 @.***> wrote:

@superuser-miguel

By the way this issue here is also affecting other "close to the hardware" OpenCL apps like LuxMark.

Perhaps someone should really try to build a Darktable AppImage which wouldn't be hampered by any "no access to the system libraries because of safety concerns" design limitation :wink:

This works almost perfectly fine for the PSX1 emulator PCSX-Redux. Ergo there should really exist a legal way also for Flatpak apps to access the system libraries. 🤡

-- Reply to this email directly or view it on GitHub: https://github.com/flathub/org.darktable.Darktable/issues/68#issuecomment-2132234614 You are receiving this because you were mentioned.

Message ID: @.***>