Переглянути джерело

- workaround allowing starpu_omp_shutdown to complete when called from a destructor, after CUDA as been used

Olivier Aumage 10 роки тому
батько
коміт
f4e9763817
1 змінених файлів з 11 додано та 1 видалено
  1. 11 1
      src/drivers/cuda/driver_cuda.c

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

@@ -333,7 +333,17 @@ static void deinit_context(struct _starpu_worker_set *worker_set)
 
 	/* cleanup the runtime API internal stuffs (which CUBLAS is using) */
 	cures = cudaThreadExit();
-	if (cures)
+	if (cures
+#ifdef STARPU_OPENMP
+		/* When StarPU is used as Open Runtime support,
+		 * starpu_omp_shutdown() will usually be called from a
+		 * destructor, in which case cudaThreadExit() reports a
+		 * cudaErrorCudartUnloading here. There should not
+		 * be any remaining tasks running at this point so
+		 * we can probably ignore it without much consequences. */
+		&& cures != cudaErrorCudartUnloading
+#endif /* STARPU_OPENMP */
+	)
 		STARPU_CUDA_REPORT_ERROR(cures);
 }
 #endif /* !SIMGRID */