Valgrind
From ScorecWiki
Contents |
Parallel Execution
Setup your environment
module load valgrind
Run Valgrind independently on each MPI process of a parallel program using MPI named 'helloWorldMPI' for this example:
/PATH/TO/mpirun -np <NUM PROCESSES> /PATH/TO/valgrind [valgrind options] ./helloWorldMPI
Useful options:
To output one leak-report file per-process in the xml format, which can be read by Valkyrie:
--xml=yes --xml-file=valgrind.%p
To output one leak-report file per-process in the format which can be read by Alleyoop:
--log-file=valgrind.%p
The following alternative file format specifier appends the MPI rank to the file name when OpenMPI is used. Note OMPI_COMM_WORLD_RANK is an environment variable set by OpenMPI.
--log-file=valgrind.%q{OMPI_COMM_WORLD_RANK}
Threads
If your code uses threads they can be ran with equal scheduling priority via the --fair-sched=yes
argument.
Note, without this argument performance will be poor.
Mem-check
To enable full leak checking:
--leak-check=full
Massif - profile heap usage
Run with threads given equal scheduling priority:
mpirun -np $SLURM_NPROCS <NUM PROCESSES> valgrind --tool=massif --fair-sched=yes --massif-out-file=massif.%q{OMPI_COMM_WORLD_RANK} <executable> <executable args>
This will output massif.[rank] files. Run ms_print to convert these to a human readable format:
ms_print massif.<rank> > massif.<rank>.log