diff options
author | jules <jules@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-05-19 11:06:31 +0000 |
---|---|---|
committer | jules <jules@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-05-19 11:06:31 +0000 |
commit | f35b05c9d2ed8cdc1eeaaceb514cac87bd6bf21e (patch) | |
tree | bd62cf7b3e9199169506a253a878c6cb1a4cbb84 /libgomp/plugin | |
parent | 41fdc863fa19792a27fe444d664eb67d6eb200d3 (diff) | |
download | gcc-f35b05c9d2ed8cdc1eeaaceb514cac87bd6bf21e.tar.gz |
* plugin/plugin-nvptx.c (nvptx_get_num_devices): Return zero
on cuInit failure.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223352 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp/plugin')
-rw-r--r-- | libgomp/plugin/plugin-nvptx.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libgomp/plugin/plugin-nvptx.c b/libgomp/plugin/plugin-nvptx.c index 583ec87aeee..ee3a0ae14a9 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) |