From aa95c5ee452a394aa2566eff8a2b314b42024b29 Mon Sep 17 00:00:00 2001 From: Ben Ashbaugh Date: Wed, 24 Jan 2024 13:56:01 -0800 Subject: [PATCH] minor improvements to tester program --- samples/99_matrixexperiments/main.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) 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);