@@ -592,6 +592,8 @@ nvptx_init (void)
return -1;
r = cuInit (0);
+ if (r == CUDA_ERROR_NO_DEVICE)
+ r = CUDA_SUCCESS;
if (r != CUDA_SUCCESS)
GOMP_PLUGIN_fatal ("cuInit error: %s", cuda_error (r));
@@ -715,7 +717,13 @@ nvptx_get_num_devices (void)
until cuInit has been called. Just call it now (but don't yet do any
further initialization). */
if (!ptx_inited)
- cuInit (0);
+ {
+ r = cuInit (0);
+ if (r == CUDA_ERROR_NO_DEVICE)
+ return 0;
+ if (r != CUDA_SUCCESS)
+ GOMP_PLUGIN_fatal ("cuInit error: %s", cuda_error (r));
+ }
r = cuDeviceGetCount (&n);
if (r!= CUDA_SUCCESS)