Added Doxygen, converted a macro to a const int.
Change-Id: I1e5579b1f80aecaf46827704cf5fd3b6d6285d80
#include "gromacs/fileio/gmxfio.h"
#include "gromacs/fileio/pdbio.h"
#include "gromacs/imd/imd.h"
-#include "gromacs/legacyheaders/bonded-threading.h"
#include "gromacs/legacyheaders/chargegroup.h"
#include "gromacs/legacyheaders/constr.h"
#include "gromacs/legacyheaders/force.h"
#include "gromacs/legacyheaders/types/shellfc.h"
#include "gromacs/legacyheaders/types/simple.h"
#include "gromacs/legacyheaders/types/state.h"
+#include "gromacs/listed-forces/manage-threading.h"
#include "gromacs/math/vec.h"
#include "gromacs/math/vectypes.h"
#include "gromacs/mdlib/nb_verlet.h"
/*! \defgroup module_listed-forces Interactions between lists of particles
* \ingroup group_mdrun
*
- * \brief Computes energies and forces for interactions between a
- * small number of particles, e.g bonds, position restraints and
- * listed non-bonded interactions (e.g. 1-4).
- *
- * As well as code to compute those quantites, high-level functions
- * for use by mdrun to compute a set of such quantities are also
- * located here.
- *
- * More functionality will move into this module shortly.
+ * \brief Handles computing energies and forces for listed
+ * interactions.
+ *
+ * Located here is the the code for
+ * - computing energies and forces for interactions between a small
+ number of particles, e.g bonds, position restraints and listed
+ non-bonded interactions (e.g. 1-4).
+ * - high-level functions used by mdrun for computing a set of such
+ quantities
+ * - managing thread-wise decomposition, thread-local buffer output,
+ and reduction of output data across threads.
*
* \author Mark Abraham <mark.j.abraham@gmail.com>
*
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
+/*! \internal \file
+ * \brief This file defines functions for managing threading of listed
+ * interactions.
+ *
+ * \author Mark Abraham <mark.j.abraham@gmail.com>
+ * \ingroup module_listed-forces
+ */
#include "gmxpre.h"
-#include "gromacs/legacyheaders/bonded-threading.h"
+#include "manage-threading.h"
#include <assert.h>
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/smalloc.h"
+//! Divides listed interactions over threads
static void divide_bondeds_over_threads(t_idef *idef, int nthreads)
{
int ftype;
}
}
+//! Construct a reduction mask for which interaction was computed on which thread
static unsigned
calc_bonded_reduction_mask(const t_idef *idef,
int shift,
return mask;
}
+
+/*! \brief We divide the force array in a maximum of 32 blocks.
+ * Minimum force block reduction size is thus 2^6=64.
+ */
+const int maxBlockBits = 32;
+
void setup_bonded_threading(t_forcerec *fr, t_idef *idef)
{
-#define MAX_BLOCK_BITS 32
int t;
int ctot, c, b;
return;
}
- /* We divide the force array in a maximum of 32 blocks.
- * Minimum force block reduction size is 2^6=64.
- */
fr->red_ashift = 6;
- while (fr->natoms_force > (int)(MAX_BLOCK_BITS*(1U<<fr->red_ashift)))
+ while (fr->natoms_force > (int)(maxBlockBits*(1U<<fr->red_ashift)))
{
fr->red_ashift++;
}
for (t = 0; t < fr->nthreads; t++)
{
c = 0;
- for (b = 0; b < MAX_BLOCK_BITS; b++)
+ for (b = 0; b < maxBlockBits; b++)
{
if (fr->f_t[t].red_mask & (1U<<b))
{
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
+/*! \libinternal \file
+ * \brief Declares functions for managing threading of listed forces
+ *
+ * \author Mark Abraham <mark.j.abraham@gmail.com>
+ * \inlibraryapi
+ * \ingroup module_listed-forces
+ */
+#ifndef GMX_LISTED_FORCES_MANAGE_THREADING_H
+#define GMX_LISTED_FORCES_MANAGE_THREADING_H
-#ifndef GMX_LEGACYHEADERS_BONDED_THREADING_H
-#define GMX_LEGACYHEADERS_BONDED_THREADING_H
-
-#include "gromacs/legacyheaders/typedefs.h"
+#include "gromacs/legacyheaders/types/forcerec.h"
+#include "gromacs/topology/idef.h"
#ifdef __cplusplus
extern "C" {
#endif
-/* Divided the bonded interactions over the threads, count=fr->nthreads
- * and set up the bonded thread-force buffer reduction.
- * This should be called each time the bonded setup changes;
- * i.e. at start-up without domain decomposition and at DD.
+/*! \brief Divide the listed interactions over the threads
+ *
+ * Uses fr->nthreads for the number of threads, and sets up the
+ * thread-force buffer reduction. This should be called each time the
+ * bonded setup changes; i.e. at start-up without domain decomposition
+ * and at DD.
*/
void setup_bonded_threading(t_forcerec *fr, t_idef *idef);
#include "gromacs/fileio/mtxio.h"
#include "gromacs/fileio/trajectory_writing.h"
#include "gromacs/imd/imd.h"
-#include "gromacs/legacyheaders/bonded-threading.h"
#include "gromacs/legacyheaders/constr.h"
#include "gromacs/legacyheaders/force.h"
#include "gromacs/legacyheaders/gmx_omp_nthreads.h"
#include "gromacs/legacyheaders/vsite.h"
#include "gromacs/legacyheaders/types/commrec.h"
#include "gromacs/linearalgebra/sparsematrix.h"
+#include "gromacs/listed-forces/manage-threading.h"
#include "gromacs/math/vec.h"
#include "gromacs/pbcutil/mshift.h"
#include "gromacs/pbcutil/pbc.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/gmxpreprocess/compute_io.h"
#include "gromacs/imd/imd.h"
-#include "gromacs/legacyheaders/bonded-threading.h"
#include "gromacs/legacyheaders/constr.h"
#include "gromacs/legacyheaders/ebin.h"
#include "gromacs/legacyheaders/force.h"
#include "gromacs/legacyheaders/types/oenv.h"
#include "gromacs/legacyheaders/types/shellfc.h"
#include "gromacs/legacyheaders/types/state.h"
+#include "gromacs/listed-forces/manage-threading.h"
#include "gromacs/math/utilities.h"
#include "gromacs/math/vec.h"
#include "gromacs/math/vectypes.h"