Skip to content

Commit dc93e46

Browse files
committed
Use Valgrind suppression files and replace exit with MPI_Abort
Added a Valgrind suppression file to handle internal MPI-related leaks, ensuring cleaner Valgrind output during tests. Replaced `exit` calls with `MPI_Abort` to properly terminate MPI programs on failure. Updated test script to utilize the new suppression file in Valgrind commands.
1 parent 3837166 commit dc93e46

4 files changed

Lines changed: 20 additions & 3 deletions

File tree

scripts/run_tests.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ def __init__(self):
3131
self.__ppc_env = None
3232
self.work_dir = None
3333

34-
self.valgrind_cmd = "valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all"
34+
suppression_file = Path(self.__get_project_path()) / "valgrind.supp"
35+
self.valgrind_cmd = (f"valgrind --suppressions={suppression_file} "
36+
f"--error-exitcode=1 --leak-check=full --show-leak-kinds=all")
3537

3638
if platform.system() == "Windows":
3739
self.mpi_exec = "mpiexec"

tasks/runners/functional.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class UnreadMessagesDetector : public ::testing::EmptyTestEventListener {
3131
stderr,
3232
"[ PROCESS {} ] [ FAILED ] {}.{}: MPI message queue has an unread message from process {} with tag {}",
3333
rank, "test_suite_name", "test_name", status.MPI_SOURCE, status.MPI_TAG);
34-
exit(EXIT_FAILURE); // NOLINT
34+
MPI_Abort(MPI_COMM_WORLD, EXIT_FAILURE);
3535
}
3636

3737
MPI_Barrier(MPI_COMM_WORLD);

tasks/runners/performance.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class UnreadMessagesDetector : public ::testing::EmptyTestEventListener {
3131
"[ PROCESS {} ] [ FAILED ] MPI message queue has an unread message from process {} with tag {}",
3232
rank, status.MPI_SOURCE, status.MPI_TAG);
3333

34-
exit(EXIT_FAILURE); // NOLINT
34+
MPI_Abort(MPI_COMM_WORLD, EXIT_FAILURE);
3535
}
3636

3737
MPI_Barrier(MPI_COMM_WORLD);

valgrind.supp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
suppress mpi init internal leaks
3+
Memcheck:Leak
4+
...
5+
fun:MPI_Init
6+
...
7+
}
8+
9+
{
10+
suppress mpi finalize internal leaks
11+
Memcheck:Leak
12+
...
13+
fun:MPI_Finalize
14+
...
15+
}

0 commit comments

Comments
 (0)