summaryrefslogtreecommitdiffstats
path: root/cuda/2d/algo.cu
diff options
context:
space:
mode:
Diffstat (limited to 'cuda/2d/algo.cu')
-rw-r--r--cuda/2d/algo.cu12
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;
}