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
21d2b6b9
Commit
21d2b6b9
authored
Nov 29, 2012
by
Peter Eastman
Browse files
Fixed bugs in CUDA implementation of AmoebaWcaDispersionForce
parent
dbccc9dc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
+10
-7
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernels.cpp
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernels.cpp
+2
-1
plugins/amoeba/platforms/cuda/src/kernels/amoebaWcaForce.cu
plugins/amoeba/platforms/cuda/src/kernels/amoebaWcaForce.cu
+8
-6
No files found.
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernels.cpp
View file @
21d2b6b9
...
@@ -2231,7 +2231,7 @@ void CudaCalcAmoebaWcaDispersionForceKernel::initialize(const System& system, co
...
@@ -2231,7 +2231,7 @@ void CudaCalcAmoebaWcaDispersionForceKernel::initialize(const System& system, co
defines
[
"SHCTD"
]
=
cu
.
doubleToString
(
force
.
getShctd
());
defines
[
"SHCTD"
]
=
cu
.
doubleToString
(
force
.
getShctd
());
CUmodule
module
=
cu
.
createModule
(
CudaKernelSources
::
vectorOps
+
CudaAmoebaKernelSources
::
amoebaWcaForce
,
defines
);
CUmodule
module
=
cu
.
createModule
(
CudaKernelSources
::
vectorOps
+
CudaAmoebaKernelSources
::
amoebaWcaForce
,
defines
);
forceKernel
=
cu
.
getKernel
(
module
,
"computeWCAForce"
);
forceKernel
=
cu
.
getKernel
(
module
,
"computeWCAForce"
);
totalMaximumDispersionEnergy
=
AmoebaWcaDispersionForceImpl
::
getTotalMaximumDispersionEnergy
(
force
);
totalMaximumDispersionEnergy
=
AmoebaWcaDispersionForceImpl
::
getTotalMaximumDispersionEnergy
(
force
);
// Add an interaction to the default nonbonded kernel. This doesn't actually do any calculations. It's
// Add an interaction to the default nonbonded kernel. This doesn't actually do any calculations. It's
// just so that CudaNonbondedUtilities will keep track of the tiles.
// just so that CudaNonbondedUtilities will keep track of the tiles.
...
@@ -2269,5 +2269,6 @@ void CudaCalcAmoebaWcaDispersionForceKernel::copyParametersToContext(ContextImpl
...
@@ -2269,5 +2269,6 @@ void CudaCalcAmoebaWcaDispersionForceKernel::copyParametersToContext(ContextImpl
radiusEpsilonVec
[
i
]
=
make_float2
((
float
)
radius
,
(
float
)
epsilon
);
radiusEpsilonVec
[
i
]
=
make_float2
((
float
)
radius
,
(
float
)
epsilon
);
}
}
radiusEpsilon
->
upload
(
radiusEpsilonVec
);
radiusEpsilon
->
upload
(
radiusEpsilonVec
);
totalMaximumDispersionEnergy
=
AmoebaWcaDispersionForceImpl
::
getTotalMaximumDispersionEnergy
(
force
);
cu
.
invalidateMolecules
();
cu
.
invalidateMolecules
();
}
}
plugins/amoeba/platforms/cuda/src/kernels/amoebaWcaForce.cu
View file @
21d2b6b9
...
@@ -226,22 +226,24 @@ extern "C" __global__ void computeWCAForce(unsigned long long* __restrict__ forc
...
@@ -226,22 +226,24 @@ extern "C" __global__ void computeWCAForce(unsigned long long* __restrict__ forc
// Compute forces.
// Compute forces.
unsigned
int
tj
=
tgx
;
for
(
unsigned
int
j
=
0
;
j
<
TILE_SIZE
;
j
++
)
{
for
(
unsigned
int
j
=
0
;
j
<
TILE_SIZE
;
j
++
)
{
int
atom2
=
y
*
TILE_SIZE
+
j
;
int
atom2
=
y
*
TILE_SIZE
+
t
j
;
if
(
atom1
!=
atom2
&&
atom1
<
NUM_ATOMS
&&
atom2
<
NUM_ATOMS
)
{
if
(
atom1
!=
atom2
&&
atom1
<
NUM_ATOMS
&&
atom2
<
NUM_ATOMS
)
{
real3
tempForce
;
real3
tempForce
;
real
tempEnergy
;
real
tempEnergy
;
computeOneInteraction
(
data
,
localData
[
tbx
+
j
],
rmixo
,
rmixh
,
emixo
,
emixh
,
tempForce
,
tempEnergy
);
computeOneInteraction
(
data
,
localData
[
tbx
+
t
j
],
rmixo
,
rmixh
,
emixo
,
emixh
,
tempForce
,
tempEnergy
);
data
.
force
+=
tempForce
;
data
.
force
+=
tempForce
;
localData
[
tbx
+
j
].
force
-=
tempForce
;
localData
[
tbx
+
t
j
].
force
-=
tempForce
;
energy
+=
(
x
==
y
?
0.5
f
*
tempEnergy
:
tempEnergy
);
energy
+=
(
x
==
y
?
0.5
f
*
tempEnergy
:
tempEnergy
);
real
emjxo
,
emjxh
,
rmjxo
,
rmjxh
;
real
emjxo
,
emjxh
,
rmjxo
,
rmjxh
;
initParticleParameters
(
localData
[
tbx
+
j
].
radius
,
localData
[
tbx
+
j
].
epsilon
,
rmjxo
,
rmjxh
,
emjxo
,
emjxh
);
initParticleParameters
(
localData
[
tbx
+
t
j
].
radius
,
localData
[
tbx
+
t
j
].
epsilon
,
rmjxo
,
rmjxh
,
emjxo
,
emjxh
);
computeOneInteraction
(
localData
[
tbx
+
j
],
data
,
rmjxo
,
rmjxh
,
emjxo
,
emjxh
,
tempForce
,
tempEnergy
);
computeOneInteraction
(
localData
[
tbx
+
t
j
],
data
,
rmjxo
,
rmjxh
,
emjxo
,
emjxh
,
tempForce
,
tempEnergy
);
data
.
force
-=
tempForce
;
data
.
force
-=
tempForce
;
localData
[
tbx
+
j
].
force
+=
tempForce
;
localData
[
tbx
+
t
j
].
force
+=
tempForce
;
energy
+=
(
x
==
y
?
0.5
f
*
tempEnergy
:
tempEnergy
);
energy
+=
(
x
==
y
?
0.5
f
*
tempEnergy
:
tempEnergy
);
}
}
tj
=
(
tj
+
1
)
&
(
TILE_SIZE
-
1
);
}
}
unsigned
int
offset
=
x
*
TILE_SIZE
+
tgx
;
unsigned
int
offset
=
x
*
TILE_SIZE
+
tgx
;
atomicAdd
(
&
forceBuffers
[
offset
],
static_cast
<
unsigned
long
long
>
((
long
long
)
(
data
.
force
.
x
*
0xFFFFFFFF
)));
atomicAdd
(
&
forceBuffers
[
offset
],
static_cast
<
unsigned
long
long
>
((
long
long
)
(
data
.
force
.
x
*
0xFFFFFFFF
)));
...
...
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