Skip to content

Commit f72c190

Browse files
committed
#2074: Add case to the offlinelb test which will result in assert
1 parent 8b6e226 commit f72c190

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

src/vt/vrt/collection/balance/lb_data_restart_reader.cc

+10-10
Original file line numberDiff line numberDiff line change
@@ -182,29 +182,29 @@ void LBDataRestartReader::determinePhasesToMigrate() {
182182

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

191191
std::set_difference(
192-
history_[curr + 1]->begin(), history_[curr + 1]->end(),
193-
history_[curr]->begin(), history_[curr]->end(),
192+
history_[i+1]->begin(), history_[i+1]->end(),
193+
history_[i]->begin(), history_[i]->end(),
194194
std::inserter(arriving, arriving.begin())
195195
);
196196

197197
std::set_difference(
198-
history_[curr]->begin(), history_[curr]->end(),
199-
history_[curr + 1]->begin(), history_[curr + 1]->end(),
198+
history_[i]->begin(), history_[i]->end(),
199+
history_[i+1]->begin(), history_[i+1]->end(),
200200
std::inserter(departing, departing.begin())
201201
);
202202

203203
for (auto&& d : departing) {
204-
proxy_[d.getHomeNode()].send<DepartMsg, &LBDataRestartReader::departing>(this_node, curr + 1, d);
204+
proxy_[d.getHomeNode()].send<DepartMsg, &LBDataRestartReader::departing>(this_node, i+1, d);
205205
}
206206
for (auto&& a : arriving) {
207-
proxy_[a.getHomeNode()].send<ArriveMsg, &LBDataRestartReader::arriving>(this_node, curr + 1, a);
207+
proxy_[a.getHomeNode()].send<ArriveMsg, &LBDataRestartReader::arriving>(this_node, i+1, a);
208208
}
209209
}
210210
}

tests/unit/lb/test_offlinelb.cc

+12-2
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ TEST_F(TestOfflineLB, test_offlinelb_2) {
245245
"6 OfflineLB\n"
246246
"7 OfflineLB\n"
247247
"8 NoLB\n"
248-
"9 NoLB\n";
248+
"9 OfflineLB\n"; // Set to OfflineLB to provoke crash
249249
out.close();
250250

251251
theConfig()->vt_lb = true;
@@ -261,12 +261,22 @@ TEST_F(TestOfflineLB, test_offlinelb_2) {
261261
.bulkInsert()
262262
.wait();
263263

264-
for (PhaseType i = 0; i < num_phases; i++) {
264+
// Do work for properly configured phases 0-8
265+
for (PhaseType i = 0; i <= 8; i++) {
265266
runInEpochCollective("run sparseHandler", [&]{
266267
proxy.broadcastCollective<typename SimCol::Msg, &SimCol::sparseHandler>(i);
267268
});
268269
thePhase()->nextPhaseCollective();
269270
}
271+
272+
if(num_nodes == 1) {
273+
// Try to run OfflineLB on phase 9 which will trigger assert.
274+
PhaseType crashingPhase = 9;
275+
runInEpochCollective("run sparseHandler", [&]{
276+
proxy.broadcastCollective<typename SimCol::Msg, &SimCol::sparseHandler>(crashingPhase);
277+
});
278+
EXPECT_DEATH(thePhase()->nextPhaseCollective(), "");
279+
}
270280
}
271281

272282
#endif

0 commit comments

Comments
 (0)