diff --git a/samples/99_matrixexperiments/main.cpp b/samples/99_matrixexperiments/main.cpp index a38cf27..55951e9 100644 --- a/samples/99_matrixexperiments/main.cpp +++ b/samples/99_matrixexperiments/main.cpp @@ -650,16 +650,27 @@ int main(int argc, char** argv) std::vector platforms; cl::Platform::get(&platforms); + if (platformIndex >= platforms.size()) { + printf("Requested platform index is %d, but only %zu platforms were found.\n", + platformIndex, platforms.size()); + return -1; + } printf("Running on platform: %s\n", platforms[platformIndex].getInfo().c_str() ); std::vector devices; platforms[platformIndex].getDevices(CL_DEVICE_TYPE_ALL, &devices); + if (deviceIndex >= devices.size()) { + printf("Requested device index is %d, but only %zu devices were found.\n", + deviceIndex, devices.size()); + } cl::Device& device = devices[deviceIndex]; - printf("Running on device: %s\n", - device.getInfo().c_str() ); + printf("Running on device: %s (%uCUs, %uMHz)\n", + device.getInfo().c_str(), + device.getInfo(), + device.getInfo()); auto minSubGroupSize = findMinSubGroupSize(device);