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
d0432e70
Commit
d0432e70
authored
Oct 24, 2012
by
Peter Eastman
Browse files
Throw an exception if the user requests double precision on a device that doesn't support it.
parent
e479d792
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
0 deletions
+4
-0
platforms/cuda/src/CudaContext.cpp
platforms/cuda/src/CudaContext.cpp
+2
-0
platforms/opencl/src/OpenCLContext.cpp
platforms/opencl/src/OpenCLContext.cpp
+2
-0
No files found.
platforms/cuda/src/CudaContext.cpp
View file @
d0432e70
...
@@ -124,6 +124,8 @@ CudaContext::CudaContext(const System& system, int deviceIndex, bool useBlocking
...
@@ -124,6 +124,8 @@ CudaContext::CudaContext(const System& system, int deviceIndex, bool useBlocking
CHECK_RESULT
(
cuDeviceComputeCapability
(
&
major
,
&
minor
,
device
));
CHECK_RESULT
(
cuDeviceComputeCapability
(
&
major
,
&
minor
,
device
));
gpuArchitecture
=
intToString
(
major
)
+
intToString
(
minor
);
gpuArchitecture
=
intToString
(
major
)
+
intToString
(
minor
);
computeCapability
=
major
+
0.1
*
minor
;
computeCapability
=
major
+
0.1
*
minor
;
if
((
useDoublePrecision
||
useMixedPrecision
)
&&
computeCapability
<
1.3
)
throw
OpenMMException
(
"This device does not support double precision"
);
defaultOptimizationOptions
=
"--use_fast_math"
;
defaultOptimizationOptions
=
"--use_fast_math"
;
unsigned
int
flags
=
CU_CTX_MAP_HOST
;
unsigned
int
flags
=
CU_CTX_MAP_HOST
;
if
(
useBlockingSync
)
if
(
useBlockingSync
)
...
...
platforms/opencl/src/OpenCLContext.cpp
View file @
d0432e70
...
@@ -154,6 +154,8 @@ OpenCLContext::OpenCLContext(const System& system, int platformIndex, int device
...
@@ -154,6 +154,8 @@ OpenCLContext::OpenCLContext(const System& system, int platformIndex, int device
defaultOptimizationOptions
=
"-cl-fast-relaxed-math"
;
defaultOptimizationOptions
=
"-cl-fast-relaxed-math"
;
supports64BitGlobalAtomics
=
(
device
.
getInfo
<
CL_DEVICE_EXTENSIONS
>
().
find
(
"cl_khr_int64_base_atomics"
)
!=
string
::
npos
);
supports64BitGlobalAtomics
=
(
device
.
getInfo
<
CL_DEVICE_EXTENSIONS
>
().
find
(
"cl_khr_int64_base_atomics"
)
!=
string
::
npos
);
supportsDoublePrecision
=
(
device
.
getInfo
<
CL_DEVICE_EXTENSIONS
>
().
find
(
"cl_khr_fp64"
)
!=
string
::
npos
);
supportsDoublePrecision
=
(
device
.
getInfo
<
CL_DEVICE_EXTENSIONS
>
().
find
(
"cl_khr_fp64"
)
!=
string
::
npos
);
if
((
useDoublePrecision
||
useMixedPrecision
)
&&
!
supportsDoublePrecision
)
throw
OpenMMException
(
"This device does not support double precision"
);
string
vendor
=
device
.
getInfo
<
CL_DEVICE_VENDOR
>
();
string
vendor
=
device
.
getInfo
<
CL_DEVICE_VENDOR
>
();
int
numThreadBlocksPerComputeUnit
=
6
;
int
numThreadBlocksPerComputeUnit
=
6
;
if
(
vendor
.
size
()
>=
6
&&
vendor
.
substr
(
0
,
6
)
==
"NVIDIA"
)
{
if
(
vendor
.
size
()
>=
6
&&
vendor
.
substr
(
0
,
6
)
==
"NVIDIA"
)
{
...
...
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