Skip to content

Commit

Permalink
#1672: tests: add test for makeGraphSymmetric
Browse files Browse the repository at this point in the history
  • Loading branch information
cz4rs committed May 30, 2022
1 parent 8124440 commit 02cae11
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/vt/vrt/collection/balance/lb_invoke/lb_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ struct LBManager : runtime::component::Component<LBManager> {
static std::unique_ptr<LBManager> construct();

public:
LBProxyType getLB() { return lb_instances_["chosen"]; }

/**
* \internal
* \brief Decide which LB to invoke given a certain phase
Expand Down
32 changes: 32 additions & 0 deletions tests/unit/collection/test_lb.extended.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@

#include "vt/vrt/collection/manager.h"
#include "vt/vrt/collection/balance/lb_data_holder.h"
#include "vt/vrt/collection/balance/lb_invoke/lb_manager.h"
#include "vt/utils/json/json_reader.h"
#include "vt/utils/json/json_appender.h"

Expand Down Expand Up @@ -152,6 +153,37 @@ TEST_P(TestLoadBalancerGreedy, test_load_balancer_greedy_keep_last_elm) {
runTest(GetParam());
}

TEST_F(TestLoadBalancerOther, test_make_graph_symmetric) {
runTest("TemperedWMin");

// auto proxy = theLBManager()->getLB();
// runInEpochCollective(
// "test_make_graph_symmetric -> makeGraphSymmetric",
// [phase, proxy] { vrt::collection::balance::makeGraphSymmetric(phase, proxy); }
// );

auto phase = num_phases - 1;
auto iter = theNodeStats()->getNodeComm()->find(phase);
ASSERT_NE(iter, theNodeStats()->getNodeComm()->end());

elm::CommMapType const& comm_data = iter->second;

fmt::print(
"\ntest_make_graph_symmetric: comm_map.size={}\n", comm_data.size()
);
for (auto&& elm : comm_data) {
if (
elm.first.commCategory() == elm::CommCategory::SendRecv and
not elm.first.selfEdge()
) {
fmt::print(
"test_make_graph_symmetric: from={}, to={}\n", elm.first.fromObj(),
elm.first.toObj()
);
}
}
}

struct MyCol2 : vt::Collection<MyCol2,vt::Index1D> {};

using TestLoadBalancerNoWork = TestParallelHarness;
Expand Down

0 comments on commit 02cae11

Please sign in to comment.