int check_nstglobalcomm(FILE *fplog, t_commrec *cr, int nstglobalcomm, t_inputrec *ir) { if (!EI_DYNAMICS(ir->eI)) { nstglobalcomm = 1; } if (nstglobalcomm == -1) { if (!(ir->nstcalcenergy > 0 || ir->nstlist > 0 || ir->etc != etcNO || ir->epc != epcNO)) { nstglobalcomm = 10; if (ir->nstenergy > 0 && ir->nstenergy < nstglobalcomm) { nstglobalcomm = ir->nstenergy; } } else { /* Ensure that we do timely global communication for * (possibly) each of the four following options. */ nstglobalcomm = lcd4(ir->nstcalcenergy, ir->nstlist, ir->etc != etcNO ? ir->nsttcouple : 0, ir->epc != epcNO ? ir->nstpcouple : 0); } } else { if (ir->nstlist > 0 && nstglobalcomm > ir->nstlist && nstglobalcomm % ir->nstlist != 0) { nstglobalcomm = (nstglobalcomm / ir->nstlist)*ir->nstlist; md_print_warn(cr, fplog, "WARNING: nstglobalcomm is larger than nstlist, but not a multiple, setting it to %d\n", nstglobalcomm); } if (ir->nstcalcenergy > 0) { check_nst_param(fplog, cr, "-gcom", nstglobalcomm, "nstcalcenergy", &ir->nstcalcenergy); } if (ir->etc != etcNO && ir->nsttcouple > 0) { check_nst_param(fplog, cr, "-gcom", nstglobalcomm, "nsttcouple", &ir->nsttcouple); } if (ir->epc != epcNO && ir->nstpcouple > 0) { check_nst_param(fplog, cr, "-gcom", nstglobalcomm, "nstpcouple", &ir->nstpcouple); } check_nst_param(fplog, cr, "-gcom", nstglobalcomm, "nstenergy", &ir->nstenergy); check_nst_param(fplog, cr, "-gcom", nstglobalcomm, "nstlog", &ir->nstlog); } if (ir->comm_mode != ecmNO && ir->nstcomm < nstglobalcomm) { md_print_warn(cr, fplog, "WARNING: Changing nstcomm from %d to %d\n", ir->nstcomm, nstglobalcomm); ir->nstcomm = nstglobalcomm; } return nstglobalcomm; }
int check_nstglobalcomm(const gmx::MDLogger &mdlog, int nstglobalcomm, t_inputrec *ir) { if (!EI_DYNAMICS(ir->eI)) { nstglobalcomm = 1; } if (nstglobalcomm == -1) { // Set up the default behaviour if (!(ir->nstcalcenergy > 0 || ir->nstlist > 0 || ir->etc != etcNO || ir->epc != epcNO)) { /* The user didn't choose the period for anything important, so we just make sure we can send signals and write output suitably. */ nstglobalcomm = 10; if (ir->nstenergy > 0 && ir->nstenergy < nstglobalcomm) { nstglobalcomm = ir->nstenergy; } } else { /* The user has made a choice (perhaps implicitly), so we * ensure that we do timely intra-simulation communication * for (possibly) each of the four parts that care. * * TODO Does the Verlet scheme (+ DD) need any * communication at nstlist steps? Is the use of nstlist * here a leftover of the twin-range scheme? Can we remove * nstlist when we remove the group scheme? */ nstglobalcomm = lcd4(ir->nstcalcenergy, ir->nstlist, ir->etc != etcNO ? ir->nsttcouple : 0, ir->epc != epcNO ? ir->nstpcouple : 0); } } else { // Check that the user's choice of mdrun -gcom will work if (ir->nstlist > 0 && nstglobalcomm > ir->nstlist && nstglobalcomm % ir->nstlist != 0) { nstglobalcomm = (nstglobalcomm / ir->nstlist)*ir->nstlist; GMX_LOG(mdlog.warning).asParagraph().appendTextFormatted( "WARNING: nstglobalcomm is larger than nstlist, but not a multiple, setting it to %d", nstglobalcomm); } if (ir->nstcalcenergy > 0) { check_nst_param(mdlog, "-gcom", nstglobalcomm, "nstcalcenergy", &ir->nstcalcenergy); } if (ir->etc != etcNO && ir->nsttcouple > 0) { check_nst_param(mdlog, "-gcom", nstglobalcomm, "nsttcouple", &ir->nsttcouple); } if (ir->epc != epcNO && ir->nstpcouple > 0) { check_nst_param(mdlog, "-gcom", nstglobalcomm, "nstpcouple", &ir->nstpcouple); } check_nst_param(mdlog, "-gcom", nstglobalcomm, "nstenergy", &ir->nstenergy); check_nst_param(mdlog, "-gcom", nstglobalcomm, "nstlog", &ir->nstlog); } if (ir->comm_mode != ecmNO && ir->nstcomm < nstglobalcomm) { GMX_LOG(mdlog.warning).asParagraph().appendTextFormatted( "WARNING: Changing nstcomm from %d to %d", ir->nstcomm, nstglobalcomm); ir->nstcomm = nstglobalcomm; } GMX_LOG(mdlog.info).appendTextFormatted( "Intra-simulation communication will occur every %d steps.\n", nstglobalcomm); return nstglobalcomm; }