Browse Source

exit(77) instead of aborting when CUDA devices are busy.

Samuel Thibault 13 years ago
parent
commit
afa5e54519
1 changed files with 6 additions and 1 deletions
  1. 6 1
      src/drivers/cuda/driver_cuda.c

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

@@ -118,8 +118,13 @@ static void init_context(int devid)
 
 
 	/* force CUDA to initialize the context for real */
 	/* force CUDA to initialize the context for real */
 	cures = cudaFree(0);
 	cures = cudaFree(0);
-	if (STARPU_UNLIKELY(cures))
+	if (STARPU_UNLIKELY(cures)) {
+		if (cures == cudaErrorDevicesUnavailable) {
+			fprintf(stderr,"All CUDA-capable devices are busy or unavailable\n");
+			exit(77);
+		}
 		STARPU_CUDA_REPORT_ERROR(cures);
 		STARPU_CUDA_REPORT_ERROR(cures);
+	}
 
 
 	cures = cudaGetDeviceProperties(&props[devid], devid);
 	cures = cudaGetDeviceProperties(&props[devid], devid);
 	if (STARPU_UNLIKELY(cures))
 	if (STARPU_UNLIKELY(cures))