Cannot get OpenCL to work on VIM3 Pro

Hi all,

I recently received my VIM3, and installed the Ubuntu Bionic 5.5 to an SD-card that I will be booting from. When I try to run clinfo, it outputs that the number of platforms is 0. I checked for libMali.so in /usr/bin/aarch64-linux-gnu, but I didn’t find it there. Shouldn’t the graphics driver already be installed, or do I need to explicitly install the drivers? In that case, where can I download them?

Edit: I now tried to install the drivers with sudo apt-get install linux-gpu-mali-fbdev, but I now get the following output from clinfo (e.g. no Device Name):

Number of platforms                               1
  Platform Name                                   ARM Platform
  Platform Vendor                                 ARM
  Platform Version                                OpenCL 2.0 git.c8adbf9.122c9daed32dbba4b3056f41a2f23c58
  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_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_fp16 cl_khr_icd cl_khr_egl_image cl_khr_image2d_from_buffer cl_khr_depth_images cl_khr_subgroups cl_khr_create_command_queue cl_arm_core_id cl_arm_printf cl_arm_thread_limit_hint cl_arm_non_uniform_work_group_size cl_arm_import_memory cl_arm_shared_virtual_memory
  Platform Extensions function suffix             ARM

  Platform Name                                   ARM Platform
Number of devices                                 1
Failed creating base context during opening of kernel driver.
Kernel module may not have been loaded
  Device Name                                     <printDeviceInfo:0: get CL_DEVICE_NAME size : error -6>
  Device Vendor                                   ARM
Failed creating base context during opening of kernel driver.
Kernel module may not have been loaded
  Device Vendor ID                                <printDeviceInfo:2: get CL_DEVICE_VENDOR_ID : error -6>
  Device Version                                  OpenCL 2.0 git.c8adbf9.122c9daed32dbba4b3056f41a2f23c58
  Driver Version                                  2.0
  Device OpenCL C Version                         OpenCL C 2.0 git.c8adbf9.122c9daed32dbba4b3056f41a2f23c58
  Device Type                                     GPU
  Device Profile                                  FULL_PROFILE
  Device Available                                Yes
  Compiler Available                              Yes
  Linker Available                                Yes
Failed creating base context during opening of kernel driver.
Kernel module may not have been loaded
  Max compute units                               <printDeviceInfo:17: get CL_DEVICE_MAX_COMPUTE_UNITS : error -6>
Failed creating base context during opening of kernel driver.
Kernel module may not have been loaded
  Max clock frequency                             <printDeviceInfo:21: get CL_DEVICE_MAX_CLOCK_FREQUENCY : error -6>
  Device Partition                                (core)
Max number of sub-devices                     0
Supported partition types                     None
  Max work item dimensions                        3
Failed creating base context during opening of kernel driver.
Kernel module may not have been loaded
  Max work item sizes                             <printDeviceInfo:36: get number of CL_DEVICE_MAX_WORK_ITEM_SIZES : error -6>
Failed creating base context during opening of kernel driver.
Kernel module may not have been loaded
  Max work group size                             <printDeviceInfo:37: get CL_DEVICE_MAX_WORK_GROUP_SIZE : error -6>
Failed creating base context during opening of kernel driver.
Kernel module may not have been loaded
  Preferred work group size multiple              <getWGsizes:671: create context : error -6>
  Preferred / native vector sizes
char                                                16 / 4
short                                                8 / 2
int                                                  4 / 1
long                                                 2 / 1
half                                                 8 / 2        (cl_khr_fp16)
float                                                4 / 1
double                                               0 / 0        (n/a)
  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  No
  Double-precision Floating-point support         (n/a)
  Address bits                                    64, Little-Endian
Failed creating base context during opening of kernel driver.
Kernel module may not have been loaded
  Global memory size                              <printDeviceInfo:74: get CL_DEVICE_GLOBAL_MEM_SIZE : error -6>
  Error Correction support                        No
Failed creating base context during opening of kernel driver.
Kernel module may not have been loaded
  Max memory allocation                           <printDeviceInfo:80: get CL_DEVICE_MAX_MEM_ALLOC_SIZE : error -6>
  Unified memory for Host and Device              Yes
Failed creating base context during opening of kernel driver.
Kernel module may not have been loaded
  Shared Virtual Memory (SVM) capabilities        <printDeviceInfo:83: get CL_DEVICE_SVM_CAPABILITIES : error -6>
Failed creating base context during opening of kernel driver.
Kernel module may not have been loaded
  Shared Virtual Memory (SVM) capabilities (ARM)  <printDeviceInfo:84: get CL_DEVICE_SVM_CAPABILITIES_ARM : error -6>
  Minimum alignment for any data type             128 bytes
  Alignment of base address                       1024 bits (128 bytes)
  Preferred alignment for atomics
SVM                                           0 bytes
Global                                        0 bytes
Local                                         0 bytes
  Max size for global variable                    65536 (64KiB)
  Preferred total size of global vars             0
  Global Memory cache type                        Read/Write
Failed creating base context during opening of kernel driver.
Kernel module may not have been loaded
  Global Memory cache size                        <printDeviceInfo:97: get CL_DEVICE_GLOBAL_MEM_CACHE_SIZE : error -6>
Failed creating base context during opening of kernel driver.
Kernel module may not have been loaded
  Global Memory cache line size                   <printDeviceInfo:98: get CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE : error -6>
  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   32 bytes
Pitch alignment for 2D image buffers          64 pixels
Max 2D image size                             65536x65536 pixels
Max 3D image size                             65536x65536x65536 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                    1
  Max pipe packet size                            1024
  Local memory type                               Global
  Local memory size                               32768 (32KiB)
  Max number of constant args                     8
  Max constant buffer size                        65536 (64KiB)
  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                                2097152 (2MiB)
Max size                                      16777216 (16MiB)
  Max queues on device                            1
  Max events on device                            1024
  Prefer user sync for interop                    No
Failed creating base context during opening of kernel driver.
Kernel module may not have been loaded
  Profiling timer resolution                      <printDeviceInfo:145: get CL_DEVICE_PROFILING_TIMER_RESOLUTION : error -6>
  Execution capabilities
Run OpenCL kernels                            Yes
Run native kernels                            No
  printf() buffer size                            1048576 (1024KiB)
  Built-in kernels
  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_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_fp16 cl_khr_icd cl_khr_egl_image cl_khr_image2d_from_buffer cl_khr_depth_images cl_khr_subgroups cl_khr_create_command_queue cl_arm_core_id cl_arm_printf cl_arm_thread_limit_hint cl_arm_non_uniform_work_group_size cl_arm_import_memory cl_arm_shared_virtual_memory

NULL platform behavior
  clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...)  ARM Platform
  clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)   Success [ARM]
Failed creating base context during opening of kernel driver.
Kernel module may not have been loaded
  clCreateContext(NULL, ...) [default]            <checkNullCtx:2694: create context with device from default platform : error -6>
Failed creating base context during opening of kernel driver.
Kernel module may not have been loaded
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT)  <checkNullCtxFromType:2737: create context from type CL_DEVICE_TYPE_DEFAULT : error -6>
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  No devices found in platform
Failed creating base context during opening of kernel driver.
Kernel module may not have been loaded
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU)  <checkNullCtxFromType:2737: create context from type CL_DEVICE_TYPE_GPU : error -6>
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM)  No devices found in platform
Failed creating base context during opening of kernel driver.
Kernel module may not have been loaded
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL)  <checkNullCtxFromType:2737: create context from type CL_DEVICE_TYPE_ALL : error -6>

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

How can I fix these errors?

Hi, I noticed that there was a lot of variables missing in the driver if you compare it to Rockchip.
For me, I miss the EGV variables: x

Be careful the kernel 5.5 do not support the nvme actually.

Thanks for a quick reply! How do I set these missing variables? Which commands do I run?

The others will be better than me, because I find it hard :slight_smile:

1 Like

No person is better than themselves,
so never underestimate yourself :wink:

Hello @marvin.reza I see you have problems with the OpenCL,
I would suggest using the Latest 4.9 kernel image, as it has everything preconfigured, it would be way more difficult in 5.5 where you do it manually, Also 5.5 rc2 has a whole lot of bugs, so I would say use a newer image :slightly_smiling_face:

Thanks for the suggestion @Electr1 – I will try it now – btw, does it also have anything to say if I use XFCE vs Server?

I guess server is better, it will minimize the load impact on the CPU and GPU, related with using a Display manager,

Please see some of the tests we ran with OpenCL for performance numbers, and other Info:

Electr1, I read the sources and I notice that the mali drivers to merge with the lib mesa 3D. Is it interesting to use the latest version of mesa?

@marvin, i would use XFCE unless you feel comfortable reconfiguring X11

I am not entirely sure about Graphics drivers @ronron, you better ask the more experienced guys about that :slightly_smiling_face:, But, I think the latest Mesa drivers offer some better performance, but please verify, I am much confused with all the words, Panfrost, Mesa, lib Mesa 3d :woozy_face:

It worked! Thank you so much !!!:slight_smile:

No problem @marvin.reza :slight_smile:, Glad it works,
what is your Application by the way, does your project heavily depend on OpenCL ?

Please mark it as solution if you are satisfied