The OpenCL spec does not describe any specific error behavior when no platforms are found, but the OpenCL ICD loader returns an error code for this case. This OpenCL runtime loader should have a build option to choose the desired behavior. This is hard-coded with an ifdef today.
// The cl_khr_icd spec says that an error should be returned if no
// platforms are found, but this is not an error condition in the OpenCL
// spec.
#if 1
return _SCL_PLATFORM_NOT_FOUND_KHR;
#else
if (num_platforms) {
num_platforms[0] = 0;
}
return CL_SUCCESS;
#endif
The OpenCL spec does not describe any specific error behavior when no platforms are found, but the OpenCL ICD loader returns an error code for this case. This OpenCL runtime loader should have a build option to choose the desired behavior. This is hard-coded with an ifdef today.