Преглед на файлове

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

Nathalie Furmento преди 14 години
родител
ревизия
9d9e0bd133
променени са 1 файла, в които са добавени 5 реда и са изтрити 1 реда
  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;
 }