valgrind question
Satish Balay
balay at mcs.anl.gov
Thu Jan 22 10:29:05 CST 2009
On Thu, 22 Jan 2009, Boyce Griffith wrote:
> Hi, Folks --
>
> I am trying to track down a bug in some of my code using Valgrind 3.4.0. I'm
> using OpenMPI 1.3, which directly integrates with Valgrind. Unfortunately, I
> have not completed the process of transitioning my code from PETSc 2.3.3 to
> 3.0.0, so these runs are using PETSc 2.3.3-p15.
>
> Running my code with Valgrind, I get a number of errors like the following:
>
> Invalid read of size 8
> at 0x6104C8F: UnPack_1 (vpscat.c:421)
> by 0x61047A4: VecScatterEnd_1 (vpscat.h:150)
> by 0x6133B2B: VecScatterEnd (vscat.c:1564)
> by 0xC6A258: IBTK::LDataManager::endDataRedistribution(int, int)
> (LDataManager.C:1200)
> by 0xA0AEF2: IBAMR::IBStaggeredHierarchyIntegrator::regridHierarchy()
> (IBStaggeredHierarchyIntegrator.C:1196)
> by 0xA0CF53:
> IBAMR::IBStaggeredHierarchyIntegrator::advanceHierarchy(double)
> (IBStaggeredHierarchyIntegrator.C:653)
> by 0x7308C4: main (main.C:798)
> Address 0xa66bfd0 is 496 bytes inside a block of size 528 alloc'd
> at 0x4A05FBB: malloc (vg_replace_malloc.c:207)
> by 0x63DCFAF: PetscMallocAlign (mal.c:40)
> by 0x63EA8A0: PetscTrMallocDefault (mtr.c:194)
> by 0x611BDB2: VecScatterCreate_PtoS (vpscat.c:1570)
> by 0x6121252: VecScatterCreate_StoP (vpscat.c:1946)
> by 0x6122D2D: VecScatterCreate_PtoP (vpscat.c:2123)
> by 0x6131B08: VecScatterCreate (vscat.c:1380)
> by 0xC6960F: IBTK::LDataManager::endDataRedistribution(int, int)
> (LDataManager.C:1158)
> by 0xA0AEF2: IBAMR::IBStaggeredHierarchyIntegrator::regridHierarchy()
> (IBStaggeredHierarchyIntegrator.C:1196)
> by 0xA0CF53:
> IBAMR::IBStaggeredHierarchyIntegrator::advanceHierarchy(double)
> (IBStaggeredHierarchyIntegrator.C:653)
> by 0x7308C4: main (main.C:798)
>
> Has anyone seen this kind of error crop up before? Does it indicate that I am
> messing up the call to VecScatterCreate? (This VecScatter is being used to
> scatter data between ghosted Vecs, and I wouldn't be shocked if I have made a
> dumb mistake.) Could Valgrind be returning a false positive?
Most likely valgrind is correct here. However its a challenge
determining where exactly the bug is - that is causing this behavior..
Checking ScatterCreate() and ScatterBegin() - and making sure that
same vector [or dupes] are specified to these routines is a start...
It is also possible that there was some other memory corruption much
earlier than this piece of code that valgrind couldn't detect [so
there is some garage already in some arrays]. And this garbage is now
causing bad memory access - thus this error.
Satish
>
> Again, this is with PETSc 2.3.3-p15. I am working on getting things up and
> running with PETSc 3.0.0.
>
> Thanks!
>
> -- Boyce
>
More information about the petsc-users
mailing list