I'm trying to install Valgrind
with full support for MPI
under Linux. According to the Valgrind documentation. I should compile with MPI
already installed, but according to both the MPICH and OpenMPI documentation, I should compile with Valgrind
already installed. This is quite confusing, so which should I install first?

- 47,137
- 25
- 94
- 117

- 2,550
- 1
- 23
- 32
2 Answers
There is no circular dependence here. Rather you are facing two different methods that place the Valgrind client requests in different places.
Open MPI can be built with OMPI-specific Valgrind support. This differs from building Memchecker with MPI support in that it also allows OMPI internals to be checked (that's why it also requires that you enable debugging in OMPI). The Memchecker client requests become part of the library code in a very OMPI-specific way. This does not require changes to the Valgrind code, i.e. it should work with any Valgrind installation (given that the minimum version requirement is satisfied)
On the other side, Open MPI as well as any other MPI implementation, provides the PMPI
profiling interface. This could be used by Memchecker to provide generic MPI support. As described in the documentation, Memchecker builds a library of functions that replace (and wrap) the original MPI calls (this is how the PMPI
mechanism works - all MPI_*
calls are weak symbols and can be overridden by other symbols of the same name, the true MPI calls are actually PMPI_*
and MPI_*
are defined to be weak aliases on ELF systems). This does not require changes to the MPI library code. It should work with any MPI implementation, but only user memory would be correctly debugged, i.e. false positives might be detected inside the MPI library code (although those need not be false positives and could mean that the library itself is buggy).
The same goes for Valgrind support in MPICH.

- 72,659
- 12
- 135
- 186
You say you are going to install valgrind with MPI support. That means you might use mpicc or some other mpi compiler. What valgrind is asking is, to be built with the same compiler. If you intend to debug any of those mpi compilers with valgrind itself, you are required to follow the instructions under the Valgrind Integration section.
There is no information on which distribution you use. On a Debian system, valgrind-mpi might be the package that you are looking for.

- 7,817
- 2
- 25
- 25
-
Sorry if my original post was not clear enough. I intend to debug my own MPI applications with Valgrind, not the actual MPI compilers. The Valgrind documentation says to configure with --with-mpicc=/path/to/mpicc, so here it is assumed you have a version of whatever MPI distro installed. However, in the OpenMPI documentation, for example, it says to configure with --enable-debug --enable-memchecker --with-valgrind=/path/to/valgrind -- which I cannot do before I have installed Valgrind naturally. – user787267 Feb 12 '13 at 02:31
-
My original understanding appears alright. You should be fine if you install mpi compiler followed by building valgrind with `--with-mpicc=/path/to/mpicc`. It is hard to go on like this. If you have any problems in the form of errors or so it will be very helpful. – vpit3833 Feb 12 '13 at 03:31