I am starting to write a little "engine" for using OpenCL. Now, I encountered a problem that is quite strange.
When I call clGetDeviceInfo()
to query informations of the specific device, some of the options for the parameter param_name
return the error code -30 ( = CL_INVALID_VALUE). A very famous one is the option CL_DEVICE_EXTENSIONS which should return me a string of extensions no matter what sdk or platform I am using. I checked every edge and also the parameters are double checked.
Another thing I do not understand is when I run my source on my Windows machine at work, the clGetPlatformInfo()
function also returns me CL_INVALID_VALUE querying the CL_PLATFORM_EXTENSIONS string. At home I am using a Linux machine running Ubuntu and it shows the extensions string without any problem.
Here are the data of my platforms:
Work:
- Intel Core i5 2500 CPU
- NVIDIA Geforce 210 GPU
- AMD APP SDK 3.0 Beta
Home:
- Intel Core i7 5820K CPU
- AMD Radeon HD7700 GPU
- AMD APP SDK 3.0 Beta
And here is the source:
The source is written in cpp and the opencl fuctions are embedded in some wrapper classes (i.e. OCLDevice).
OCLDevice::OCLDevice(cl_device_id device)
{
cl_int errNum;
cl_uint uintBuffer;
cl_long longBuffer;
cl_bool boolBuffer;
char str[128];
size_t strSize = (sizeof(char) * 128);
size_t retSize;
//Device name string.
errNum =
clGetDeviceInfo(device,CL_DEVICE_NAME,strSize,(void*)str,&retSize);
throwException();
this->name = string(str,retSize);
//The platform associated with this device.
errNum =
clGetDeviceInfo(device, CL_DEVICE_PLATFORM,
sizeof(cl_platform_id),
(void*)&(this->platform), &retSize);
throwException();
//The OpenCL device type.
errNum =
clGetDeviceInfo(device, CL_DEVICE_TYPE,
sizeof(cl_device_type),
(void*)&(this->devType),&retSize);
throwException();
//Vendor name string.
errNum =
clGetDeviceInfo(device,CL_DEVICE_VENDOR,
strSize,(void*)str,&retSize);
throwException();
this->vendor = string(str,retSize);
//A unique device vendor identifier.
//An example of a unique device identifier could be the PCIe ID.
errNum =
clGetDeviceInfo(device, CL_DEVICE_VENDOR_ID,
sizeof(unsigned int),
(void*)&(this->vendorID),&retSize);
throwException();
//Returns a space separated list of extension names
//supported by the device.
clearString(str,retSize); //fills the char string with 0-characters
errNum =
clGetDeviceInfo(device,CL_DEVICE_EXTENSIONS,strSize,str,&retSize);
throwException();
//some more queries (some with some without the same error)...
}
As you can see in the code param_value_size > param_value_size_ret so that there is no reason to return the error, too. The param_name is copied from the header to be save there is no typing error.
It would be great if somebody knew an answer to this problem.