Commit 260627de authored by peastman's avatar peastman
Browse files

Catch exception when an OpenCL platform has no devices

parent 45f8c022
......@@ -104,7 +104,13 @@ OpenCLContext::OpenCLContext(const System& system, int platformIndex, int device
string platformVendor = platforms[j].getInfo<CL_PLATFORM_VENDOR>();
vector<cl::Device> devices;
platforms[j].getDevices(CL_DEVICE_TYPE_ALL, &devices);
try {
platforms[j].getDevices(CL_DEVICE_TYPE_ALL, &devices);
}
catch (...) {
// There are no devices available for this platform.
continue;
}
if (deviceIndex < -1 || deviceIndex >= (int) devices.size())
throw OpenMMException("Illegal value for DeviceIndex: "+intToString(deviceIndex));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment