Vijay I am running things on single processor. <div><br></div><div>Is my understanding of creation of temporary Vec vt1 right in previous email? Also shouldn't all <div>temporary Vecs be generated via user-defined function for MatShell, where </div>
<div>one can get chance to adjust shell Vecs.</div><div><div><br><div class="gmail_quote">On Fri, Mar 1, 2013 at 6:31 PM, Vijay S. Mahadevan <span dir="ltr"><<a href="mailto:vijay.m@gmail.com" target="_blank">vijay.m@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Amneet, are you witnessing these errors in parallel alone, by any chance ?<br>
<br>
The reason I ask is because one of the tests using VecNest (with<br>
Get/Set SubVec = vec/examples/tests/ex41.c) fails in parallel and I<br>
have a patch to fix this (attached). The primary issue is that calls<br>
to SetSubVec create a mismatch in numbering of the IS maintained by<br>
the VecNest structure which gets propagated by VecDuplicate. This only<br>
happens in parallel though because the local numbering of the IS is<br>
what gets modified wrongly. It might be a separate unrelated issue to<br>
yours but cannot confirm for sure.<br>
<br>
Jed can you please review this patch. If it works, feel free to push<br>
after testing on ex41.c. I also have a variation of ex41 that is a<br>
little more rigorous but I can send that to you in a separate patch.<br>
<span class="HOEnZb"><font color="#888888"><br>
Vijay<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Fri, Mar 1, 2013 at 5:05 PM, Amneet Bhalla <<a href="mailto:mail2amneet@gmail.com">mail2amneet@gmail.com</a>> wrote:<br>
> Jed this is output from gdb:<br>
><br>
> #0 0x0000000000000000 in ?? ()<br>
> #1 0x00000000009857fd in VecGetArrayRead (x=0x33ba0b0, a=0x7fff1f0cf100) at<br>
> /home/amneet/SOFTWARES/LIBRARIESIBAMR/PETSc-3.3-Lite/include/petsc-private/vecimpl.h:350<br>
> #2 0x000000000098f67f in VecGetArray_Nest (X=0x33c0850, x=0x7fff1f0cf200)<br>
> at<br>
> /home/amneet/SOFTWARES/LIBRARIESIBAMR/PETSc-3.3-Lite/src/vec/vec/impls/nest/vecnest.c:719<br>
> #3 0x0000000000a3f4df in VecGetArrayRead (x=0x33c0850, a=0x7fff1f0cf200) at<br>
> /home/amneet/SOFTWARES/LIBRARIESIBAMR/PETSc-3.3-Lite/include/petsc-private/vecimpl.h:350<br>
> #4 0x0000000000a51d83 in MatMult (mat=0x326e480, x=0x33150c0, y=0x33c0850)<br>
> at<br>
> /home/amneet/SOFTWARES/LIBRARIESIBAMR/PETSc-3.3-Lite/src/mat/interface/matrix.c:2092<br>
> #5 0x00000000012b2b78 in KSPInitialResidual (ksp=0x32f6bb0,<br>
> vsoln=0x33150c0, vt1=0x33c0850, vt2=0x33d3c60, vres=0x33e6d30, vb=0x3328710)<br>
> at<br>
> /home/amneet/SOFTWARES/LIBRARIESIBAMR/PETSc-3.3-Lite/src/ksp/ksp/interface/itres.c:54<br>
> #6 0x0000000000da2faa in KSPSolve_GMRES (ksp=0x32f6bb0) at<br>
> /home/amneet/SOFTWARES/LIBRARIESIBAMR/PETSc-3.3-Lite/src/ksp/ksp/impls/gmres/gmres.c:230<br>
> #7 0x0000000000d1ae6b in KSPSolve (ksp=0x32f6bb0, b=0x3328710, x=0x33150c0)<br>
> at<br>
> /home/amneet/SOFTWARES/LIBRARIESIBAMR/PETSc-3.3-Lite/src/ksp/ksp/interface/itfunc.c:446<br>
> #8 0x00000000006b8b0a in IBTK::PETScBlockKrylovLinearSolver::solveSystem<br>
> (this=0x31f4310, x=0x329ed20, b=0x32b75d0) at<br>
> PETScBlockKrylovLinearSolver.C:381<br>
> #9 0x00000000005777e3 in main (argc=5, argv=0x7fff1f0d3468) at main.C:274<br>
><br>
> In frame 5, there is call to function<br>
> PetscErrorCode KSPInitialResidual(KSP ksp,Vec vsoln,Vec vt1,Vec vt2,Vec<br>
> vres,Vec vb)<br>
><br>
> which calls the matrix-vector function in frame 4, i.e,<br>
> ierr = KSP_MatMult(ksp,Amat,vsoln,vt1);CHKERRQ(ierr);<br>
><br>
> Now the error comes in frame 4, where there is call to<br>
> VecValidValues(y,3,PETSC_FALSE); y being vt1, a temporary left Vec to hold<br>
> value<br>
> of user-defined matrix vector product.<br>
><br>
> I have passed a user-defined function to tell MatShell how to create<br>
> left/right Vec(s);<br>
> where I also set left/right->ops->getarray = PETSC_NULL. If vt1 was created<br>
> using<br>
> this routine, there would not have been any error related to<br>
> VecGetArrayRead routine<br>
> and should have printed some tracer printf statements. So my guess is that<br>
> this temporary<br>
> vector is created by directly calling VecDuplicate routine which sets<br>
> vec->ops->getarray = VecGetArray_Nest by default.<br>
><br>
><br>
> On Fri, Mar 1, 2013 at 1:07 PM, Jed Brown <<a href="mailto:jedbrown@mcs.anl.gov">jedbrown@mcs.anl.gov</a>> wrote:<br>
>>><br>
>>> Where should this routine be added and how should it look like for shell<br>
>>> vectors? I had assumed that<br>
>>> such changes should be done in user defined MatGetVecs routine. Clearly<br>
>>> this is not happening.<br>
>><br>
>><br>
>> Please explain.<br>
><br>
><br>
><br>
><br>
><br>
> --<br>
> Amneet<br>
><br>
><br>
><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div>Amneet <br><br></div><div><br></div><div><br></div>
</div></div></div>