Skip to content

Commit

Permalink
#1672: extract getSharedEdges method
Browse files Browse the repository at this point in the history
  • Loading branch information
cz4rs committed May 30, 2022
1 parent d9951d4 commit a0394e7
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions src/vt/vrt/collection/balance/lb_invoke/lb_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -728,22 +728,15 @@ void LBManager::closeStatisticsFile() {
statistics_writer_ = nullptr;
}

void makeGraphSymmetric(
PhaseType phase, objgroup::proxy::Proxy<lb::BaseLB> proxy
) {
// Go through the comm graph and extract out paired SendRecv edges that are
// not self-send and have a non-local edge
std::unordered_map<NodeType, lb::BaseLB::ElementCommType>
getSharedEdges(elm::CommMapType const& comm_data) {
auto const this_node = theContext()->getNode();
auto iter = theNodeLBData()->getNodeComm()->find(phase);
if (iter == theNodeLBData()->getNodeComm()->end()) {
return;
}

// Go through the comm graph and extract out paired SendRecv edges that are
// not self-send and have a non-local edge
elm::CommMapType const& comm_data = iter->second;
std::unordered_map<NodeType, lb::BaseLB::ElementCommType> shared_edges;

vt_debug_print(
verbose, temperedwmin, "makeGraphSymmetric: comm size={}\n",
verbose, temperedwmin, "getSharedEdges: comm size={}\n",
comm_data.size()
);

Expand All @@ -764,7 +757,7 @@ void makeGraphSymmetric(
);

vt_debug_print(
verbose, temperedwmin, "makeGraphSymmetric: elm: from={}, to={}\n",
verbose, temperedwmin, "getSharedEdges: elm: from={}, to={}\n",
from, to
);

Expand All @@ -776,6 +769,19 @@ void makeGraphSymmetric(
}
}

return shared_edges;
}

void makeGraphSymmetric(
PhaseType phase, objgroup::proxy::Proxy<lb::BaseLB> proxy
) {
auto iter = theNodeLBData()->getNodeComm()->find(phase);
if (iter == theNodeLBData()->getNodeComm()->end()) {
return;
}

auto shared_edges = getSharedEdges(iter->second);

for (auto&& elm : shared_edges) {
proxy[elm.first].send<lb::CommMsg, &lb::BaseLB::recvSharedEdges>(
elm.second
Expand Down

0 comments on commit a0394e7

Please sign in to comment.