/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017,2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018,2019,2020,2021, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
atomX = gm_coordinates[atomIndexGlobal];
atomCharge = gm_coefficientsA[atomIndexGlobal];
}
- calculate_splines<order, atomsPerBlock, atomsPerWarp, true, false>(
+ calculate_splines<order, atomsPerBlock, atomsPerWarp, true, false, numGrids>(
kernelParams, atomIndexOffset, atomX, atomCharge, sm_theta, sm_dtheta, sm_gridlineIndices);
__syncwarp();
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017,2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018,2019,2020,2021, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* \tparam[in] atomsPerBlock Number of atoms processed by a block - should be accounted for
* in the sizes of the shared memory arrays.
* \tparam[in] atomsPerWarp Number of atoms processed by a warp
- * \tparam[in] writeSmDtheta Bool controling if the theta derivative should be written to shared memory. Enables calculation of dtheta if set.
- * \tparam[in] writeGlobal A boolean which tells if the theta values and gridlines should be written to global memory. Enables calculation of dtheta if set.
+ * \tparam[in] writeSmDtheta Bool controling if the theta derivative should be written to
+ * shared memory. Enables calculation of dtheta if set.
+ * \tparam[in] writeGlobal A boolean which tells if the theta values and gridlines should
+ * be written to global memory. Enables calculation of dtheta if
+ * set.
+ * \tparam[in] numGrids The number of grids using the splines.
* \param[in] kernelParams Input PME CUDA data in constant memory.
* \param[in] atomIndexOffset Starting atom index for the execution block w.r.t. global memory.
* \param[in] atomX Atom coordinate of atom processed by thread.
* \param[out] sm_gridlineIndices Atom gridline indices in the shared memory.
*/
-template<int order, int atomsPerBlock, int atomsPerWarp, bool writeSmDtheta, bool writeGlobal>
+template<int order, int atomsPerBlock, int atomsPerWarp, bool writeSmDtheta, bool writeGlobal, int numGrids>
__device__ __forceinline__ void calculate_splines(const PmeGpuCudaKernelParams kernelParams,
const int atomIndexOffset,
const float3 atomX,
float* __restrict__ sm_dtheta,
int* __restrict__ sm_gridlineIndices)
{
+ assert(numGrids == 1 || numGrids == 2);
+ assert(numGrids == 1 || c_skipNeutralAtoms == false);
+
/* Global memory pointers for output */
float* __restrict__ gm_theta = kernelParams.atoms.d_theta;
float* __restrict__ gm_dtheta = kernelParams.atoms.d_dtheta;
/* B-spline calculation */
const int chargeCheck = pme_gpu_check_atom_charge(atomCharge);
- if (chargeCheck)
+ /* With FEP (numGrids == 2), we might have 0 charge in state A, but !=0 in state B, so we always calculate splines */
+ if (numGrids == 2 || chargeCheck)
{
float div;
int o = orderIndex; // This is an index that is set once for PME_GPU_PARALLEL_SPLINE == 1
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020,2021, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/* Thread index w.r.t. block */
assert((get_local_id(2) * get_local_size(1) + get_local_id(1)) * get_local_size(0) + get_local_id(0)
< MAX_INT);
+ assert(numGrids == 1 || numGrids == 2);
+ assert(numGrids == 1 || c_skipNeutralAtoms == false);
const int threadLocalIndex =
(int)((get_local_id(2) * get_local_size(1) + get_local_id(1)) * get_local_size(0)
+ get_local_id(0));
/* B-spline calculation */
const int chargeCheck = pme_gpu_check_atom_charge(sm_coefficients[atomIndexLocal]);
- if (chargeCheck)
+ /* With FEP (numGrids == 2), we might have 0 charge in state A, but !=0 in state B, so we always calculate splines */
+ if (numGrids == 2 || chargeCheck)
{
int o = orderIndex; // This is an index that is set once for PME_GPU_PARALLEL_SPLINE == 1
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013-2016,2017,2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2013-2016,2017,2018,2019,2020,2021, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
{
atomX = gm_coordinates[atomIndexGlobal];
}
- calculate_splines<order, atomsPerBlock, atomsPerWarp, false, writeGlobal>(
+ calculate_splines<order, atomsPerBlock, atomsPerWarp, false, writeGlobal, numGrids>(
kernelParams, atomIndexOffset, atomX, atomCharge, sm_theta, &dtheta, sm_gridlineIndices);
__syncwarp();
}