Skip to content
This repository was archived by the owner on Jan 26, 2026. It is now read-only.

Commit ccef45d

Browse files
committed
checking MPI_THREAD_MULTIPLE when MPI pre-initialized
1 parent c63171a commit ccef45d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/MPITransceiver.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ MPITransceiver::MPITransceiver()
1616
"Please use a thread-safe MPI implementation.");
1717
}
1818
} else {
19+
MPI_Query_thread(&flag);
20+
if(flag != MPI_THREAD_MULTIPLE)
21+
throw(std::logic_error("MPI had been initialized incorrectly: not MPI_THREAD_MULTIPLE"));
1922
std::cerr << "MPI already initialized\n";
2023
}
2124
int nranks, rank;

0 commit comments

Comments
 (0)