Commit 1e2606ec authored by Peter Eastman's avatar Peter Eastman
Browse files

Fixed bug in parallel nonbonded force

parent 1a21cf08
...@@ -375,6 +375,8 @@ void OpenCLNonbondedUtilities::setTileRange(int startTileIndex, int numTiles) { ...@@ -375,6 +375,8 @@ void OpenCLNonbondedUtilities::setTileRange(int startTileIndex, int numTiles) {
findInteractingBlocksKernel.setArg<cl_uint>(10, startTileIndex); findInteractingBlocksKernel.setArg<cl_uint>(10, startTileIndex);
findInteractingBlocksKernel.setArg<cl_uint>(11, startTileIndex+numTiles); findInteractingBlocksKernel.setArg<cl_uint>(11, startTileIndex+numTiles);
} }
else
forceKernel.setArg<cl_uint>(9, numTiles);
} }
cl::Kernel OpenCLNonbondedUtilities::createInteractionKernel(const string& source, const vector<ParameterInfo>& params, const vector<ParameterInfo>& arguments, bool useExclusions, bool isSymmetric) const { cl::Kernel OpenCLNonbondedUtilities::createInteractionKernel(const string& source, const vector<ParameterInfo>& params, const vector<ParameterInfo>& arguments, bool useExclusions, bool isSymmetric) const {
......
...@@ -676,7 +676,7 @@ void testDispersionCorrection() { ...@@ -676,7 +676,7 @@ void testDispersionCorrection() {
ASSERT_EQUAL_TOL(expected, energy1-energy2, 1e-4); ASSERT_EQUAL_TOL(expected, energy1-energy2, 1e-4);
} }
void testParallelComputation() { void testParallelComputation(bool useCutoff) {
OpenCLPlatform platform; OpenCLPlatform platform;
System system; System system;
const int numParticles = 200; const int numParticles = 200;
...@@ -685,6 +685,8 @@ void testParallelComputation() { ...@@ -685,6 +685,8 @@ void testParallelComputation() {
NonbondedForce* force = new NonbondedForce(); NonbondedForce* force = new NonbondedForce();
for (int i = 0; i < numParticles; i++) for (int i = 0; i < numParticles; i++)
force->addParticle(i%2-0.5, 0.5, 1.0); force->addParticle(i%2-0.5, 0.5, 1.0);
if (useCutoff)
force->setNonbondedMethod(NonbondedForce::CutoffNonPeriodic);
system.addForce(force); system.addForce(force);
OpenMM_SFMT::SFMT sfmt; OpenMM_SFMT::SFMT sfmt;
init_gen_rand(0, sfmt); init_gen_rand(0, sfmt);
...@@ -725,7 +727,8 @@ int main() { ...@@ -725,7 +727,8 @@ int main() {
testBlockInteractions(false); testBlockInteractions(false);
testBlockInteractions(true); testBlockInteractions(true);
testDispersionCorrection(); testDispersionCorrection();
testParallelComputation(); testParallelComputation(false);
testParallelComputation(true);
} }
catch(const exception& e) { catch(const exception& e) {
cout << "exception: " << e.what() << endl; cout << "exception: " << e.what() << endl;
......
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