4 merge requests!368Update prace.md to document the change from qprace to qprod as the default...,!367Update prace.md to document the change from qprace to qprod as the default...,!366Update prace.md to document the change from qprace to qprod as the default...,!323extended-acls-storage-section
@@ -15,24 +15,24 @@ The main tools available in Valgrind are:
***Hellgrind** and **DRD** can detect race conditions in multi-threaded applications.
***Cachegrind**, a cache profiler.
***Callgrind**, a callgraph analyzer.
* For a full list and detailed documentation, refer to the [official Valgrind documentation][b].
* For more information, refer to the [official Valgrind documentation][b].
## Installed Versions
There are two versions of Valgrind available on Anselm.
* Version 3.6.0, installed by operating system vendor in /usr/bin/valgrind. This version is available by default, without the need to load any module. This version however does not provide additional MPI support.
* Version 3.9.0 with support for Intel MPI, available in [module][1]valgrind/3.9.0-impi. After loading the module, this version replaces the default valgrind.
* Version 3.9.0 with support for Intel MPI, available in the `valgrind/3.9.0-impi`[module][1]. After loading the module, this version replaces the default Valgrind.
There are two versions of Valgrind available on the Salomon.
* Version 3.8.1, installed by operating system vendor in /usr/bin/valgrind. This version is available by default, without the need to load any module. However, this version does not provide additional MPI support. Also, it does not support AVX2 instructions - debugging of an AVX2-enabled executable with this version will fail
* Version 3.11.0 built by ICC with support for Intel MPI, available in module Valgrind/3.11.0-intel-2015b. After loading the module, this version replaces the default Valgrind.
* Version 3.11.0 built by GCC with support for OpenMPI, module Valgrind/3.11.0-foss-2015b
* Version 3.11.0 built by ICC with support for Intel MPI, available in module `Valgrind/3.11.0-intel-2015b`. After loading the module, this version replaces the default Valgrind.
* Version 3.11.0 built by GCC with support for OpenMPI, module `Valgrind/3.11.0-foss-2015b`
## Usage
Compile the application which you want to debug as usual. It is advisable to add the compilation flags -g (to add debugging information to the binary so that you will see original source code lines in the output) and -O0 (to disable compiler optimizations).
Compile the application which you want to debug as usual. It is advisable to add the compilation flags `-g` (to add debugging information to the binary so that you will see original source code lines in the output) and `-O0` (to disable compiler optimizations).
For example, let us look at this C code, which has two problems:
...
...
@@ -52,7 +52,7 @@ int main(void)
}
```
Now, compile it with Intel compiler :
Now, compile it with the Intel compiler :
```console
$module add intel
...
...
@@ -97,7 +97,7 @@ $ valgrind ./valgrind-example
==12652== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 6 from 6)
```
In the output, we can see that Valgrind has detected both errors - the off-by-one memory access at line 5 and a memory leak of 40 bytes. If we want a detailed analysis of the memory leak, we need to run Valgrind with --leak-check=full option:
In the output, we can see that Valgrind has detected both errors - the off-by-one memory access at line 5 and a memory leak of 40 bytes. If we want a detailed analysis of the memory leak, we need to run Valgrind with the `--leak-check=full` option: