As the title suggests, the OpenCL API only detects my Intel iGPU but not the CPU itself. any ideas on why ? I have installed the Intel-opencl-icd via the package manager but it doesn't seem to be enough to find the CPU.
For context this is the code I have so far.
#include <iostream>
#include <vector>
#include <CL/opencl.hpp>
int main(int argc, char const *argv[])
{
std::vector<cl::Platform> platforms;
cl::Platform::get(&platforms);
std::cout << "Numbers of platforms : " << platforms.size() << std::endl;
int platform_id = 0;
int device_id = 0;
for(cl::vector<cl::Platform>::iterator it = platforms.begin(); it != platforms.end(); ++it){
cl::Platform platform(*it);
std::cout << "Platform ID: " << platform_id++ << std::endl;
std::cout << "Platform Name: " << platform.getInfo<CL_PLATFORM_NAME>() << std::endl;
std::cout << "Platform Vendor: " << platform.getInfo<CL_PLATFORM_VENDOR>() << std::endl;
cl::vector<cl::Device> devices;
platform.getDevices(CL_DEVICE_TYPE_ALL, &devices);
for(cl::vector<cl::Device>::iterator it2 = devices.begin(); it2 != devices.end(); ++it2){
cl::Device device(*it2);
std::cout << "\tDevice " << device_id++ << ": " << std::endl;
std::cout << "\t\tDevice Name: " << device.getInfo<CL_DEVICE_NAME>() << std::endl;
std::cout << "\t\tDevice Type: " << device.getInfo<CL_DEVICE_TYPE>();
std::cout << " (GPU: " << CL_DEVICE_TYPE_GPU << ", CPU: " << CL_DEVICE_TYPE_CPU << ")" << std::endl;
std::cout << "\t\tDevice Vendor: " << device.getInfo<CL_DEVICE_VENDOR>() << std::endl;
std::cout << "\t\tDevice Max Compute Units: " << device.getInfo<CL_DEVICE_MAX_COMPUTE_UNITS>() << std::endl;
std::cout << "\t\tDevice Global Memory: " << device.getInfo<CL_DEVICE_GLOBAL_MEM_SIZE>() << std::endl;
std::cout << "\t\tDevice Max Clock Frequency: " << device.getInfo<CL_DEVICE_MAX_CLOCK_FREQUENCY>() << std::endl;
std::cout << "\t\tDevice Max Allocateable Memory: " << device.getInfo<CL_DEVICE_MAX_MEM_ALLOC_SIZE>() << std::endl;
std::cout << "\t\tDevice Local Memory: " << device.getInfo<CL_DEVICE_LOCAL_MEM_SIZE>() << std::endl;
std::cout << "\t\tDevice Available: " << device.getInfo< CL_DEVICE_AVAILABLE>() << std::endl;
}
std::cout<< std::endl;
}
return 0;
}
It technically wouldn't be too much of an issue not being able to run the code on the CPU cores but I wanted to see the difference in speed between using the CPU cores and GPU cores as I'm just starting in OpenCL
Thanks
Install the latest Intel OpenCL CPU Runtime. This works for both Intel and AMD CPUs. The corresponding GitHub repository is here.
Note: Do not use the old 16.1 or 18.1 versions (first result on Google search) on Windows. These don't work properly.