<div dir="ltr"><div dir="ltr">Hi Smith,<div><br></div><div>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..... </div><div><br></div><div>Thank you guys for all your help~</div><div>Best,</div><div>Chang</div></div></div><br><div class="gmail_quote"><div dir="ltr">On Sun, Jan 6, 2019 at 5:24 PM Smith, Barry F. <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
> On Jan 6, 2019, at 5:21 PM, Victor Eijkhout <<a href="mailto:eijkhout@tacc.utexas.edu" target="_blank">eijkhout@tacc.utexas.edu</a>> wrote:<br>
> <br>
> Hey Barry,<br>
> <br>
> Chang is one of my users and I’m out of my depth here:<br>
> <br>
> > [0]PETSC ERROR: --------------------- Error Message<br>
> > --------------------------------------------------------------<br>
> > [0]PETSC ERROR: Corrupt argument:<br>
> <br>
> > [0]PETSC ERROR: Invalid Pointer to Object: Parameter # 1<br>
> <br>
> > [0]PETSC ERROR: #1 VecGetArray() line 1578 in<br>
> <br>
> It looks like VecGetArrayF90 is no longer allowed in callbacks, which is what seems to be happening here.<br>
> <br>
> Victor.<br>
> <br>
> <br>
>> On Jan 6, 2019, at 5:05 PM, Smith, Barry F. via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>> wrote:<br>
>> <br>
>> <br>
>> What is the error message, cut and paste the entire message?<br>
>> <br>
>> Barry<br>
>> <br>
>> <br>
>>> On Jan 6, 2019, at 3:12 PM, Chang Liu via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>> wrote:<br>
>>> <br>
>>> Hi All,<br>
>>> 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:<br>
>>> <br>
>>> subroutine mymult(A,x,y,loco_ierr) <br>
>>> !!!!!!!!!!!!!!! matrix-vector multiplication y=A.x !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br>
>>> use mat_vec_mult,only:matvec<br>
>>> implicit none<br>
>>> Mat,intent(in)::A ! required by PETSc<br>
>>> Vec,intent(in)::x<br>
>>> Vec,intent(out)::y<br>
<br>
This is wrong. y is not returned from your subroutine, it is passed into the subroutine and hence is intent(in). <br>
<br>
Hopefully this resolves your problem, otherwise let us know.<br>
<br>
Barry<br>
<br>
>>> PetscErrorCode,intent(out)::loco_ierr<br>
>>> PetscScalar,pointer::xx(:),yy(:)<br>
>>> <br>
>>> call VecGetArrayReadF90(x,xx,loco_ierr)<br>
>>> call VecGetArrayF90(y,yy,loco_ierr)<br>
>>> call matvec(xx,yy)<br>
>>> call VecRestoreArrayReadF90(x,xx,loco_ierr)<br>
>>> call VecRestoreArrayF90(y,yy,loco_ierr)<br>
>>> return<br>
>>> end subroutine mymult<br>
>>> <br>
>>> I checked the change log on the website and saw a statement:<br>
>>> TAO:<br>
>>> <br>
>>> • Added VecLock{Push|Pop} calls around user callbacks; use of VecGetArray in user callbacks is now prohibited.<br>
>>> 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.<br>
>>> <br>
>>> I am confused and not sure what is the problem?<br>
>>> Could I get some help? <br>
>>> Thanks,<br>
>>> -- <br>
>>> Chang Liu<br>
>>> PhD candidate<br>
>>> Dept. of Electrical & Computer Engineering<br>
>>> Ph: 765-7143357<br>
>>> Email: <a href="mailto:chang.liu@utexas.edu" target="_blank">chang.liu@utexas.edu</a><br>
>> <br>
> <br>
<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Chang Liu</div><div>PhD candidate</div><div>Dept. of Electrical & Computer Engineering</div><div>Ph: 765-7143357</div><div>Email: <a href="mailto:chang.liu@utexas.edu" target="_blank">chang.liu@utexas.edu</a></div></div></div></div></div>