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
aba74fd8
Commit
aba74fd8
authored
Aug 07, 2013
by
peastman
Browse files
Bug fixes and an optimization to CustomNonbondedForce with interaction groups
parent
5aebb617
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
15 deletions
+25
-15
platforms/cuda/src/CudaKernels.cpp
platforms/cuda/src/CudaKernels.cpp
+3
-0
platforms/cuda/src/kernels/customNonbondedGroups.cu
platforms/cuda/src/kernels/customNonbondedGroups.cu
+22
-15
No files found.
platforms/cuda/src/CudaKernels.cpp
View file @
aba74fd8
...
@@ -46,6 +46,7 @@
...
@@ -46,6 +46,7 @@
#include "lepton/ParsedExpression.h"
#include "lepton/ParsedExpression.h"
#include "SimTKOpenMMRealType.h"
#include "SimTKOpenMMRealType.h"
#include "SimTKOpenMMUtilities.h"
#include "SimTKOpenMMUtilities.h"
#include <algorithm>
#include <cmath>
#include <cmath>
#include <set>
#include <set>
...
@@ -2290,6 +2291,8 @@ double CudaCalcCustomNonbondedForceKernel::execute(ContextImpl& context, bool in
...
@@ -2290,6 +2291,8 @@ double CudaCalcCustomNonbondedForceKernel::execute(ContextImpl& context, bool in
interactionGroupArgs
.
push_back
(
&
cu
.
getEnergyBuffer
().
getDevicePointer
());
interactionGroupArgs
.
push_back
(
&
cu
.
getEnergyBuffer
().
getDevicePointer
());
interactionGroupArgs
.
push_back
(
&
cu
.
getPosq
().
getDevicePointer
());
interactionGroupArgs
.
push_back
(
&
cu
.
getPosq
().
getDevicePointer
());
interactionGroupArgs
.
push_back
(
&
interactionGroupData
->
getDevicePointer
());
interactionGroupArgs
.
push_back
(
&
interactionGroupData
->
getDevicePointer
());
interactionGroupArgs
.
push_back
(
cu
.
getPeriodicBoxSizePointer
());
interactionGroupArgs
.
push_back
(
cu
.
getInvPeriodicBoxSizePointer
());
for
(
int
i
=
0
;
i
<
(
int
)
params
->
getBuffers
().
size
();
i
++
)
for
(
int
i
=
0
;
i
<
(
int
)
params
->
getBuffers
().
size
();
i
++
)
interactionGroupArgs
.
push_back
(
&
params
->
getBuffers
()[
i
].
getMemory
());
interactionGroupArgs
.
push_back
(
&
params
->
getBuffers
()[
i
].
getMemory
());
if
(
globals
!=
NULL
)
if
(
globals
!=
NULL
)
...
...
platforms/cuda/src/kernels/customNonbondedGroups.cu
View file @
aba74fd8
...
@@ -11,7 +11,8 @@ typedef struct {
...
@@ -11,7 +11,8 @@ typedef struct {
}
AtomData
;
}
AtomData
;
extern
"C"
__global__
void
computeInteractionGroups
(
extern
"C"
__global__
void
computeInteractionGroups
(
unsigned
long
long
*
__restrict__
forceBuffers
,
real
*
__restrict__
energyBuffer
,
const
real4
*
__restrict__
posq
,
const
int4
*
__restrict__
groupData
unsigned
long
long
*
__restrict__
forceBuffers
,
real
*
__restrict__
energyBuffer
,
const
real4
*
__restrict__
posq
,
const
int4
*
__restrict__
groupData
,
real4
periodicBoxSize
,
real4
invPeriodicBoxSize
PARAMETER_ARGUMENTS
)
{
PARAMETER_ARGUMENTS
)
{
const
unsigned
int
totalWarps
=
(
blockDim
.
x
*
gridDim
.
x
)
/
TILE_SIZE
;
const
unsigned
int
totalWarps
=
(
blockDim
.
x
*
gridDim
.
x
)
/
TILE_SIZE
;
const
unsigned
int
warp
=
(
blockIdx
.
x
*
blockDim
.
x
+
threadIdx
.
x
)
/
TILE_SIZE
;
// global warpIndex
const
unsigned
int
warp
=
(
blockIdx
.
x
*
blockDim
.
x
+
threadIdx
.
x
)
/
TILE_SIZE
;
// global warpIndex
...
@@ -53,20 +54,26 @@ extern "C" __global__ void computeInteractionGroups(
...
@@ -53,20 +54,26 @@ extern "C" __global__ void computeInteractionGroups(
delta
.
z
-=
floor
(
delta
.
z
*
invPeriodicBoxSize
.
z
+
0.5
f
)
*
periodicBoxSize
.
z
;
delta
.
z
-=
floor
(
delta
.
z
*
invPeriodicBoxSize
.
z
+
0.5
f
)
*
periodicBoxSize
.
z
;
#endif
#endif
real
r2
=
delta
.
x
*
delta
.
x
+
delta
.
y
*
delta
.
y
+
delta
.
z
*
delta
.
z
;
real
r2
=
delta
.
x
*
delta
.
x
+
delta
.
y
*
delta
.
y
+
delta
.
z
*
delta
.
z
;
real
invR
=
RSQRT
(
r2
);
#ifdef USE_CUTOFF
real
r
=
RECIP
(
invR
);
if
(
!
isExcluded
&&
r2
<
CUTOFF_SQUARED
)
{
LOAD_ATOM2_PARAMETERS
#endif
real
dEdR
=
0.0
f
;
real
invR
=
RSQRT
(
r2
);
real
tempEnergy
=
0.0
f
;
real
r
=
RECIP
(
invR
);
COMPUTE_INTERACTION
LOAD_ATOM2_PARAMETERS
energy
+=
tempEnergy
;
real
dEdR
=
0.0
f
;
delta
*=
dEdR
;
real
tempEnergy
=
0.0
f
;
force
.
x
-=
delta
.
x
;
COMPUTE_INTERACTION
force
.
y
-=
delta
.
y
;
energy
+=
tempEnergy
;
force
.
z
-=
delta
.
z
;
delta
*=
dEdR
;
localData
[
localIndex
].
fx
+=
delta
.
x
;
force
.
x
-=
delta
.
x
;
localData
[
localIndex
].
fy
+=
delta
.
y
;
force
.
y
-=
delta
.
y
;
localData
[
localIndex
].
fz
+=
delta
.
z
;
force
.
z
-=
delta
.
z
;
localData
[
localIndex
].
fx
+=
delta
.
x
;
localData
[
localIndex
].
fy
+=
delta
.
y
;
localData
[
localIndex
].
fz
+=
delta
.
z
;
#ifdef USE_CUTOFF
}
#endif
tj
=
(
tj
==
rangeEnd
-
1
?
rangeStart
:
tj
+
1
);
tj
=
(
tj
==
rangeEnd
-
1
?
rangeStart
:
tj
+
1
);
}
}
if
(
exclusions
!=
0
)
{
if
(
exclusions
!=
0
)
{
...
...
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