Commit 52a6a366 authored by Peter Eastman's avatar Peter Eastman
Browse files

Fixed bugs in CPU version of Custom GB

parent 600a7afa
...@@ -2339,7 +2339,7 @@ double OpenCLCalcCustomGBForceKernel::execute(ContextImpl& context, bool include ...@@ -2339,7 +2339,7 @@ double OpenCLCalcCustomGBForceKernel::execute(ContextImpl& context, bool include
} }
int index = 0; int index = 0;
pairValueKernel.setArg<cl::Buffer>(index++, cl.getPosq().getDeviceBuffer()); pairValueKernel.setArg<cl::Buffer>(index++, cl.getPosq().getDeviceBuffer());
pairValueKernel.setArg(index++, nb.getForceThreadBlockSize()*sizeof(cl_float4), NULL); pairValueKernel.setArg(index++, (deviceIsCpu ? OpenCLContext::TileSize : nb.getForceThreadBlockSize())*sizeof(cl_float4), NULL);
pairValueKernel.setArg<cl::Buffer>(index++, cl.getNonbondedUtilities().getExclusions().getDeviceBuffer()); pairValueKernel.setArg<cl::Buffer>(index++, cl.getNonbondedUtilities().getExclusions().getDeviceBuffer());
pairValueKernel.setArg<cl::Buffer>(index++, cl.getNonbondedUtilities().getExclusionIndices().getDeviceBuffer()); pairValueKernel.setArg<cl::Buffer>(index++, cl.getNonbondedUtilities().getExclusionIndices().getDeviceBuffer());
pairValueKernel.setArg<cl::Buffer>(index++, cl.getNonbondedUtilities().getExclusionRowIndices().getDeviceBuffer()); pairValueKernel.setArg<cl::Buffer>(index++, cl.getNonbondedUtilities().getExclusionRowIndices().getDeviceBuffer());
...@@ -2361,7 +2361,7 @@ double OpenCLCalcCustomGBForceKernel::execute(ContextImpl& context, bool include ...@@ -2361,7 +2361,7 @@ double OpenCLCalcCustomGBForceKernel::execute(ContextImpl& context, bool include
for (int i = 0; i < (int) params->getBuffers().size(); i++) { for (int i = 0; i < (int) params->getBuffers().size(); i++) {
const OpenCLNonbondedUtilities::ParameterInfo& buffer = params->getBuffers()[i]; const OpenCLNonbondedUtilities::ParameterInfo& buffer = params->getBuffers()[i];
pairValueKernel.setArg<cl::Memory>(index++, buffer.getMemory()); pairValueKernel.setArg<cl::Memory>(index++, buffer.getMemory());
pairValueKernel.setArg(index++, nb.getForceThreadBlockSize()*buffer.getSize(), NULL); pairValueKernel.setArg(index++, (deviceIsCpu ? OpenCLContext::TileSize : nb.getForceThreadBlockSize())*buffer.getSize(), NULL);
} }
if (tabulatedFunctionParams != NULL) { if (tabulatedFunctionParams != NULL) {
for (int i = 0; i < (int) tabulatedFunctions.size(); i++) for (int i = 0; i < (int) tabulatedFunctions.size(); i++)
......
...@@ -80,6 +80,7 @@ __kernel void computeN2Energy(__global float4* restrict forceBuffers, __global f ...@@ -80,6 +80,7 @@ __kernel void computeN2Energy(__global float4* restrict forceBuffers, __global f
#endif #endif
unsigned int atom1 = x*TILE_SIZE+tgx; unsigned int atom1 = x*TILE_SIZE+tgx;
float4 force = 0.0f; float4 force = 0.0f;
DECLARE_ATOM1_DERIVATIVES
float4 posq1 = posq[atom1]; float4 posq1 = posq[atom1];
LOAD_ATOM1_PARAMETERS LOAD_ATOM1_PARAMETERS
for (unsigned int j = 0; j < TILE_SIZE; j++) { for (unsigned int j = 0; j < TILE_SIZE; j++) {
...@@ -141,6 +142,7 @@ __kernel void computeN2Energy(__global float4* restrict forceBuffers, __global f ...@@ -141,6 +142,7 @@ __kernel void computeN2Energy(__global float4* restrict forceBuffers, __global f
if ((flags2&(1<<tgx)) != 0) { if ((flags2&(1<<tgx)) != 0) {
unsigned int atom1 = x*TILE_SIZE+tgx; unsigned int atom1 = x*TILE_SIZE+tgx;
float value = 0.0f; float value = 0.0f;
DECLARE_ATOM1_DERIVATIVES
float4 posq1 = posq[atom1]; float4 posq1 = posq[atom1];
LOAD_ATOM1_PARAMETERS LOAD_ATOM1_PARAMETERS
for (unsigned int j = 0; j < TILE_SIZE; j++) { for (unsigned int j = 0; j < TILE_SIZE; j++) {
...@@ -188,6 +190,7 @@ __kernel void computeN2Energy(__global float4* restrict forceBuffers, __global f ...@@ -188,6 +190,7 @@ __kernel void computeN2Energy(__global float4* restrict forceBuffers, __global f
for (unsigned int tgx = 0; tgx < TILE_SIZE; tgx++) { for (unsigned int tgx = 0; tgx < TILE_SIZE; tgx++) {
unsigned int atom1 = x*TILE_SIZE+tgx; unsigned int atom1 = x*TILE_SIZE+tgx;
float4 force = 0.0f; float4 force = 0.0f;
DECLARE_ATOM1_DERIVATIVES
float4 posq1 = posq[atom1]; float4 posq1 = posq[atom1];
LOAD_ATOM1_PARAMETERS LOAD_ATOM1_PARAMETERS
#ifdef USE_EXCLUSIONS #ifdef USE_EXCLUSIONS
......
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