Arnaud's advice to develop and debug numerical applications
- Use at least two compilers
- Trap floating point exceptions
During the development, set the floating point hardware to trap on divide
by zero, invalid and overflow. This usually involved to compile the main
function with some flags.
- Set the most stringent set of debugging options available
This includes:
- trap on uninitialized variables
- trap on integer overflow and divide by zero
- checks (bound checking, format, ...)
- debug version of memory allocator
- putting constant objects in read-only memory
- symbolic debugging with optimization on if possible
Apply these flags at compile and link time. Link with the compiler
command.
- Use a build procedure with a debug and release mode
And get hold of libraries compiled with checks on.
- Use a symbolic debugger when useful
For numerical application most notably with large data sets, symbolic
debuggers are not as handy as with "ordinary" applications. However, they
are extremely helpful in these situations:
- to get a stack trace
- setting watchpoints helps to find out where memory has been
trashed.
If realloc is used, purify watchpoints are the
solution.
- short debugging sessions help to get some insight on code
logic.
- Use static analysers
- Use memory debuggers
- Think of code coverage tools
The "Compiler and Tools tricks" page
details how to implement these steps.
$Id: ArnaudAdvice.html,v 1.8 2004/02/16 17:28:03 arnaud Exp $
by Arnaud Desitter.
© Arnaud Desitter, 2002, 2003