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
c6ccb344
Commit
c6ccb344
authored
Feb 19, 2010
by
Christopher Bruns
Browse files
Corrected to avoid CUDA tests when cuda-enabled GPU is not present on Windows
parent
83889f1e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
platforms/cuda/CMakeLists.txt
platforms/cuda/CMakeLists.txt
+4
-2
platforms/cuda/tests/has_cuda_gpu.c
platforms/cuda/tests/has_cuda_gpu.c
+7
-1
No files found.
platforms/cuda/CMakeLists.txt
View file @
c6ccb344
...
...
@@ -26,10 +26,12 @@ try_run(RUN_RESULT_VAR COMPILE_RESULT_VAR
COMPILE_OUTPUT_VARIABLE COMPILE_OUTPUT_VAR
RUN_OUTPUT_VARIABLE RUN_OUTPUT_VAR
)
message
(
"COMPILE_OUTPUT_VAR =
${
COMPILE_OUTPUT_VAR
}
"
)
message
(
"RUN_OUTPUT_VAR =
${
RUN_OUTPUT_VAR
}
"
)
message
(
"
${
RUN_OUTPUT_VAR
}
"
)
# Display number of GPUs found
# COMPILE_RESULT_VAR is TRUE when compile succeeds
# RUN_RESULT_VAR is
equal t
o
t
he
number of
GPUs found
if
(
COMPILE_RESULT_VAR AND RUN_RESULT_VAR
)
# RUN_RESULT_VAR is
zer
o
w
he
n a
GPU
i
s found
if
(
COMPILE_RESULT_VAR AND
NOT
RUN_RESULT_VAR
)
set
(
CUDA_HAVE_GPU TRUE CACHE BOOL
"Whether CUDA-capable GPU is present"
)
else
()
set
(
CUDA_HAVE_GPU FALSE CACHE BOOL
"Whether CUDA-capable GPU is present"
)
...
...
platforms/cuda/tests/has_cuda_gpu.c
View file @
c6ccb344
...
...
@@ -8,6 +8,7 @@ int main() {
cudaError_t
cudaResultCode
=
cudaGetDeviceCount
(
&
deviceCount
);
if
(
cudaResultCode
!=
cudaSuccess
)
deviceCount
=
0
;
/* machines with no GPUs can still report one emulation device */
for
(
device
=
0
;
device
<
deviceCount
;
++
device
)
{
cudaGetDeviceProperties
(
&
properties
,
device
);
if
(
properties
.
major
!=
9999
)
/* 9999 means emulation only */
...
...
@@ -15,6 +16,11 @@ int main() {
}
printf
(
"%d GPU CUDA device(s) found
\n
"
,
gpuDeviceCount
);
return
gpuDeviceCount
;
/* don't just return the number of gpus, because other weird
errors can yield non-zero return values */
if
(
gpuDeviceCount
>
0
)
return
0
;
/* success */
else
return
1
;
/* failure */
}
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