|
From: Robert A. <rw...@gm...> - 2008-02-14 21:08:36
|
I am debugging an MPI program using valgrind, and getting unusable results
(tons of false positives and negatives).
Here's an example. The program:
#include <cstdlib>
using namespace std;
int main()
{
int* a = (int*)malloc(1*sizeof(int));
a[10] = 1;
}
runs clean:
==31559== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 12 from 5)
when compiled using MPI, but correctly reports the invalid write bug when
compiled without MPI libraries.
By looking at the output of -v, I notice that malloc never gets redirected
when compiled with MPI, but it does get redirected when compiled without
MPI.
Without MPI:
% valgrind -v ./a.out 2>&1 | grep malloc | grep REDIR
--2240-- REDIR: 0x510C3F0 (malloc) redirected to 0x4A18D8C (malloc)
With MPI:
% valgrind -v ./a.out 2>&1 | grep malloc | grep REDIR
%
malloc appears to resolve to an implementation in an mpich shared library on
my system. Is there a way to get memcheck to redirect from this malloc to
valgrind's malloc? Is this a bug in valgrind that it doesn't do this
automatically?
Thanks,
Bob
|