[petsc-users] How to ignore a one floating point exception and move to the next?

Barry Smith bsmith at petsc.dev
Tue Jun 7 18:10:15 CDT 2022


  PETSc uses the signal handler to catch floating point exceptions when run by default or with -fp_trap. These are hard to recover from and continue.

  You can run PETSc with -fp_trap off in the debugger but tell the debugger to catch the floating point exceptions. You may be able to continue from those.

  Not having uninitialized variables and strange unimportant floating point exceptions in your code is part of good housekeeping and means that when you really need to debug you can be much more efficient in the debugging process. Like trying to find something in a messy room or a well organized room. I recommend you first do the housekeeping rather than try to find ways to avoid doing the housekeeping.

  Barry


> On Jun 7, 2022, at 6:51 PM, Ramakrishnan Thirumalaisamy <rthirumalaisam1857 at sdsu.edu> wrote:
> 
> Hi everyone,
> 
> I am using fp_trap to debug the floating-point error in my code. Is there any way I can move from one floating point to next one When I run the code in the debugger with "-fp_trap"? I know that some floating point errors are due to uninitialized variables but those are benign. I want to move to those ones that lead to NANs or division by zero.
> 
> 
> 
> Thanks,
> Rama



More information about the petsc-users mailing list