Re: [petsc-dev] [petsc-users] MATNEST with shell matrices
On Thu, Feb 28, 2013 at 12:58 PM, Amneet Bhalla <[email protected]>wrote:
Hi Jed,
I have registered MatShell that operates on VecNest (which is composed of shell vectors) with KSP. When I am solving sytem of equations using this KSP, I am getting some errors. The sequence of events from gdb are:
#0 0x0000000000000000 in ?? ()
#1 0x00000000009856fd in VecGetArrayRead (x=0x3422a30, a=0x7fff8b8c6620) at /home/amneet/SOFTWARES/LIBRARIESIBAMR/PETSc-3.3-Lite/include/petsc-private/vecimpl.h:350
#2 0x000000000098f57f in VecGetArray_Nest (X=0x34291d0, x=0x7fff8b8c6720) at /home/amneet/SOFTWARES/LIBRARIESIBAMR/PETSc-3.3-Lite/src/vec/vec/impls/nest/vecnest.c:719
#3 0x0000000000a3f3df in VecGetArrayRead (x=0x34291d0, a=0x7fff8b8c6720) at /home/amneet/SOFTWARES/LIBRARIESIBAMR/PETSc-3.3-Lite/include/petsc-private/vecimpl.h:350
This is calling VecValidValues() checks for vec->ops->getarray. Since VecGetArray_Nest() is implemented, it calls the routine. I'm inclined to add a vec->ops->validvalues() and _not_ try to hack it in terms of VecGetArray().
#4 0x0000000000a51c83 in MatMult (mat=0x32c34f0, x=0x336a1c0, y=0x34291d0) at /home/amneet/SOFTWARES/LIBRARIESIBAMR/PETSc-3.3-Lite/src/mat/interface/matrix.c:2092
#5 0x00000000012b2a78 in KSPInitialResidual (ksp=0x334bcb0, vsoln=0x336a1c0, vt1=0x34291d0, vt2=0x343c150, vres=0x344f220, vb=0x337d810) at /home/amneet/SOFTWARES/LIBRARIESIBAMR/PETSc-3.3-Lite/src/ksp/ksp/interface/itres.c:54
#6 0x0000000000da2eaa in KSPSolve_GMRES (ksp=0x334bcb0) at /home/amneet/SOFTWARES/LIBRARIESIBAMR/PETSc-3.3-Lite/src/ksp/ksp/impls/gmres/gmres.c:230
#7 0x0000000000d1ad6b in KSPSolve (ksp=0x334bcb0, b=0x337d810, x=0x336a1c0) at /home/amneet/SOFTWARES/LIBRARIESIBAMR/PETSc-3.3-Lite/src/ksp/ksp/interface/itfunc.c:446
#8 0x00000000006b8a08 in IBTK::PETScBlockKrylovLinearSolver::solveSystem ( this=0x3249380, x=0x32f3e20, b=0x330c6d0) at PETScBlockKrylovLinearSolver.C:384
#9 0x00000000005777e3 in main (argc=6, argv=0x7fff8b8ca988) at main.C:274
In frame 4, the user defined matrix-vector multiplication is successful ( I printed out a statement). This would imply in the routine MatVecMult(Mat A, Vec x, Vec y), Vec y would be a duplicated vector. This in turn would mean that user-defined routine to duplicate vectors MatGetVecs(Mat A, Vec *left, Vec* right) should have been called. But this is not happening. It is in this routine, that I am setting
*left->ops->getarray = PETSC_NULL;
Any thoughts on what might be going on?
Thanks, Amneet
participants (1)
-
Jed Brown