Explorar o código

CUDA driver: do not enable more CUDA devices than requested through configure option --enable-maxcudadev

Nathalie Furmento %!s(int64=14) %!d(string=hai) anos
pai
achega
9d9e0bd133
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      src/drivers/cuda/driver_cuda.c

+ 5 - 1
src/drivers/cuda/driver_cuda.c

@@ -142,7 +142,11 @@ unsigned _starpu_get_cuda_device_count(void)
 	cures = cudaGetDeviceCount(&cnt);
 	if (STARPU_UNLIKELY(cures))
 		 return 0;
-	
+
+	if (cnt > STARPU_MAXCUDADEVS) {
+		fprintf(stderr, "# Warning: %d CUDA devices available. Only %d enabled. Use configure option --enable-maxcudadev=xxx to update the maximum value of supported CUDA devices.\n", cnt, STARPU_MAXCUDADEVS);
+		cnt = STARPU_MAXCUDADEVS;
+	}
 	return (unsigned)cnt;
 }