<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 29, 2015 at 2:03 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class=""><br>
> On May 29, 2015, at 10:32 AM, Mark Adams <<a href="mailto:mfadams@lbl.gov">mfadams@lbl.gov</a>> wrote:<br>
><br>
> I am getting errors in code that I thought was working ...<br>
><br>
> I create a PC shell like so:<br>
><br>
>   ! set shell PC<br>
>   call SNESGetKSP(solver%snes,innerksp,ierr)<br>
>   call KSPGetPC(innerksp,spc,ierr)<br>
>   call PCSetType(spc,PCSHELL,ierr) ! overriding opions !!!<br>
>   call PCShellSetApply(spc,PCShermanMorrisonApply,ierr)<br>
>   call PCSetApplicationContext(spc,solver,ierr)<br>
><br>
> and in PCShermanMorrisonApply I have:<br>
><br>
>   call PCGetApplicationContext(pc,solver,ierr)<br>
>   call DMCompositeGetAccessArray(solver%da,xin,itwo,PETSC_NULL_INTEGER,Xsub,ierr)<br>
>   call DMCompositeGetAccessArray(solver%da,yout,itwo,PETSC_NULL_INTEGER,Ysub,ierr)<br>
>   call PCFieldSplitGetSubKSP(solver%pc,PETSC_NULL_INTEGER,subksp,ierr)<br>
>   call KSPSolve(subksp(1),Xsub(1),Ysub(1),ierr)<br>
>   call MatMult(solver%Cmat,Ysub(1),Xsub(2),ierr) ! ignoring <> input<br>
><br>
> I get an error on this last statement about a vector being locked.<br>
<br>
</span>   What vector? the Xsub(2) vector?<br></blockquote><div><br></div><div>Yes, arg #3</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
   Based on the names of the variable I am guessing that xin is the input vector to your Apply() hence it is read only. Thus Xsub is read only, but you are trying to put the results of a MatMult() int Xsub(2) which is completely wrong. You cannot use Xsub for work space because it will corrupt the outer solver.<br>
<span class=""><br>
>  There does not seem to be:<br>
><br>
> call DMCompositeGetAccessArrayRead( ...<br>
<br>
</span>   There doesn't need to be. Internally the DMCompositeGetAccessArray() will make the subvectors read only if the large vector is read only.<br></blockquote><div><br></div><div>OK, but I am getting an error.  This is it. Line 2218 here is (not clear what is going on here, a macro?):</div><div><br></div><div><div>  VecLocked(y,3);</div></div><div><br></div><div><div>[8]PETSC ERROR:  Vec is locked read only, argument # 3</div><div>[8]PETSC ERROR: See <a href="http://www.mcs.anl.gov/petsc/documentation/faq.html">http://www.mcs.anl.gov/petsc/documentation/faq.html</a> for trouble shooting.</div><div>[8]PETSC ERROR: Petsc Development GIT revision: v3.5.4-3050-g7d7ead0  GIT Date: 2015-05-28 23:28:47 -0500</div><div>[8]PETSC ERROR: /global/homes/m/madams/epsi/XGC1_3/xgc-es on a arch-xc30-dbg-intel named nid05966 by madams Fri May 29 12:56:27 2015</div><div>[8]PETSC ERROR: Configure options --COPTFLAGS="-no-ipo -g -O0" --CXXOPTFLAGS="-no-ipo -g -O0" --FOPTFLAGS="-no-ipo -g -O0" --download-parmetis --download-metis --with-cc=cc --with-clib-autodetect=0 --with-cxx=CC --with-cxxlib-autodetect=0 --with-debugging=1 --with-fc=ftn --with-fortranlib-autodetect=0 --with-hdf5-dir=/opt/cray/hdf5-parallel/1.8.13/intel/140/ --with-shared-libraries=0 --with-x=0 --with-mpiexec=aprun LIBS=-lstdc++ PETSC_ARCH=arch-xc30-dbg-intel</div><div>[8]PETSC ERROR: #1 MatMult() line 2218 in /global/u2/m/madams/petsc/src/mat/interface/matrix.c</div></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class=""><div class="h5"><br>
><br>
> I thought I fixed this problem ... or at least one like it.<br>
><br>
> Mark<br>
<br>
</div></div></blockquote></div><br></div></div>