[petsc-users] strange FPE divide by zero

Barry Smith bsmith at mcs.anl.gov
Mon Sep 14 13:53:18 CDT 2015


  Randy,

     This is actually expected behavior. LAPACK was designed and implemented treating Inf is a valid numerical result, thus LAPACK will generate Inf internally as it computes and resulting in correct answers. 

     Of course this can be annoying because there is no easy way to distinguish between "reasonable" floating point exceptions (like Inf in LAPACK) and bad floating point exceptions caused by bugs in code. In PETSc when you run with -fp_trap on we "turn off" the trapping during LAPACK calls those "ok" floating point exceptions are ignored but it will still trap other floating point exceptions that are likely bugs.

   Barry


> On Sep 14, 2015, at 1:15 PM, Randall Mackie <rlmackie862 at gmail.com> wrote:
> 
> I’ve run into a strange error, which is that when I compile my Fortran code with -ffpe-trap=invalid it bombs out and gives the backtrace below. If I don’t include the ffpe-trap switch, the code runs fine and gives the expected results.
> 
> I’ve even run the code through Valgrind, and no issues were found.
> 
> I don’t know if this is just something strange with my matrix, or this is a bug somewhere in the PETSc code.
> 
> I do have a small test program and a large binary matrix and vector file if you want to test.
> 
> 
> Randy
> 
> 
> [9]PETSC ERROR: ------------------------------------------------------------------------
> [9]PETSC ERROR: Caught signal number 8 FPE: Floating Point Exception,probably divide by zero
> [9]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger
> [9]PETSC ERROR: or see http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind
> [9]PETSC ERROR: [0]PETSC ERROR: or try http://valgrind.org on GNU/linux and Apple Mac OS X to find memory corruption errors
> 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] LAPACKgesvd line 44 /state/std2/FEMI/PETSc/petsc-3.6.1/src/ksp/ksp/impls/gmres/gmreig.c
> [0]PETSC ERROR: [0] KSPComputeExtremeSingularValues_GMRES line 24 /state/std2/FEMI/PETSc/petsc-3.6.1/src/ksp/ksp/impls/gmres/gmreig.c
> [0]PETSC ERROR: [0] KSPComputeExtremeSingularValues line 51 /state/std2/FEMI/PETSc/petsc-3.6.1/src/ksp/ksp/interface/itfunc.c
> [2]PETSC ERROR: likely location of problem given in stack below
> [2]PETSC ERROR: ---------------------  Stack Frames ------------------------------------
> [2]PETSC ERROR: Note: The EXACT line numbers in the stack are not available,
> [2]PETSC ERROR:       INSTEAD the line number of the start of the function
> [2]PETSC ERROR:       is given.
> [2]PETSC ERROR: [2] LAPACKgesvd line 44 /state/std2/FEMI/PETSc/petsc-3.6.1/src/ksp/ksp/impls/gmres/gmreig.c
> [2]PETSC ERROR: [2] KSPComputeExtremeSingularValues_GMRES line 24 /state/std2/FEMI/PETSc/petsc-3.6.1/src/ksp/ksp/impls/gmres/gmreig.c
> [2]PETSC ERROR: [2] KSPComputeExtremeSingularValues line 51 /state/std2/FEMI/PETSc/petsc-3.6.1/src/ksp/ksp/interface/itfunc.c
> [2]PETSC ERROR: [2] PCGAMGOptProlongator_AGG line 1187 /state/std2/FEMI/PETSc/petsc-3.6.1/src/ksp/pc/impls/gamg/agg.c
> [2]PETSC ERROR: [2] PCSetUp_GAMG line 468 /state/std2/FEMI/PETSc/petsc-3.6.1/src/ksp/pc/impls/gamg/gamg.c
> [2]PETSC ERROR: [2] PCSetUp line 944 /state/std2/FEMI/PETSc/petsc-3.6.1/src/ksp/pc/interface/precon.c
> [2]PETSC ERROR: [2] KSPSetUp line 247 /state/std2/FEMI/PETSc/petsc-3.6.1/src/ksp/ksp/interface/itfunc.c
> [2]PETSC ERROR: [2] KSPSolve line 510 /state/std2/FEMI/PETSc/petsc-3.6.1/src/ksp/ksp/interface/itfunc.c
> [2]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
> [2]PETSC ERROR: Signal received
> [5]PETSC ERROR: [2]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting.
> 
> 
> This happens using either mpich or mvapich. The mvapich backtrace shows this:
> 
> [compute-1-11.local:mpi_rank_6][print_backtrace]   5: /state/std2/FEMI/PETSc/petsc-3.6.1/linux-gfortran-debug/lib/libpetsc.so.3.6(+0x268d24) [0x2ba2fac58d24]
> [compute-1-11.local:mpi_rank_6][print_backtrace]   6: /lib64/libc.so.6() [0x38af6329a0]
> [compute-1-11.local:mpi_rank_6][print_backtrace]   7: /state/std2/FEMI/PETSc/petsc-3.6.1/linux-gfortran-debug/lib/libpetsc.so.3.6(ieeeck_+0x1e9) [0x2ba2fc0e7b55]
> [compute-1-11.local:mpi_rank_6][print_backtrace]   8: /state/std2/FEMI/PETSc/petsc-3.6.1/linux-gfortran-debug/lib/libpetsc.so.3.6(ilaenv_+0x1b17) [0x2ba2fc0baa77]
> [compute-1-11.local:mpi_rank_6][print_backtrace]   9: /state/std2/FEMI/PETSc/petsc-3.6.1/linux-gfortran-debug/lib/libpetsc.so.3.6(dlasq2_+0x9a2) [0x2ba2fc0dd53e]
> [compute-1-11.local:mpi_rank_6][print_backtrace]  10: /state/std2/FEMI/PETSc/petsc-3.6.1/linux-gfortran-debug/lib/libpetsc.so.3.6(dlasq1_+0x45d) [0x2ba2fc0dc941]
> [compute-1-11.local:mpi_rank_6][print_backtrace]  11: /state/std2/FEMI/PETSc/petsc-3.6.1/linux-gfortran-debug/lib/libpetsc.so.3.6(zbdsqr_+0x33e) [0x2ba2fc0bb42a]
> [compute-1-11.local:mpi_rank_6][print_backtrace]  12: /state/std2/FEMI/PETSc/petsc-3.6.1/linux-gfortran-debug/lib/libpetsc.so.3.6(zgesvd_+0x9091) [0x2ba2fc089445]
> [compute-1-11.local:mpi_rank_6][print_backtrace]  13: /state/std2/FEMI/PETSc/petsc-3.6.1/linux-gfortran-debug/lib/libpetsc.so.3.6(KSPComputeExtremeSingularValues_GMRES+0x7e0) [0x2ba2fbcf77fd]
> [compute-1-11.local:mpi_rank_6][print_backtrace]  14: /state/std2/FEMI/PETSc/petsc-3.6.1/linux-gfortran-debug/lib/libpetsc.so.3.6(KSPComputeExtremeSingularValues+0x4ec) [0x2ba2fbd78ea6]
> [compute-1-11.local:mpi_rank_6][print_backtrace]  15: /state/std2/FEMI/PETSc/petsc-3.6.1/linux-gfortran-debug/lib/libpetsc.so.3.6(PCGAMGOptProlongator_AGG+0x111a) [0x2ba2fbbb28f9]
> [compute-1-11.local:mpi_rank_6][print_backtrace]  16: /state/std2/FEMI/PETSc/petsc-3.6.1/linux-gfortran-debug/lib/libpetsc.so.3.6(PCSetUp_GAMG+0x1565) [0x2ba2fbb9995b]
> [compute-1-11.local:mpi_rank_6][print_backtrace]  17: /state/std2/FEMI/PETSc/petsc-3.6.1/linux-gfortran-debug/lib/libpetsc.so.3.6(PCSetUp+0xc6b) [0x2ba2fbcb06b3]
> [compute-1-11.local:mpi_rank_6][print_backtrace]  18: /state/std2/FEMI/PETSc/petsc-3.6.1/linux-gfortran-debug/lib/libpetsc.so.3.6(KSPSetUp+0x14e5) [0x2ba2fbd7bac3]
> [compute-1-11.local:mpi_rank_6][print_backtrace]  19: /state/std2/FEMI/PETSc/petsc-3.6.1/linux-gfortran-debug/lib/libpetsc.so.3.6(KSPSolve+0xc31) [0x2ba2fbd7d70a]
> [compute-1-11.local:mpi_rank_6][print_backtrace]  20: /state/std2/FEMI/PETSc/petsc-3.6.1/linux-gfortran-debug/lib/libpetsc.so.3.6(kspsolve_+0x3e) [0x2ba2fbdbba40]
> [compute-1-11.local:mpi_rank_6][print_backtrace]  21: ./test() [0x401425]
> [compute-1-11.local:mpi_rank_6][print_backtrace]  22: ./test() [0x4014ca]
> 
> 
> 



More information about the petsc-users mailing list