bashbaug / opencl-runtime-loader

OpenCL Runtime Loader Library
MIT License
2 stars 0 forks source link

add build option for zero platforms behavior #10

Open bashbaug opened 4 years ago

bashbaug commented 4 years ago

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