int *rank;
#endif
- if (multidirs.size() <= 1)
-#if !GMX_MPI
- if (nsim > 1)
++ if (multidirs.empty())
{
- gmx_fatal(FARGS, "This binary is compiled without MPI support, can not do multiple simulations.");
+ return nullptr;
+ }
- if (!GMX_LIB_MPI && multidirs.size() > 1)
++
++ if (!GMX_LIB_MPI && multidirs.size() >= 1)
+ {
+ gmx_fatal(FARGS, "mdrun -multidir is only supported when GROMACS has been "
+ "configured with a proper external MPI library.");
}
-#endif
- if (nsim == 1)
++ if (multidirs.size() == 1)
+ {
+ /* NOTE: It would be nice if this special case worked, but this requires checks/tests. */
- gmx_fatal(FARGS, "To run mdrun in multiple simulation mode, more then one actual simulation is required. The single simulation case is not supported.");
++ gmx_fatal(FARGS, "To run mdrun in multiple simulation mode, more then one "
++ "actual simulation is required. The single simulation case is not supported.");
+ }
+
- nnodes = cr->nnodes;
- if (nnodes % nsim != 0)
+#if GMX_MPI
+ int numRanks;
+ MPI_Comm_size(comm, &numRanks);
+ if (numRanks % multidirs.size() != 0)
{
- gmx_fatal(FARGS, "The number of ranks (%d) is not a multiple of the number of simulations (%d)", nnodes, nsim);
+ gmx_fatal(FARGS, "The number of ranks (%d) is not a multiple of the number of simulations (%zu)", numRanks, multidirs.size());
}
- nnodpersim = nnodes/nsim;
- sim = cr->nodeid/nnodpersim;
+ int numRanksPerSim = numRanks/multidirs.size();
+ int rankWithinComm;
+ MPI_Comm_rank(comm, &rankWithinComm);
if (debug)
{
gmx_membed_t *membed,
gmx_walltime_accounting_t walltime_accounting)
{
-- gmx_mdoutf_t outf = nullptr;
-- gmx_int64_t step, step_rel;
-- double elapsed_time;
-- double t, t0, lam0[efptNR];
-- gmx_bool bGStatEveryStep, bGStat, bCalcVir, bCalcEnerStep, bCalcEner;
-- gmx_bool bNS, bNStList, bSimAnn, bStopCM,
-- bFirstStep, bInitStep, bLastStep = FALSE,
- bUsingEnsembleRestraints;
- bBornRadii;
++ gmx_mdoutf_t outf = nullptr;
++ gmx_int64_t step, step_rel;
++ double elapsed_time;
++ double t, t0, lam0[efptNR];
++ gmx_bool bGStatEveryStep, bGStat, bCalcVir, bCalcEnerStep, bCalcEner;
++ gmx_bool bNS, bNStList, bSimAnn, bStopCM,
++ bFirstStep, bInitStep, bLastStep = FALSE;
gmx_bool bDoDHDL = FALSE, bDoFEP = FALSE, bDoExpanded = FALSE;
gmx_bool do_ene, do_log, do_verbose, bRerunWarnNoV = TRUE,
bForceUpdate = FALSE, bCPT;
const bool useReplicaExchange = (replExParams.exchangeInterval > 0);
if (useReplicaExchange && MASTER(cr))
{
- repl_ex = init_replica_exchange(fplog, cr->ms, top_global->natoms, ir,
+ repl_ex = init_replica_exchange(fplog, ms, top_global->natoms, ir,
replExParams);
}
--
/* PME tuning is only supported in the Verlet scheme, with PME for
* Coulomb. It is not supported with only LJ PME, or for
* reruns. */
bSumEkinhOld = FALSE;
bExchanged = FALSE;
bNeedRepartition = FALSE;
- // TODO This implementation of ensemble orientation restraints is nasty because
- // a user can't just do multi-sim with single-sim orientation restraints.
- bUsingEnsembleRestraints = (fcd->disres.nsystems > 1) || (ms && fcd->orires.nr);
+ bool simulationsShareState = false;
+ int nstSignalComm = nstglobalcomm;
{
- // Replica exchange and ensemble restraints need all
+ // TODO This implementation of ensemble orientation restraints is nasty because
+ // a user can't just do multi-sim with single-sim orientation restraints.
- bool usingEnsembleRestraints = (fcd->disres.nsystems > 1) || (cr->ms && fcd->orires.nr);
- bool awhUsesMultiSim = (ir->bDoAwh && ir->awhParams->shareBiasMultisim && cr->ms);
++ bool usingEnsembleRestraints = (fcd->disres.nsystems > 1) || (ms && fcd->orires.nr);
++ bool awhUsesMultiSim = (ir->bDoAwh && ir->awhParams->shareBiasMultisim && ms);
+
+ // Replica exchange, ensemble restraints and AWH need all
// simulations to remain synchronized, so they need
// checkpoints and stop conditions to act on the same step, so
// the propagation of such signals must take place between