Commit 042b8c2c authored by Peter Eastman's avatar Peter Eastman
Browse files

Fixed crashes in variable time step integrators

parent 94fd9e1d
...@@ -4329,7 +4329,7 @@ double CudaIntegrateVariableLangevinStepKernel::execute(ContextImpl& context, co ...@@ -4329,7 +4329,7 @@ double CudaIntegrateVariableLangevinStepKernel::execute(ContextImpl& context, co
useDouble ? (void*) &kT : (void*) &kTFloat, useDouble ? (void*) &kT : (void*) &kTFloat,
&cu.getIntegrationUtilities().getStepSize().getDevicePointer(), &cu.getIntegrationUtilities().getStepSize().getDevicePointer(),
&cu.getVelm().getDevicePointer(), &cu.getForce().getDevicePointer(), &params->getDevicePointer()}; &cu.getVelm().getDevicePointer(), &cu.getForce().getDevicePointer(), &params->getDevicePointer()};
int sharedSize = blockSize*(useDouble ? sizeof(double) : sizeof(float)); int sharedSize = 2*blockSize*(useDouble ? sizeof(double) : sizeof(float));
cu.executeKernel(selectSizeKernel, argsSelect, blockSize, blockSize, sharedSize); cu.executeKernel(selectSizeKernel, argsSelect, blockSize, blockSize, sharedSize);
// Call the first integration kernel. // Call the first integration kernel.
......
...@@ -4466,7 +4466,8 @@ double OpenCLIntegrateVariableVerletStepKernel::execute(ContextImpl& context, co ...@@ -4466,7 +4466,8 @@ double OpenCLIntegrateVariableVerletStepKernel::execute(ContextImpl& context, co
selectSizeKernel.setArg<cl::Buffer>(3, cl.getIntegrationUtilities().getStepSize().getDeviceBuffer()); selectSizeKernel.setArg<cl::Buffer>(3, cl.getIntegrationUtilities().getStepSize().getDeviceBuffer());
selectSizeKernel.setArg<cl::Buffer>(4, cl.getVelm().getDeviceBuffer()); selectSizeKernel.setArg<cl::Buffer>(4, cl.getVelm().getDeviceBuffer());
selectSizeKernel.setArg<cl::Buffer>(5, cl.getForce().getDeviceBuffer()); selectSizeKernel.setArg<cl::Buffer>(5, cl.getForce().getDeviceBuffer());
selectSizeKernel.setArg(6, blockSize*sizeof(cl_float), NULL); int elementSize = (useDouble ? sizeof(cl_double) : sizeof(cl_float));
selectSizeKernel.setArg(6, blockSize*elementSize, NULL);
} }
// Select the step size to use. // Select the step size to use.
...@@ -4572,8 +4573,9 @@ double OpenCLIntegrateVariableLangevinStepKernel::execute(ContextImpl& context, ...@@ -4572,8 +4573,9 @@ double OpenCLIntegrateVariableLangevinStepKernel::execute(ContextImpl& context,
selectSizeKernel.setArg<cl::Buffer>(5, cl.getVelm().getDeviceBuffer()); selectSizeKernel.setArg<cl::Buffer>(5, cl.getVelm().getDeviceBuffer());
selectSizeKernel.setArg<cl::Buffer>(6, cl.getForce().getDeviceBuffer()); selectSizeKernel.setArg<cl::Buffer>(6, cl.getForce().getDeviceBuffer());
selectSizeKernel.setArg<cl::Buffer>(7, params->getDeviceBuffer()); selectSizeKernel.setArg<cl::Buffer>(7, params->getDeviceBuffer());
selectSizeKernel.setArg(8, params->getSize()*sizeof(cl_float), NULL); int elementSize = (useDouble ? sizeof(cl_double) : sizeof(cl_float));
selectSizeKernel.setArg(9, blockSize*sizeof(cl_float), NULL); selectSizeKernel.setArg(8, params->getSize()*elementSize, NULL);
selectSizeKernel.setArg(9, blockSize*elementSize, NULL);
} }
// Select the step size to use. // Select the step size to use.
......
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