Skip to content

Commit

Permalink
#2074: Add case to the offlinelb test which will result in assert
Browse files Browse the repository at this point in the history
  • Loading branch information
thearusable authored and cwschilly committed Sep 20, 2024
1 parent e2b3b9b commit 374b1e0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
20 changes: 10 additions & 10 deletions src/vt/vrt/collection/balance/lb_data_restart_reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -182,29 +182,29 @@ void LBDataRestartReader::determinePhasesToMigrate() {

auto const this_node = theContext()->getNode();
runInEpochCollective("LBDataRestartReader::updateLocations", [&]{
for (PhaseType curr = 0; curr < num_phases_ - 1; ++curr) {
if(history_.count(curr) && history_.count(curr + 1)) {
local_changed_distro[curr] = *history_[curr] != *history_[curr + 1];
if (local_changed_distro[curr]) {
for (PhaseType i = 0; i < num_phases_ - 1; ++i) {
if(history_.count(i) && history_.count(i+1)) {
local_changed_distro[i] = *history_[i] != *history_[i+1];
if (local_changed_distro[i]) {
std::set<ElementIDStruct> departing, arriving;

std::set_difference(
history_[curr + 1]->begin(), history_[curr + 1]->end(),
history_[curr]->begin(), history_[curr]->end(),
history_[i+1]->begin(), history_[i+1]->end(),
history_[i]->begin(), history_[i]->end(),
std::inserter(arriving, arriving.begin())
);

std::set_difference(
history_[curr]->begin(), history_[curr]->end(),
history_[curr + 1]->begin(), history_[curr + 1]->end(),
history_[i]->begin(), history_[i]->end(),
history_[i+1]->begin(), history_[i+1]->end(),
std::inserter(departing, departing.begin())
);

for (auto&& d : departing) {
proxy_[d.getHomeNode()].send<DepartMsg, &LBDataRestartReader::departing>(this_node, curr + 1, d);
proxy_[d.getHomeNode()].send<DepartMsg, &LBDataRestartReader::departing>(this_node, i+1, d);
}
for (auto&& a : arriving) {
proxy_[a.getHomeNode()].send<ArriveMsg, &LBDataRestartReader::arriving>(this_node, curr + 1, a);
proxy_[a.getHomeNode()].send<ArriveMsg, &LBDataRestartReader::arriving>(this_node, i+1, a);
}
}
}
Expand Down
14 changes: 12 additions & 2 deletions tests/unit/lb/test_offlinelb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ TEST_F(TestOfflineLB, test_offlinelb_2) {
"6 OfflineLB\n"
"7 OfflineLB\n"
"8 NoLB\n"
"9 NoLB\n";
"9 OfflineLB\n"; // Set to OfflineLB to provoke crash
out.close();

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

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

if(num_nodes == 1) {
// Try to run OfflineLB on phase 9 which will trigger assert.
PhaseType crashingPhase = 9;
runInEpochCollective("run sparseHandler", [&]{
proxy.broadcastCollective<typename SimCol::Msg, &SimCol::sparseHandler>(crashingPhase);
});
EXPECT_DEATH(thePhase()->nextPhaseCollective(), "");
}
}

#endif
Expand Down

0 comments on commit 374b1e0

Please sign in to comment.