Dear PETSc team, I have interfaced our fortran legacy code with PETSC SNES. I mainly followed the examples you provide. What I conceptually used is : ------------------------------------------------------------ -------------------------------------------------------------------------- call SNESCreate(PETSC_COMM_WORLD,snes,ierr) call SNESSetFromOptions(snes,ierr) call SNESSETFunction(snes, pf, nonlinFormFunction, PETSC_NULL_OBJECT, ierr) call SNESSetJacobian(snes, mat, mat, nonlinFormJacobian, PETSC_NULL_OBJECT, ierr) call SNESSetKSP(snes, myksp, ierr) ------------------------------------------------------------ -------------------------------------------------------------------------- The code runs fine with -snes_type newtonls or newtontr. But when using -snes_type fas, it complains with the message : ------------------------------------------------------------ -------------------------------------------------------------------------- [0]PETSC ERROR: --------------------- Error Message -------------------------------------------------------------- [0]PETSC ERROR: Corrupt argument: http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind [0]PETSC ERROR: Fortran callback not set on this object [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting. [0]PETSC ERROR: Petsc Release Version 3.7.2, Jun, 05, 2016 [0]PETSC ERROR: on a arch-linux2-c-debug named dsp0780450 by niko Thu Jun 1 16:18:43 2017 [0]PETSC ERROR: Configure options --prefix=/home/niko/dev/codeaster-prerequisites/petsc-3.7.2/Install --with-mpi=yes --with-x=yes --download-ml=/home/niko/dev/codeaster-prerequisites/petsc-3.7.2/ml-6.2-p3.tar.gz --with-mumps-lib="-L/home/niko/dev/codeaster-prerequisites/v13/prerequisites/Mumps-502_consortium_aster1/MPI/lib -lzmumps -ldmumps -lmumps_common -lpord -L/home/niko/dev/codeaster-prerequisites/v13/prerequisites/Scotch_aster-604_aster6/MPI/lib -lesmumps -lptscotch -lptscotcherr -lptscotcherrexit -lscotch -lscotcherr -lscotcherrexit -L/home/niko/dev/codeaster-prerequisites/v13/prerequisites/Parmetis_aster-403_aster/lib -lparmetis -L/home/niko/dev/codeaster-prerequisites/v13/prerequisites/Metis_aster-510_aster1/lib -lmetis -L/usr/lib -lscalapack-openmpi -L/usr/lib -lblacs-openmpi -lblacsCinit-openmpi -lblacsF77init-openmpi -L/usr/lib/x86_64-linux-gnu -lgomp " --with-mumps-include=/home/niko/dev/codeaster-prerequisites/v13/prerequisites/Mumps-502_consortium_aster1/MPI/include --with-scalapack-lib="-L/usr/lib -lscalapack-openmpi" --with-blacs-lib="-L/usr/lib -lblacs-openmpi -lblacsCinit-openmpi -lblacsF77init-openmpi" --with-blas-lib="-L/usr/lib -lopenblas -lcblas" --with-lapack-lib="-L/usr/lib -llapack" [0]PETSC ERROR: #1 PetscObjectGetFortranCallback() line 263 in /home/niko/dev/codeaster-prerequisites/petsc-3.7.2/src/sys/objects/inherit.c [0]PETSC ERROR: #2 oursnesjacobian() line 105 in /home/niko/dev/codeaster-prerequisites/petsc-3.7.2/src/snes/interface/ftn-custom/zsnesf.c [0]PETSC ERROR: #3 SNESComputeJacobian() line 2312 in /home/niko/dev/codeaster-prerequisites/petsc-3.7.2/src/snes/interface/snes.c [0]PETSC ERROR: #4 SNESSolve_NEWTONLS() line 228 in /home/niko/dev/codeaster-prerequisites/petsc-3.7.2/src/snes/impls/ls/ls.c [0]PETSC ERROR: #5 SNESSolve() line 4008 in /home/niko/dev/codeaster-prerequisites/petsc-3.7.2/src/snes/interface/snes.c [0]PETSC ERROR: #6 SNESFASDownSmooth_Private() line 512 in /home/niko/dev/codeaster-prerequisites/petsc-3.7.2/src/snes/impls/fas/fas.c [0]PETSC ERROR: #7 SNESFASCycle_Multiplicative() line 816 in /home/niko/dev/codeaster-prerequisites/petsc-3.7.2/src/snes/impls/fas/fas.c [0]PETSC ERROR: #8 SNESSolve_FAS() line 987 in /home/niko/dev/codeaster-prerequisites/petsc-3.7.2/src/snes/impls/fas/fas.c [0]PETSC ERROR: #9 SNESSolve() line 4008 in /home/niko/dev/codeaster-prerequisites/petsc-3.7.2/src/snes/interface/snes.c ------------------------------------------------------------ -------------------------------------------------------------------------- When exploring a little bit with a debugger, it seems that the object snes->vec_rhs which is used is fas.c is a null pointer. What is this object vec_rhs and how to set it? Thank you in advance, Nicolas
Dear All, In order to ease the investigation, I reproduced this segfault by running snes/examples/tutorials/ex1f.F with the option -snes_type fas. I have the feeling that this is due to the nullity of the context object of FormJacobian (PETSC_NULL_OBJECT in Fortran). Best regards, Nicolas 2017-06-01 16:30 GMT+02:00 Karin&NiKo <[email protected]>:
Dear PETSc team,
I have interfaced our fortran legacy code with PETSC SNES. I mainly followed the examples you provide. What I conceptually used is :
------------------------------------------------------------ --------------------------------------------------------------------------
call SNESCreate(PETSC_COMM_WORLD,snes,ierr)
call SNESSetFromOptions(snes,ierr)
call SNESSETFunction(snes, pf, nonlinFormFunction, PETSC_NULL_OBJECT, ierr)
call SNESSetJacobian(snes, mat, mat, nonlinFormJacobian, PETSC_NULL_OBJECT, ierr)
call SNESSetKSP(snes, myksp, ierr) ------------------------------------------------------------ --------------------------------------------------------------------------
The code runs fine with -snes_type newtonls or newtontr. But when using -snes_type fas, it complains with the message :
------------------------------------------------------------ -------------------------------------------------------------------------- [0]PETSC ERROR: --------------------- Error Message -------------------------------------------------------------- [0]PETSC ERROR: Corrupt argument: http://www.mcs.anl.gov/petsc/ documentation/faq.html#valgrind [0]PETSC ERROR: Fortran callback not set on this object [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting. [0]PETSC ERROR: Petsc Release Version 3.7.2, Jun, 05, 2016 [0]PETSC ERROR:
on a arch-linux2-c-debug named dsp0780450 by niko Thu Jun 1 16:18:43 2017 [0]PETSC ERROR: Configure options --prefix=/home/niko/dev/ codeaster-prerequisites/petsc-3.7.2/Install --with-mpi=yes --with-x=yes --download-ml=/home/niko/dev/codeaster-prerequisites/petsc-3.7.2/ml-6.2-p3.tar.gz --with-mumps-lib="-L/home/niko/dev/codeaster-prerequisites/v13/ prerequisites/Mumps-502_consortium_aster1/MPI/lib -lzmumps -ldmumps -lmumps_common -lpord -L/home/niko/dev/codeaster-prerequisites/v13/ prerequisites/Scotch_aster-604_aster6/MPI/lib -lesmumps -lptscotch -lptscotcherr -lptscotcherrexit -lscotch -lscotcherr -lscotcherrexit -L/home/niko/dev/codeaster-prerequisites/v13/prerequisites/Parmetis_aster-403_aster/lib -lparmetis -L/home/niko/dev/codeaster-prerequisites/v13/ prerequisites/Metis_aster-510_aster1/lib -lmetis -L/usr/lib -lscalapack-openmpi -L/usr/lib -lblacs-openmpi -lblacsCinit-openmpi -lblacsF77init-openmpi -L/usr/lib/x86_64-linux-gnu -lgomp " --with-mumps-include=/home/niko/dev/codeaster-prerequisites/v13/ prerequisites/Mumps-502_consortium_aster1/MPI/include --with-scalapack-lib="-L/usr/lib -lscalapack-openmpi" --with-blacs-lib="-L/usr/lib -lblacs-openmpi -lblacsCinit-openmpi -lblacsF77init-openmpi" --with-blas-lib="-L/usr/lib -lopenblas -lcblas" --with-lapack-lib="-L/usr/lib -llapack" [0]PETSC ERROR: #1 PetscObjectGetFortranCallback() line 263 in /home/niko/dev/codeaster-prerequisites/petsc-3.7.2/src/ sys/objects/inherit.c [0]PETSC ERROR: #2 oursnesjacobian() line 105 in /home/niko/dev/codeaster- prerequisites/petsc-3.7.2/src/snes/interface/ftn-custom/zsnesf.c [0]PETSC ERROR: #3 SNESComputeJacobian() line 2312 in /home/niko/dev/codeaster-prerequisites/petsc-3.7.2/src/ snes/interface/snes.c [0]PETSC ERROR: #4 SNESSolve_NEWTONLS() line 228 in /home/niko/dev/codeaster-prerequisites/petsc-3.7.2/src/snes/impls/ls/ls.c [0]PETSC ERROR: #5 SNESSolve() line 4008 in /home/niko/dev/codeaster- prerequisites/petsc-3.7.2/src/snes/interface/snes.c [0]PETSC ERROR: #6 SNESFASDownSmooth_Private() line 512 in /home/niko/dev/codeaster-prerequisites/petsc-3.7.2/src/ snes/impls/fas/fas.c [0]PETSC ERROR: #7 SNESFASCycle_Multiplicative() line 816 in /home/niko/dev/codeaster-prerequisites/petsc-3.7.2/src/ snes/impls/fas/fas.c [0]PETSC ERROR: #8 SNESSolve_FAS() line 987 in /home/niko/dev/codeaster- prerequisites/petsc-3.7.2/src/snes/impls/fas/fas.c [0]PETSC ERROR: #9 SNESSolve() line 4008 in /home/niko/dev/codeaster- prerequisites/petsc-3.7.2/src/snes/interface/snes.c ------------------------------------------------------------ --------------------------------------------------------------------------
When exploring a little bit with a debugger, it seems that the object snes->vec_rhs which is used is fas.c is a null pointer.
What is this object vec_rhs and how to set it?
Thank you in advance, Nicolas
I emphasize that snes/examples/tutorials/ex1.c works perfectly with the option -snes_type fas. 2017-06-02 17:07 GMT+02:00 Karin&NiKo <[email protected]>:
Dear All,
In order to ease the investigation, I reproduced this segfault by running snes/examples/tutorials/ex1f.F with the option -snes_type fas. I have the feeling that this is due to the nullity of the context object of FormJacobian (PETSC_NULL_OBJECT in Fortran).
Best regards, Nicolas
2017-06-01 16:30 GMT+02:00 Karin&NiKo <[email protected]>:
Dear PETSc team,
I have interfaced our fortran legacy code with PETSC SNES. I mainly followed the examples you provide. What I conceptually used is :
------------------------------------------------------------ ------------------------------------------------------------ --------------
call SNESCreate(PETSC_COMM_WORLD,snes,ierr)
call SNESSetFromOptions(snes,ierr)
call SNESSETFunction(snes, pf, nonlinFormFunction, PETSC_NULL_OBJECT, ierr)
call SNESSetJacobian(snes, mat, mat, nonlinFormJacobian, PETSC_NULL_OBJECT, ierr)
call SNESSetKSP(snes, myksp, ierr) ------------------------------------------------------------ ------------------------------------------------------------ --------------
The code runs fine with -snes_type newtonls or newtontr. But when using -snes_type fas, it complains with the message :
------------------------------------------------------------ ------------------------------------------------------------ -------------- [0]PETSC ERROR: --------------------- Error Message -------------------------------------------------------------- [0]PETSC ERROR: Corrupt argument: http://www.mcs.anl.gov/petsc/d ocumentation/faq.html#valgrind [0]PETSC ERROR: Fortran callback not set on this object [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting. [0]PETSC ERROR: Petsc Release Version 3.7.2, Jun, 05, 2016 [0]PETSC ERROR:
on a arch-linux2-c-debug named dsp0780450 by niko Thu Jun 1 16:18:43 2017 [0]PETSC ERROR: Configure options --prefix=/home/niko/dev/codeas ter-prerequisites/petsc-3.7.2/Install --with-mpi=yes --with-x=yes --download-ml=/home/niko/dev/codeaster-prerequisites/petsc-3.7.2/ml-6.2-p3.tar.gz --with-mumps-lib="-L/home/niko/dev/codeaster-prerequisites/ v13/prerequisites/Mumps-502_consortium_aster1/MPI/lib -lzmumps -ldmumps -lmumps_common -lpord -L/home/niko/dev/codeaster-pre requisites/v13/prerequisites/Scotch_aster-604_aster6/MPI/lib -lesmumps -lptscotch -lptscotcherr -lptscotcherrexit -lscotch -lscotcherr -lscotcherrexit -L/home/niko/dev/codeaster-pre requisites/v13/prerequisites/Parmetis_aster-403_aster/lib -lparmetis -L/home/niko/dev/codeaster-prerequisites/v13/prerequisites/Metis_aster-510_aster1/lib -lmetis -L/usr/lib -lscalapack-openmpi -L/usr/lib -lblacs-openmpi -lblacsCinit-openmpi -lblacsF77init-openmpi -L/usr/lib/x86_64-linux-gnu -lgomp " --with-mumps-include=/home/niko/dev/codeaster-prerequisites/ v13/prerequisites/Mumps-502_consortium_aster1/MPI/include --with-scalapack-lib="-L/usr/lib -lscalapack-openmpi" --with-blacs-lib="-L/usr/lib -lblacs-openmpi -lblacsCinit-openmpi -lblacsF77init-openmpi" --with-blas-lib="-L/usr/lib -lopenblas -lcblas" --with-lapack-lib="-L/usr/lib -llapack" [0]PETSC ERROR: #1 PetscObjectGetFortranCallback() line 263 in /home/niko/dev/codeaster-prerequisites/petsc-3.7.2/src/sys/ objects/inherit.c [0]PETSC ERROR: #2 oursnesjacobian() line 105 in /home/niko/dev/codeaster-prerequisites/petsc-3.7.2/src/snes/ interface/ftn-custom/zsnesf.c [0]PETSC ERROR: #3 SNESComputeJacobian() line 2312 in /home/niko/dev/codeaster-prerequisites/petsc-3.7.2/src/snes/ interface/snes.c [0]PETSC ERROR: #4 SNESSolve_NEWTONLS() line 228 in /home/niko/dev/codeaster-prerequisites/petsc-3.7.2/src/snes/impls/ls/ls.c [0]PETSC ERROR: #5 SNESSolve() line 4008 in /home/niko/dev/codeaster-prere quisites/petsc-3.7.2/src/snes/interface/snes.c [0]PETSC ERROR: #6 SNESFASDownSmooth_Private() line 512 in /home/niko/dev/codeaster-prerequisites/petsc-3.7.2/src/snes/ impls/fas/fas.c [0]PETSC ERROR: #7 SNESFASCycle_Multiplicative() line 816 in /home/niko/dev/codeaster-prerequisites/petsc-3.7.2/src/snes/ impls/fas/fas.c [0]PETSC ERROR: #8 SNESSolve_FAS() line 987 in /home/niko/dev/codeaster-prerequisites/petsc-3.7.2/src/snes/ impls/fas/fas.c [0]PETSC ERROR: #9 SNESSolve() line 4008 in /home/niko/dev/codeaster-prere quisites/petsc-3.7.2/src/snes/interface/snes.c ------------------------------------------------------------ ------------------------------------------------------------ --------------
When exploring a little bit with a debugger, it seems that the object snes->vec_rhs which is used is fas.c is a null pointer.
What is this object vec_rhs and how to set it?
Thank you in advance, Nicolas
participants (1)
-
Karin&NiKo