[petsc-dev] Errors with DM & PCSHELL

Mark Adams mfadams at lbl.gov
Fri May 29 16:16:17 CDT 2015


Woops, sorry, I see now.
Thanks,

On Fri, May 29, 2015 at 4:12 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:

>
> > On May 29, 2015, at 3:01 PM, Mark Adams <mfadams at lbl.gov> wrote:
> >
> >
> >
> > On Fri, May 29, 2015 at 2:03 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
> >
> > > On May 29, 2015, at 10:32 AM, Mark Adams <mfadams at lbl.gov> wrote:
> > >
> > > I am getting errors in code that I thought was working ...
> > >
> > > I create a PC shell like so:
> > >
> > >   ! set shell PC
> > >   call SNESGetKSP(solver%snes,innerksp,ierr)
> > >   call KSPGetPC(innerksp,spc,ierr)
> > >   call PCSetType(spc,PCSHELL,ierr) ! overriding opions !!!
> > >   call PCShellSetApply(spc,PCShermanMorrisonApply,ierr)
> > >   call PCSetApplicationContext(spc,solver,ierr)
> > >
> > > and in PCShermanMorrisonApply I have:
> > >
> > >   call PCGetApplicationContext(pc,solver,ierr)
> > >   call
> DMCompositeGetAccessArray(solver%da,xin,itwo,PETSC_NULL_INTEGER,Xsub,ierr)
> > >   call
> DMCompositeGetAccessArray(solver%da,yout,itwo,PETSC_NULL_INTEGER,Ysub,ierr)
> > >   call PCFieldSplitGetSubKSP(solver%pc,PETSC_NULL_INTEGER,subksp,ierr)
> > >   call KSPSolve(subksp(1),Xsub(1),Ysub(1),ierr)
> > >   call MatMult(solver%Cmat,Ysub(1),Xsub(2),ierr) ! ignoring <> input
> > >
> > > I get an error on this last statement about a vector being locked.
> >
> >    What vector? the Xsub(2) vector?
> >
> > Yes, arg #3
> >
> >
> >    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.
>
>    Mark,
>
>      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.
>
>    Barry
>
> >
> > >  There does not seem to be:
> > >
> > > call DMCompositeGetAccessArrayRead( ...
> >
> >    There doesn't need to be. Internally the DMCompositeGetAccessArray()
> will make the subvectors read only if the large vector is read only.
> >
> > OK, but I am getting an error.  This is it. Line 2218 here is (not clear
> what is going on here, a macro?):
> >
> >   VecLocked(y,3);
> >
> > [8]PETSC ERROR:  Vec is locked read only, argument # 3
> > [8]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html
> for trouble shooting.
> > [8]PETSC ERROR: Petsc Development GIT revision: v3.5.4-3050-g7d7ead0
> GIT Date: 2015-05-28 23:28:47 -0500
> > [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
> > [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
> > [8]PETSC ERROR: #1 MatMult() line 2218 in
> /global/u2/m/madams/petsc/src/mat/interface/matrix.c
> >
> >
> >
> > >
> > > I thought I fixed this problem ... or at least one like it.
> > >
> > > Mark
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20150529/ad623a6a/attachment.html>


More information about the petsc-dev mailing list