diff options
Diffstat (limited to 'libgomp/plugin')
-rw-r--r-- | libgomp/plugin/cuda-lib.def | 2 | ||||
-rw-r--r-- | libgomp/plugin/plugin-nvptx.c | 10 |
2 files changed, 8 insertions, 4 deletions
diff --git a/libgomp/plugin/cuda-lib.def b/libgomp/plugin/cuda-lib.def index be8e3b3..6365cdb 100644 --- a/libgomp/plugin/cuda-lib.def +++ b/libgomp/plugin/cuda-lib.def @@ -15,7 +15,7 @@ CUDA_ONE_CALL (cuEventQuery) CUDA_ONE_CALL (cuEventRecord) CUDA_ONE_CALL (cuEventSynchronize) CUDA_ONE_CALL (cuFuncGetAttribute) -CUDA_ONE_CALL (cuGetErrorString) +CUDA_ONE_CALL_MAYBE_NULL (cuGetErrorString) CUDA_ONE_CALL (cuInit) CUDA_ONE_CALL (cuLaunchKernel) CUDA_ONE_CALL (cuLinkAddData) diff --git a/libgomp/plugin/plugin-nvptx.c b/libgomp/plugin/plugin-nvptx.c index 589d659..b549b77 100644 --- a/libgomp/plugin/plugin-nvptx.c +++ b/libgomp/plugin/plugin-nvptx.c @@ -161,13 +161,17 @@ init_cuda_lib (void) static const char * cuda_error (CUresult r) { + const char *fallback = "unknown cuda error"; const char *desc; + if (!CUDA_CALL_EXISTS (cuGetErrorString)) + return fallback; + r = CUDA_CALL_NOCHECK (cuGetErrorString, r, &desc); - if (r != CUDA_SUCCESS) - desc = "unknown cuda error"; + if (r == CUDA_SUCCESS) + return desc; - return desc; + return fallback; } static unsigned int instantiated_devices = 0; |