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
5e535679
Commit
5e535679
authored
Dec 02, 2016
by
Peter Eastman
Browse files
Fixed error building neighbor list with triclinic boxes
parent
9f717609
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
1 deletion
+19
-1
platforms/cuda/src/CudaNonbondedUtilities.cpp
platforms/cuda/src/CudaNonbondedUtilities.cpp
+2
-0
platforms/cuda/src/kernels/findInteractingBlocks.cu
platforms/cuda/src/kernels/findInteractingBlocks.cu
+7
-0
platforms/opencl/src/OpenCLNonbondedUtilities.cpp
platforms/opencl/src/OpenCLNonbondedUtilities.cpp
+2
-0
platforms/opencl/src/kernels/findInteractingBlocks.cl
platforms/opencl/src/kernels/findInteractingBlocks.cl
+8
-1
No files found.
platforms/cuda/src/CudaNonbondedUtilities.cpp
View file @
5e535679
...
...
@@ -513,6 +513,8 @@ void CudaNonbondedUtilities::createKernelsForGroups(int groups) {
defines
[
"NUM_TILES_WITH_EXCLUSIONS"
]
=
context
.
intToString
(
exclusionTiles
->
getSize
());
if
(
usePeriodic
)
defines
[
"USE_PERIODIC"
]
=
"1"
;
if
(
context
.
getBoxIsTriclinic
())
defines
[
"TRICLINIC"
]
=
"1"
;
defines
[
"MAX_EXCLUSIONS"
]
=
context
.
intToString
(
maxExclusions
);
defines
[
"MAX_BITS_FOR_PAIRS"
]
=
(
canUsePairList
?
"2"
:
"0"
);
CUmodule
interactingBlocksProgram
=
context
.
createModule
(
CudaKernelSources
::
vectorOps
+
CudaKernelSources
::
findInteractingBlocks
,
defines
);
...
...
platforms/cuda/src/kernels/findInteractingBlocks.cu
View file @
5e535679
...
...
@@ -255,6 +255,13 @@ extern "C" __global__ void findBlocksWithInteractions(real4 periodicBoxSize, rea
blockDelta
.
y
=
max
(
0.0
f
,
fabs
(
blockDelta
.
y
)
-
blockSizeX
.
y
-
blockSizeY
.
y
);
blockDelta
.
z
=
max
(
0.0
f
,
fabs
(
blockDelta
.
z
)
-
blockSizeX
.
z
-
blockSizeY
.
z
);
includeBlock2
&=
(
blockDelta
.
x
*
blockDelta
.
x
+
blockDelta
.
y
*
blockDelta
.
y
+
blockDelta
.
z
*
blockDelta
.
z
<
PADDED_CUTOFF_SQUARED
);
#ifdef TRICLINIC
// The calculation to find the nearest periodic copy is only guaranteed to work if the nearest copy is less than half a box width away.
// If there's any possibility we might have missed it, do a detailed check.
if
(
periodicBoxSize
.
z
/
2
-
blockSizeX
.
z
-
blockSizeY
.
z
<
PADDED_CUTOFF
||
periodicBoxSize
.
y
/
2
-
blockSizeX
.
y
-
blockSizeY
.
y
<
PADDED_CUTOFF
)
includeBlock2
=
true
;
#endif
if
(
includeBlock2
)
{
unsigned
short
y
=
(
unsigned
short
)
sortedBlocks
[
block2
].
y
;
for
(
int
k
=
0
;
k
<
numExclusions
;
k
++
)
...
...
platforms/opencl/src/OpenCLNonbondedUtilities.cpp
View file @
5e535679
...
...
@@ -511,6 +511,8 @@ void OpenCLNonbondedUtilities::createKernelsForGroups(int groups) {
defines
[
"SIMD_WIDTH"
]
=
context
.
intToString
(
context
.
getSIMDWidth
());
if
(
usePeriodic
)
defines
[
"USE_PERIODIC"
]
=
"1"
;
if
(
context
.
getBoxIsTriclinic
())
defines
[
"TRICLINIC"
]
=
"1"
;
defines
[
"MAX_EXCLUSIONS"
]
=
context
.
intToString
(
maxExclusions
);
defines
[
"BUFFER_GROUPS"
]
=
(
deviceIsCpu
?
"4"
:
"2"
);
string
file
=
(
deviceIsCpu
?
OpenCLKernelSources
::
findInteractingBlocks_cpu
:
OpenCLKernelSources
::
findInteractingBlocks
);
...
...
platforms/opencl/src/kernels/findInteractingBlocks.cl
View file @
5e535679
...
...
@@ -105,7 +105,7 @@ __kernel void findBlocksWithInteractions(real4 periodicBoxSize, real4 invPeriodi
__local
volatile
int*
tileStartIndex
=
workgroupTileIndex+
(
warpStart/32
)
;
//
Loop
over
blocks.
for
(
int
block1
=
startBlockIndex+warpIndex
; block1 < startBlockIndex+numBlocks; block1 += totalWarps) {
//
Load
data
for
this
block.
Note
that
all
threads
in
a
warp
are
processing
the
same
block.
...
...
@@ -158,6 +158,13 @@ __kernel void findBlocksWithInteractions(real4 periodicBoxSize, real4 invPeriodi
blockDelta.y
=
max
((
real
)
0
,
fabs
(
blockDelta.y
)
-blockSizeX.y-blockSizeY.y
)
;
blockDelta.z
=
max
((
real
)
0
,
fabs
(
blockDelta.z
)
-blockSizeX.z-blockSizeY.z
)
;
includeBlock2
&=
(
blockDelta.x*blockDelta.x+blockDelta.y*blockDelta.y+blockDelta.z*blockDelta.z
<
PADDED_CUTOFF_SQUARED
)
;
#
ifdef
TRICLINIC
//
The
calculation
to
find
the
nearest
periodic
copy
is
only
guaranteed
to
work
if
the
nearest
copy
is
less
than
half
a
box
width
away.
//
If
there
's
any
possibility
we
might
have
missed
it,
do
a
detailed
check.
if
(
periodicBoxSize.z/2-blockSizeX.z-blockSizeY.z
<
PADDED_CUTOFF
|
| periodicBoxSize.y/2-blockSizeX.y-blockSizeY.y < PADDED_CUTOFF)
includeBlock2 = true;
#endif
if (includeBlock2) {
unsigned short y = (unsigned short) sortedBlocks[block2].y;
for (int k = 0; k < numExclusions; k++)
...
...
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