Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem loading OpenCL 2.0 on Intel i7 #59

Closed
botev opened this issue Feb 3, 2017 · 7 comments
Closed

Problem loading OpenCL 2.0 on Intel i7 #59

botev opened this issue Feb 3, 2017 · 7 comments

Comments

@botev
Copy link

botev commented Feb 3, 2017

Ok so I tried the simple example of just listing my platform. Got some errors and other problems. So first on my system I've installed the Intel OpenCL 2.0 extension. When I do clinfo in terminal I get:

 Platform ID:					 0x201f9e0
  Name:						 Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz
  Vendor:					 Intel(R) Corporation
  Device OpenCL C version:			 OpenCL C 2.0 
  Driver version:				 1.2.0.18
  Profile:					 FULL_PROFILE
  Version:					 OpenCL 2.1 (Build 18)
  Extensions:					 cl_khr_icd 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_depth_images cl_khr_3d_image_writes cl_intel_exec_by_local_thread cl_khr_spir cl_khr_fp64 cl_khr_image2d_from_buffer 

Running the example for the platform in Rust gave me:

Platform:
    Profile: FULL_PROFILE
    Version: OpenCL 1.2 LINUX
    Name: Intel(R) OpenCL
    Vendor: Intel(R) Corporation
    Extensions: cl_khr_icd 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_depth_images cl_khr_3d_image_writes cl_intel_exec_by_local_thread cl_khr_spir cl_khr_fp64

and for the device:

Name: Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz
    Vendor: Intel(R) Corporation
    DriverVersion: 1.2.0.43
    Profile: FULL_PROFILE
    Version: OpenCL 1.2 (Build 43)
    Extensions: cl_khr_icd 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_depth_images cl_khr_3d_image_writes cl_intel_exec_by_local_thread cl_khr_spir cl_khr_fp64 
    Platform: PlatformId(0x7f30dba150b0)
    DoubleFpConfig: FP_DENORM | FP_INF_NAN | FP_ROUND_TO_NEAREST | FP_ROUND_TO_ZERO | FP_ROUND_TO_INF | FP_FMA
    HalfFpConfig: 

Additionally the HalffpConfig produced the error:

################################ OPENCL ERROR ############################### 

Error executing function: clGetDeviceInfo  

Status error code: CL_INVALID_VALUE (-30)  

Please visit the following url for more information: 

https://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clGetDeviceInfo.html#errors  

First is it intentional there is no option to loading the 2.0 version or potentially this might mean that my environment is not pointing to it correctly.
Also any idea about the HalfFpConfig?

@c0gent
Copy link
Member

c0gent commented Feb 3, 2017

So for starters yes, you may have some sort of issue with your ICD loader. You might be linking directly to an OpenCL 1.2 driver instead of your system-wide loader, which should include all installed platforms. Let me know which OS you're on and I'll point you in the right direction. If you're on Windows this could be related to the recently added build script and we'll need to improve that script if that's the case (we simply haven't had enough people use it yet).

The HalffpConfig error is normal, it just means your driver doesn't support it. That error should probably be silenced or something.

Additionally, there are various quirks with OpenCL 2.0+ on every platform I know of (AMD, NVIDIA, Intel, ARM) such as the version not displaying correctly but in this case I think we just need to tweak or fix how your library is being linked.

@botev
Copy link
Author

botev commented Feb 3, 2017

I'm on ubuntu 14.04, more specifically:
Linux botev-ThinkPad-T440 3.19.0-25-generic #26~14.04.1-Ubuntu SMP Fri Jul 24 21:16:20 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

@c0gent
Copy link
Member

c0gent commented Feb 3, 2017

Ok so you need to relink your OpenCL loader if you want to use OpenCL 2.0+ features.

There are a number of ways to configure this but you should have /usr/lib/libOpenCL.so linked (eventually) to the system wide loader rather than a specific vendor's library.

For troubleshooting purposes however, first locate your OpenCL 2.x library. It's probably in /opt/intel/ somewhere. Possibly /opt/intel/intel-opencl{...}/opencl/lib64/libOpenCL.so.X....

  • Find the libOpenCL that is the actual binary and not a symlink.
  • Temporarily rename /usr/lib/libOpenCL.so to /usr/lib/libOpenCL.so.bak
  • Do: sudo ln {path to intel binary} /usr/lib/libOpenCL.so

This should link your Intel 2.x library as your system default (assuming you have no other custom ld stuff going on). Run the ocl info and info-core examples and see what you see.

If that works and you have no immediate need to use another device, leave it alone. If you want to set your libraries up properly to the system loader (which should be able to load all available platforms) I can help you sort that out.

@botev
Copy link
Author

botev commented Feb 3, 2017

Ah it was quite a dumb mistake, I was just not looping trough the platforms (I assumed that the 2.0 was overwriting the previous) thus I was just listing the OpenCL 1.2. Just to update the output now is as expected:

Platform:
    Profile: FULL_PROFILE
    Version: OpenCL 1.2 LINUX
    Name: Intel(R) OpenCL
    Vendor: Intel(R) Corporation
    Extensions: cl_khr_icd 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_depth_images cl_khr_3d_image_writes cl_intel_exec_by_local_thread cl_khr_spir cl_khr_fp64 
    Total Device Count: 1
    Device[0]: 
        Name: Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz
        Type: DEVICE_TYPE_CPU
        Vendor: Intel(R) Corporation[32902]
        MaxComputeUnits: 4
        MaxWorkItemDimensions: 3
        MaxWorkGroupSize: 8192
        MaxWorkItemSizes: [8192, 8192, 8192]

Platform:
    Profile: FULL_PROFILE
    Version: OpenCL 2.1 LINUX
    Name: Experimental OpenCL 2.1 CPU Only Platform
    Vendor: Intel(R) Corporation
    Extensions: cl_khr_icd 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_depth_images cl_khr_3d_image_writes cl_intel_exec_by_local_thread cl_khr_spir cl_khr_fp64 cl_khr_image2d_from_buffer 
    Total Device Count: 1
    Device[0]: 
        Name: Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz
        Type: DEVICE_TYPE_CPU
        Vendor: Intel(R) Corporation[32902]
        MaxComputeUnits: 4
        MaxWorkItemDimensions: 3
        MaxWorkGroupSize: 8192
        MaxWorkItemSizes: [8192, 8192, 8192]

@botev
Copy link
Author

botev commented Feb 3, 2017

One suggestion though. If you remember I was getting an error from the HalfFpConfig:

################################ OPENCL ERROR ############################### 

Error executing function: clGetDeviceInfo  

Status error code: CL_INVALID_VALUE (-30)  

Please visit the following url for more information: 

https://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clGetDeviceInfo.html#errors  

And this pops up when you call device.to_stirng(). I suggest that the method should unwrap any errors and just add to the string and indication it does not support that info, rather than breaking the string and giving up.

@c0gent
Copy link
Member

c0gent commented Feb 3, 2017

Yeah I've been meaning to get to that...

I actually wanted to do a detection of whether or not the device supports each particular feature before even requesting info for it but it remains on my very long list of things to get to.

@c0gent
Copy link
Member

c0gent commented Feb 5, 2017

@c0gent c0gent closed this as completed Feb 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants