From 3f92cb89d96c0514ddc0679c94f493af324a92d8 Mon Sep 17 00:00:00 2001 From: Sean McGovern Date: Tue, 20 Sep 2022 00:06:12 +0000 Subject: [PATCH 1/3] #1942: use isActive in termination and inline --- src/vt/termination/term_state.cc | 9 ++++----- src/vt/termination/term_state.h | 4 +++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/vt/termination/term_state.cc b/src/vt/termination/term_state.cc index 57c5dc10e4..76cb40d251 100644 --- a/src/vt/termination/term_state.cc +++ b/src/vt/termination/term_state.cc @@ -121,15 +121,14 @@ TermCounterType TermState::decrementDependency() { return --deps_; } -bool TermState::readySubmitParent(bool const needs_active) const { +bool TermState::readySubmitParent() const { vtAssert( num_children_ != uninitialized_destination, "Children must be valid" ); - auto const ret = (epoch_active_ or not needs_active) and - recv_child_count_ == num_children_ and local_terminated_ and - submitted_wave_ == cur_wave_ - 1 and not term_detected_ and - deps_ == 0; + auto const ret = epoch_active_ and local_terminated_ and + deps_ == 0 and recv_child_count_ == num_children_ and + submitted_wave_ == cur_wave_ - 1 and not term_detected_; vt_debug_print( verbose, term, diff --git a/src/vt/termination/term_state.h b/src/vt/termination/term_state.h index 5cbae03b5d..1e0d2aaa25 100644 --- a/src/vt/termination/term_state.h +++ b/src/vt/termination/term_state.h @@ -66,7 +66,7 @@ struct TermState : EpochDependency, EpochLabel { void notifyLocalTerminated(bool const terminated = true); void submitToParent(bool const is_root, bool const setup = false); void receiveContinueSignal(TermWaveType const& wave); - bool readySubmitParent(bool const needs_active = true) const; + bool readySubmitParent() const; EventCountType getRecvChildCount() const; EpochType getEpoch() const; TermWaveType getCurWave() const; @@ -76,6 +76,8 @@ struct TermState : EpochDependency, EpochLabel { void incrementDependency(); TermCounterType decrementDependency(); + inline bool isActive() const { return epoch_active_; } + TermState( EpochType const& in_epoch, bool const in_local_terminated, bool const active, NodeType const& children From 106a1e4303a3d95209e5a0c565fd85044af3820f Mon Sep 17 00:00:00 2001 From: Sean McGovern Date: Fri, 23 Sep 2022 17:38:42 +0000 Subject: [PATCH 2/3] #1942: call isActive() --- src/vt/termination/termination.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vt/termination/termination.cc b/src/vt/termination/termination.cc index a413df460c..23b4b33ced 100644 --- a/src/vt/termination/termination.cc +++ b/src/vt/termination/termination.cc @@ -176,7 +176,7 @@ void TerminationDetector::maybePropagate() { propagateEpoch(any_epoch_state_); } - if (hang_.readySubmitParent()) { + if (hang_.isActive() and hang_.readySubmitParent()) { propagateEpoch(hang_); } From 9fcbb7a39b18601a39df1e8b63657e2801968e12 Mon Sep 17 00:00:00 2001 From: Sean McGovern Date: Tue, 27 Sep 2022 21:33:42 +0000 Subject: [PATCH 3/3] #1942: add isActive() for other epochs --- src/vt/termination/termination.cc | 6 +++--- src/vt/termination/termination.impl.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/vt/termination/termination.cc b/src/vt/termination/termination.cc index 23b4b33ced..4d3eb497fb 100644 --- a/src/vt/termination/termination.cc +++ b/src/vt/termination/termination.cc @@ -172,7 +172,7 @@ TerminationDetector::getDSTerm(EpochType epoch, bool is_root) { } void TerminationDetector::maybePropagate() { - if (any_epoch_state_.readySubmitParent()) { + if (any_epoch_state_.isActive() and any_epoch_state_.readySubmitParent()) { propagateEpoch(any_epoch_state_); } @@ -181,7 +181,7 @@ void TerminationDetector::maybePropagate() { } for (auto&& state : epoch_state_) { - if (state.second.readySubmitParent()) { + if (state.second.isActive() and state.second.readySubmitParent()) { propagateEpoch(state.second); } } @@ -202,7 +202,7 @@ void TerminationDetector::propagateEpochExternalState( state.notifyChildReceive(); - if (state.readySubmitParent()) { + if (state.isActive() and state.readySubmitParent()) { propagateEpoch(state); } } diff --git a/src/vt/termination/termination.impl.h b/src/vt/termination/termination.impl.h index 6b61c87e6f..f9c2b4730e 100644 --- a/src/vt/termination/termination.impl.h +++ b/src/vt/termination/termination.impl.h @@ -97,7 +97,7 @@ inline void TerminationDetector::produceConsumeState( print_bool(produce) ); - if (state.readySubmitParent()) { + if (state.isActive() and state.readySubmitParent()) { propagateEpoch(state); } }