Skip to content

Commit

Permalink
#1941: use TerminationDetector for any_epoch_sentinel
Browse files Browse the repository at this point in the history
  • Loading branch information
stmcgovern committed Sep 20, 2022
1 parent db0ffb1 commit 80b564f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
2 changes: 0 additions & 2 deletions src/vt/messaging/active.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion src/vt/termination/termination.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
15 changes: 14 additions & 1 deletion src/vt/termination/termination.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"; }

Expand Down

0 comments on commit 80b564f

Please sign in to comment.