<div dir="ltr">Woops, sorry, I see now.<div>Thanks,</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 29, 2015 at 4:12 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
> On May 29, 2015, at 3:01 PM, Mark Adams <<a href="mailto:mfadams@lbl.gov">mfadams@lbl.gov</a>> wrote:<br>
><br>
><br>
><br>
> On Fri, May 29, 2015 at 2:03 PM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:<br>
><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>
> What vector? the Xsub(2) vector?<br>
><br>
> Yes, arg #3<br>
><br>
><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>
<br>
</span> Mark,<br>
<br>
I just told you above. Since xin is readonly input to the shell apply and xsub points into xin you cannot use xsub as workspace in your computations. You need to get another vector to use for workspace. If it worked in that past it was wrong in the past because it would have corrupted the xin vector.<br>
<span class="HOEnZb"><font color="#888888"><br>
Barry<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
><br>
> > There does not seem to be:<br>
> ><br>
> > call DMCompositeGetAccessArrayRead( ...<br>
><br>
> There doesn't need to be. Internally the DMCompositeGetAccessArray() will make the subvectors read only if the large vector is read only.<br>
><br>
> OK, but I am getting an error. This is it. Line 2218 here is (not clear what is going on here, a macro?):<br>
><br>
> VecLocked(y,3);<br>
><br>
> [8]PETSC ERROR: Vec is locked read only, argument # 3<br>
> [8]PETSC ERROR: See <a href="http://www.mcs.anl.gov/petsc/documentation/faq.html" target="_blank">http://www.mcs.anl.gov/petsc/documentation/faq.html</a> for trouble shooting.<br>
> [8]PETSC ERROR: Petsc Development GIT revision: v3.5.4-3050-g7d7ead0 GIT Date: 2015-05-28 23:28:47 -0500<br>
> [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<br>
> [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<br>
> [8]PETSC ERROR: #1 MatMult() line 2218 in /global/u2/m/madams/petsc/src/mat/interface/matrix.c<br>
><br>
><br>
><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>