30.01.2013 Views

TotalView Users Guide - CI Wiki

TotalView Users Guide - CI Wiki

TotalView Users Guide - CI Wiki

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Debugging OpenMP Applications<br />

� The compiler splits variables between the original routine and the outlined<br />

routine. Normally, shared variables reside in the master thread’s<br />

original routine, and private variables reside in the outlined routine.<br />

� The master thread creates threads to share the workload. As the master<br />

thread begins to execute a parallel region in the OpenMP code, it creates<br />

the worker threads, dispatches them to the outlined routine, and then<br />

calls the outlined routine itself.<br />

About <strong>TotalView</strong> OpenMP Features<br />

<strong>TotalView</strong> interprets the changes that the OpenMP compiler makes to your<br />

code so that it can display your program in a coherent way. Here are some<br />

things you should know:<br />

� The compiler can generate multiple outlined routines from a single parallel<br />

region. This means that a single line of source code can generate multiple<br />

blocks of machine code inside different functions.<br />

� You can’t single step into or out of a parallel region. Instead, set a breakpoint<br />

inside the parallel region and let the process run to it. After execution<br />

reaches the parallel region, you can single step in it.<br />

� OpenMP programs are multi-threaded programs, so the rules for debugging<br />

multi-threaded programs apply.<br />

Figure 94 on page 134 shows a sample OpenMP debugging session.<br />

About OpenMP Platform Differences<br />

In general, <strong>TotalView</strong> smooths out the differences that occur when you execute<br />

OpenMP platforms on different platforms. The following list discusses<br />

these differences:<br />

� The OpenMP master thread has logical thread ID number 1. The OpenMP<br />

worker threads have a logical thread ID number greater than 1.<br />

� Select or dive on the stack parent token line to view the original routine’s<br />

stack frame in the OpenMP master thread.<br />

� When you stop the OpenMP worker threads in a PARALLEL DO outlined<br />

routine, the stack backtrace shows the following call sequence:<br />

� Outlined routine called from the special stack parent token line.<br />

� The OpenMP runtime library called from.<br />

� The original routine (containing the parallel region).<br />

� On HP Alpha Tru64 UNIX, the system manager threads have a negative<br />

thread ID; since these threads are created by OpenMP, they are not part of<br />

the code you wrote. Consequently, you should never manipulate them.<br />

� On HP Alpha Tru64 UNIX and on the <strong>Guide</strong> compilers, the OpenMP<br />

threads are implemented by the compiler as pthreads. On SGI IRIX, they<br />

are implemented as sprocs. <strong>TotalView</strong> shows the threads’ logical and/or<br />

system thread ID, not the OpenMP thread number.<br />

� SGI OpenMP uses the SIGTERM signal to terminate threads. Because<br />

<strong>TotalView</strong> stops a process when the process receives a SIGTERM, the<br />

OpenMP process doesn’t terminate. If you want the OpenMP process to<br />

terminate instead of stop, set the default action for the SIGTERM signal<br />

to Resend.<br />

<strong>TotalView</strong> Reference <strong>Guide</strong>: version 8.7 133

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

Saved successfully!

Ooh no, something went wrong!