{
r = std::min(r, comm.cellsize_min[dd->dim[di]]);
}
- if (comm.bBondComm)
+ if (comm.systemInfo.filterBondedCommunication)
{
r = std::max(r, comm.cutoff_mbody);
}
}
}
+bool ddHaveSplitConstraints(const gmx_domdec_t &dd)
+{
+ return dd.comm->systemInfo.haveSplitConstraints;
+}
+
void dd_cycles_add(const gmx_domdec_t *dd, float cycles, int ddCycl)
{
/* Note that the cycles value can be incorrect, either 0 or some
if (systemInfo.useUpdateGroups)
{
- dd->splitConstraints = false;
- dd->splitSettles = false;
+ systemInfo.haveSplitConstraints = false;
+ systemInfo.haveSplitSettles = false;
}
else
{
- dd->splitConstraints = gmx::inter_charge_group_constraints(*mtop);
- dd->splitSettles = gmx::inter_charge_group_settles(*mtop);
+ systemInfo.haveSplitConstraints = gmx::inter_charge_group_constraints(*mtop);
+ systemInfo.haveSplitSettles = gmx::inter_charge_group_settles(*mtop);
}
if (ir->rlist == 0)
systemInfo.minCutoffForMultiBody = 0;
/* Determine the minimum cell size limit, affected by many factors */
- systemInfo.cellsizeLimit = 0;
- comm->bBondComm = FALSE;
+ systemInfo.cellsizeLimit = 0;
+ systemInfo.filterBondedCommunication = false;
/* We do not allow home atoms to move beyond the neighboring domain
* between domain decomposition steps, which limits the cell size.
atomToAtomIntoDomainToDomainCutoff(systemInfo, options.minimumCommunicationRange);
if (options.useBondedCommunication)
{
- comm->bBondComm = (systemInfo.minCutoffForMultiBody > systemInfo.cutoff);
+ systemInfo.filterBondedCommunication = (systemInfo.minCutoffForMultiBody > systemInfo.cutoff);
}
else
{
{
r_bonded = std::max(r_2b, r_mb);
r_bonded_limit = tenPercentMargin*r_bonded;
- comm->bBondComm = TRUE;
+ /* This is the (only) place where we turn on the filtering */
+ systemInfo.filterBondedCommunication = true;
}
else
{
}
real rconstr = 0;
- if (dd->splitConstraints && options.constraintCommunicationRange <= 0)
+ if (systemInfo.haveSplitConstraints && options.constraintCommunicationRange <= 0)
{
/* There is a cell size limit due to the constraints (P-LINCS) */
rconstr = gmx::constr_r_max(mdlog, mtop, ir);
if (ddSetup.numDomains[XX] == 0)
{
char buf[STRLEN];
- gmx_bool bC = (dd->splitConstraints && rconstr > r_bonded_limit);
+ gmx_bool bC = (systemInfo.haveSplitConstraints && rconstr > r_bonded_limit);
sprintf(buf, "Change the number of ranks or mdrun option %s%s%s",
!bC ? "-rdd" : "-rcon",
comm->dlbState != DlbState::offUser ? " or -dds" : "",
comm->cellsize_limit = systemInfo.cellsizeLimit;
if (systemInfo.haveInterDomainBondeds && comm->cutoff_mbody == 0)
{
- if (comm->bBondComm || !isDlbDisabled(comm))
+ if (systemInfo.filterBondedCommunication || !isDlbDisabled(comm))
{
/* Set the bonded communication distance to halfway
* the minimum and the maximum,
comm->cutoff_mbody = std::min(comm->cutoff_mbody,
options.dlbScaling*acs);
}
- if (!comm->bBondComm)
+ if (!systemInfo.filterBondedCommunication)
{
/* Without bBondComm do not go beyond the n.b. cut-off */
comm->cutoff_mbody = std::min(comm->cutoff_mbody, systemInfo.cutoff);
{
fprintf(debug, "Bonded atom communication beyond the cut-off: %s\n"
"cellsize limit %f\n",
- gmx::boolToString(comm->bBondComm), comm->cellsize_limit);
+ gmx::boolToString(systemInfo.filterBondedCommunication),
+ comm->cellsize_limit);
}
if (MASTER(cr))
comm = dd->comm;
- if (comm->bBondComm)
+ if (comm->systemInfo.filterBondedCommunication)
{
/* Communicate atoms beyond the cut-off for bonded interactions */
comm = dd->comm;
if (comm->systemInfo.haveInterDomainBondeds ||
haveInterDomainVsites ||
- dd->splitConstraints || dd->splitSettles)
+ comm->systemInfo.haveSplitConstraints ||
+ comm->systemInfo.haveSplitSettles)
{
std::string decompUnits;
if (comm->systemInfo.useUpdateGroups)
std::max(comm->systemInfo.cutoff, comm->cutoff_mbody));
log->writeLineFormatted("%40s %-7s %6.3f nm",
"multi-body bonded interactions", "(-rdd)",
- (comm->bBondComm || isDlbOn(dd->comm)) ? comm->cutoff_mbody : std::min(comm->systemInfo.cutoff, limit));
+ (comm->systemInfo.filterBondedCommunication || isDlbOn(dd->comm)) ? comm->cutoff_mbody : std::min(comm->systemInfo.cutoff, limit));
}
if (haveInterDomainVsites)
{
log->writeLineFormatted("%40s %-7s %6.3f nm",
"virtual site constructions", "(-rcon)", limit);
}
- if (dd->splitConstraints || dd->splitSettles)
+ if (comm->systemInfo.haveSplitConstraints || comm->systemInfo.haveSplitSettles)
{
std::string separation = gmx::formatString("atoms separated by up to %d constraints",
1+ir->nProjOrder);
/*! \brief Returns the maximum shift for coordinate communication in PME, dim y */
int dd_pme_maxshift_y(const gmx_domdec_t *dd);
+/*! \brief Return whether constraints, not including settles, cross domain boundaries */
+bool ddHaveSplitConstraints(const gmx_domdec_t &dd);
+
/*! \brief Initialized the domain decomposition, chooses the DD grid and PME ranks, return the DD struct */
gmx_domdec_t *
init_domain_decomposition(const gmx::MDLogger &mdlog,
#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/smalloc.h"
+#include "domdec_internal.h"
#include "domdec_specatomcomm.h"
/*! \brief Struct used during constraint setup with domain decomposition */
// This code should not be called unless this condition is true,
// because that's the only time init_domdec_constraints is
// called...
- GMX_RELEASE_ASSERT(dd->splitConstraints || dd->splitSettles, "dd_make_local_constraints called when there are no local constraints");
+ GMX_RELEASE_ASSERT(dd->comm->systemInfo.haveSplitConstraints ||
+ dd->comm->systemInfo.haveSplitSettles,
+ "dd_make_local_constraints called when there are no local constraints");
// ... and init_domdec_constraints always sets
// dd->constraint_comm...
GMX_RELEASE_ASSERT(dd->constraint_comm, "Invalid use of dd_make_local_constraints before construction of constraint_comm");
gmx::ArrayRef < const std::vector < int>> at2settle_mt;
/* When settle works inside charge groups, we assigned them already */
- if (dd->splitSettles)
+ if (dd->comm->systemInfo.haveSplitSettles)
{
// TODO Perhaps gmx_domdec_constraints_t should keep a valid constr?
GMX_RELEASE_ASSERT(constr != nullptr, "Must have valid constraints object");
real cutoff = 0;
//! The lower limit for the DD cell size
real cellsizeLimit = 0;
+
+ //! Can atoms connected by constraints be assigned to different domains?
+ bool haveSplitConstraints = false;
+ //! Can atoms connected by settles be assigned to different domains?
+ bool haveSplitSettles = false;
+
+ //! Whether to only communicate atoms beyond the non-bonded cut-off when they are involved in bonded interactions with non-local atoms
+ bool filterBondedCommunication = false;
};
/*! \brief Struct for domain decomposition communication
//! Centers of mass of local update groups
std::unique_ptr<gmx::UpdateGroupsCog> updateGroupsCog;
- /* Data for the optional bonded interaction atom communication range */
- /**< Only communicate atoms beyond the non-bonded cut-off when they are involved in bonded interactions with non-local atoms */
- gmx_bool bBondComm = false;
+ /* Data for the optional filtering of communication of atoms for bonded interactions */
/**< Links between cg's through bonded interactions */
t_blocka *cglink = nullptr;
/**< Local cg availability, TODO: remove when group scheme is removed */
/* Only available on the master node */
std::unique_ptr<AtomDistribution> ma;
- /* Can atoms connected by constraints be assigned to different domains? */
- bool splitConstraints = false;
- /* Can atoms connected by settles be assigned to different domains? */
- bool splitSettles = false;
-
/* Global atom number to interaction list */
gmx_reverse_top_t *reverse_top = nullptr;
int nbonded_global = 0;
dd->reverse_top = new gmx_reverse_top_t;
*dd->reverse_top =
make_reverse_top(mtop, ir->efep != efepNO,
- !dd->splitConstraints, !dd->splitSettles,
+ !dd->comm->systemInfo.haveSplitConstraints,
+ !dd->comm->systemInfo.haveSplitSettles,
bBCheck, &dd->nbonded_global);
gmx_reverse_top_t *rt = dd->reverse_top;
init_domdec_vsites(dd, vsite->numInterUpdategroupVsites);
}
- if (dd->splitConstraints || dd->splitSettles)
+ if (dd->comm->systemInfo.haveSplitConstraints || dd->comm->systemInfo.haveSplitSettles)
{
init_domdec_constraints(dd, mtop);
}
comm->dth.resize(numThreads);
}
- bBondComm = comm->bBondComm;
+ bBondComm = comm->systemInfo.filterBondedCommunication;
/* Do we need to determine extra distances for multi-body bondeds? */
bDistMB = (comm->systemInfo.haveInterDomainMultiBodyBondeds && isDlbOn(dd->comm) && dd->ndim > 1);
}
break;
case DDAtomRanges::Type::Constraints:
- if (dd->splitConstraints || dd->splitSettles)
+ if (dd->comm->systemInfo.haveSplitConstraints || dd->comm->systemInfo.haveSplitSettles)
{
/* Only for inter-cg constraints we need special code */
n = dd_make_local_constraints(dd, n, &top_global, fr->cginfo.data(),
{
lincsd = init_lincs(log, mtop,
nflexcon, at2con_mt,
- DOMAINDECOMP(cr) && cr->dd->splitConstraints,
+ DOMAINDECOMP(cr) && ddHaveSplitConstraints(*cr->dd),
ir.nLincsIter, ir.nProjOrder);
}
if (ir.eConstrAlg == econtSHAKE)
{
- if (DOMAINDECOMP(cr) && cr->dd->splitConstraints)
+ if (DOMAINDECOMP(cr) && ddHaveSplitConstraints(*cr->dd))
{
gmx_fatal(FARGS, "SHAKE is not supported with domain decomposition and constraint that cross charge group boundaries, use LINCS");
}