Skip to content

Commit 8df5fdf

Browse files
authored
Capture MPI_Iprobe errors (#526)
## Summary - handle return value from `MPI_Iprobe` in `UnreadMessagesDetector` ## Testing - `pre-commit run --files modules/runners/src/runners.cpp` ------ https://chatgpt.com/codex/tasks/task_e_686a6373e2bc832fbeae9af1495e0525
1 parent 8ee6414 commit 8df5fdf

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

modules/runners/src/runners.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ void UnreadMessagesDetector::OnTestEnd(const ::testing::TestInfo& /*test_info*/)
2424
int flag = -1;
2525
MPI_Status status;
2626

27-
MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &flag, &status);
27+
const int iprobe_res = MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &flag, &status);
28+
if (iprobe_res != MPI_SUCCESS) {
29+
std::cerr << std::format("[ PROCESS {} ] [ ERROR ] MPI_Iprobe failed with code {}", rank, iprobe_res) << '\n';
30+
MPI_Abort(MPI_COMM_WORLD, iprobe_res);
31+
}
2832

2933
if (flag != 0) {
3034
std::cerr

0 commit comments

Comments
 (0)