Skip to content

Commit 9e854a7

Browse files
cwschillycz4rs
authored andcommitted
#2201: tests: avoid calculating imbalance manually
1 parent e6855fb commit 9e854a7

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tests/unit/lb/test_temperedlb.cc

+5-4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ std::string writeTemperedLBConfig(std::string transfer_strategy,
2929
if (mem_constraints) {
3030
cfg_file_ << " memory_threshold=20.0";
3131
}
32+
if (transfer_strategy == "SwapClusters") {
33+
cfg_file_ << " rollback=false";
34+
}
3235
cfg_file_.close();
3336
}
3437
return config_file;
@@ -37,7 +40,6 @@ std::string writeTemperedLBConfig(std::string transfer_strategy,
3740
void runTemperedLBTest(std::string config_file, double expected_imb = 0.0) {
3841
// Set configuration
3942
theConfig()->vt_lb = true;
40-
theConfig()->vt_lb_name = "TemperedLB";
4143
theConfig()->vt_lb_data_in = true;
4244
theConfig()->vt_lb_file_name = config_file;
4345
theConfig()->vt_lb_data_file_in="synthetic-dataset-blocks.%p.json";
@@ -54,8 +56,7 @@ void runTemperedLBTest(std::string config_file, double expected_imb = 0.0) {
5456
auto phase_info = theLBManager()->getPhaseInfo();
5557

5658
// Assert that temperedLB found the correct imbalance
57-
auto imb = (phase_info->max_load / phase_info->avg_load) - 1;
58-
EXPECT_EQ(imb, expected_imb);
59+
EXPECT_EQ(phase_info->imb_load_post_lb, expected_imb);
5960

6061
// Clear the LB config ahead of next test
6162
vrt::collection::balance::ReadLBConfig::clear();
@@ -78,7 +79,7 @@ TEST_F(TestTemperedLB, test_load_memory_homing_swapclusters) {
7879

7980
TEST_F(TestTemperedLB, test_load_memory_homing_comms) {
8081
auto cfg = writeTemperedLBConfig("SwapClusters", true, 1.0, 1.0);
81-
double expected_imbalance = 0.25; // placeholder for value from MILP
82+
double expected_imbalance = 0.0; // placeholder for value from MILP
8283
runTemperedLBTest(cfg, expected_imbalance);
8384
}
8485

0 commit comments

Comments
 (0)