[petsc-dev] Uninitialized memory used in MatLUFactorNumeric_SeqAIJ_Inode?
Chetan Jhurani
chetan.jhurani at gmail.com
Thu Jun 3 16:39:10 CDT 2010
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