public:
//! Constructor, pass a pointer to t_commrec or nullptr when not using domain decomposition
DDBalanceRegionHandler(const t_commrec *cr) :
+ useBalancingRegion_(havePPDomainDecomposition(cr)),
dd_(cr != nullptr ? cr->dd : nullptr)
{
- useBalancingRegion_ = (cr != nullptr &&
- cr->dd != nullptr &&
- cr->nnodes - cr->npmenodes > 1);
}
/*! \brief Returns whether were are actually using the balancing region
bool stepIsEven = ((stepWithCurrentList & 1) == 0);
if (stepWithCurrentList > 0 &&
stepWithCurrentList < inputrec->nstlist - 1 &&
- (stepIsEven || DOMAINDECOMP(cr)))
+ (stepIsEven || havePPDomainDecomposition(cr)))
{
Nbnxm::gpu_launch_kernel_pruneonly(nbv->gpu_nbv,
stepIsEven ? Nbnxm::InteractionLocality::Local : Nbnxm::InteractionLocality::NonLocal,
// bonded work not split into separate local and non-local, so with DD
// we can only launch the kernel after non-local coordinates have been received.
- if (ppForceWorkload->haveGpuBondedWork && !DOMAINDECOMP(cr))
+ if (ppForceWorkload->haveGpuBondedWork && !havePPDomainDecomposition(cr))
{
wallcycle_sub_start(wcycle, ewcsLAUNCH_GPU_BONDED);
fr->gpuBonded->launchKernels(fr, flags, box);
/* Communicate coordinates and sum dipole if necessary +
do non-local pair search */
- if (DOMAINDECOMP(cr))
+ if (havePPDomainDecomposition(cr))
{
nbnxn_pairlist_set_t &pairlistSet = nbv->grp[Nbnxm::InteractionLocality::NonLocal].nbl_lists;
/* launch D2H copy-back F */
wallcycle_start_nocount(wcycle, ewcLAUNCH_GPU);
wallcycle_sub_start_nocount(wcycle, ewcsLAUNCH_GPU_NONBONDED);
- if (DOMAINDECOMP(cr))
+ if (havePPDomainDecomposition(cr))
{
Nbnxm::gpu_launch_cpyback(nbv->gpu_nbv, nbv->nbat,
flags, Nbnxm::AtomLocality::NonLocal, ppForceWorkload->haveGpuBondedWork);
if (!bUseOrEmulGPU)
{
- if (DOMAINDECOMP(cr))
+ if (havePPDomainDecomposition(cr))
{
do_nb_verlet(fr, ic, enerd, flags, Nbnxm::InteractionLocality::NonLocal, enbvClearFNo,
step, nrnb, wcycle);
if (bUseOrEmulGPU)
{
/* wait for non-local forces (or calculate in emulation mode) */
- if (DOMAINDECOMP(cr))
+ if (havePPDomainDecomposition(cr))
{
if (bUseGPU)
{
}
}
- if (DOMAINDECOMP(cr))
+ if (havePPDomainDecomposition(cr))
{
/* We are done with the CPU compute.
* We will now communicate the non-local forces.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018,2019, 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.
* PAR(cr) and DOMAINDECOMP(cr) are not universally synonymous. In
* particular, DOMAINDECOMP(cr) == true indicates that there is more
* than one domain, not just that the dd algorithm is active. */
-#define DOMAINDECOMP(cr) (((cr)->dd != NULL) && PAR(cr))
+#define DOMAINDECOMP(cr) (((cr)->dd != nullptr) && PAR(cr))
+
+/*! \brief Returns whether we have actual domain decomposition for the particle-particle interactions
+ *
+ * Will return false when we use 1 rank for PP and 1 for PME
+ */
+static bool inline havePPDomainDecomposition(const t_commrec *cr)
+{
+ /* NOTE: It would be better to use cr->dd->nnodes, but we do not want
+ * to pull in a dependency on domdec.h into this file.
+ */
+ return (cr != nullptr &&
+ cr->dd != nullptr &&
+ cr->nnodes - cr->npmenodes > 1);
+}
//! Are we doing multiple independent simulations?
static bool inline isMultiSim(const gmx_multisim_t *ms)