Valgrind: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 5: Line 5:


== Preparing your application ==
== Preparing your application ==
To get useful information from [http://valgrind.org/ Valgrind], you first need to compile your code with debuging information enabled. With the [[GCC/en|GNU]] and [[Intel/en|Intel]] compilers, you do so by adding a "<tt>-g</tt>" option on compilation. For other compilers, check their documentation.
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.


Some aggressive optimisations may yield false errors in Valgrind if they result in unsupported operations. This is the case for example with some operations implemented in the [[MKL/en|MKL]] library. Since you don't want to diagnose errors in those libraries, but rather errors in your own code, you should compile and link your code against non-optimized versions of the libraries (such as the Netlib implementation of BLAS/LAPACK) that will not do those operations. This is of course only to diagnose issues. When time comes to run real simulations, you should link against optimized libraries.
Some aggressive optimizations may yield false errors in Valgrind if they result in unsupported operations, which may occurr in certain mathematical libraries. Since you don't want to diagnose errors in those libraries, but rather errors in your own code, you should compile and link your code against non-optimized versions of the libraries (such as the Netlib implementation of BLAS/LAPACK) that do not use those operations. This is of course only to diagnose issues; when the time comes to run real simulations, you should link against optimized libraries.


== Using Valgrind ==
== Using Valgrind ==
Bureaucrats, cc_docs_admin, cc_staff
2,318

edits