Debugging, Profiling, and Validation

by Dave Levermore
AMSC 664 lecture, 31 January 2003

Once code is written you must begin three tasks that should continue so long as the code is in use:

These tasks should be carried out on each component (module) of your code in "isolation". You should be aware of and use all tools at your disposal. You should keep a log of both your profiling and validation efforts. There should be a section addressing each in your final project report.

Debugging has two stages:

The first stage must be completed before doing anything else. It must be revisited every time new coding is introduced. The second stage begins during the profiling and validation processes, but should continue throughout the useful life of the code. Of course, most compilers come with debugging tools that help you through the first stage. There are also some platform-dependent debugging tools as well as many general strategies that can be applied to the second stage. Examples will be given in subsequent lectures.

Profiling involves the insertion of diagnostics into your code to assess its performance on a given platform. You want to find out:

One can use such information to tune your code's performance. Many of the tools with which you make such assessments are platform dependent. For example, one can check round-off sensitivity by masking the two least significant bits of the calculation. In some cases this can be done at the level of the compiler while in others one has to insert some lines into your code. Other examples will be given in subsequent lectures.

Validation of both your model and your algorithms is critical to the development of any piece of scientific software. How one might do this is the focus of this lecture. We will mention several approaches that are geared toward traditional simulation codes, but most of them have analogs that can be applied to any scientific computation project.