Valgrind is a flexible system for debugging and profiling Linux executables for x86_64 (and some other) architectures. The functionality of Valgrind covers :
Check for available version :
$ module avail perf/valgrind
Load the software, from login nodes (mesologin1, mesologin2) :
$ module load perf/valgrind
Which will provide suitable environment settings for using Valgrind.
For most cases, Valgrind will run your program considerably slower than usual, and also may use more resources, so it is recommended to cut down on problem sizes for profiling.
A number of example programs are available valgrind_examples.tar, which illustrate the various usage possibilities. The archive contains the following files
Source of examples and copyrights : https://www.lrz.de/services/software/programmierung/valgrind/
$ valgrind --tool=memcheck --leak-check=yes --show-reachable=yes ./leak1.exe
$ valgrind --tool=massif --depth=5 ./heap1.exe
$ valgrind --tool=cachegrind ./cache1.exe
$ valgrind --tool=callgrind ./heap1.exe $ callgrind_annotate --tree=both --auto=yes callgrind.out*
One can visualize the call graphs with Kcachedgrind