Skip to content

Commit

Permalink
#2074: Check the phase if needs OfflineLB even if requested in config
Browse files Browse the repository at this point in the history
  • Loading branch information
thearusable authored and cwschilly committed Sep 20, 2024
1 parent 7d9a9a5 commit a3b11e4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/vt/runtime/runtime.cc
Original file line number Diff line number Diff line change
Expand Up @@ -435,10 +435,10 @@ bool Runtime::needLBDataRestartReader() {
return ReadLBConfig::hasOfflineLB();
}
}
return false;
} else
}
#endif
return false;

return false;
}

bool Runtime::initialize(bool const force_now) {
Expand Down
5 changes: 5 additions & 0 deletions src/vt/vrt/collection/balance/lb_invoke/lb_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ LBType LBManager::decideLBToRun(PhaseType phase, bool try_file) {
}
}

// Check if LBDataRestartReader requires to run OfflineLB for a given phase.
if(the_lb == LBType::OfflineLB && !theLBDataReader()->needsLB(phase)) {
the_lb = LBType::NoLB;
}

vt_debug_print(
terse, lb,
"LBManager::decidedLBToRun: phase={}, return lb_={}\n",
Expand Down
15 changes: 7 additions & 8 deletions tests/unit/lb/test_offlinelb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -233,19 +233,19 @@ TEST_F(TestOfflineLB, test_offlinelb_2) {
std::string file_name = getUniqueFilenameWithRanks(".txt");
std::ofstream out(file_name);

// NoLB for phases on skipped list and one phase before them.
// Phases on the skipped list: 1, 2, 9
// Request OfflineLB for each phase.
// LBDataRestartReader will check beforehand if that phase requires OfflineLB.
out << ""
"0 NoLB\n"
"1 NoLB\n"
"2 NoLB\n"
"0 OfflineLB\n"
"1 OfflineLB\n"
"2 OfflineLB\n"
"3 OfflineLB\n"
"4 OfflineLB\n"
"5 OfflineLB\n"
"6 OfflineLB\n"
"7 OfflineLB\n"
"8 NoLB\n"
"9 NoLB\n";
"8 OfflineLB\n"
"9 OfflineLB\n";
out.close();

theConfig()->vt_lb = true;
Expand All @@ -261,7 +261,6 @@ TEST_F(TestOfflineLB, test_offlinelb_2) {
.bulkInsert()
.wait();

// Do work for properly configured phases 0-8
for (PhaseType i = 0; i < num_phases; i++) {
runInEpochCollective("run sparseHandler", [&]{
proxy.broadcastCollective<typename SimCol::Msg, &SimCol::sparseHandler>(i);
Expand Down

0 comments on commit a3b11e4

Please sign in to comment.