12.2. Using Valgrind

To run any of the Valgrind tools on a program you want to profile, type the following at a shell prompt:
scl enable devtoolset-4 'valgrind [--tool=tool] program [argument...]'
See Table 12.1, “Tools Distributed with Valgrind for Red Hat Developer Toolset” for a list of tools that are distributed with Valgrind. The argument of the --tool command line option must be specified in lower case, and if this option is omitted, Valgrind uses Memcheck by default. For example, to run Cachegrind on a program to identify the sources of cache misses, type:
scl enable devtoolset-4 'valgrind --tool=cachegrind program [argument...]'
Note that you can execute any command using the scl utility, causing it to be run with the Red Hat Developer Toolset binaries used in preference to the Red Hat Enterprise Linux system equivalent. This allows you to run a shell session with Red Hat Developer Toolset Valgrind as default:
scl enable devtoolset-4 'bash'

Important

Red Hat Developer Toolset 4.0 as well as Red Hat Enterprise Linux 7.0 and 7.1 support only the Open MPI application binary interface (ABI) version 1.6, whereas Red Hat Enterprise Linux 7.2 supports Open MPI 1.10. The two versions are binary incompatible. As a consequence, programs that are built against Open MPI 1.10 cannot be run under Valgrind included in Red Hat Developer Toolset. To work around this problem, use the Red Hat Enterprise Linux 7.2 version of Valgrind for programs linked against Open MPI version 1.10.

Note

To verify the version of Valgrind you are using at any point, type the following at a shell prompt:
which valgrind
Red Hat Developer Toolset's valgrind executable path will begin with /opt. Alternatively, you can use the following command to confirm that the version number matches that for Red Hat Developer Toolset Valgrind:
valgrind --version