Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
351f6455
Commit
351f6455
authored
Jul 17, 2009
by
Peter Eastman
Browse files
Avoid setting the device multiple times
parent
bb2c5f84
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
platforms/cuda/src/kernels/gpu.cpp
platforms/cuda/src/kernels/gpu.cpp
+6
-2
No files found.
platforms/cuda/src/kernels/gpu.cpp
View file @
351f6455
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment