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
7c35e413
Commit
7c35e413
authored
Jan 13, 2010
by
Peter Eastman
Browse files
Another attempt at getting device selection to work correctly on all platforms
parent
ebfcfe24
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
platforms/cuda/src/kernels/gpu.cpp
platforms/cuda/src/kernels/gpu.cpp
+6
-3
No files found.
platforms/cuda/src/kernels/gpu.cpp
View file @
7c35e413
...
@@ -1692,8 +1692,11 @@ void* gpuInit(int numAtoms, unsigned int device, bool useBlockingSync)
...
@@ -1692,8 +1692,11 @@ void* gpuInit(int numAtoms, unsigned int device, bool useBlockingSync)
int
SMMinor
=
0
;
int
SMMinor
=
0
;
// Select which device to use
// Select which device to use
cudaError_t
status
=
cudaSetDevice
(
device
);
int
currentDevice
;
RTERROR
(
status
,
"Error setting CUDA device"
)
cudaError_t
status
=
cudaGetDevice
(
&
currentDevice
);
RTERROR
(
status
,
"Error getting CUDA device"
)
if
(
device
!=
currentDevice
)
cudaSetDevice
(
device
);
// Ignore errors
status
=
cudaGetDevice
(
&
gpu
->
device
);
status
=
cudaGetDevice
(
&
gpu
->
device
);
RTERROR
(
status
,
"Error getting CUDA device"
)
RTERROR
(
status
,
"Error getting CUDA device"
)
status
=
cudaSetDeviceFlags
(
useBlockingSync
?
cudaDeviceBlockingSync
:
cudaDeviceScheduleAuto
);
status
=
cudaSetDeviceFlags
(
useBlockingSync
?
cudaDeviceBlockingSync
:
cudaDeviceScheduleAuto
);
...
@@ -1702,7 +1705,7 @@ void* gpuInit(int numAtoms, unsigned int device, bool useBlockingSync)
...
@@ -1702,7 +1705,7 @@ void* gpuInit(int numAtoms, unsigned int device, bool useBlockingSync)
// Determine kernel call configuration
// Determine kernel call configuration
cudaDeviceProp
deviceProp
;
cudaDeviceProp
deviceProp
;
cudaGetDeviceProperties
(
&
deviceProp
,
gpu
->
d
evice
);
cudaGetDeviceProperties
(
&
deviceProp
,
currentD
evice
);
// Determine SM version
// Determine SM version
if
(
deviceProp
.
major
==
1
)
if
(
deviceProp
.
major
==
1
)
...
...
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