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
36b9db84
"plugins/rpmd/vscode:/vscode.git/clone" did not exist on "18eaf2ca75dd00f829d623159d175a92ed553810"
Commit
36b9db84
authored
Jul 13, 2018
by
Peter Eastman
Browse files
Bug fixes and code simplification
parent
1b12ede8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
11 deletions
+7
-11
platforms/cuda/src/CudaKernels.cpp
platforms/cuda/src/CudaKernels.cpp
+4
-5
platforms/cuda/src/kernels/pme.cu
platforms/cuda/src/kernels/pme.cu
+3
-6
No files found.
platforms/cuda/src/CudaKernels.cpp
View file @
36b9db84
...
@@ -1749,7 +1749,6 @@ void CudaCalcNonbondedForceKernel::initialize(const System& system, const Nonbon
...
@@ -1749,7 +1749,6 @@ void CudaCalcNonbondedForceKernel::initialize(const System& system, const Nonbon
pmeDefines
[
"GRID_SIZE_X"
]
=
cu
.
intToString
(
dispersionGridSizeX
);
pmeDefines
[
"GRID_SIZE_X"
]
=
cu
.
intToString
(
dispersionGridSizeX
);
pmeDefines
[
"GRID_SIZE_Y"
]
=
cu
.
intToString
(
dispersionGridSizeY
);
pmeDefines
[
"GRID_SIZE_Y"
]
=
cu
.
intToString
(
dispersionGridSizeY
);
pmeDefines
[
"GRID_SIZE_Z"
]
=
cu
.
intToString
(
dispersionGridSizeZ
);
pmeDefines
[
"GRID_SIZE_Z"
]
=
cu
.
intToString
(
dispersionGridSizeZ
);
pmeDefines
[
"EPSILON_FACTOR"
]
=
"1"
;
pmeDefines
[
"RECIP_EXP_FACTOR"
]
=
cu
.
doubleToString
(
M_PI
*
M_PI
/
(
dispersionAlpha
*
dispersionAlpha
));
pmeDefines
[
"RECIP_EXP_FACTOR"
]
=
cu
.
doubleToString
(
M_PI
*
M_PI
/
(
dispersionAlpha
*
dispersionAlpha
));
pmeDefines
[
"USE_LJPME"
]
=
"1"
;
pmeDefines
[
"USE_LJPME"
]
=
"1"
;
double
invRCut6
=
pow
(
force
.
getCutoffDistance
(),
-
6
);
double
invRCut6
=
pow
(
force
.
getCutoffDistance
(),
-
6
);
...
@@ -1778,7 +1777,7 @@ void CudaCalcNonbondedForceKernel::initialize(const System& system, const Nonbon
...
@@ -1778,7 +1777,7 @@ void CudaCalcNonbondedForceKernel::initialize(const System& system, const Nonbon
roundedZSize
=
PmeOrder
*
(
int
)
ceil
(
dispersionGridSizeZ
/
(
double
)
PmeOrder
);
roundedZSize
=
PmeOrder
*
(
int
)
ceil
(
dispersionGridSizeZ
/
(
double
)
PmeOrder
);
gridElements
=
max
(
gridElements
,
dispersionGridSizeX
*
dispersionGridSizeY
*
roundedZSize
);
gridElements
=
max
(
gridElements
,
dispersionGridSizeX
*
dispersionGridSizeY
*
roundedZSize
);
}
}
pmeGrid1
.
initialize
(
cu
,
gridElements
,
2
*
elementSize
,
"
originalP
meGrid"
);
pmeGrid1
.
initialize
(
cu
,
gridElements
,
2
*
elementSize
,
"
p
meGrid
1
"
);
pmeGrid2
.
initialize
(
cu
,
gridElements
,
2
*
elementSize
,
"pmeGrid2"
);
pmeGrid2
.
initialize
(
cu
,
gridElements
,
2
*
elementSize
,
"pmeGrid2"
);
cu
.
addAutoclearBuffer
(
pmeGrid2
);
cu
.
addAutoclearBuffer
(
pmeGrid2
);
pmeBsplineModuliX
.
initialize
(
cu
,
gridSizeX
,
elementSize
,
"pmeBsplineModuliX"
);
pmeBsplineModuliX
.
initialize
(
cu
,
gridSizeX
,
elementSize
,
"pmeBsplineModuliX"
);
...
@@ -2196,14 +2195,14 @@ double CudaCalcNonbondedForceKernel::execute(ContextImpl& context, bool includeF
...
@@ -2196,14 +2195,14 @@ double CudaCalcNonbondedForceKernel::execute(ContextImpl& context, bool includeF
sort
->
sort
(
pmeAtomGridIndex
);
sort
->
sort
(
pmeAtomGridIndex
);
}
}
cu
.
clearBuffer
(
pmeGrid
1
);
cu
.
clearBuffer
(
pmeGrid
2
);
void
*
spreadArgs
[]
=
{
&
cu
.
getPosq
().
getDevicePointer
(),
&
pmeGrid
1
.
getDevicePointer
(),
cu
.
getPeriodicBoxSizePointer
(),
void
*
spreadArgs
[]
=
{
&
cu
.
getPosq
().
getDevicePointer
(),
&
pmeGrid
2
.
getDevicePointer
(),
cu
.
getPeriodicBoxSizePointer
(),
cu
.
getInvPeriodicBoxSizePointer
(),
cu
.
getPeriodicBoxVecXPointer
(),
cu
.
getPeriodicBoxVecYPointer
(),
cu
.
getPeriodicBoxVecZPointer
(),
cu
.
getInvPeriodicBoxSizePointer
(),
cu
.
getPeriodicBoxVecXPointer
(),
cu
.
getPeriodicBoxVecYPointer
(),
cu
.
getPeriodicBoxVecZPointer
(),
recipBoxVectorPointer
[
0
],
recipBoxVectorPointer
[
1
],
recipBoxVectorPointer
[
2
],
&
pmeAtomGridIndex
.
getDevicePointer
(),
recipBoxVectorPointer
[
0
],
recipBoxVectorPointer
[
1
],
recipBoxVectorPointer
[
2
],
&
pmeAtomGridIndex
.
getDevicePointer
(),
&
sigmaEpsilon
.
getDevicePointer
()};
&
sigmaEpsilon
.
getDevicePointer
()};
cu
.
executeKernel
(
pmeDispersionSpreadChargeKernel
,
spreadArgs
,
cu
.
getNumAtoms
(),
128
);
cu
.
executeKernel
(
pmeDispersionSpreadChargeKernel
,
spreadArgs
,
cu
.
getNumAtoms
(),
128
);
void
*
finishSpreadArgs
[]
=
{
&
pmeGrid1
.
getDevicePointer
()};
void
*
finishSpreadArgs
[]
=
{
&
pmeGrid2
.
getDevicePointer
(),
&
pmeGrid1
.
getDevicePointer
()};
cu
.
executeKernel
(
pmeDispersionFinishSpreadChargeKernel
,
finishSpreadArgs
,
dispersionGridSizeX
*
dispersionGridSizeY
*
dispersionGridSizeZ
,
256
);
cu
.
executeKernel
(
pmeDispersionFinishSpreadChargeKernel
,
finishSpreadArgs
,
dispersionGridSizeX
*
dispersionGridSizeY
*
dispersionGridSizeZ
,
256
);
if
(
useCudaFFT
)
{
if
(
useCudaFFT
)
{
...
...
platforms/cuda/src/kernels/pme.cu
View file @
36b9db84
...
@@ -52,7 +52,7 @@ extern "C" __global__ void gridSpreadCharge(const real4* __restrict__ posq, real
...
@@ -52,7 +52,7 @@ extern "C" __global__ void gridSpreadCharge(const real4* __restrict__ posq, real
real4
pos
=
posq
[
atom
];
real4
pos
=
posq
[
atom
];
#ifdef USE_LJPME
#ifdef USE_LJPME
const
float2
sigEps
=
sigmaEpsilon
[
atom
];
const
float2
sigEps
=
sigmaEpsilon
[
atom
];
const
real
charge
=
8
*
sigEps
.
x
*
sigEps
.
x
*
sigEps
.
x
*
sigEps
.
y
*
EPSILON_FACTOR
;
const
real
charge
=
8
*
sigEps
.
x
*
sigEps
.
x
*
sigEps
.
x
*
sigEps
.
y
;
#else
#else
const
real
charge
=
(
CHARGE
)
*
EPSILON_FACTOR
;
const
real
charge
=
(
CHARGE
)
*
EPSILON_FACTOR
;
#endif
#endif
...
@@ -140,11 +140,8 @@ extern "C" __global__ void finishSpreadCharge(
...
@@ -140,11 +140,8 @@ extern "C" __global__ void finishSpreadCharge(
const
unsigned
int
gridSize
=
GRID_SIZE_X
*
GRID_SIZE_Y
*
GRID_SIZE_Z
;
const
unsigned
int
gridSize
=
GRID_SIZE_X
*
GRID_SIZE_Y
*
GRID_SIZE_Z
;
real
scale
=
1
/
(
real
)
0x100000000
;
real
scale
=
1
/
(
real
)
0x100000000
;
for
(
int
index
=
blockIdx
.
x
*
blockDim
.
x
+
threadIdx
.
x
;
index
<
gridSize
;
index
+=
blockDim
.
x
*
gridDim
.
x
)
{
for
(
int
index
=
blockIdx
.
x
*
blockDim
.
x
+
threadIdx
.
x
;
index
<
gridSize
;
index
+=
blockDim
.
x
*
gridDim
.
x
)
{
int
xindex
=
index
/
(
GRID_SIZE_Y
*
GRID_SIZE_Z
);
int
zindex
=
index
%
GRID_SIZE_Z
;
int
remainder
=
index
-
xindex
*
GRID_SIZE_Y
*
GRID_SIZE_Z
;
int
loadIndex
=
zindexTable
[
zindex
]
+
blockSize
*
(
int
)
(
index
/
GRID_SIZE_Z
);
int
yindex
=
remainder
/
GRID_SIZE_Z
;
int
zindex
=
remainder
-
yindex
*
GRID_SIZE_Z
;
int
loadIndex
=
zindexTable
[
zindex
]
+
(
xindex
*
GRID_SIZE_Y
+
yindex
)
*
blockSize
;
#if defined(USE_DOUBLE_PRECISION) || defined(USE_DETERMINISTIC_FORCES)
#if defined(USE_DOUBLE_PRECISION) || defined(USE_DETERMINISTIC_FORCES)
grid2
[
index
]
=
scale
*
grid1
[
loadIndex
];
grid2
[
index
]
=
scale
*
grid1
[
loadIndex
];
#else
#else
...
...
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