[Openmp-commits] [PATCH] D95412: [libomptarget][cuda] Gracefully handle missing cuda library
Jon Chesterfield via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Tue Jan 26 12:43:43 PST 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7baff00eeedb: [libomptarget][cuda] Gracefully handle missing cuda library (authored by JonChesterfield).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D95412/new/
https://reviews.llvm.org/D95412
Files:
openmp/libomptarget/plugins/cuda/dynamic_cuda/cuda.cpp
openmp/libomptarget/plugins/cuda/dynamic_cuda/cuda.h
openmp/libomptarget/plugins/cuda/src/rtl.cpp
Index: openmp/libomptarget/plugins/cuda/src/rtl.cpp
===================================================================
--- openmp/libomptarget/plugins/cuda/src/rtl.cpp
+++ openmp/libomptarget/plugins/cuda/src/rtl.cpp
@@ -401,6 +401,11 @@
DP("Start initializing CUDA\n");
CUresult Err = cuInit(0);
+ if (Err == CUDA_ERROR_INVALID_HANDLE) {
+ // Can't call cuGetErrorString if dlsym failed
+ DP("Failed to load CUDA shared library\n");
+ return;
+ }
if (!checkResult(Err, "Error returned from cuInit\n")) {
return;
}
Index: openmp/libomptarget/plugins/cuda/dynamic_cuda/cuda.h
===================================================================
--- openmp/libomptarget/plugins/cuda/dynamic_cuda/cuda.h
+++ openmp/libomptarget/plugins/cuda/dynamic_cuda/cuda.h
@@ -26,6 +26,7 @@
typedef enum cudaError_enum {
CUDA_SUCCESS = 0,
CUDA_ERROR_INVALID_VALUE = 1,
+ CUDA_ERROR_INVALID_HANDLE = 400,
} CUresult;
typedef enum CUstream_flags_enum {
Index: openmp/libomptarget/plugins/cuda/dynamic_cuda/cuda.cpp
===================================================================
--- openmp/libomptarget/plugins/cuda/dynamic_cuda/cuda.cpp
+++ openmp/libomptarget/plugins/cuda/dynamic_cuda/cuda.cpp
@@ -93,7 +93,7 @@
// Note: Called exactly once from cuda rtl.cpp in a global constructor so
// does not need to handle being called repeatedly or concurrently
if (!checkForCUDA()) {
- return CUDA_ERROR_INVALID_VALUE;
+ return CUDA_ERROR_INVALID_HANDLE;
}
return dlwrap_cuInit(X);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95412.319388.patch
Type: text/x-patch
Size: 1550 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210126/b2c01d4f/attachment.bin>
More information about the Openmp-commits
mailing list