[petsc-users] MatMFFDSetBase

Gaetan Kenway gaetank at gmail.com
Tue Jun 19 13:03:12 CDT 2018


The issue is that in matffd.c passing PETSC_NULL_VEC for F is treated as
true in :

  if (F) {
    if (ctx->current_f_allocated) {ierr =
VecDestroy(&ctx->current_f);CHKERRQ(ierr);}
    ctx->current_f           = F;
    ctx->current_f_allocated = PETSC_FALSE;
    printf("F is given\n");
  } else if (!ctx->current_f_allocated) {
    ierr = MatCreateVecs(J,NULL,&ctx->current_f);CHKERRQ(ierr);
    printf("F create\n");
    ctx->current_f_allocated = PETSC_TRUE;
  }

so the ctx->current_f vector is never created as it should be. How do you
*actually* pass a "null" since petsc_null_object is gone?

Thanks,
Gaetan

On Tue, Jun 19, 2018 at 10:36 AM 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
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20180619/d5dd2d77/attachment.html>


More information about the petsc-users mailing list