Skip to content

Commit

Permalink
#702: CollectionChainSet: fix formatting and add assertion to mergeSt…
Browse files Browse the repository at this point in the history
…epCollective that the index exists in both chain sets
  • Loading branch information
nmm0 committed Aug 25, 2020
1 parent 71ff4f6 commit 7f31685
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/vt/messaging/collection_chain_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ class CollectionChainSet final {
theTerm()->finishedEpoch(epoch);
}


static void mergeStepCollective(CollectionChainSet &a, CollectionChainSet &b,
std::function<PendingSend(Index)> step_action
) {
Expand All @@ -206,18 +205,21 @@ class CollectionChainSet final {
CollectionChainSet &a, CollectionChainSet &b,
std::function<PendingSend(Index)> step_action
) {
auto epoch = theTerm()->makeEpochCollective(label);
vt::theMsg()->pushEpoch(epoch);
auto epoch = theTerm()->makeEpochCollective(label);
vt::theMsg()->pushEpoch(epoch);

for (auto &entry : a.chains_) {
for (auto &entry : a.chains_) {
auto& idx = entry.first;
auto& chaina = entry.second;
auto& chainb = b.chains_[entry.first];
auto chainb_pos = b.chains_.find(entry.first);
vtAssert(chainb_pos != b.chains_.end(), fmt::format("index {} must be present in chainset b", entry.first));

auto& chainb = chainb_pos->second;
DependentSendChain::mergeChainStep(chaina, chainb, epoch, step_action(idx));
}
}

vt::theMsg()->popEpoch(epoch);
theTerm()->finishedEpoch(epoch);
vt::theMsg()->popEpoch(epoch);
theTerm()->finishedEpoch(epoch);
}

/**
Expand Down

0 comments on commit 7f31685

Please sign in to comment.