[petsc-dev] Uninitialized memory used in MatLUFactorNumeric_SeqAIJ_Inode?

Barry Smith bsmith at mcs.anl.gov
Thu Jun 3 16:50:26 CDT 2010


   Could you please run the offending code with -ksp_view_binary and send us the resulting file calling binaryoutput so we can reproduce the problem. Or if the code is simple enough to build and run just send us the code.

    TO petsc-maint at mcs.anl.gov NOT this email.

   thanks



    Barry

On Jun 3, 2010, at 4:39 PM, Chetan Jhurani wrote:

> 
> Hello, 
> 
> I noticed a big difference between debug and optimized versions 
> of petsc3.1-p2 while using KSPSolve with PCILU and GMRES. 
> 
> This is on Windows/VS2005 if it matters. 
> 
> Well, luckily, the big difference was convergence in optimized 
> version vs. no convergence in debug version for some problems 
> so it could not be dismissed as just a floating point issue.
> 
> It seems the problem happens in MatLUFactorNumeric_SeqAIJ_Inode 
> in src/mat/impls/aij/seq/inode.c because it reads from b->a which 
> is pointing to the non-zeroed array elements of the output 
> factor B.  This specific b->a points to memory allocated in 
> MatILUFactorSymbolic_SeqAIJ, src/mat/impls/aij/seq/aijfact.c 
> by PetscMalloc((bdiag[0]+1)*sizeof(PetscScalar),&b->a); 
> 
> Using a PetscMemzero(b->a,(bdiag[0]+1)*sizeof(PetscScalar)) 
> after the allocation makes the debug vs. optimized problem 
> go away completely. 
> 
> Can someone confirm this?  Is there a better fix? 
> 
> Thanks, 
> 
> Chetan
> 




More information about the petsc-dev mailing list