diff options
author | Willem Jan Palenstijn <WillemJan.Palenstijn@uantwerpen.be> | 2014-04-02 14:21:59 +0000 |
---|---|---|
committer | wpalenst <WillemJan.Palenstijn@uantwerpen.be> | 2014-04-02 14:21:59 +0000 |
commit | 2895e27613dab0815e9f0f2f0ed7853d31f856b4 (patch) | |
tree | 851d7171e07aa6db322cbf9286107b3db20f6a4e /cuda/2d/algo.cu | |
parent | 1d1e084d501883784eab283c622cb28510f36d27 (diff) | |
download | astra-2895e27613dab0815e9f0f2f0ed7853d31f856b4.tar.gz astra-2895e27613dab0815e9f0f2f0ed7853d31f856b4.tar.bz2 astra-2895e27613dab0815e9f0f2f0ed7853d31f856b4.tar.xz astra-2895e27613dab0815e9f0f2f0ed7853d31f856b4.zip |
Add global astra_set_gpu_index function
Diffstat (limited to 'cuda/2d/algo.cu')
-rw-r--r-- | cuda/2d/algo.cu | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/cuda/2d/algo.cu b/cuda/2d/algo.cu index 5ae5d08..f04607f 100644 --- a/cuda/2d/algo.cu +++ b/cuda/2d/algo.cu @@ -99,12 +99,14 @@ void ReconAlgo::reset() bool ReconAlgo::setGPUIndex(int iGPUIndex) { - cudaSetDevice(iGPUIndex); - cudaError_t err = cudaGetLastError(); + if (iGPUIndex != -1) { + cudaSetDevice(iGPUIndex); + cudaError_t err = cudaGetLastError(); - // Ignore errors caused by calling cudaSetDevice multiple times - if (err != cudaSuccess && err != cudaErrorSetOnActiveProcess) - return false; + // Ignore errors caused by calling cudaSetDevice multiple times + if (err != cudaSuccess && err != cudaErrorSetOnActiveProcess) + return false; + } return true; } |