openmpi with valgrind (can I compile with MPI in U

2019-06-09 01:01发布

问题:

I have a naive question: I compiled a version of Openmpi 1.4.4. with Valgrind :

./configure --prefix=/opt/openmpi-1.4.4/ --enable-debug --enable-memchecker --with-valgrind=/usr....

I want to do memory check.

Usually for debuggin (and running) I compile it with OpenMPI in Ubuntu distributive with

CC =            mpic++
CCFLAGS =   -g

The question is, can I compile my code just with Ubuntu distro MPI 1.4.3 and then run with this modified (valgrind) mpirun version:

mpirun -np 8 valgrind ....

?

回答1:

You can always do the mpirun -np 8 valgrind ... bit with any MPI implementation and any valgrind. But you won't (of course) get the full benefit of the memchecker built into the OpenMPI installation that you built with memcheck enabled and pointing to your valgrind.

Note too that if you do this you'll probably get a lot of false positives from valgrind in the MPI routines; you can improve that by building the valgrind MPI wrappers for your stock Ubuntu OpenMPI, as described in the Valgrind manual.

But as to compiling code with one MPI distribution and running it with another, that can only lead to problems, regardless of the whole with/without valgrind thing. In practice, OpenMPI 1.4.3 and 1.4.4 are similar enough that it will probably work but I wouldn't recommend it, as it just introduces uncertainty -- and the reason why you're running valgrind anyway is to track down problems, right? There's no sense in introducing a new place where problems could occur.