diff options
author | Julian Brown <julian@codesourcery.com> | 2015-05-19 11:06:31 +0000 |
---|---|---|
committer | Julian Brown <jules@gcc.gnu.org> | 2015-05-19 11:06:31 +0000 |
commit | c83198264705c6a36d0f20470af67f62928278bb (patch) | |
tree | bd62cf7b3e9199169506a253a878c6cb1a4cbb84 /libgomp | |
parent | 9626d143b96c1d860b478cd4196373b6c9428f6d (diff) | |
download | gcc-c83198264705c6a36d0f20470af67f62928278bb.zip gcc-c83198264705c6a36d0f20470af67f62928278bb.tar.gz gcc-c83198264705c6a36d0f20470af67f62928278bb.tar.bz2 |
plugin-nvptx.c (nvptx_get_num_devices): Return zero on cuInit failure.
* plugin/plugin-nvptx.c (nvptx_get_num_devices): Return zero
on cuInit failure.
From-SVN: r223352
Diffstat (limited to 'libgomp')
-rw-r--r-- | libgomp/ChangeLog | 5 | ||||
-rw-r--r-- | libgomp/plugin/plugin-nvptx.c | 8 |
2 files changed, 12 insertions, 1 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 33ea5fb..60ad7f5 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,8 @@ +2015-05-19 Julian Brown <julian@codesourcery.com> + + * plugin/plugin-nvptx.c (nvptx_get_num_devices): Return zero + on cuInit failure. + 2015-05-13 Jakub Jelinek <jakub@redhat.com> PR middle-end/66133 diff --git a/libgomp/plugin/plugin-nvptx.c b/libgomp/plugin/plugin-nvptx.c index 583ec87..ee3a0ae 100644 --- a/libgomp/plugin/plugin-nvptx.c +++ b/libgomp/plugin/plugin-nvptx.c @@ -782,7 +782,13 @@ nvptx_get_num_devices (void) until cuInit has been called. Just call it now (but don't yet do any further initialization). */ if (instantiated_devices == 0) - cuInit (0); + { + r = cuInit (0); + /* This is not an error: e.g. we may have CUDA libraries installed but + no devices available. */ + if (r != CUDA_SUCCESS) + return 0; + } r = cuDeviceGetCount (&n); if (r!= CUDA_SUCCESS) |