diff --git a/projects/rccl-tests/src/common.cu b/projects/rccl-tests/src/common.cu index d708a7a916..d4d528ea7c 100644 --- a/projects/rccl-tests/src/common.cu +++ b/projects/rccl-tests/src/common.cu @@ -738,6 +738,15 @@ int main(int argc, char* argv[]) { return 0; } } + + int numDevices; + HIPCHECK(hipGetDeviceCount(&numDevices)); + if (nGpus > numDevices) + { + fprintf(stderr, "[ERROR] The number of requested GPUs (%d) is greater than the number of GPUs available (%d)\n", nGpus, numDevices); + return testNcclError; + } + #ifdef MPI_SUPPORT MPI_Init(&argc, &argv); #endif