From 15e4c9fb228849941b2472b85b7f3eaf6914c631 Mon Sep 17 00:00:00 2001 From: Arkadiusz Szczepkowicz Date: Tue, 17 Sep 2024 16:42:22 +0200 Subject: [PATCH] #1934: Update usage of the buffer in the codebase --- .../vrt/collection/balance/workload_replay.cc | 8 ++++---- tests/unit/collection/test_lb.extended.cc | 7 ++++--- tests/unit/lb/test_lb_data_comm.cc | 18 +++++++++--------- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/vt/vrt/collection/balance/workload_replay.cc b/src/vt/vrt/collection/balance/workload_replay.cc index 82fd5c38da..7d6f8e145b 100644 --- a/src/vt/vrt/collection/balance/workload_replay.cc +++ b/src/vt/vrt/collection/balance/workload_replay.cc @@ -249,19 +249,19 @@ readInWorkloads(const std::string &filename) { auto json = r.readFile(); auto sd = std::make_shared(*json); - for (auto phase = sd->node_data_.backPhase(); phase <= sd->node_data_.frontPhase(); phase++) { + for (auto &phase_data : sd->node_data_) { vt_debug_print( normal, replay, "found {} loads for phase {}\n", - sd->node_data_[phase].size(), phase + phase_data.second.size(), phase_data.first ); } - for (auto phase = sd->node_comm_.backPhase(); phase <= sd->node_comm_.frontPhase(); phase++) { + for (auto &phase_data : sd->node_comm_) { vt_debug_print( normal, replay, "found {} comms for phase {}\n", - sd->node_comm_[phase].size(), phase + phase_data.second.size(), phase_data.first ); } diff --git a/tests/unit/collection/test_lb.extended.cc b/tests/unit/collection/test_lb.extended.cc index bdf91f2c46..31a142f9b9 100644 --- a/tests/unit/collection/test_lb.extended.cc +++ b/tests/unit/collection/test_lb.extended.cc @@ -606,8 +606,9 @@ TEST_F(TestRestoreLBData, test_restore_lb_data_data_1) { ); } else { // compare the whole-phase load data in detail - for (auto phase = lbdh.node_data_.backPhase(); phase <= lbdh.node_data_.frontPhase(); phase++) { - EXPECT_TRUE(lbdh_read.node_data_.contains(phase)); + for (auto &phase_data : lbdh.node_data_) { + auto phase = phase_data.first; + EXPECT_FALSE(!lbdh_read.node_data_.contains(phase)); if (!lbdh_read.node_data_.contains(phase)) { fmt::print( "Phase {} in whole-phase loads were not read in", @@ -615,7 +616,7 @@ TEST_F(TestRestoreLBData, test_restore_lb_data_data_1) { ); } else { auto &read_load_map = lbdh_read.node_data_[phase]; - auto &orig_load_map = lbdh.node_data_[phase]; + auto &orig_load_map = phase_data.second; for (auto &entry : read_load_map) { auto read_elm_id = entry.first; if ((read_elm_id.id == vt::elm::no_element_id) diff --git a/tests/unit/lb/test_lb_data_comm.cc b/tests/unit/lb/test_lb_data_comm.cc index b2441ee0fe..b0ab4e6c69 100644 --- a/tests/unit/lb/test_lb_data_comm.cc +++ b/tests/unit/lb/test_lb_data_comm.cc @@ -294,7 +294,7 @@ TEST_F(TestLBDataComm, test_lb_data_comm_col_to_col_send) { if (proxy(i).tryGetLocalPtr()) { bool found = false; for (auto&& x : comm) { - for (auto&& y : x) { + for (auto&& y : x.second) { auto key = y.first; auto vol = y.second; if (key.to_.id == idxToElmID(idx)) { @@ -358,7 +358,7 @@ TEST_F(TestLBDataComm, test_lb_data_comm_col_to_objgroup_send) { bool found = false; auto idb = vt::elm::ElmIDBits::createObjGroup(op, next).id; for (auto&& x : comm) { - for (auto&& y : x) { + for (auto&& y : x.second) { auto key = y.first; auto vol = y.second; if (key.from_.id == idxToElmID(idx) /*and key.to_.id == idb*/) { @@ -421,7 +421,7 @@ TEST_F(TestLBDataComm, test_lb_data_comm_objgroup_to_col_send) { if (proxy(i).tryGetLocalPtr()) { bool found = false; for (auto&& x : comm) { - for (auto&& y : x) { + for (auto&& y : x.second) { auto key = y.first; auto vol = y.second; if (key.to_.id == idxToElmID(idx)) { @@ -475,7 +475,7 @@ TEST_F(TestLBDataComm, test_lb_data_comm_objgroup_to_objgroup_send) { // Check that communication exists on the send side as expected bool found = false; for (auto&& x : comm) { - for (auto&& y : x) { + for (auto&& y : x.second) { auto key = y.first; auto vol = y.second; if (key.from_.id == ida /*and key.to_.id == idb*/) { @@ -532,7 +532,7 @@ TEST_F(TestLBDataComm, test_lb_data_comm_handler_to_col_send) { if (proxy(i).tryGetLocalPtr()) { bool found = false; for (auto&& x : comm) { - for (auto&& y : x) { + for (auto&& y : x.second) { auto key = y.first; auto vol = y.second; if (key.to_.id == idxToElmID(idx)) { @@ -592,7 +592,7 @@ TEST_F(TestLBDataComm, test_lb_data_comm_col_to_handler_send) { if (proxy(i).tryGetLocalPtr()) { bool found = false; for (auto&& x : comm) { - for (auto&& y : x) { + for (auto&& y : x.second) { auto key = y.first; auto vol = y.second; fmt::print("from={}, to={}\n", key.from_, key.to_); @@ -641,7 +641,7 @@ TEST_F(TestLBDataComm, test_lb_data_comm_objgroup_to_handler_send) { // Check that communication exists on the send side as expected bool found = false; for (auto&& x : comm) { - for (auto&& y : x) { + for (auto&& y : x.second) { auto key = y.first; auto vol = y.second; if (key.from_.id == ida) { @@ -686,7 +686,7 @@ TEST_F(TestLBDataComm, test_lb_data_comm_handler_to_objgroup_send) { // Check that communication exists on the send side as expected bool found = false; for (auto&& x : comm) { - for (auto&& y : x) { + for (auto&& y : x.second) { auto key = y.first; auto vol = y.second; if (key.to_.id == ida) { @@ -727,7 +727,7 @@ TEST_F(TestLBDataComm, test_lb_data_comm_handler_to_handler_send) { // Check that communication exists on the send side as expected bool found = false; for (auto&& x : comm) { - for (auto&& y : x) { + for (auto&& y : x.second) { auto key = y.first; auto vol = y.second; if (key.to_.id == ida and key.from_.id == idb) {