diff --git a/src/vt/messaging/collection_chain_set.h b/src/vt/messaging/collection_chain_set.h index 8497a70554..68edfca469 100644 --- a/src/vt/messaging/collection_chain_set.h +++ b/src/vt/messaging/collection_chain_set.h @@ -194,7 +194,6 @@ class CollectionChainSet final { theTerm()->finishedEpoch(epoch); } - static void mergeStepCollective(CollectionChainSet &a, CollectionChainSet &b, std::function step_action ) { @@ -206,18 +205,21 @@ class CollectionChainSet final { CollectionChainSet &a, CollectionChainSet &b, std::function 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); } /**