Skip to content

Instantly share code, notes, and snippets.

@ParkerdeWaal
Last active October 31, 2017 16:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ParkerdeWaal/113b9c7460f21b111e4c83d5277cc856 to your computer and use it in GitHub Desktop.
Save ParkerdeWaal/113b9c7460f21b111e4c83d5277cc856 to your computer and use it in GitHub Desktop.
__global__ void
#if (__CUDA_ARCH__ >= 300)
__launch_bounds__(SM_3X_GENERAL_THREADS_PER_BLOCK, 1)
#else
__launch_bounds__(SM_2X_GENERAL_THREADS_PER_BLOCK, 1)
#endif
kZeroSpecificForces_kernel()
{
__threadfence();
__syncthreads();
unsigned int myatoms [] = {4, 6, 8, 14}; // zero these atoms
for (int i = 0; i < 4; i++)
{
int p1 = cSim.pImageAtomLookup[myatoms[i]];
cSim.pForceAccumulator[p1] = FORCESCALE * 0;
cSim.pForceAccumulator[p1 + cSim.stride] = FORCESCALE * 0;
cSim.pForceAccumulator[p1 + cSim.stride2] = FORCESCALE * 0;
}
}
void kZeroSpecificForces(gpuContext gpu)
{
kZeroSpecificForces_kernel<<<gpu->blocks, gpu->generalThreadsPerBlock>>>();
LAUNCHERROR("kZeroSpecificForces");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment