{
pme_lb->bBalance = dd_dlb_is_on(cr->dd);
}
- else
+ /* We should ignore the first timing to avoid timing allocation
+ * overhead. And since the PME load balancing is called just
+ * before DD repartitioning, the ratio returned by dd_pme_f_ratio
+ * is not over the last nstlist steps, but the nstlist steps before
+ * that. So the first useful ratio is available at step_rel=3*nstlist.
+ */
+ else if (step_rel >= 3*ir->nstlist)
{
if (DDMASTER(cr->dd))
{
- /* PME node load is too high, start tuning */
+ /* If PME rank load is too high, start tuning */
pme_lb->bBalance =
(dd_pme_f_ratio(cr->dd) >= loadBalanceTriggerFactor);
}
}
if (!pme_lb->bBalance &&
- (!pme_lb->bSepPMERanks || (step_rel <= pme_lb->step_rel_stop)))
+ (!pme_lb->bSepPMERanks || step_rel > pme_lb->step_rel_stop))
{
/* We have just deactivated the balancing and we're not measuring PP/PME
* imbalance during the first steps of the run: deactivate the tuning.