Commit 845050d4 authored by Peter Eastman's avatar Peter Eastman
Browse files

Optimization (consolidated two SHAKE related kernels into one)

parent 08f52358
...@@ -420,6 +420,22 @@ void kApplySecondShake_kernel() ...@@ -420,6 +420,22 @@ void kApplySecondShake_kernel()
pos += blockDim.x * gridDim.x; pos += blockDim.x * gridDim.x;
} }
// Update any atoms that SHAKE is not applied to.
pos = threadIdx.x + blockIdx.x * blockDim.x;
while (pos < cSim.NonShakeConstraints)
{
int atomID = cSim.pNonShakeID[pos];
float4 apos = cSim.pOldPosq[atomID];
float4 xpi = cSim.pPosq[atomID];
xpi.x += apos.x;
xpi.y += apos.y;
xpi.z += apos.z;
cSim.pPosq[atomID] = xpi;
pos += blockDim.x * gridDim.x;
}
} }
__global__ void __global__ void
...@@ -447,7 +463,6 @@ kApplyNoShake_kernel() ...@@ -447,7 +463,6 @@ kApplyNoShake_kernel()
} }
} }
void kApplySecondShake(gpuContext gpu) void kApplySecondShake(gpuContext gpu)
{ {
// printf("kApplySecondShake\n"); // printf("kApplySecondShake\n");
...@@ -456,11 +471,9 @@ void kApplySecondShake(gpuContext gpu) ...@@ -456,11 +471,9 @@ void kApplySecondShake(gpuContext gpu)
kApplySecondShake_kernel<<<gpu->sim.blocks, gpu->sim.shake_threads_per_block>>>(); kApplySecondShake_kernel<<<gpu->sim.blocks, gpu->sim.shake_threads_per_block>>>();
LAUNCHERROR("kApplySecondShake"); LAUNCHERROR("kApplySecondShake");
} }
else if (gpu->sim.NonShakeConstraints > 0)
// handle non-Shake atoms
if (gpu->sim.NonShakeConstraints > 0)
{ {
// handle non-Shake atoms
kApplyNoShake_kernel<<<gpu->sim.blocks, gpu->sim.nonshake_threads_per_block>>>(); kApplyNoShake_kernel<<<gpu->sim.blocks, gpu->sim.nonshake_threads_per_block>>>();
LAUNCHERROR("kApplyNoShake"); LAUNCHERROR("kApplyNoShake");
} }
......
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