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

Jacob Faibussowitsch jacob.fai at gmail.com
Tue Jun 7 18:31:13 CDT 2022


You can also compile your code (and PETSc) using `-fsanitize=undefined` and run it to detect such errors. 

Note however that this will most likely also catch/error out on usage of uninitialized variables so your mileage may vary. As Barry notes this kind of stuff is much easier to debug when you don’t have to ignore other errors.

Best regards,

Jacob Faibussowitsch
(Jacob Fai - booss - oh - vitch)

> On Jun 7, 2022, at 19:10, Barry Smith <bsmith at petsc.dev> wrote:
> 
> 
>  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