diff --git a/eradicate2.cpp b/eradicate2.cpp index 56cdb32..d7d863a 100644 --- a/eradicate2.cpp +++ b/eradicate2.cpp @@ -47,7 +47,9 @@ std::vector getAllDevices(cl_device_type deviceType = CL_DEVICE_TY clGetDeviceIDs(*it, deviceType, 0, NULL, &countDevice); std::vector deviceIds(countDevice); - clGetDeviceIDs(*it, deviceType, countDevice, deviceIds.data(), &countDevice); + if (clGetDeviceIDs(*it, deviceType, countDevice, deviceIds.data(), &countDevice) != CL_SUCCESS) { + continue; + } std::copy( deviceIds.begin(), deviceIds.end(), std::back_inserter(vDevices) ); } @@ -297,7 +299,7 @@ int main(int argc, char * * argv) { const auto globalMemSize = clGetWrapper(clGetDeviceInfo, deviceId, CL_DEVICE_GLOBAL_MEM_SIZE); std::cout << " GPU" << i << ": " << strName << ", " << globalMemSize << " bytes available, " << computeUnits << " compute units" << std::endl; - vDevices.push_back(vFoundDevices[i]); + vDevices.push_back(deviceId); mDeviceIndex[vFoundDevices[i]] = i; }