Unable to activate OpenCL

Hello,
I have been trying to get LibreOffice 6.2 to use OpenCL to accelerate processing large spreadsheets (over 3MB raw data). I am running Ubuntu Mate 18.04.3 with the 5.3.1 Mainline kernel.
clinfo output:


    Number of platforms                               1
  Platform Name                                   Intel Gen OCL Driver
  Platform Vendor                                 Intel
  Platform Version                                OpenCL 2.0 beignet 1.3
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             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_byte_addressable_store cl_khr_3d_image_writes cl_khr_image2d_from_buffer cl_khr_depth_images cl_khr_spir cl_khr_icd cl_intel_accelerator cl_intel_subgroups cl_intel_subgroups_short cl_khr_gl_sharing
  Platform Extensions function suffix             Intel

  Platform Name                                   Intel Gen OCL Driver
Number of devices                                 1
  Device Name                                     Intel(R) HD Graphics 5500 BroadWell U-Processor GT2
  Device Vendor                                   Intel
  Device Vendor ID                                0x8086
  Device Version                                  OpenCL 1.2 beignet 1.3
  Driver Version                                  1.3
  Device OpenCL C Version                         OpenCL C 1.2 beignet 1.3
  Device Type                                     GPU
  Device Profile                                  FULL_PROFILE
  Device Available                                Yes
  Compiler Available                              Yes
  Linker Available                                Yes
  Max compute units                               24
  Max clock frequency                             1000MHz
  Device Partition                                (core)
    Max number of sub-devices                     1
    Supported partition types                     None, None, None
  Max work item dimensions                        3
  Max work item sizes                             512x512x512
  Max work group size                             512
  Preferred work group size multiple              16
  Preferred / native vector sizes                 
    char                                                16 / 8       
    short                                                8 / 8       
    int                                                  4 / 4       
    long                                                 2 / 2       
    half                                                 0 / 8        (cl_khr_fp16)
    float                                                4 / 4       
    double                                               0 / 2        (n/a)
  Half-precision Floating-point support           (cl_khr_fp16)
    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
  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         (n/a)
  Address bits                                    32, Little-Endian
  Global memory size                              4294967296 (4GiB)
  Error Correction support                        No
  Max memory allocation                           2147483648 (2GiB)
  Unified memory for Host and Device              Yes
  Minimum alignment for any data type             128 bytes
  Alignment of base address                       1024 bits (128 bytes)
  Global Memory cache type                        Read/Write
  Global Memory cache size                        8192 (8KiB)
  Global Memory cache line size                   64 bytes
  Image support                                   Yes
    Max number of samplers per kernel             16
    Max size for 1D images from buffer            65536 pixels
    Max 1D or 2D image array size                 2048 images
    Base address alignment for 2D image buffers   4096 bytes
    Pitch alignment for 2D image buffers          1 pixels
    Max 2D image size                             8192x8192 pixels
    Max 3D image size                             8192x8192x2048 pixels
    Max number of read image args                 128
    Max number of write image args                8
  Local memory type                               Local
  Local memory size                               65536 (64KiB)
  Max number of constant args                     8
  Max constant buffer size                        134217728 (128MiB)
  Max size of kernel argument                     1024
  Queue properties                                
    Out-of-order execution                        No
    Profiling                                     Yes
  Prefer user sync for interop                    Yes
  Profiling timer resolution                      80ns
  Execution capabilities                          
    Run OpenCL kernels                            Yes
    Run native kernels                            Yes
    SPIR versions                                 1.2
  printf() buffer size                            1048576 (1024KiB)
  Built-in kernels                                __cl_copy_region_align4;__cl_copy_region_align16;__cl_cpy_region_unalign_same_offset;__cl_copy_region_unalign_dst_offset;__cl_copy_region_unalign_src_offset;__cl_copy_buffer_rect;__cl_copy_image_1d_to_1d;__cl_copy_image_2d_to_2d;__cl_copy_image_3d_to_2d;__cl_copy_image_2d_to_3d;__cl_copy_image_3d_to_3d;__cl_copy_image_2d_to_buffer;__cl_copy_image_3d_to_buffer;__cl_copy_buffer_to_image_2d;__cl_copy_buffer_to_image_3d;__cl_fill_region_unalign;__cl_fill_region_align2;__cl_fill_region_align4;__cl_fill_region_align8_2;__cl_fill_region_align8_4;__cl_fill_region_align8_8;__cl_fill_region_align8_16;__cl_fill_region_align128;__cl_fill_image_1d;__cl_fill_image_1d_array;__cl_fill_image_2d;__cl_fill_image_2d_array;__cl_fill_image_3d;
  Device Extensions                               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_byte_addressable_store cl_khr_3d_image_writes cl_khr_image2d_from_buffer cl_khr_depth_images cl_khr_spir cl_khr_icd cl_intel_accelerator cl_intel_subgroups cl_intel_subgroups_short cl_khr_gl_sharing cl_khr_fp16

NULL platform behavior
  clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...)  Intel Gen OCL Driver
  clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)   Success [Intel]
  clCreateContext(NULL, ...) [default]            Success [Intel]
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT)  Success (1)
    Platform Name                                 Intel Gen OCL Driver
    Device Name                                   Intel(R) HD Graphics 5500 BroadWell U-Processor GT2
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU)  Success (1)
    Platform Name                                 Intel Gen OCL Driver
    Device Name                                   Intel(R) HD Graphics 5500 BroadWell U-Processor GT2
  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 Gen OCL Driver
    Device Name                                   Intel(R) HD Graphics 5500 BroadWell U-Processor GT2

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

Everytime I try to Select the OpenCL option it asks me to restart LibO. When it does the option is disabled again.
How can I fix this issue?

Unfortunately OpenCL implementations greatly vary between drivers and devices, and not all are suitable. Or rather, few are. In this case I guess it’s because it is not whitelisted. Or otherwise the driver doesn’t pass the tests LibreOffice carries out so it gets disabled. I’m wondering though that the Vendor is given just as Intel instead of Intel(R) Corporation (which then would match the whitelist).

You can try to add the device/driver details to your user profile’s registrymodifications.xcu (see https://wiki.documentfoundation.org/UserProfile#GNU.2FLinux for where it’s located) in OpenCLWhiteList and see if it works; note it may crash LibreOffice or even worse, calculate some things wrongly. Look for

<item oor:path="/org.openoffice.Office.Common/Misc"><prop oor:name="OpenCLWhiteList" oor:op="fuse">

(that should be present if you tried to enable OpenCL) and in the <value> list add an item

<it>Linux//Intel//OpenCL 2\.0 beignet 1\.3</it>

Note the // double slashes that delimit empty fields. I’m not entirely sure about the OpenCL 2\.0 beignet 1\.3 that should be the device driver version, it could also be just 1\.3 (note the string is a regular expression, hence the \. escaped dot).

I’m not responsible if this toasts your machine!

Please give feedback, if it works for you and calculates things correctly then we maybe could add the driver to the known whitelist.

The list item above didn’t work. I’m gonna try messing around with this a little.
Btw. So far I’ve only managed to toast a GPU due to attempting to control a motor using the DDC interface :wink:

Edit: I’ve just found this string in here:

Intel(R) HD Graphics 5500 BroadWell U-Processor GT2

Edit2: Nvm, I remember adding this myself. derp

Ok, So far I’ve tried 2.0 beignet 1.3, 1.3, 1.2 etc.
Is there a way to get a verbose log?

Only in a debug build you’d have to compile yourself, it could output the detected device info (might be worth changing that to also production build). However, if it fails with all version strings tried then possibly it fails during the runtime check, in which case nothing would help.

Hello @ΩElias :slight_smile: I suggest running clinfo command to get the present status of your OpenCL. If the result is 0 (zero). Then you need to install the appropriate OpenCL package(s) for your CPU.

Below is the same as above. But with details if you’re interested in those.

Steps

  1. Install this clinfo package Debian -- Package Search Results -- clinfo

  2. If not already done, install this sudo package Debian -- Package Search Results -- sudo

  3. Using Terminal, run this command get the present status of your OpenCL sudo clinfo

  4. If Terminal return this message Number of platforms 0 Then it is likely that OpenCL is not install, or not configure properly, or the wrong package was installed.

  5. If OpenCL is not install. You need to install the appropriate OpenCL package(s) for your CPU. For example, for Debian 10 Buster, with an Intel i7 CPU & NVIDIA graphics, install this package nvidia-opencl-icd at Debian -- Details of package nvidia-opencl-icd in buster

  6. Restart your device

  7. Using Terminal, run this command again to get the present status of your OpenCL sudo clinfo. If the result is not zero then you have successfully installed OpenCL for your device.

  8. Using LibreOffice, try to activate OpenCL again. Enjoy much faster calculations in LibreOffice.