[petsc-users] VecGetArrayF90 in PETSc/3.10 (Fortran)
Chang Liu
chang.liu at utexas.edu
Sun Jan 6 18:11:26 CST 2019
Hi Smith,
I tried and it works. Thank you so much! It is weird that this bug hides so
well since petsc/3.4,3.5 (5-6 years ago) in our code; now from petsc/3.9,
it shows up.....
Thank you guys for all your help~
Best,
Chang
On Sun, Jan 6, 2019 at 5:24 PM Smith, Barry F. <bsmith at mcs.anl.gov> wrote:
>
>
> > On Jan 6, 2019, at 5:21 PM, Victor Eijkhout <eijkhout at tacc.utexas.edu>
> wrote:
> >
> > Hey Barry,
> >
> > Chang is one of my users and I’m out of my depth here:
> >
> > > [0]PETSC ERROR: --------------------- Error Message
> > > --------------------------------------------------------------
> > > [0]PETSC ERROR: Corrupt argument:
> >
> > > [0]PETSC ERROR: Invalid Pointer to Object: Parameter # 1
> >
> > > [0]PETSC ERROR: #1 VecGetArray() line 1578 in
> >
> > It looks like VecGetArrayF90 is no longer allowed in callbacks, which is
> what seems to be happening here.
> >
> > Victor.
> >
> >
> >> On Jan 6, 2019, at 5:05 PM, Smith, Barry F. via petsc-users <
> petsc-users at mcs.anl.gov> wrote:
> >>
> >>
> >> What is the error message, cut and paste the entire message?
> >>
> >> Barry
> >>
> >>
> >>> On Jan 6, 2019, at 3:12 PM, Chang Liu via petsc-users <
> petsc-users at mcs.anl.gov> wrote:
> >>>
> >>> Hi All,
> >>> Recently, when I am upgrading our code from 3.8 to 3.10, it always
> runs into error during VecGetArrayF90 call (it is Fortran90-based code).
> The reason we use is to access the array for our user-defined matrix-vector
> multiplication subroutine, for example:
> >>>
> >>> subroutine mymult(A,x,y,loco_ierr)
> >>> !!!!!!!!!!!!!!! matrix-vector multiplication y=A.x
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
> >>> use mat_vec_mult,only:matvec
> >>> implicit none
> >>> Mat,intent(in)::A ! required by PETSc
> >>> Vec,intent(in)::x
> >>> Vec,intent(out)::y
>
> This is wrong. y is not returned from your subroutine, it is passed
> into the subroutine and hence is intent(in).
>
> Hopefully this resolves your problem, otherwise let us know.
>
> Barry
>
> >>> PetscErrorCode,intent(out)::loco_ierr
> >>> PetscScalar,pointer::xx(:),yy(:)
> >>>
> >>> call VecGetArrayReadF90(x,xx,loco_ierr)
> >>> call VecGetArrayF90(y,yy,loco_ierr)
> >>> call matvec(xx,yy)
> >>> call VecRestoreArrayReadF90(x,xx,loco_ierr)
> >>> call VecRestoreArrayF90(y,yy,loco_ierr)
> >>> return
> >>> end subroutine mymult
> >>>
> >>> I checked the change log on the website and saw a statement:
> >>> TAO:
> >>>
> >>> • Added VecLock{Push|Pop} calls around user callbacks; use of
> VecGetArray in user callbacks is now prohibited.
> >>> Is there any relation to my issue? All the online PETSc examples and
> description for VecGetArray/VecGetArrayF90 are the same as PETSc/3.8. I
> tried to add/use VecLockPop/Push, but still doesn't work.
> >>>
> >>> I am confused and not sure what is the problem?
> >>> Could I get some help?
> >>> Thanks,
> >>> --
> >>> Chang Liu
> >>> PhD candidate
> >>> Dept. of Electrical & Computer Engineering
> >>> Ph: 765-7143357
> >>> Email: chang.liu at utexas.edu
> >>
> >
>
>
--
Chang Liu
PhD candidate
Dept. of Electrical & Computer Engineering
Ph: 765-7143357
Email: chang.liu at utexas.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190106/e6cfca6b/attachment.html>
More information about the petsc-users
mailing list