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
8365dede
Commit
8365dede
authored
Nov 07, 2009
by
Peter Eastman
Browse files
Fixed two bugs
parent
cc5467e7
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
4 deletions
+11
-4
platforms/opencl/src/OpenCLContext.cpp
platforms/opencl/src/OpenCLContext.cpp
+1
-0
platforms/opencl/src/OpenCLContext.h
platforms/opencl/src/OpenCLContext.h
+7
-0
platforms/opencl/src/OpenCLKernels.cpp
platforms/opencl/src/OpenCLKernels.cpp
+2
-2
platforms/opencl/src/OpenCLPlatform.cpp
platforms/opencl/src/OpenCLPlatform.cpp
+1
-2
No files found.
platforms/opencl/src/OpenCLContext.cpp
View file @
8365dede
...
...
@@ -60,6 +60,7 @@ OpenCLContext::OpenCLContext(int numParticles, int deviceIndex) : time(0.0), ste
if
(
deviceIndex
==
-
1
)
throw
OpenMMException
(
"No compatible OpenCL device is available"
);
device
=
devices
[
deviceIndex
];
this
->
deviceIndex
=
deviceIndex
;
if
(
device
.
getInfo
<
CL_DEVICE_MAX_WORK_GROUP_SIZE
>
()
<
minThreadBlockSize
)
throw
OpenMMException
(
"The specified OpenCL device is not compatible with OpenMM"
);
compilationOptions
=
"-cl-fast-relaxed-math"
;
...
...
platforms/opencl/src/OpenCLContext.h
View file @
8365dede
...
...
@@ -97,6 +97,12 @@ public:
cl
::
Device
&
getDevice
()
{
return
device
;
}
/**
* Get the index of the cl::Device associated with this object.
*/
int
getDeviceIndex
()
{
return
deviceIndex
;
}
/**
* Get the cl::CommandQueue associated with this object.
*/
...
...
@@ -286,6 +292,7 @@ private:
void
findMoleculeGroups
(
const
System
&
system
);
static
void
tagAtomsInMolecule
(
int
atom
,
int
molecule
,
std
::
vector
<
int
>&
atomMolecule
,
std
::
vector
<
std
::
vector
<
int
>
>&
atomBonds
);
double
time
;
int
deviceIndex
;
int
stepCount
;
int
computeForceCount
;
int
numAtoms
;
...
...
platforms/opencl/src/OpenCLKernels.cpp
View file @
8365dede
...
...
@@ -1140,7 +1140,7 @@ void OpenCLCalcGBSAOBCForceKernel::executeForces(ContextImpl& context) {
program
=
cl
.
createProgram
(
cl
.
loadSourceFromFile
(
"gbsaObcReductions.cl"
),
defines
);
reduceBornSumKernel
=
cl
::
Kernel
(
program
,
"reduceBornSum"
);
reduceBornSumKernel
.
setArg
<
cl_int
>
(
0
,
cl
.
getPaddedNumAtoms
());
reduceBornSumKernel
.
setArg
<
cl_int
>
(
1
,
cl
.
getNumForceBuffers
());
reduceBornSumKernel
.
setArg
<
cl_int
>
(
1
,
nb
.
getNumForceBuffers
());
reduceBornSumKernel
.
setArg
<
cl_float
>
(
2
,
1.0
f
);
reduceBornSumKernel
.
setArg
<
cl_float
>
(
3
,
0.8
f
);
reduceBornSumKernel
.
setArg
<
cl_float
>
(
4
,
4.85
f
);
...
...
@@ -1150,7 +1150,7 @@ void OpenCLCalcGBSAOBCForceKernel::executeForces(ContextImpl& context) {
reduceBornSumKernel
.
setArg
<
cl
::
Buffer
>
(
8
,
obcChain
->
getDeviceBuffer
());
reduceBornForceKernel
=
cl
::
Kernel
(
program
,
"reduceBornForce"
);
reduceBornForceKernel
.
setArg
<
cl_int
>
(
0
,
cl
.
getPaddedNumAtoms
());
reduceBornForceKernel
.
setArg
<
cl_int
>
(
1
,
cl
.
getNumForceBuffers
());
reduceBornForceKernel
.
setArg
<
cl_int
>
(
1
,
nb
.
getNumForceBuffers
());
reduceBornForceKernel
.
setArg
<
cl
::
Buffer
>
(
2
,
bornForce
->
getDeviceBuffer
());
reduceBornForceKernel
.
setArg
<
cl
::
Buffer
>
(
3
,
cl
.
getEnergyBuffer
().
getDeviceBuffer
());
reduceBornForceKernel
.
setArg
<
cl
::
Buffer
>
(
4
,
params
->
getDeviceBuffer
());
...
...
platforms/opencl/src/OpenCLPlatform.cpp
View file @
8365dede
...
...
@@ -93,13 +93,12 @@ void OpenCLPlatform::contextCreated(ContextImpl& context) const {
void
OpenCLPlatform
::
contextDestroyed
(
ContextImpl
&
context
)
const
{
PlatformData
*
data
=
reinterpret_cast
<
PlatformData
*>
(
context
.
getPlatformData
());
// gpuShutDown(data->gpu);
delete
data
;
}
OpenCLPlatform
::
PlatformData
::
PlatformData
(
int
numParticles
,
int
deviceIndex
)
:
removeCM
(
false
),
stepCount
(
0
),
computeForceCount
(
0
),
time
(
0.0
)
{
context
=
new
OpenCLContext
(
numParticles
,
deviceIndex
);
stringstream
device
;
//
device <<
gpu->device
;
device
<<
context
->
getDeviceIndex
()
;
propertyValues
[
OpenCLPlatform
::
OpenCLDeviceIndex
()]
=
device
.
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