Totalview® for HPC User Guide : PART IV Advanced Tools and Customization : Chapter 21 Setting Up Parallel Debugging Sessions : Debugging OpenMP Applications : Debugging OpenMP Programs
Debugging OpenMP Programs
Debugging OpenMP code is similar to debugging multi-threaded code. The major differences are in the way the OpenMP compiler alters your code. These alterations include:
Outlining. The compiler pulls the body of a parallel region out of the original routine and places it in an outlined routine. In some cases, the compiler generates multiple outlined routines from a single parallel region. This allows multiple threads to execute the parallel region.
The outlined routine’s name is based on the original routine’s name. In most cases, the compiler adds a numeric suffix.
The compiler inserts calls to the OpenMP runtime library.
The compiler splits variables between the original routine and the outlined routine. Normally, shared variables reside in the master thread’s original routine, and private variables reside in the outlined routine.
The master thread creates threads to share the workload. As the master thread begins to execute a parallel region in the OpenMP code, it creates the worker threads, dispatches them to the outlined routine, and then calls the outlined routine itself.