Altera_Forum
Honored Contributor
10 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.