Commit 351f6455 authored by Peter Eastman's avatar Peter Eastman
Browse files

Avoid setting the device multiple times

parent bb2c5f84
......@@ -1125,8 +1125,12 @@ void* gpuInit(int numAtoms, unsigned int device)
int SMMinor = 0;
// Select which device to use
cudaSetDevice(device); // Ignore errors
cudaError_t status = cudaGetDevice(&gpu->device);
int currentDevice;
cudaError_t status = cudaGetDevice(&currentDevice);
RTERROR(status, "Error getting CUDA device")
if (device != currentDevice)
cudaSetDevice(device); // Ignore errors
status = cudaGetDevice(&gpu->device);
RTERROR(status, "Error getting CUDA device")
// Determine kernel call configuration
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment