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
27b802cf
Commit
27b802cf
authored
Aug 22, 2013
by
Robert McGibbon
Browse files
bugfixes to previous commit
parent
576eb902
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
4 deletions
+15
-4
platforms/opencl/include/OpenCLContext.h
platforms/opencl/include/OpenCLContext.h
+7
-0
platforms/opencl/src/OpenCLContext.cpp
platforms/opencl/src/OpenCLContext.cpp
+6
-4
platforms/opencl/src/OpenCLPlatform.cpp
platforms/opencl/src/OpenCLPlatform.cpp
+2
-0
No files found.
platforms/opencl/include/OpenCLContext.h
View file @
27b802cf
...
...
@@ -191,6 +191,12 @@ public:
int
getDeviceIndex
()
{
return
deviceIndex
;
}
/**
* Get the index of the cl::Platform associated with this object.
*/
int
getPlatformIndex
()
{
return
platformIndex
;
}
/**
* Get the PlatformData object this context is part of.
*/
...
...
@@ -604,6 +610,7 @@ private:
double
time
;
OpenCLPlatform
::
PlatformData
&
platformData
;
int
deviceIndex
;
int
platformIndex
;
int
contextIndex
;
int
stepCount
;
int
computeForceCount
;
...
...
platforms/opencl/src/OpenCLContext.cpp
View file @
27b802cf
...
...
@@ -88,19 +88,19 @@ OpenCLContext::OpenCLContext(const System& system, int platformIndex, int device
contextIndex
=
platformData
.
contexts
.
size
();
std
::
vector
<
cl
::
Platform
>
platforms
;
cl
::
Platform
::
get
(
&
platforms
);
const
int
minThreadBlockSize
=
32
;
int
bestSpeed
=
-
1
;
int
bestDevice
=
-
1
;
int
bestPlatform
=
-
1
;
for
(
j
=
0
;
i
<
platforms
.
size
();
j
++
)
{
for
(
int
j
=
0
;
j
<
platforms
.
size
();
j
++
)
{
// if they supplied a valid platformIndex, we only look through that platform
if
(
j
!=
plaformIndex
&&
platformIndex
>=
0
&&
platformIndex
<
(
int
)
platforms
.
size
())
if
(
j
!=
pla
t
formIndex
&&
platformIndex
>=
0
&&
platformIndex
<
(
int
)
platforms
.
size
())
continue
;
string
platformVendor
=
platforms
[
j
].
getInfo
<
CL_PLATFORM_VENDOR
>
();
vector
<
cl
::
Device
>
devices
;
platforms
[
j
].
getDevices
(
CL_DEVICE_TYPE_ALL
,
&
devices
);
const
int
minThreadBlockSize
=
32
;
for
(
int
i
=
0
;
i
<
(
int
)
devices
.
size
();
i
++
)
{
// if they supplied a valid deviceIndex, we only look through that one
...
...
@@ -160,9 +160,11 @@ OpenCLContext::OpenCLContext(const System& system, int platformIndex, int device
vector
<
cl
::
Device
>
devices
;
platforms
[
bestPlatform
].
getDevices
(
CL_DEVICE_TYPE_ALL
,
&
devices
);
string
platformVendor
=
platforms
[
bestPlatform
].
getInfo
<
CL_PLATFORM_VENDOR
>
();
device
=
devices
[
bestDevice
];
this
->
deviceIndex
=
bestDevice
;
this
->
platformIndex
=
bestPlatform
;
if
(
device
.
getInfo
<
CL_DEVICE_MAX_WORK_GROUP_SIZE
>
()
<
minThreadBlockSize
)
throw
OpenMMException
(
"The specified OpenCL device is not compatible with OpenMM"
);
compilationDefines
[
"WORK_GROUP_SIZE"
]
=
intToString
(
ThreadBlockSize
);
...
...
@@ -244,7 +246,7 @@ OpenCLContext::OpenCLContext(const System& system, int platformIndex, int device
compilationDefines
[
"SYNC_WARPS"
]
=
"barrier(CLK_LOCAL_MEM_FENCE)"
;
vector
<
cl
::
Device
>
contextDevices
;
contextDevices
.
push_back
(
device
);
cl_context_properties
cprops
[]
=
{
CL_CONTEXT_PLATFORM
,
(
cl_context_properties
)
platforms
[
p
latform
Index
](),
0
};
cl_context_properties
cprops
[]
=
{
CL_CONTEXT_PLATFORM
,
(
cl_context_properties
)
platforms
[
bestP
latform
](),
0
};
context
=
cl
::
Context
(
contextDevices
,
cprops
,
errorCallback
);
queue
=
cl
::
CommandQueue
(
context
,
device
);
numAtoms
=
system
.
getNumParticles
();
...
...
platforms/opencl/src/OpenCLPlatform.cpp
View file @
27b802cf
...
...
@@ -161,6 +161,8 @@ OpenCLPlatform::PlatformData::PlatformData(const System& system, const string& p
deviceIndex
<<
contexts
[
i
]
->
getDeviceIndex
();
deviceName
<<
contexts
[
i
]
->
getDevice
().
getInfo
<
CL_DEVICE_NAME
>
();
}
platformIndex
=
contexts
[
0
]
->
getPlatformIndex
();
useCpuPme
=
(
cpuPmeProperty
==
"true"
&&
!
contexts
[
0
]
->
getUseDoublePrecision
());
propertyValues
[
OpenCLPlatform
::
OpenCLDeviceIndex
()]
=
deviceIndex
.
str
();
propertyValues
[
OpenCLPlatform
::
OpenCLDeviceName
()]
=
deviceName
.
str
();
...
...
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