|
From: Tom H. <th...@cy...> - 2004-01-15 14:47:09
|
In message <400...@ma...>
Matthew Bettencourt <ma...@ma...> wrote:
> I have a problem I am trying to debug via valgrind and I am seeing
> something really odd. I am getting a read from uninit error.
>
> ==11800== Use of uninitialised value of size 4
> ==11800== at 0x80A6931: AddTemperature (c_part.c:2518)
>
> Looking at that line
> u->x += v_thermal*nu1*sqrt(-log(R2)/R2);
>
> I thought I would figure out which var is causing the problem, so I did this
> fubar = v_thermal;
> fubar *= nu1;
> fubar *=R2;
> fubar = u->x;
> fubar = v_thermal*nu1*sqrt(-log(R2)/R2);
Well those two code sequences aren't doing the same thing to start
with as you aren't adding u->x to the result of the multiplications
in the second one.
An easier way to find out what is uninitialised would be to add in
some client requests before calculation, like this:
VALGRIND_CHECK_DEFINED( u->x );
VALGRIND_CHECK_DEFINED( v_thermal );
VALGRIND_CHECK_DEFINED( nu1 );
VALGRIND_CHECK_DEFINED( R2 );
Then you should be able to tell from the report which of those lines
found uninitialised data.
> None of these report uninited vars. so I am guessing there is
> something odd happening with valgrind. I have compiled the code as
> follows
>
> mpicc -I/usr/local/mpich/include -I../mp -DLINUX -DMPICH -DBITFLAGS
> -g -Wimplicit -Wall -pedantic -Wno-long-long -c -o VT.o VT.c
>
> So, the compiler shouldn't be cutting out the useless code. I have
> tried this with both the 2.0.0 and 2.1.0 versions and get the same
> result. Any ideas would be helpful..
What's mpicc? Is it some special compiler that will be using SSE ops
and such like to do the calculation?
Tom
--
Tom Hughes (th...@cy...)
Software Engineer, Cyberscience Corporation
http://www.cyberscience.com/
|