[petsc-users] Question about correctly catching fp_trap

Balay, Satish balay at mcs.anl.gov
Fri Jan 4 19:46:37 CST 2019


I had made a change so that configure uses CFLAGS etc from spack - so diabled internal COPTFLAGS guess within petsc.

I haven't figure out the correct way to do debug vs release builds in spack yet.

So the +debug option is broken [as mentioned before].

One workarround is is to improve '+debug' option for now with :

diff --git a/var/spack/repos/builtin/packages/petsc/package.py b/var/spack/repos/builtin/packages/petsc/package.py
index 99800b501..3fba7cf72 100644
--- a/var/spack/repos/builtin/packages/petsc/package.py
+++ b/var/spack/repos/builtin/packages/petsc/package.py
@@ -195,10 +195,7 @@ class Petsc(Package):
                    '--download-hwloc=0',
                    'CFLAGS=%s' % ' '.join(spec.compiler_flags['cflags']),
                    'FFLAGS=%s' % ' '.join(spec.compiler_flags['fflags']),
-                   'CXXFLAGS=%s' % ' '.join(spec.compiler_flags['cxxflags']),
-                   'COPTFLAGS=',
-                   'FOPTFLAGS=',
-                   'CXXOPTFLAGS=']
+                   'CXXFLAGS=%s' % ' '.join(spec.compiler_flags['cxxflags'])]
         options.extend(self.mpi_dependent_options())
         options.extend([
             '--with-precision=%s' % (
@@ -209,6 +206,13 @@ class Petsc(Package):
             '--with-debugging=%s' % ('1' if '+debug' in spec else '0'),
             '--with-64-bit-indices=%s' % ('1' if '+int64' in spec else '0')
         ])
+        if '+debug' in spec:
+            options.append('--with-debugging=%s')
+        else:
+            options.extend('COPTFLAGS=',
+                           'FOPTFLAGS=',
+                           'CXXOPTFLAGS=')
+
         # Make sure we use exactly the same Blas/Lapack libraries
         # across the DAG. To that end list them explicitly
         lapack_blas = spec['lapack'].libs + spec['blas'].libs

Satish

On Sat, 5 Jan 2019, Smith, Barry F. via petsc-users wrote:

>  
>    Looks like spack did not compile PETSc with the -g option; which is strange because in both debug and and --with-debugging=0 PETSc ./configure make uses debug symbols
> 
> #0  __muldc3 (a=-6.6364040265716871e-306, b=1.1689456061105587e-305, c=-0.0024992568840190117, d=0.024886737403015963)
>     at /raid/home/sajid/packages/spack/var/spack/stage/gcc-7.3.0-qrjpi76aeo4bysagruwwfii6oneh56lj/gcc-7.3.0/libgcc/libgcc2.c:1978
> #1  0x00007ffff630fe87 in MatSolve_SeqAIJ_NaturalOrdering ()
>    from /raid/home/sajid/packages/spack/opt/spack/linux-rhel7-x86_64/gcc-7.3.0/petsc-develop-2u6vuwagkoczyvnpsubzrubmtmpfhhkj/lib/libpetsc.so.3.010
> 
>    Anyway the FPE occurs in MatSolve_SeqAIJ_NaturalOrdering which usually indicates a zero on the diagonal of the matrix. Is that possible?
> 
>    Barry
> 
> 
>     Satish,
> 
>       Does spack somehow turn off the -g ?
> 
> > On Jan 4, 2019, at 3:24 PM, Sajid Ali <sajidsyed2021 at u.northwestern.edu> wrote:
> > 
> > Trying it slightly differently, I do see it's a SIGFPE, arithmetic exception but all it shows is that it's an error in TSSolve but no further than that. 
> > 
> > [sajid at xrm free_space]$ gdb ex_modify 
> > GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-100.el7
> > Copyright (C) 2013 Free Software Foundation, Inc.
> > License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> > This is free software: you are free to change and redistribute it.
> > There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> > and "show warranty" for details.
> > This GDB was configured as "x86_64-redhat-linux-gnu".
> > For bug reporting instructions, please see:
> > <http://www.gnu.org/software/gdb/bugs/>...
> > Reading symbols from /raid/home/sajid/packages/xwp_petsc/2d/free_space/ex_modify...done.
> > (gdb) run -ts_type cn --args -fp_trap
> > Starting program: /raid/home/sajid/packages/xwp_petsc/2d/free_space/ex_modify -ts_type cn --args -fp_trap
> > [Thread debugging using libthread_db enabled]
> > Using host libthread_db library "/lib64/libthread_db.so.1".
> > warning: File "/raid/home/sajid/packages/spack/opt/spack/linux-rhel7-x86_64/gcc-4.8.5/gcc-7.3.0-qrjpi76aeo4bysagruwwfii6oneh56lj/lib64/libstdc++.so.6.0.24-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load:/usr/bin/mono-gdb.py".
> > To enable execution of this file add
> >         add-auto-load-safe-path /raid/home/sajid/packages/spack/opt/spack/linux-rhel7-x86_64/gcc-4.8.5/gcc-7.3.0-qrjpi76aeo4bysagruwwfii6oneh56lj/lib64/libstdc++.so.6.0.24-gdb.py
> > line to your configuration file "/raid/home/sajid/.gdbinit".
> > To completely disable this security protection add
> >         set auto-load safe-path /
> > line to your configuration file "/raid/home/sajid/.gdbinit".
> > For more information about this security protection see the
> > "Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
> >         info "(gdb)Auto-loading safe path"
> > Solving a linear TS problem on 1 processor
> > mx : 512, my: 512 lambda : 1.239840e-10
> > 
> > Program received signal SIGFPE, Arithmetic exception.
> > __muldc3 (a=-6.6364040265716871e-306, b=1.1689456061105587e-305, c=-0.0024992568840190117, d=0.024886737403015963)
> >     at /raid/home/sajid/packages/spack/var/spack/stage/gcc-7.3.0-qrjpi76aeo4bysagruwwfii6oneh56lj/gcc-7.3.0/libgcc/libgcc2.c:1978
> > 1978    /raid/home/sajid/packages/spack/var/spack/stage/gcc-7.3.0-qrjpi76aeo4bysagruwwfii6oneh56lj/gcc-7.3.0/libgcc/libgcc2.c: No such file or directory.
> > Missing separate debuginfos, use: debuginfo-install blas-3.4.2-8.el7.x86_64 bzip2-libs-1.0.6-13.el7.x86_64 elfutils-libelf-0.168-8.el7.x86_64 elfutils-libs-0.168-8.el7.x86_64 glibc-2.17-196.el7.x86_64 lapack-3.4.2-8.el7.x86_64 libattr-2.4.46-12.el7.x86_64 libcap-2.22-9.el7.x86_64 libgfortran-4.8.5-16.el7.x86_64 libxml2-2.9.1-6.el7_2.3.x86_64 systemd-libs-219-42.el7_4.4.x86_64 xz-libs-5.2.2-1.el7.x86_64 zlib-1.2.7-17.el7.x86_64
> > (gdb) bt
> > #0  __muldc3 (a=-6.6364040265716871e-306, b=1.1689456061105587e-305, c=-0.0024992568840190117, d=0.024886737403015963)
> >     at /raid/home/sajid/packages/spack/var/spack/stage/gcc-7.3.0-qrjpi76aeo4bysagruwwfii6oneh56lj/gcc-7.3.0/libgcc/libgcc2.c:1978
> > #1  0x00007ffff630fe87 in MatSolve_SeqAIJ_NaturalOrdering ()
> >    from /raid/home/sajid/packages/spack/opt/spack/linux-rhel7-x86_64/gcc-7.3.0/petsc-develop-2u6vuwagkoczyvnpsubzrubmtmpfhhkj/lib/libpetsc.so.3.010
> > #2  0x00007ffff5ba61a8 in MatSolve ()
> >    from /raid/home/sajid/packages/spack/opt/spack/linux-rhel7-x86_64/gcc-7.3.0/petsc-develop-2u6vuwagkoczyvnpsubzrubmtmpfhhkj/lib/libpetsc.so.3.010
> > #3  0x00007ffff6bc8a55 in PCApply_ILU ()
> >    from /raid/home/sajid/packages/spack/opt/spack/linux-rhel7-x86_64/gcc-7.3.0/petsc-develop-2u6vuwagkoczyvnpsubzrubmtmpfhhkj/lib/libpetsc.so.3.010
> > #4  0x00007ffff6cde6eb in PCApply ()
> >    from /raid/home/sajid/packages/spack/opt/spack/linux-rhel7-x86_64/gcc-7.3.0/petsc-develop-2u6vuwagkoczyvnpsubzrubmtmpfhhkj/lib/libpetsc.so.3.010
> > #5  0x00007ffff6e3ad4a in KSP_PCApply ()
> >    from /raid/home/sajid/packages/spack/opt/spack/linux-rhel7-x86_64/gcc-7.3.0/petsc-develop-2u6vuwagkoczyvnpsubzrubmtmpfhhkj/lib/libpetsc.so.3.010
> > #6  0x00007ffff6e3bc36 in KSPInitialResidual ()
> >    from /raid/home/sajid/packages/spack/opt/spack/linux-rhel7-x86_64/gcc-7.3.0/petsc-develop-2u6vuwagkoczyvnpsubzrubmtmpfhhkj/lib/libpetsc.so.3.010
> > #7  0x00007ffff6dc0736 in KSPSolve_GMRES ()
> >    from /raid/home/sajid/packages/spack/opt/spack/linux-rhel7-x86_64/gcc-7.3.0/petsc-develop-2u6vuwagkoczyvnpsubzrubmtmpfhhkj/lib/libpetsc.so.3.010
> > #8  0x00007ffff6e1158e in KSPSolve ()
> >    from /raid/home/sajid/packages/spack/opt/spack/linux-rhel7-x86_64/gcc-7.3.0/petsc-develop-2u6vuwagkoczyvnpsubzrubmtmpfhhkj/lib/libpetsc.so.3.010
> > #9  0x00007ffff6fac311 in SNESSolve_KSPONLY ()
> >    from /raid/home/sajid/packages/spack/opt/spack/linux-rhel7-x86_64/gcc-7.3.0/petsc-develop-2u6vuwagkoczyvnpsubzrubmtmpfhhkj/lib/libpetsc.so.3.010
> > #10 0x00007ffff6f346c7 in SNESSolve ()
> >    from /raid/home/sajid/packages/spack/opt/spack/linux-rhel7-x86_64/gcc-7.3.0/petsc-develop-2u6vuwagkoczyvnpsubzrubmtmpfhhkj/lib/libpetsc.so.3.010
> > #11 0x00007ffff714d58b in TSTheta_SNESSolve ()
> >    from /raid/home/sajid/packages/spack/opt/spack/linux-rhel7-x86_64/gcc-7.3.0/petsc-develop-2u6vuwagkoczyvnpsubzrubmtmpfhhkj/lib/libpetsc.so.3.010
> > #12 0x00007ffff714df63 in TSStep_Theta ()
> >    from /raid/home/sajid/packages/spack/opt/spack/linux-rhel7-x86_64/gcc-7.3.0/petsc-develop-2u6vuwagkoczyvnpsubzrubmtmpfhhkj/lib/libpetsc.so.3.010
> > #13 0x00007ffff7053ebe in TSStep ()
> >    from /raid/home/sajid/packages/spack/opt/spack/linux-rhel7-x86_64/gcc-7.3.0/petsc-develop-2u6vuwagkoczyvnpsubzrubmtmpfhhkj/lib/libpetsc.so.3.010
> > ---Type <return> to continue, or q <return> to quit---
> > #14 0x00007ffff70560bc in TSSolve ()
> >    from /raid/home/sajid/packages/spack/opt/spack/linux-rhel7-x86_64/gcc-7.3.0/petsc-develop-2u6vuwagkoczyvnpsubzrubmtmpfhhkj/lib/libpetsc.so.3.010
> > #15 0x000000000040271d in main (argc=5, argv=0x7fffffffce38) at /raid/home/sajid/packages/xwp_petsc/2d/free_space/ex_modify.c:183
> > 
> 



More information about the petsc-users mailing list