I have a code which works perfect in serial but with mpirun -n 2 ./out
it gives the following error:
./out\': malloc(): smallbin double linked l
Note that with the invocation above,
valgrind --leak-check=yes mpirun -n 2 ./out
you are running valgrind on the program mpirun
, which presumably has been extensively tested and works correctly, and not the program ./out
, which you know to have a problem.
To run valgrind on your test program you will want to do:
mpirun -n 2 valgrind --leak-check=yes ./out
Which uses mpirun to launch 2 processes, each running valgrind --leak-check=yes ./out
.
You can never go wrong with a Jonathan Dursi answer but let me just add that with more than one processor it can be a pain to read valgrind output.
Instead of outputting to the console, dump it to a log file. Of course you can't dump both processes to the same log file. valgrind interprets '%p' as the process id so you get two (or more) log files:
mpiexec -np 2 valgrind --leak-check=full \
--show-reachable=yes --log-file=nc.vg.%p ./noncontig_coll2 -fname blah