[petsc-users] About KSPConvergedReasonView

Barry Smith bsmith at petsc.dev
Sat Aug 29 11:53:04 CDT 2020


  Branch barry/2020-08-29/fortran-stub-converged-reason-view should fix this, soon to be in master.

  Barry


> On Aug 28, 2020, at 6:11 AM, Thibaut Appel <t.appel17 at imperial.ac.uk> wrote:
> 
> On 28/08/2020 10:52, Jose E. Roman wrote:
>> Thibaut: the changes that Barry mentioned are already in master. Can you try?
>> 
>> Barry: I think the issue is with the PetscViewer argument. KSPView() has a custom Fortran stub that calls PetscPatchDefaultViewers_Fortran(), but this is missing in KSPConvergedReasonView().
>> 
>> Jose
> 
> I reconfigured/compiled PETSc from the most recent master branch an hour ago; the following compiles fine:
> 
>     CALL KSPSolve(ksp,vec_rhs,vec_sol,ierr)
>     CHKERRA(ierr)
> 
>     CALL KSPGetConvergedReason(ksp,ksp_reason,ierr)
>     CHKERRA(ierr)
> 
>     CALL KSPConvergedReasonView(ksp,PETSC_VIEWER_STDOUT_WORLD,ierr)
>     CHKERRA(ierr)
> 
> but I still get a similar backtrace when KSPConvergedReasonView is called:
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x00007ffff511e89c in PetscObjectTypeCompare (obj=0x8, type_name=0x7ffff7580128 "ascii",
>     same=0x7fffffffd7c8) at /home/thibaut/Packages/petsc/src/sys/objects/destroy.c:160
> 160      else if (!type_name || !obj->type_name) *same = PETSC_FALSE;
> (gdb) backtrace
> #0  0x00007ffff511e89c in PetscObjectTypeCompare (obj=0x8, type_name=0x7ffff7580128 "ascii",
>     same=0x7fffffffd7c8) at /home/Packages/petsc/src/sys/objects/destroy.c:160
> #1  0x00007ffff66ed4d3 in KSPConvergedReasonView (ksp=0x555555b44860, viewer=0x8)
>     at /home/Packages/petsc/src/ksp/ksp/interface/itfunc.c:455
> #2  0x00007ffff6733fca in kspconvergedreasonview_ (ksp=0x5555559403c0 <__solver_MOD_ksp>,
>     viewer=0x7fffffffda60, __ierr=0x7fffffffda6c)
>     at /home/Packages/petsc/src/ksp/ksp/interface/ftn-auto/itfuncf.c:295
> #3  0x00005555555e165d in solver::solve_linear_problem (vec_rhs=..., vec_sol=...)
>     at mod_solver.F90:1867
> #4  0x00005555556156fe in solver::solve () at mod_solver.F90:164
> #5  0x00005555555bb8f3 in main () at main.F90:67
> #6  0x00005555555bb964 in main (argc=1, argv=0x7fffffffe17d) at main.F90:3
> #7  0x00007ffff46f71e3 in __libc_start_main () from /usr/lib/x86_64-linux-gnu/libc.so.6
> #8  0x000055555555cd5e in _start ()
> 
> Thibaut
> 
>>> El 27 ago 2020, a las 17:59, Barry Smith <bsmith at petsc.dev> escribió:
>>> 
>>> 
>>>  This is probably due to the final argument being a character string which PETSc has difficulty managing by default for Fortran.
>>> 
>>>  I just removed the format argument from the call so this problem will gone soon.
>>> 
>>>  You could just comment out the call for now and put a print statement in instead.
>>> 
>>>  The problem will be fixed as soon as my merge request gets into master.
>>> 
>>>  Sorry about this.
>>> 
>>>  Barry
>>> 
>>> 
>>> 
>>> 
>>> 
>>>> On Aug 27, 2020, at 10:25 AM, Thibaut Appel <t.appel17 at imperial.ac.uk> wrote:
>>>> 
>>>> Dear PETSc users,
>>>> 
>>>> I found out that (at least in the master branch) that KSPReasonView has been recently deprecated in favor of KSPConvergedReasonView.
>>>> 
>>>> After changing my application code, I thought I was using the function correctly:
>>>> 
>>>>    CALL KSPGetConvergedReason(ksp,ksp_reason,ierr)
>>>>    CHKERRA(ierr)
>>>> 
>>>>    IF (ksp_reason < 0) THEN
>>>> 
>>>>      CALL KSPConvergedReasonView(ksp,PETSC_VIEWER_STDOUT_WORLD,PETSC_VIEWER_DEFAULT,ierr)
>>>>      CHKERRA(ierr)
>>>> 
>>>>    END IF
>>>> 
>>>> but I still get the following backtrace
>>>> 
>>>> Program received signal SIGSEGV, Segmentation fault.
>>>> 0x00007ffff51dea59 in PetscObjectTypeCompare (obj=0x8,
>>>>    type_name=0x7ffff75b5b88 "ascii", same=0x7fffffffd7b8)
>>>>    at /home/Packages/petsc/src/sys/objects/destroy.c:160
>>>> 160      else if (!type_name || !obj->type_name) *same = PETSC_FALSE;
>>>> (gdb) bt
>>>> #0  0x00007ffff51dea59 in PetscObjectTypeCompare (obj=0x8,
>>>>    type_name=0x7ffff75b5b88 "ascii", same=0x7fffffffd7b8)
>>>>    at /home/Packages/petsc/src/sys/objects/destroy.c:160
>>>> #1  0x00007ffff6ba1d83 in KSPConvergedReasonView (ksp=0x555555bb2510, viewer=0x8,
>>>>    format=PETSC_VIEWER_DEFAULT)
>>>>    at /home/Packages/petsc/src/ksp/ksp/interface/itfunc.c:452
>>>> #2  0x00007ffff6beb37a in kspconvergedreasonview_ (
>>>>    ksp=0x55555593f3c0 <__solver_MOD_ksp>, viewer=0x7fffffffda50,
>>>>    format=0x5555558fae48, __ierr=0x7fffffffda6c)
>>>>    at /home/Packages/petsc/src/ksp/ksp/interface/ftn-auto/itfuncf.c:295
>>>> #3  0x00005555555e040d in solver::solve_linear_problem (vec_rhs=..., vec_sol=...)
>>>>    at mod_solver.F90:1872
>>>> #4  0x0000555555614453 in solver::solve () at mod_solver.F90:164
>>>> #5  0x00005555555ba3c6 in main () at main.F90:67
>>>> #6  0x00005555555ba437 in main (argc=1, argv=0x7fffffffe17e) at main.F90:3
>>>> #7  0x00007ffff46fa1e3 in __libc_start_main ()
>>>>   from /usr/lib/x86_64-linux-gnu/libc.so.6
>>>> #8  0x000055555555cd7e in _start ()
>>>> 
>>>> as if there was a type mismatch. Could anyone pinpoint what's wrong?
>>>> 
>>>> Thank you,
>>>> 
>>>> Thibaut
>>>> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200829/9255dab7/attachment-0001.html>


More information about the petsc-users mailing list