Browse Source

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

Nathalie Furmento 14 years ago
parent
commit
9d9e0bd133
1 changed files with 5 additions and 1 deletions
  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;
 }