Skip to content

Commit

Permalink
#1672: lb: do not loop over comm_data twice
Browse files Browse the repository at this point in the history
  • Loading branch information
cz4rs committed Mar 11, 2022
1 parent ab02e9a commit 45d96fd
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/vt/vrt/collection/balance/lb_invoke/lb_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,13 @@ void LBManager::computeStatistics(
lstats.emplace_back(reduceVec(lb::Statistic::O_l, std::move(O_l)));

double comm_load = 0.0;
std::vector<balance::LoadData> O_c;
for (auto&& elm : *comm_data) {
// Only count object-to-object direct edges in the O_c statistics
if (elm.first.cat_ == elm::CommCategory::SendRecv and not elm.first.selfEdge()) {
O_c.emplace_back(LoadData{lb::Statistic::O_c, elm.second.bytes});
}

if (not comm_collectives and isCollectiveComm(elm.first.cat_)) {
continue;
}
Expand All @@ -473,15 +479,6 @@ void LBManager::computeStatistics(
}

lstats.emplace_back(LoadData{lb::Statistic::P_c, comm_load});

std::vector<balance::LoadData> O_c;
for (auto&& elm : *comm_data) {
// Only count object-to-object direct edges in the O_c statistics
if (elm.first.cat_ == elm::CommCategory::SendRecv and not elm.first.selfEdge()) {
O_c.emplace_back(LoadData{lb::Statistic::O_c, elm.second.bytes});
}
}

lstats.emplace_back(reduceVec(lb::Statistic::O_c, std::move(O_c)));

auto msg = makeMessage<StatsMsgType>(std::move(lstats));
Expand Down

0 comments on commit 45d96fd

Please sign in to comment.