Skip to content

Commit

Permalink
#649: LBManager: use epoch/scheduler helper routines instead of expli…
Browse files Browse the repository at this point in the history
…cit creation/management
  • Loading branch information
PhilMiller committed Jul 28, 2020
1 parent a3bf94d commit 31325d3
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions src/vt/vrt/collection/balance/lb_invoke/lb_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -151,47 +151,34 @@ LBManager::makeLB(MsgSharedPtr<StartLBMsg> msg) {

destroy_lb_ = [proxy]{ proxy.destroyCollective(); };

EpochType model_epoch = theTerm()->makeEpochCollective("LBManager::model_epoch");
EpochType balance_epoch = theTerm()->makeEpochCollective("LBManager::balance_epoch");
EpochType migrate_epoch = theTerm()->makeEpochCollective("LBManager::migrate_epoch");

theMsg()->pushEpoch(model_epoch);
model_->updateLoads(phase);
theMsg()->popEpoch(model_epoch);
theTerm()->finishedEpoch(model_epoch);
runInEpochCollective([=] {
model_->updateLoads(phase);
});

theTerm()->addAction(model_epoch, [=] {
runInEpochCollective([=] {
vt_debug_print(
lb, node,
"LBManager: running strategy\n"
);
theMsg()->pushEpoch(balance_epoch);
strat->startLB(phase, base_proxy, model_.get(), theProcStats()->getProcComm()->back());
theMsg()->popEpoch(balance_epoch);
theTerm()->finishedEpoch(balance_epoch);
});

theTerm()->addAction(balance_epoch, [=] {
runInEpochCollective([=] {
vt_debug_print(
lb, node,
"LBManager: starting migrations\n"
);
theMsg()->pushEpoch(migrate_epoch);
strat->applyMigrations(strat->getTransfers());
theMsg()->popEpoch(migrate_epoch);
theTerm()->finishedEpoch(migrate_epoch);
});

theTerm()->addAction(migrate_epoch, [=] {
runInEpochCollective([=] {
vt_debug_print(
lb, node,
"LBManager: finished migrations\n"
);
theProcStats()->startIterCleanup();
this->finishedRunningLB(phase);
});

runSchedulerThrough(migrate_epoch);
}

void LBManager::collectiveImpl(
Expand Down

0 comments on commit 31325d3

Please sign in to comment.