diff --git a/src/vt/messaging/active.cc b/src/vt/messaging/active.cc index ead645d317..b5c7de42dc 100644 --- a/src/vt/messaging/active.cc +++ b/src/vt/messaging/active.cc @@ -151,8 +151,6 @@ void ActiveMessenger::initialize() { } void ActiveMessenger::startup() { - pushEpoch(term::any_epoch_sentinel); - auto const this_node = theContext()->getNode(); bare_handler_dummy_elm_id_for_lb_data_ = elm::ElmIDBits::createBareHandler(this_node); diff --git a/src/vt/termination/termination.cc b/src/vt/termination/termination.cc index 979e1856aa..bcd1dd6912 100644 --- a/src/vt/termination/termination.cc +++ b/src/vt/termination/termination.cc @@ -66,7 +66,9 @@ TerminationDetector::TerminationDetector() any_epoch_state_(any_epoch_sentinel, false, true, getNumChildren()), hang_(no_epoch, true, false, getNumChildren()), this_node_(theContext()->getNode()) -{ } +{ + pushEpoch(term::any_epoch_sentinel); +} /*static*/ void TerminationDetector::makeRootedHandler(TermMsg* msg) { theTerm()->makeRootedHan(msg->new_epoch, false); diff --git a/src/vt/termination/termination.h b/src/vt/termination/termination.h index 7d1765357d..88a70588b9 100644 --- a/src/vt/termination/termination.h +++ b/src/vt/termination/termination.h @@ -121,7 +121,20 @@ struct TerminationDetector : */ TerminationDetector(); - virtual ~TerminationDetector() {} + virtual ~TerminationDetector() { + //Pop all extraneous epochs off the stack greater than 1 + auto stack_size = epoch_stack_.size(); + while (stack_size > 1) { + stack_size = (epoch_stack_.pop(), epoch_stack_.size()); + } + // Pop off the last epoch: term::any_epoch_sentinel + auto const ret_epoch = popEpoch(term::any_epoch_sentinel); + vtAssertInfo( + ret_epoch == term::any_epoch_sentinel, "Last pop must be any epoch", + ret_epoch, term::any_epoch_sentinel, epoch_stack_.size() + ); + vtAssertExpr(epoch_stack_.size() == 0); + } std::string name() override { return "TerminationDetector"; }