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
a4673043
Commit
a4673043
authored
May 07, 2012
by
Peter Eastman
Browse files
A cl::Context only specifies the particular device it is using, not all devices
parent
59131379
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
platforms/opencl/src/OpenCLContext.cpp
platforms/opencl/src/OpenCLContext.cpp
+6
-3
No files found.
platforms/opencl/src/OpenCLContext.cpp
View file @
a4673043
...
...
@@ -75,9 +75,8 @@ OpenCLContext::OpenCLContext(int numParticles, int platformIndex, int deviceInde
cl
::
Platform
::
get
(
&
platforms
);
if
(
platformIndex
<
0
||
platformIndex
>=
platforms
.
size
())
throw
OpenMMException
(
"Illegal value for OpenCL platform index"
);
cl_context_properties
cprops
[]
=
{
CL_CONTEXT_PLATFORM
,
(
cl_context_properties
)
platforms
[
platformIndex
](),
0
};
context
=
cl
::
Context
(
CL_DEVICE_TYPE_ALL
,
cprops
,
errorCallback
);
vector
<
cl
::
Device
>
devices
=
context
.
getInfo
<
CL_CONTEXT_DEVICES
>
();
vector
<
cl
::
Device
>
devices
;
platforms
[
platformIndex
].
getDevices
(
CL_DEVICE_TYPE_ALL
,
&
devices
);
const
int
minThreadBlockSize
=
32
;
if
(
deviceIndex
<
0
||
deviceIndex
>=
(
int
)
devices
.
size
())
{
// Try to figure out which device is the fastest.
...
...
@@ -203,6 +202,10 @@ OpenCLContext::OpenCLContext(int numParticles, int platformIndex, int deviceInde
compilationDefines
[
"SUPPORTS_64_BIT_ATOMICS"
]
=
""
;
if
(
supportsDoublePrecision
)
compilationDefines
[
"SUPPORTS_DOUBLE_PRECISION"
]
=
""
;
vector
<
cl
::
Device
>
contextDevices
;
contextDevices
.
push_back
(
device
);
cl_context_properties
cprops
[]
=
{
CL_CONTEXT_PLATFORM
,
(
cl_context_properties
)
platforms
[
platformIndex
](),
0
};
context
=
cl
::
Context
(
contextDevices
,
cprops
,
errorCallback
);
queue
=
cl
::
CommandQueue
(
context
,
device
);
numAtoms
=
numParticles
;
paddedNumAtoms
=
TileSize
*
((
numParticles
+
TileSize
-
1
)
/
TileSize
);
...
...
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