Unverified Commit 2c287f10 authored by Peter Eastman's avatar Peter Eastman Committed by GitHub
Browse files

Fixed issue that caused inefficient sorting when a block contained only one atom (#5215)

* Fixed issue that caused inefficient sorting when a block contained only one atom

* Add the fix to OpenCL and HIP
parent acf36fd6
......@@ -109,6 +109,7 @@ extern "C" __global__ void computeSortKeys(const real4* __restrict__ blockBoundi
sizeRange = blockSizeRange[0];
for (int i = 1; i < numSizes; i++) {
real2 size = blockSizeRange[i];
if (size.x > 0)
sizeRange.x = min(sizeRange.x, size.x);
sizeRange.y = max(sizeRange.y, size.y);
}
......
......@@ -115,6 +115,7 @@ extern "C" __global__ void findBlockBounds(int numAtoms, real4 periodicBoxSize,
// Record the range of sizes.
real totalSize = blockSize.x+blockSize.y+blockSize.z;
if (totalSize > 0)
atomicMin(&blockSizeRange->x, totalSize);
atomicMax(&blockSizeRange->y, totalSize);
}
......
......@@ -75,6 +75,7 @@ __kernel void computeSortKeys(__global const real4* restrict blockBoundingBox, _
sizeRange = blockSizeRange[0];
for (int i = 1; i < numSizes; i++) {
real2 size = blockSizeRange[i];
if (size.x > 0)
sizeRange.x = min(sizeRange.x, size.x);
sizeRange.y = max(sizeRange.y, size.y);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment