[petsc-users] MATNEST with shell matrices

Amneet Bhalla mail2amneet at gmail.com
Fri Mar 1 17:05:00 CST 2013


Jed this is output from gdb:

#0  0x0000000000000000 in ?? ()
#1  0x00000000009857fd in VecGetArrayRead (x=0x33ba0b0, a=0x7fff1f0cf100)
at
/home/amneet/SOFTWARES/LIBRARIESIBAMR/PETSc-3.3-Lite/include/petsc-private/vecimpl.h:350
#2  0x000000000098f67f in VecGetArray_Nest (X=0x33c0850, x=0x7fff1f0cf200)
at
/home/amneet/SOFTWARES/LIBRARIESIBAMR/PETSc-3.3-Lite/src/vec/vec/impls/nest/vecnest.c:719
#3  0x0000000000a3f4df in VecGetArrayRead (x=0x33c0850, a=0x7fff1f0cf200)
at
/home/amneet/SOFTWARES/LIBRARIESIBAMR/PETSc-3.3-Lite/include/petsc-private/vecimpl.h:350
#4  0x0000000000a51d83 in MatMult (mat=0x326e480, x=0x33150c0, y=0x33c0850)
at
/home/amneet/SOFTWARES/LIBRARIESIBAMR/PETSc-3.3-Lite/src/mat/interface/matrix.c:2092
#5  0x00000000012b2b78 in KSPInitialResidual (ksp=0x32f6bb0,
vsoln=0x33150c0, vt1=0x33c0850, vt2=0x33d3c60, vres=0x33e6d30,
vb=0x3328710) at
/home/amneet/SOFTWARES/LIBRARIESIBAMR/PETSc-3.3-Lite/src/ksp/ksp/interface/itres.c:54
#6  0x0000000000da2faa in KSPSolve_GMRES (ksp=0x32f6bb0) at
/home/amneet/SOFTWARES/LIBRARIESIBAMR/PETSc-3.3-Lite/src/ksp/ksp/impls/gmres/gmres.c:230
#7  0x0000000000d1ae6b in KSPSolve (ksp=0x32f6bb0, b=0x3328710,
x=0x33150c0) at
/home/amneet/SOFTWARES/LIBRARIESIBAMR/PETSc-3.3-Lite/src/ksp/ksp/interface/itfunc.c:446
#8  0x00000000006b8b0a in IBTK::PETScBlockKrylovLinearSolver::solveSystem
(this=0x31f4310, x=0x329ed20, b=0x32b75d0) at
PETScBlockKrylovLinearSolver.C:381
#9  0x00000000005777e3 in main (argc=5, argv=0x7fff1f0d3468) at main.C:274

In frame 5, there is call to function
 PetscErrorCode  KSPInitialResidual(KSP ksp,Vec vsoln,Vec vt1,Vec vt2,Vec
vres,Vec vb)

which calls the matrix-vector function in frame 4, i.e,
ierr = KSP_MatMult(ksp,Amat,vsoln,vt1);CHKERRQ(ierr);

Now the error comes in frame 4, where there is call to
VecValidValues(y,3,PETSC_FALSE); y being vt1, a temporary left Vec to hold
value
of user-defined matrix vector product.

I have passed a user-defined function to tell MatShell how to create
left/right Vec(s);
where I also set left/right->ops->getarray = PETSC_NULL. If vt1 was created
using
this routine, there would not have been any error related to
 VecGetArrayRead routine
and should have printed some tracer printf statements. So my guess is that
this temporary
vector is created by directly calling VecDuplicate routine which sets
 vec->ops->getarray = VecGetArray_Nest by default.


On Fri, Mar 1, 2013 at 1:07 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:

> Where should this routine be added and how should it look like for shell
>> vectors? I had assumed that
>> such changes should be done in user defined MatGetVecs routine. Clearly
>> this is not happening.
>>
>
> Please explain.
>




-- 
Amneet
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130301/8ab61965/attachment-0001.html>


More information about the petsc-users mailing list