[petsc-users] MatMFFDSetBase
Smith, Barry F.
bsmith at mcs.anl.gov
Tue Jun 19 16:55:20 CDT 2018
Could you please try changing it to CHKFORTRANNULLOBJECTDEREFERENCE; recompile and run again
Barry
> On Jun 19, 2018, at 3:28 PM, Gaetan Kenway <gaetank at gmail.com> wrote:
>
> I tried the patch. It initially didn't compile because of a conflict with the corresponding ftn-auto file. When i commented out the stuff there it compiled, but I got a segfault here:
>
> at /nobackup/gkenway/packages/petsc-3.9.2/src/mat/impls/mffd/ftn-custom/zmffdf.c:52
> 52 *ierr = MatMFFDSetBase(*mat,*u,*f);
> (gdb) bt
> #0 matmffdsetbase_ (mat=mat at entry=0x7fffb461ba10 <__anksolver_MOD_drdw>, u=u at entry=0x7fffb461b9a0 <__anksolver_MOD_wvec>, f=0x0, f at entry=0x7fffffffb970, ierr=ierr at entry=0x7fffffffb938)
> at /nobackup/gkenway/packages/petsc-3.9.2/src/mat/impls/mffd/ftn-custom/zmffdf.c:52
> #1 0x00007fffb3d7e871 in anksolver::ankstep (firstcall=<optimized out>) at ../NKSolver/NKSolvers.F90:2891
> #2 0x00007fffb3ebbde9 in solvers::solvestate () at ../solver/solvers.F90:1114
> #3 0x00007fffb3ebe4b5 in solvers::solver () at ../solver/solvers.F90:69
> #4 0x00007fffb3cfcaa7 in f2py_rout_libadflow_solvers_solver (capi_self=<optimized out>, capi_args=<optimized out>, capi_keywds=<optimized out>, f2py_func=0x7fffb3ebe310 <solvers::solver>)
> at libadflowmodule.c:6710
> #5 0x00007fffb3cf8643 in fortran_call (fp=<optimized out>, arg=<optimized out>, kw=<optimized out>) at /u/wk/gkenway/.local/lib/python2.7/site-packages/numpy/f2py/src/fortranobject.c:404
> #6 0x00007ffff7a5aa63 in PyObject_Call () from /lib64/libpython2.7.so.1.0
> #7 0x00007ffff7aef236 in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0
> #8 0x00007ffff7af603d in PyEval_EvalCodeEx () from /lib64/libpython2.7.so.1.0
> #9 0x00007ffff7a7f978 in function_call () from /lib64/libpython2.7.so.1.0
> #10 0x00007ffff7a5aa63 in PyObject_Call () from /lib64/libpython2.7.so.1.0
> #11 0x00007ffff7a69a55 in instancemethod_call () from /lib64/libpython2.7.so.1.0
> #12 0x00007ffff7a5aa63 in PyObject_Call () from /lib64/libpython2.7.so.1.0
> #13 0x00007ffff7ab1e27 in slot_tp_call () from /lib64/libpython2.7.so.1.0
> #14 0x00007ffff7a5aa63 in PyObject_Call () from /lib64/libpython2.7.so.1.0
> #15 0x00007ffff7aef236 in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0
> #16 0x00007ffff7af603d in PyEval_EvalCodeEx () from /lib64/libpython2.7.so.1.0
> #17 0x00007ffff7af6142 in PyEval_EvalCode () from /lib64/libpython2.7.so.1.0
> #18 0x00007ffff7b0f57f in run_mod () from /lib64/libpython2.7.so.1.0
> #19 0x00007ffff7b1073e in PyRun_FileExFlags () from /lib64/libpython2.7.so.1.0
> #20 0x00007ffff7b119c9 in PyRun_SimpleFileExFlags () from /lib64/libpython2.7.so.1.0
> #21 0x00007ffff7b22b7f in Py_Main () from /lib64/libpython2.7.so.1.0
> #22 0x00007ffff6d3f3d5 in __libc_start_main () from /lib64/libc.so.6
> #23 0x000000000040066e in _start ()
>
> which was the new code that got added. So I never got the patch to work correctly.
>
> However, I circumvented the problem by making my own vector and calling the matfd-function, and then passing in the vector. This is essentially the same thing and I means I don't need an if-def for older versions.
>
> Gaetan
>
>
>
> On Tue, Jun 19, 2018 at 11:24 AM Smith, Barry F. <bsmith at mcs.anl.gov> wrote:
>
> The code to handle the null vector got mistakenly removed. Please find attached a patch that should resolve the problem.
>
>
>
> Please let us know if it works,
>
> Thanks
>
> Barry
>
>
> > On Jun 19, 2018, at 12:36 PM, Gaetan Kenway <gaetank at gmail.com> wrote:
> >
> > Seems like the MatMFFDSetBase is now broken in petsc 3.9
> >
> > In 3.7 I used:
> >
> > call MatMFFDSetBase(dRdW, wVec, PETSC_NULL_OBJECT, ierr)
> >
> > and the most logical translation is now
> >
> > call MatMFFDSetBase(dRdW, wVec, PETSC_NULL_VEC, ierr)
> >
> > Unfortunately this just segfaults:
> > #0 VecAXPY (y=y at entry=0x10a3750, alpha=alpha at entry=-1, x=x at entry=0xffffffffffffffff) at /nobackup/gkenway/packages/petsc-3.9.2/src/vec/vec/interface/rvector.c:601
> > #1 0x00007fffb697faae in MatMult_MFFD (mat=0x291a150, a=0x10b25c0, y=0x10a3750) at /nobackup/gkenway/packages/petsc-3.9.2/src/mat/impls/mffd/mffd.c:368
> > #2 0x00007fffb6847af2 in MatMult (mat=0x291a150, x=x at entry=0x10b25c0, y=y at entry=0x10a3750) at /nobackup/gkenway/packages/petsc-3.9.2/src/mat/interface/matrix.c:2305
> > #3 0x00007fffb6e982e7 in PCApplyBAorAB (pc=0xe64d00, side=PC_RIGHT, x=0x10aaee0, y=y at entry=0x10a3750, work=0x10b25c0) at /nobackup/gkenway/packages/petsc-3.9.2/src/ksp/pc/interface/precon.c:680
> > #4 0x00007fffb6f02b84 in KSP_PCApplyBAorAB (w=<optimized out>, y=0x10a3750, x=<optimized out>, ksp=0xf135e0) at /u/wk/gkenway/scratch/packages/petsc-3.9.2/include/petsc/private/kspimpl.h:304
> > #5 KSPGMRESCycle (itcount=itcount at entry=0x7fffffffb73c, ksp=ksp at entry=0xf135e0) at /nobackup/gkenway/packages/petsc-3.9.2/src/ksp/ksp/impls/gmres/gmres.c:152
> > #6 0x00007fffb6f035c2 in KSPSolve_GMRES (ksp=0xf135e0) at /nobackup/gkenway/packages/petsc-3.9.2/src/ksp/ksp/impls/gmres/gmres.c:234
> > #7 0x00007fffb6f35050 in KSPSolve (ksp=0xf135e0, b=0xf7ced0, x=0xf77be0) at /nobackup/gkenway/packages/petsc-3.9.2/src/ksp/ksp/interface/itfunc.c:669
> > #8 0x00007fffb6f482ee in kspsolve_ (ksp=ksp at entry=0x7fffb461bae8 <__anksolver_MOD_ank_ksp>, b=<optimized out>, b at entry=0x7fffb461b9c8 <__anksolver_MOD_rvec>, x=<optimized out>,
> > x at entry=0x7fffb461ba18 <__anksolver_MOD_deltaw>, ierr=ierr at entry=0x7fffffffb938) at /nobackup/gkenway/packages/petsc-3.9.2/src/ksp/ksp/interface/ftn-custom/zitfuncf.c:54
> > #9 0x00007fffb3d7e697 in anksolver::ankstep (firstcall=<optimized out>) at ../NKSolver/NKSolvers.F90:2891
> > #10 0x00007fffb3ebbbb9 in solvers::solvestate () at ../solver/solvers.F90:1114
> > #11 0x00007fffb3ebe285 in solvers::solver () at ../solver/solvers.F90:69
> > #12 0x00007fffb3cfca17 in f2py_rout_libadflow_solvers_solver (capi_self=<optimized out>, capi_args=<optimized out>, capi_keywds=<optimized out>, f2py_func=0x7fffb3ebe0e0 <solvers::solver>)
> > at libadflowmodule.c:6710
> > #13 0x00007fffb3cf85b3 in fortran_call (fp=<optimized out>, arg=<optimized out>, kw=<optimized out>) at /u/wk/gkenway/.local/lib/python2.7/site-packages/numpy/f2py/src/fortranobject.c:404
> > #14 0x00007ffff7a5aa63 in PyObject_Call () from /lib64/libpython2.7.so.1.0
> > #15 0x00007ffff7aef236 in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0
> > #16 0x00007ffff7af603d in PyEval_EvalCodeEx () from /lib64/libpython2.7.so.1.0
> > #17 0x00007ffff7a7f978 in function_call () from /lib64/libpython2.7.so.1.0
> > #18 0x00007ffff7a5aa63 in PyObject_Call () from /lib64/libpython2.7.so.1.0
> > #19 0x00007ffff7a69a55 in instancemethod_call () from /lib64/libpython2.7.so.1.0
> > #20 0x00007ffff7a5aa63 in PyObject_Call () from /lib64/libpython2.7.so.1.0
> > #21 0x00007ffff7ab1e27 in slot_tp_call () from /lib64/libpython2.7.so.1.0
> > #22 0x00007ffff7a5aa63 in PyObject_Call () from /lib64/libpython2.7.so.1.0
> > #23 0x00007ffff7aef236 in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0
> > #24 0x00007ffff7af603d in PyEval_EvalCodeEx () from /lib64/libpython2.7.so.1.0
> > #25 0x00007ffff7af6142 in PyEval_EvalCode () from /lib64/libpython2.7.so.1.0
> > #26 0x00007ffff7b0f57f in run_mod () from /lib64/libpython2.7.so.1.0
> > #27 0x00007ffff7b1073e in PyRun_FileExFlags () from /lib64/libpython2.7.so.1.0
> > #28 0x00007ffff7b119c9 in PyRun_SimpleFileExFlags () from /lib64/libpython2.7.so.1.0
> > #29 0x00007ffff7b22b7f in Py_Main () from /lib64/libpython2.7.so.1.0
> > #30 0x00007ffff6d3f3d5 in __libc_start_main () from /lib64/libc.so.6
> > #31 0x000000000040066e in _start ()
> >
> > Thanks,
> >
> > Gaetan
> >
> >
> >
> >
>
More information about the petsc-users
mailing list