30.01.2013 Views

TotalView Users Guide - CI Wiki

TotalView Users Guide - CI Wiki

TotalView Users Guide - CI Wiki

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Debugging OpenMP Applications<br />

Debugging OpenMP Applications<br />

<strong>TotalView</strong> supports many OpenMP C and Fortran compilers. Supported<br />

compilers and architectures are listed in the <strong>TotalView</strong> Platforms and Systems<br />

Requirements document, which is on our Web site.<br />

The following are some of the features that <strong>TotalView</strong> supports:<br />

� Source-level debugging of the original OpenMP code.<br />

� The ability to plant breakpoints throughout the OpenMP code, including<br />

lines that are executed in parallel.<br />

� Visibility of OpenMP worker threads.<br />

� Access to SHARED and PRIVATE variables in OpenMP PARALLEL code.<br />

� A stack-back link token in worker threads’ stacks so that you can find<br />

their master stack.<br />

� Access to OMP THREADPRIVATE data in code compiled by the IBM and<br />

<strong>Guide</strong>, SGI IRIX, and HP Alpha compilers.<br />

The code examples used in this section are included in the <strong>TotalView</strong> distribution<br />

in the examples/omp_simplef file.<br />

On the SGI IRIX platform, you must use the MIPSpro 7.3 compiler or later to debug<br />

OpenMP.<br />

Topics in this section are:<br />

� “Debugging OpenMP Programs” on page 132<br />

� “Viewing OpenMP Private and Shared Variables” on page 134<br />

� “Viewing OpenMP THREADPRIVATE Common Blocks” on page 136<br />

� “Viewing the OpenMP Stack Parent Token Line” on page 137<br />

Debugging OpenMP Programs<br />

The way in which you debug OpenMP code is similar to the way you debug<br />

multi-threaded code. The major differences are related to the way the<br />

OpenMP compiler alters your code. These alterations include:<br />

� The most visible transformation is outlining. The compiler pulls the body<br />

of a parallel region out of the original routine and places it in an outlined<br />

routine. In some cases, the compiler generates multiple outlined routines<br />

from a single parallel region. This allows multiple threads to execute the<br />

parallel region.<br />

The outlined routine’s name is based on the original routine’s name. In<br />

most cases, the compiler adds a numeric suffix.<br />

� The compiler inserts calls to the OpenMP runtime library.<br />

132 Chapter 7: Setting Up Parallel Debugging Sessions

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!