UoB-HPC / BabelStream

STREAM, for lots of devices written in many programming models
Other
325 stars 112 forks source link

Update cl2.hpp to handle OpenCL platforms with zero devices. #62

Closed Noerr closed 4 years ago

Noerr commented 4 years ago

Need to more carefully handle the case of a platform detected with zero devices. In the first call to clGetDeviceIDs, this will return code CL_DEVICE_NOT_FOUND and set n=0 if no devices are reported by the platform. ( https://www.khronos.org/registry/OpenCL/sdk/1.2/docs/man/xhtml/clGetDeviceIDs.html ) The second call to clGetDeviceIDs cannot be allowed occur if n=0, otherwise CL_INVALID_VALUE is reported. A platform with zero devices is not an error condition. Device enumeration should simply move on.

tomdeakin commented 4 years ago

The cl2.hpp header in this repository is a local clone of the official Khronos OpenCL C++ header. We periodically copy it from upstream into this repository as it does not always ship with OpenCL platforms.

I'd recommend you open an Issue against the header source so that we can pick it up from there.

Noerr commented 4 years ago

The proposed change is now merged into the upstream master. https://github.com/KhronosGroup/OpenCL-CLHPP/pull/85 @tomdeakin I recommend updating the cl2.hpp copy in this project.

tomdeakin commented 4 years ago

@Noerr Done! Thanks for the contribution, and I'm really pleased it went into the official header quickly.