- Infos im HLRS Wiki sind nicht rechtsverbindlich und ohne Gewähr -
- Information contained in the HLRS Wiki is not legally binding and HLRS is not responsible for any damages that might result from its use -
Valgrind: Difference between revisions
No edit summary |
|||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Infobox software | {{Infobox software | ||
| logo = [[Image:valgrind-logo.png]] | | logo = [[Image:valgrind-logo.png|75px]] | ||
| description = '''Valgrind''' is an award-winning instrumentation framework for building dynamic analysis tools. There are Valgrind tools that can automatically detect many memory management and threading bugs, and profile your programs in detail. You can also use Valgrind to build new tools. | | description = '''Valgrind''' is an award-winning instrumentation framework for building dynamic analysis tools. There are Valgrind tools that can automatically detect many memory management and threading bugs, and profile your programs in detail. You can also use Valgrind to build new tools. | ||
| developer = Valgrind Developers | | developer = Valgrind Developers | ||
Line 12: | Line 12: | ||
==Usage== | ==Usage== | ||
In order to | In order to use Valgrind, you need to first load it: | ||
{{Command|command= | {{Command|command= | ||
Line 48: | Line 48: | ||
}} | }} | ||
{{note|text= For Open MPI there exists a suppression file which can be used with the following command <pre>mpirun -np 4 valgrind --suppressions=$(dirname $(which mpirun))/../share/openmpi/openmpi-valgrind.supp ./app</pre>}} | |||
Line 75: | Line 76: | ||
[[Image:kcachegrind.jpg|center|Example of using Kcachegrind with Callgrind.]] | [[Image:kcachegrind.jpg|center|Example of using Kcachegrind with Callgrind.]] | ||
== Hawk special == | |||
To work with valgrind on Hawk with mpt MPI you should set the following environment variables to disable xpmem and switch to TCP for communication | |||
{{Command|command= | |||
export MPI_XPMEM_ENABLED=false<br> | |||
export MPI_USE_TCP=true | |||
}} | |||
In case valgrind cannot find a local debuginfo file it will try downloading it via HTTP. Since Hawk is not directly connected to the internet this download attempt can stall valgrind. | |||
This can be avoided by unsetting the DEBUGINFOD_URLS environment variable | |||
{{Command|command= | |||
export DEBUGINFOD_URLS= | |||
}} | |||
== See also == | == See also == |
Latest revision as of 12:50, 29 August 2023
Valgrind is an award-winning instrumentation framework for building dynamic analysis tools. There are Valgrind tools that can automatically detect many memory management and threading bugs, and profile your programs in detail. You can also use Valgrind to build new tools. |
|
Usage
In order to use Valgrind, you need to first load it:
To check your application with Valgrind, please use following command format (take ls command as an example):
Please note, the default checking tool is Memcheck. If you want to use other tools in Valgrind, you have to specify it via --tool=<name> option.
Valgrind can also be used to check parallel application. For example, in order to check an MPI application, please follow the steps:
- First reserve compute nodes:
- Load all necessary tools:
- Run your MPI application with Valgrind:
mpirun -np 4 valgrind --suppressions=$(dirname $(which mpirun))/../share/openmpi/openmpi-valgrind.supp ./app
If you want to run Callgrind and later visualize the output in Kcachegrind, you have to do following steps:
- Run your application with Callgrind:
The above command will generate an output file with name callgrind.out.xxxx, where xxxx is the pid of the checked application.
- Load Kcachegrind
- Open Kcachegrind with the generated Callgrind output file. Or open Kcachegrind and load the callgrind file in the GUI.
You will see the Kcachegrind window similar to this:
Hawk special
To work with valgrind on Hawk with mpt MPI you should set the following environment variables to disable xpmem and switch to TCP for communication
export MPI_USE_TCP=true
In case valgrind cannot find a local debuginfo file it will try downloading it via HTTP. Since Hawk is not directly connected to the internet this download attempt can stall valgrind.
This can be avoided by unsetting the DEBUGINFOD_URLS environment variable