Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1942 improve efficiency of epoch stack #1979

Merged
merged 3 commits into from
Sep 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/vt/termination/term_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion src/vt/termination/term_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/vt/termination/termination.cc
Original file line number Diff line number Diff line change
Expand Up @@ -172,16 +172,16 @@ 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_);
}

if (hang_.readySubmitParent()) {
if (hang_.isActive() and hang_.readySubmitParent()) {
propagateEpoch(hang_);
}

for (auto&& state : epoch_state_) {
if (state.second.readySubmitParent()) {
if (state.second.isActive() and state.second.readySubmitParent()) {
propagateEpoch(state.second);
}
}
Expand All @@ -202,7 +202,7 @@ void TerminationDetector::propagateEpochExternalState(

state.notifyChildReceive();

if (state.readySubmitParent()) {
if (state.isActive() and state.readySubmitParent()) {
propagateEpoch(state);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/vt/termination/termination.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ inline void TerminationDetector::produceConsumeState(
print_bool(produce)
);

if (state.readySubmitParent()) {
if (state.isActive() and state.readySubmitParent()) {
propagateEpoch(state);
}
}
Expand Down