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
537221a0
Commit
537221a0
authored
Oct 06, 2009
by
Peter Eastman
Browse files
Fixed a problem under Nvidia's OpenCL implementation
parent
1acb7fa9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
28 deletions
+36
-28
platforms/opencl/src/OpenCLContext.cpp
platforms/opencl/src/OpenCLContext.cpp
+36
-28
No files found.
platforms/opencl/src/OpenCLContext.cpp
View file @
537221a0
...
...
@@ -39,6 +39,7 @@ using namespace OpenMM;
using
namespace
std
;
OpenCLContext
::
OpenCLContext
(
int
numParticles
,
int
deviceIndex
)
:
time
(
0.0
),
stepCount
(
0
)
{
try
{
context
=
cl
::
Context
(
CL_DEVICE_TYPE_ALL
);
vector
<
cl
::
Device
>
devices
=
context
.
getInfo
<
CL_CONTEXT_DEVICES
>
();
const
int
minThreadBlockSize
=
32
;
...
...
@@ -59,7 +60,8 @@ OpenCLContext::OpenCLContext(int numParticles, int deviceIndex) : time(0.0), ste
if
(
device
.
getInfo
<
CL_DEVICE_MAX_WORK_ITEM_SIZES
>
()[
0
]
<
minThreadBlockSize
)
throw
OpenMMException
(
"The specified OpenCL device is not compatible with OpenMM"
);
compilationOptions
=
"-cl-fast-relaxed-math"
;
if
(
device
.
getInfo
<
CL_DEVICE_VENDOR
>
()
==
"NVIDIA"
)
string
vendor
=
device
.
getInfo
<
CL_DEVICE_VENDOR
>
();
if
(
vendor
.
size
()
>=
6
&&
vendor
.
substr
(
0
,
6
)
==
"NVIDIA"
)
compilationOptions
+=
" -DWARPS_ARE_ATOMIC"
;
queue
=
cl
::
CommandQueue
(
context
,
device
);
numAtoms
=
numParticles
;
...
...
@@ -69,6 +71,12 @@ OpenCLContext::OpenCLContext(int numParticles, int deviceIndex) : time(0.0), ste
nonbonded
=
new
OpenCLNonbondedUtilities
(
*
this
);
posq
=
new
OpenCLArray
<
mm_float4
>
(
*
this
,
paddedNumAtoms
,
"posq"
,
true
);
velm
=
new
OpenCLArray
<
mm_float4
>
(
*
this
,
paddedNumAtoms
,
"velm"
,
true
);
}
catch
(
cl
::
Error
err
)
{
std
::
stringstream
str
;
str
<<
"Error initializing context: "
<<
err
.
what
()
<<
" ("
<<
err
.
err
()
<<
")"
;
throw
OpenMMException
(
str
.
str
());
}
// Create utility kernels that are used in multiple places.
...
...
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