Valgrind: Difference between revisions

Jump to navigation Jump to search
no edit summary
m (Added to Software category)
No edit summary
Line 7: Line 7:
[http://valgrind.org/ Valgrind] is a powerful debugging tool to detect bad memory usage. It can detect memory leaks, but also access to unallocated or deallocated memory, multiple deallocation or other bad memory usage. If your program ends with a ''segmentation fault'', ''broken pipe'' or ''bus error'', you most likely have such a problem in your code. Valgrind is installed on Compute Canada clusters as part of the base software distribution, so there is no need to load a module to use it.
[http://valgrind.org/ Valgrind] is a powerful debugging tool to detect bad memory usage. It can detect memory leaks, but also access to unallocated or deallocated memory, multiple deallocation or other bad memory usage. If your program ends with a ''segmentation fault'', ''broken pipe'' or ''bus error'', you most likely have such a problem in your code. Valgrind is installed on Compute Canada clusters as part of the base software distribution, so there is no need to load a module to use it.


== AVX512 Limitations ==
Note that current versions of Valgrind are unable to handle the AVX512 instructions used on the latest Intel processors, producing an error message like the following,
<source>
vex amd64->IR: unhandled instruction bytes: 0x62 0xF1 0xFE 0x8 0x6F 0x8B 0xE8 0xFF 0xFF 0xFF
vex amd64->IR:  REX=0 REX.W=0 REX.R=0 REX.X=0 REX.B=0
vex amd64->IR:  VEX=0 VEX.L=0 VEX.nVVVV=0x0 ESC=NONE
vex amd64->IR:  PFX.66=0 PFX.F2=0 PFX.F3=0
==35839== valgrind: Unrecognised instruction at address 0x4e68448.
==35839==    at 0x4E68448: if_posix_open (in /cvmfs/soft.computecanada.ca/easybuild/software/2020/avx512/Compiler/gcc9/openmpi/4.0.3/lib/libopen-pal.so.40.20.3)
==35839==    by 0x4E2C44A: mca_base_framework_components_open (in /cvmfs/soft.computecanada.ca/easybuild/software/2020/avx512/Compiler/gcc9/openmpi/4.0.3/lib/libopen-pal.so.40.20.3)
...
</source>
You can circumvent this problem by first loading the AVX2 environment,
{{Command|module load arch/avx2}}
and then recompiling your application from scratch to ensure the binary doesn't contain any such instructions.
 
== Preparing your application == <!--T:3-->
== Preparing your application == <!--T:3-->
To get useful information from [http://valgrind.org/ Valgrind], you first need to compile your code with debugging information enabled. With the most compilers, you do so by adding a "<tt>-g</tt>" option during compilation.   
To get useful information from [http://valgrind.org/ Valgrind], you first need to compile your code with debugging information enabled. With the most compilers, you do so by adding a "<tt>-g</tt>" option during compilation.   
Bureaucrats, cc_docs_admin, cc_staff
2,314

edits

Navigation menu