static void reset_pmeonly_counters(t_commrec *cr, gmx_wallcycle_t wcycle,
- t_nrnb *nrnb, t_inputrec *ir, gmx_large_int_t step_rel)
+ t_nrnb *nrnb, t_inputrec *ir,
+ gmx_large_int_t step)
{
/* Reset all the counters related to performance over the run */
wallcycle_stop(wcycle, ewcRUN);
wallcycle_reset_all(wcycle);
init_nrnb(nrnb);
- ir->init_step += step_rel;
- ir->nsteps -= step_rel;
+ if (ir->nsteps >= 0)
+ {
+ /* ir->nsteps is not used here, but we update it for consistency */
+ ir->nsteps -= step - ir->init_step;
+ }
+ ir->init_step = step;
wallcycle_start(wcycle, ewcRUN);
}
int npmedata;
gmx_pme_t *pmedata;
gmx_pme_pp_t pme_pp;
+ int ret;
int natoms;
matrix box;
rvec *x_pp = NULL, *f_pp = NULL;
do
{
/* Domain decomposition */
- natoms = gmx_pme_recv_q_x(pme_pp,
- &chargeA, &chargeB, box, &x_pp, &f_pp,
- &maxshift_x, &maxshift_y,
- &pme->bFEP, &lambda,
- &bEnerVir,
- &step,
- grid_switch, &ewaldcoeff);
-
- if (natoms == -2)
+ ret = gmx_pme_recv_q_x(pme_pp,
+ &natoms,
+ &chargeA, &chargeB, box, &x_pp, &f_pp,
+ &maxshift_x, &maxshift_y,
+ &pme->bFEP, &lambda,
+ &bEnerVir,
+ &step,
+ grid_switch, &ewaldcoeff);
+
+ if (ret == pmerecvqxSWITCHGRID)
{
/* Switch the PME grid to grid_switch */
gmx_pmeonly_switch(&npmedata, &pmedata, grid_switch, cr, ir, &pme);
}
+
+ if (ret == pmerecvqxRESETCOUNTERS)
+ {
+ /* Reset the cycle and flop counters */
+ reset_pmeonly_counters(cr, wcycle, nrnb, ir, step);
+ }
}
- while (natoms == -2);
+ while (ret == pmerecvqxSWITCHGRID || ret == pmerecvqxRESETCOUNTERS);
- if (natoms == -1)
+ if (ret == pmerecvqxFINISH)
{
/* We should stop: break out of the loop */
break;
cycles);
count++;
-
- if (step_rel == wcycle_get_reset_counters(wcycle))
- {
- /* Reset all the counters related to performance over the run */
- reset_pmeonly_counters(cr, wcycle, nrnb, ir, step_rel);
- wcycle_set_reset_counters(wcycle, 0);
- }
-
} /***** end of quasi-loop, we stop with the break above */
while (TRUE);