I'm writing an openCL program on a mid 2012 13" macbook pro with the following specs:
Processor: 2.9 GHz Intel Core i7
Graphics: Intel HD Graphics 4000
In my program I do the following to check how many devices I have access to:
// get first platform
cl_platform_id platform;
err = clGetPlatformIDs(1, &platform, NULL);
// get device count
cl_uint gpuCount;
err = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, NULL, &gpuCount);
cl_uint cpuCount;
err |= clGetDeviceIDs(platform, CL_DEVICE_TYPE_CPU, 0, NULL, &cpuCount);
std::cout<<"NUM CPUS: "<<cpuCount<<" NUM GPUS: "<<gpuCount<<std::endl;
After execution, my program states that I have only one CPU and zero GPUs.
How can that be? Is openCL not compatible with Intel HD Graphics 4000 card? And I thought my computer had a dual core processor. So shouldn't there be 2 CPUs and 1 GPU?
Or am I simply not fetching the data correctly?
EDIT: I have found the issue. After upgrading my OS to Mavericks (was previously running Mountain Lion), openCL now recognizes my graphics card as a valid device.
Your processor has multiple cores, which are recognized as Compute Units. Run following code snippet & check that number of CU is as expected:
cl_device_id device;
cl_uint max_compute_units;
cl_int ret = clGetDeviceInfo(device, CL_DEVICE_MAX_COMPUTE_UNITS, sizeof(cl_uint), &max_compute_units, NULL);
printf("Number of computing units: %u\n", max_compute_units);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With