s-u / OpenCL

Interface allowing R to use OpenCL
Other
15 stars 10 forks source link

Intel OpenCL not recognized #4

Closed rstub closed 4 years ago

rstub commented 6 years ago

I have a (Debian stable) system with three OpenCL platforms installed:

$ clinfo | head -21
Number of platforms                               3
  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
  Platform Extensions function suffix             Intel

  Platform Name                                   Intel(R) OpenCL
  Platform Vendor                                 Intel(R) Corporation
  Platform Version                                OpenCL 2.0 
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_depth_images cl_khr_fp64 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_icd cl_khr_image2d_from_buffer cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_spir
  Platform Extensions function suffix             INTEL

  Platform Name                                   Portable Computing Language
  Platform Vendor                                 The pocl project
  Platform Version                                OpenCL 2.0 pocl 0.13, LLVM 3.8.1
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd
  Platform Extensions function suffix             POCL

Beignet and POCL have been installed from the Debian repositories. For Intel OpenCL I used the binary installer from Intel. A simple sample program finds all three platforms:

#include <stdio.h>
#include <CL/cl.h>

int main(void)
{
    cl_int err;
    cl_uint numPlatforms = 0;

    err = clGetPlatformIDs(0, NULL, &numPlatforms);
    if (CL_SUCCESS == err)
        printf("Detected OpenCL platforms: %d\n", numPlatforms);
    else
        printf("Error calling clGetPlatformIDs. Error code: %d\n", err);
    return 0;
}

Output:

$ ./platforms 
Detected OpenCL platforms: 3

However, OpenCL::oclPlatforms() finds only two of them:

OpenCL::oclPlatforms()
#> [[1]]
#>  OpenCL platform 'Intel Gen OCL Driver'
#> 
#> [[2]]
#>  OpenCL platform 'Portable Computing Language'
packageVersion("OpenCL")
#> [1] '0.1.4'
aaronpuchert commented 6 years ago

It's probably easiest to debug this yourself, it's just a few lines of code. I don't see an obvious reason why this could fail, it's essentially doing the same as your sample program.

s-u commented 4 years ago

I would suspect LD_LIBRAY_PATH or similar settings are different in R and when you run the binary. Closing as not reproducible.