[libgomp, nvptx] Allow cuGetErrorString to be NULL
Cuda driver api function cuGetErrorString is available in version 6.0 and higher. Currently, when the driver that is used does not contain this function, the libgomp nvptx plugin will not build (PLUGIN_NVPTX_DYNAMIC == 0) or run (PLUGIN_NVPTX_DYNAMIC == 1). This patch fixes this problem by testing for the presence of the function, and handling absence. Build on x86_64 with nvptx accelerator and reg-tested libgomp, both with and without --without-cuda-driver. 2018-08-08 Tom de Vries <tdevries@suse.de> * plugin/cuda-lib.def (cuGetErrorString): Use CUDA_ONE_CALL_MAYBE_NULL. * plugin/plugin-nvptx.c (cuda_error): Handle if cuGetErrorString is not present. From-SVN: r263407
This commit is contained in:
parent
b113af959c
commit
cedd9bd016
3 changed files with 15 additions and 5 deletions
|
@ -1,3 +1,9 @@
|
|||
2018-08-08 Tom de Vries <tdevries@suse.de>
|
||||
|
||||
* plugin/cuda-lib.def (cuGetErrorString): Use CUDA_ONE_CALL_MAYBE_NULL.
|
||||
* plugin/plugin-nvptx.c (cuda_error): Handle if cuGetErrorString is not
|
||||
present.
|
||||
|
||||
2018-08-08 Tom de Vries <tdevries@suse.de>
|
||||
|
||||
* plugin/plugin-nvptx.c
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -161,13 +161,17 @@ init_cuda_lib (void)
|
|||
static const char *
|
||||
cuda_error (CUresult r)
|
||||
{
|
||||
const char *fallback = "unknown cuda error";
|
||||
const char *desc;
|
||||
|
||||
r = CUDA_CALL_NOCHECK (cuGetErrorString, r, &desc);
|
||||
if (r != CUDA_SUCCESS)
|
||||
desc = "unknown cuda error";
|
||||
if (!CUDA_CALL_EXISTS (cuGetErrorString))
|
||||
return fallback;
|
||||
|
||||
return desc;
|
||||
r = CUDA_CALL_NOCHECK (cuGetErrorString, r, &desc);
|
||||
if (r == CUDA_SUCCESS)
|
||||
return desc;
|
||||
|
||||
return fallback;
|
||||
}
|
||||
|
||||
static unsigned int instantiated_devices = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue