[petsc-dev] integer divide by zero when using a two triangle DMPlex

Matthew Knepley knepley at gmail.com
Thu Nov 21 18:11:23 CST 2013


On Thu, Nov 21, 2013 at 1:48 PM, Geoffrey Irving <irving at naml.us> wrote:

> I'm getting the following crash trying to use a two triangle mesh with
> DMPlex FEM.  The problem is that the PetscFEGetQuadrature call on line
> 546 of DMPlexComputeResidualFEM produces a quadrature object with
> q.numPoints = 0, which we then use for division.
>

Yes, it causes batchSize = 0. I think we could error is q.numPoints == 0.


> I'm using the default elements, which based on the "fe dofs" printout
> are piecewise constant.
>

You are supposed to create the quadrature (like ex12.c:382). The default
thing is completely empty.


> I imagine this is user error, but in addition to fixing it I'd like to
> insert another error check into the petsc code so that similar errors
> look nicer in future.
>
> Extra data: if I use a slightly larger mesh, it bails with a negative
> determinant error.  I don't quite understand how DMPlex determines
>

This likely happens because your quadrature is completely undefined.

  Thanks,

      Matt


> orientations, so that may or may be related to this crash.  I'm
> building my own DMPlex rather than using one of the existing creation
> routines, so it's quite possible my DMPlex is invalid.  An example
> determinant error is reproduced below.  For completeness, the DMPlex
> creation code is here:
>
>
> https://github.com/otherlab/hollow/blob/6fa039bcc2a3308532db45ccd350e201900bcf08/hollow/dm.cpp#L213
>
> Thanks,
> Geoffrey
>
> ---------------------------------------
>
> (master) cayley:example% ./laplace --resolution 1
> mesh counts = [4 5 2]
> dm counts   = [4 5 2]
> fe dofs = [0 0 1]
> fe bd dofs = [0 0 1]
> [0]PETSC ERROR:
> ------------------------------------------------------------------------
> [0]PETSC ERROR: Caught signal number 8 FPE: Floating Point
> Exception,probably divide by zero
> [0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger
> [0]PETSC ERROR: or see
> http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind[0]PETSC
> ERROR: or try http://valgrind.org on GNU/linux and Apple Mac OS X to
> find memory corruption errors
> [0]PETSC ERROR: likely location of problem given in stack below
> [0]PETSC ERROR: ---------------------  Stack Frames
> ------------------------------------
> [0]PETSC ERROR: Note: The EXACT line numbers in the stack are not
> available,
> [0]PETSC ERROR:       INSTEAD the line number of the start of the function
> [0]PETSC ERROR:       is given.
> [0]PETSC ERROR: [0] DMPlexComputeResidualFEM line 492
> src/dm/impls/plex/plexfem.c
> [0]PETSC ERROR: [0] SNESComputeFunction_DMLocal line 63
> src/snes/utils/dmlocalsnes.c
> [0]PETSC ERROR: [0] SNES user function line 2076 src/snes/interface/snes.c
> [0]PETSC ERROR: [0] SNESComputeFunction line 2064 src/snes/interface/snes.c
> [0]PETSC ERROR: [0] SNESSolve_NEWTONLS line 144 src/snes/impls/ls/ls.c
> [0]PETSC ERROR: [0] SNESSolve line 3755 src/snes/interface/snes.c
> [0]PETSC ERROR: --------------------- Error Message
> ------------------------------------
> [0]PETSC ERROR: Signal received!
> [0]PETSC ERROR:
> ------------------------------------------------------------------------
> [0]PETSC ERROR: Petsc Development GIT revision:
> 352a19e720c6e388b1693cf6502c5f90a094459e  GIT Date: 2013-11-20
> 19:18:56 -0800
> [0]PETSC ERROR: See docs/changes/index.html for recent updates.
> [0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
> [0]PETSC ERROR: See docs/index.html for manual pages.
> [0]PETSC ERROR:
> ------------------------------------------------------------------------
> [0]PETSC ERROR: Unknown Name on a debug named cayley by irving Thu Nov
> 21 11:34:18 2013
> [0]PETSC ERROR: Libraries linked from /home/irving/petsc/debug/lib
> [0]PETSC ERROR: Configure run at Wed Nov 20 19:39:25 2013
> [0]PETSC ERROR: Configure options --download-ctetgen
> --download-exodusii --download-generator --with-debugging=1
> --with-fortran=1 --with-hdf5-dir=/usr --with-netcdf-dir=/usr
> --with-triangle-dir=/usr PETSC_ARCH=debug
> [0]PETSC ERROR:
> ------------------------------------------------------------------------
> [0]PETSC ERROR: User provided function() line 0 in  unknown file
> --------------------------------------------------------------------------
> MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD
> with errorcode 59.
>
> NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.
> You may or may not see output from other processes, depending on
> exactly when Open MPI kills them.
> --------------------------------------------------------------------------
>
>
> ------------------------------------------------------------------------------
>
> (master) cayley:example% ./laplace --resolution 2
> mesh counts = [12 23 12]
> dm counts   = [12 23 12]
> fe dofs = [0 0 1]
> fe bd dofs = [0 0 1]
> [0]PETSC ERROR: --------------------- Error Message
> ------------------------------------
> [0]PETSC ERROR: Argument out of range!
> [0]PETSC ERROR: Invalid determinant -0.0416667 for element 4!
> [0]PETSC ERROR:
> ------------------------------------------------------------------------
> [0]PETSC ERROR: Petsc Development GIT revision:
> 352a19e720c6e388b1693cf6502c5f90a094459e  GIT Date: 2013-11-20
> 19:18:56 -0800
> [0]PETSC ERROR: See docs/changes/index.html for recent updates.
> [0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
> [0]PETSC ERROR: See docs/index.html for manual pages.
> [0]PETSC ERROR:
> ------------------------------------------------------------------------
> [0]PETSC ERROR: Unknown Name on a debug named cayley by irving Thu Nov
> 21 11:42:24 2013
> [0]PETSC ERROR: Libraries linked from /home/irving/petsc/debug/lib
> [0]PETSC ERROR: Configure run at Wed Nov 20 19:39:25 2013
> [0]PETSC ERROR: Configure options --download-ctetgen
> --download-exodusii --download-generator --with-debugging=1
> --with-fortran=1 --with-hdf5-dir=/usr --with-netcdf-dir=/usr
> --with-triangle-dir=/usr PETSC_ARCH=debug
> [0]PETSC ERROR:
> ------------------------------------------------------------------------
> [0]PETSC ERROR: DMPlexComputeResidualFEM() line 530 in
> src/dm/impls/plex/plexfem.c
> [0]PETSC ERROR: SNESComputeFunction_DMLocal() line 75 in
> src/snes/utils/dmlocalsnes.c
> [0]PETSC ERROR: SNESComputeFunction() line 2077 in
> src/snes/interface/snes.c
> [0]PETSC ERROR: SNESSolve_NEWTONLS() line 175 in src/snes/impls/ls/ls.c
> [0]PETSC ERROR: SNESSolve() line 3809 in src/snes/interface/snes.c
> [0]PETSC ERROR: --------------------- Error Message
> ------------------------------------
> [0]PETSC ERROR: Argument out of range!
> [0]PETSC ERROR:  !
> [0]PETSC ERROR:
> ------------------------------------------------------------------------
> [0]PETSC ERROR: Petsc Development GIT revision:
> 352a19e720c6e388b1693cf6502c5f90a094459e  GIT Date: 2013-11-20
> 19:18:56 -0800
> [0]PETSC ERROR: See docs/changes/index.html for recent updates.
> [0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
> [0]PETSC ERROR: See docs/index.html for manual pages.
> [0]PETSC ERROR:
> ------------------------------------------------------------------------
> [0]PETSC ERROR: Unknown Name on a debug named cayley by irving Thu Nov
> 21 11:42:24 2013
> [0]PETSC ERROR: Libraries linked from /home/irving/petsc/debug/lib
> [0]PETSC ERROR: Configure run at Wed Nov 20 19:39:25 2013
> [0]PETSC ERROR: Configure options --download-ctetgen
> --download-exodusii --download-generator --with-debugging=1
> --with-fortran=1 --with-hdf5-dir=/usr --with-netcdf-dir=/usr
> --with-triangle-dir=/usr PETSC_ARCH=debug
> [0]PETSC ERROR:
> ------------------------------------------------------------------------
> [0]PETSC ERROR: solve() line 33 in hollow/snes.cpp
> Traceback (most recent call last):
>   File "./laplace", line 94, in <module>
>     main()
>   File "./laplace", line 89, in main
>     snes.solve(None,u)
> RuntimeError: hollow/config.cpp:void hollow::check_failed(const int,
> const char *, const char *, const char *, const int):33: Fatal error
>



-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20131121/c8d11113/attachment.html>


More information about the petsc-dev mailing list