Opencl clGetDeviceIDs(platform, CL_DEVICE_TYPE_CPU, 0, NULL, &num_devices) returning -1 - opencl

I'm using Intel OpenCL SDK. Last month, when I tried to run my opencl code on CPU present in my system , by clGetDeviceIDs(platform, CL_DEVICE_TYPE_CPU, 0, NULL, &num_devices), it worked..and number of total platforms its detected is 2.One is Intel GPU and another is Intel CPU.I was able to run the code both on Intel GPU and CPU just by changing the macro CL_DEVICE_TYPE_CPU.
But now when I try to detect the platform and devices on the same system, its not detecting CPU. Its showing available platforms as 1 that is Intel GPU.
So, when clGetDeviceIDs(platform, CL_DEVICE_TYPE_CPU, 0, NULL,&num_devices); is called it returns -1 (CL_DEVICE_NOT_FOUND) and program is exiting.
Can anyone please help me on resolving the issue , why on the same system CPU is not getting detected, when we have Intel CPU available on it.
But GPU is getting detected correctly with macro CL_DEVICE_TYPE_GPU.
Thanks.

Intel OpenCL runtime for GPU is a part of Intel GPU driver. So, it is enough to install the GPU driver from Intel and you will be able to get OpenCL device for Intel GPU. But Intel OpenCL runtime for CPU should be installed separately: OpenCL Runtimes for Intel Processors. If Intel OpenCL runtime for CPU is installed but OpenCL CPU device is not available, it is necessary to check that ICD knows about the installed runtime and can find it. Please see sections 2.5-2.7 in The OpenCL Extension Specification on how the ICD loader looks for the runtime libraries.

Related

Intel SDK for OpenCL Installation

My question is related to the following question:
Installing Intel SDK for OpenCL Application Setup and got an error below
When I try to install the Intel SDK for OpenCL it tells me that the OpenCL driver is missing or out of date.
The problem I also have is that I cannot even install the OpenCL™ Runtime for Intel® Core.
This is the message I get:
When I try to uninstall the Intel HD graphics driver it gets installed back.
I have tried to disconnect from the internet, uninstall the driver, restart and try to install the OpenCL Runtime, but it gives me the same message.
My laptop has:
Intel(R) Core(TM) i5 CPU
Intel(R) HD Graphics
Intel software is a horrible mess, bigger than its hardware mess (and their help is so useful as an hernia), in my experience:
OpenCL and Cuda SDKs are hardware dependent and driver specific, so you should install the included driver, in the case it doesn't work, try updating your computer bios and try again.
I have to use Intel OpenCL not by my own choice, the SDK keeps uninstalling itself silently and sometimes makes the computer lag. and I have an i7 7thGen with Intel HD-630.

OpenCL for Intel CPU and Nvidia GPU simultaneously

I am trying to get started with some OpenCL coding.
I've installed the NVidia CUDA OpenCL on my computer and have managed to build a simple "Hello World!" application using Visual Studio 2017.
I have also installed the Intel OpenCL SDK (installation warned me that I needed to update my OpenCL drivers but the Intel update manager was telling me that everything was up to date, so I'm not sure whether this could be an issue).
Now whenever I query the OpenCL platforms on my PC lie so:
std::vector< cl::Platform > platformList;
cl::Platform::get(&platformList);
I only get back my nVidia openCL platform, with my GPU as the only device. I am not getting anything back for my CPU.
Can anyone help? Is it possible to perform both CPU and GPU OpenCL computations in the same project (In different OpenCL contexts? How would I go about doing this?
Seems that Intel GPU driver was not installed properly. You can install a CPU-only package instead:
https://software.intel.com/en-us/articles/opencl-drivers#latest_CPU_runtime

Beignet does not find CPU

I am using Beignet to try out OpenCL on my notebook with a 4th gen i7 and integrated graphic accelerator, running Ubuntu 16.04
Upon running clinfo I only find 1 platform and 1 device, which is the graphic accelerator.
Should I not find also the CPU itself? As I have read that OpenCL allows to use the host as a normal device and run some kernels on it
Beignet does not include an ICD for Intel CPUs, it's only for the integrated GPU:
Beignet is an open source implementation of the OpenCL specification - a generic compute oriented API. This code base contains the code to run OpenCL programs on Intel GPUs which basically defines and implements the OpenCL host functions required to initialize the device, create the command queues, the kernels and the programs and run them on the GPU.
(from the official beignet webpage)
You need to install the intel ICD, since there appears to not be an open source OCL implementation for intel CPUs.

AMD APP SDK (OpenCL) doesn't detect AMD CPU

I've got an AMD FX-8350 CPU and a NVIDIA GeForce GTX 960 GPU on a PC with OpenSUSE Leap x86_64. I want to work with CUDA and OpenCL on it, so I first installed Cuda Toolkit 7.5. That worked fine.
Then, I installed AMD APP SDK 3.0, because I want to work OpenCL on the AMD CPU. That worked fine, it seems. $AMDAPPSDKROOT echoes /opt/AMDAPPSDK-3.0 and $LD_LIBRARY_PATH echoes /opt/AMDAPPSDK-3.0/lib/x86_64/.
After that, I compiled and ran a basic deviceQuery code (basically this one, but modified to show platform name) with the following command:
gcc -L$AMDAPPSDKROOT/lib/x86_64/ -I$AMDAPPSDKROOT/include anotherDeviceQuery.c -lOpenCL
The code compiles and executes, but the output only shows the NVIDIA GPU info.
Platform NVIDIA CUDA found.
1. Device: GeForce GTX 960
1.1 Hardware version: OpenCL 1.2 CUDA
1.2 Software version: 352.39
1.3 OpenCL C version: OpenCL C 1.2
1.4 Parallel compute units: 8
I can't seem to find any solution. What could the problem be?
According to this web page, your AMD CPU FX-8350 is not supported by the AMD APP SDK 3.0 (OpenCL 2.0).
All the devices listed there are either GPUs or CPUs with an integrated graphics core (APU). So, I would not expect that your CPU-only will be supported in the near future, because OpenCL is mainly designed to run kernel code on the faster GPU (part).

Run OpenCL program on NVIDIA hardware

I've build a simple OpenCL based program (in C++) and tested in on Windows 8 system with AMD FirePro V4900 card. I was using AMD APP SDK.
When I copy my binaries to the other machine (Windows 8 with NVIDIA Quadro 4000 card) I get
"The procedure entry point clReleaseDevice couldn't be located in the dynamic linked library (exe of my program)". This second machine has the latest NVIDIA drivers and CUDA 5 installed.
Any ideas on what to I need to make it work with NVIDIA hardware?
Its an OpenCL 1.1 vs 1.2 version issue. Nvidia are STILL on OpenCL version 1.1. You have used AMD's OpenCL 1.2. To get and OpenCL app that works on both systems need to remove your clReleaseDevice API call and other 1.2 calls and recompile using the AMD SDK with the 1.1 version option.

Resources