Suppressing Errors

The error-checking tools detect numerous problems in the system libraries, such as the C library, which come pre-installed with your OS. You can't easily fix these, but you don't want to see these errors (and yes, there are many!) So Valgrind reads a list of errors to suppress at startup. A default suppression file is created by the ./configure script when the system is built. For MPI programs, there may be memory leaks coming from using MPI functions like MPI_Init() and MPI_File_Open() when MPI runtime allocates some memory in those functions that it doesn’t bother to free before the end of the program. There is a suppression file provided by Intel’s MPI, $I_MPI_ROOT/etc64/valgrind.supp, but not all of those errors are covered by it.

You can modify and add to the suppressions file at your leisure, or, better, write your own. Multiple suppression files are allowed. This is useful if part of your project contains errors you can't or don't want to fix, yet you don't want to continuously be reminded of them. By far the easiest way to add suppressions is to use the --gen-suppressions=yes option. This generates suppressions automatically. For best results, though, you may want to edit the output of --gen-suppressions=yes by hand.

To generate supressions:

mpirun -n 1 valgrind --leak-check=full --log-file=Valgrind.%p --gen-suppressions=all ./mpi_hello.x

To use supressions:

mpirun -n 1 valgrind --leak-check=full --log-file=Valgrind.%p --suppressions=New_Supp_File ./mpi_hello.x

If you use the -v option, at the end of execution, Valgrind prints out one line for each used suppression, giving the number of times it got used, its name and the filename and line number where the suppression is defined. Depending on the suppression kind, the filename and line number are optionally followed by additional information (such as the number of blocks and bytes suppressed by a memcheck leak suppression).

The suppressions used by a run:

--31855-- used_suppression: 1 MPI Init leak - unknown calloc New_Supp_File:35 suppressed: 9,248 bytes in 1 blocks
--31855-- used_suppression: 1 MPI Init leak - unknown malloc New_Supp_File:21 suppressed: 528 bytes in 1 blocks
--31855-- used_suppression: 2 MPI Init leak - malloc New_Supp_File:8 suppressed: 268 bytes in 2 blocks
--31855-- used_suppression: 2 MPI File Open leak - realloc New_Supp_File:53 suppressed: 32 bytes in 8 blocks

If you want to understand more about suppressions, look at the Valgrind User Manual.

Supported By

File Browser Reference
Department FHERIS
University of Galway
HEA Logo