Forum Discussion
Altera_Forum
Honored Contributor
11 years agoWrong behavior of clGetPlatformIDs()
Hi all,
I discovered that calling the function cl_int clgetplatformids (cl_uint num_entries, cl_platform_id *platforms, cl_uint *num_platforms) with the platforms parameter set to NULL and the num_entries different from zero I get a CL_INVALID_VALUE error return value. Follows an example of the code used:
cl_uint err, platformCount;
// get platform counter
err = clGetPlatformIDs (1, NULL, &platformCount);
if (err != CL_SUCCESS) {
printf("ERROR %s\n", getErrorString(err));
exit(err);
}
This should not happened because as defined from the standard: (https://www.khronos.org/registry/cl/sdk/1.0/docs/man/xhtml/clgetplatformids.html) --- Quote Start --- Errors: Returns CL_SUCCESS if the function is executed successfully. Otherwise it returns CL_INVALID_VALUE if num_entries is equal to zero and platforms is not NULL, or if both num_platforms and platforms are NULL. --- Quote End --- Is it wanted from Altera or is it a bug in the implementation? :confused: p.s: If I use clGetPlatformIDs (0, NULL, &platformCount) works perfectly.2 Replies
- Altera_Forum
Honored Contributor
Indeed you seem to have found a bug since per the OpenCL 1.0 specification: "the number of OpenCL platforms returned is the mininum of the value specified by num_entries or the number of OpenCL platforms available." Would you please file an service request (SR) with you myAltera account, including the code snippet you provided, to make sure this gets routed to the right people within Altera.
- Altera_Forum
Honored Contributor
Just opened a service request. I will update the post as soon as I have news.