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 />

Viewing OpenMP THREADPRIVATE Common Blocks<br />

The HP Alpha Tru64 UNIX OpenMP and SGI IRIX compilers implement<br />

OpenMP THREADPRIVATE common blocks by using the thread local storage<br />

system facility. This facility stores a variable declared in OpenMP<br />

THREADPRIVATE common blocks at different memory locations in each<br />

thread in an OpenMP process. This allows the variable to have different values<br />

in each thread. In contrast, the IBM and <strong>Guide</strong> compilers use the<br />

pthread key facility.<br />

When you use SGI compilers, the compiler maps THREADPRIVATE variables<br />

to the same virtual address. However, they have different physical<br />

addresses.<br />

To view a variable in an OpenMP THREADPRIVATE common block, or the<br />

OpenMP THREADPRIVATE common block:<br />

1 In the Threads Tab of the Process Window, select the thread that contains<br />

the private copy of the variable or common block you want to view.<br />

2 In the Stack Trace Pane of the Process Window, select the stack frame that<br />

lets you access the OpenMP THREADPRIVATE common block variable. You<br />

can select either the outlined routine or the original routine for an<br />

OpenMP master thread. You must, however, select the outlined routine<br />

for an OpenMP worker thread.<br />

3 From the Process Window, dive on the variable name or common block<br />

name, or select the View > Lookup Variable command. When prompted,<br />

enter the name of the variable or common block. You may need to<br />

append an underscore character (_) after the common block name.<br />

CLI: dprint<br />

<strong>TotalView</strong> opens a Variable Window that displays the value of the variable<br />

or common block for the selected thread.<br />

See “Displaying Variables” on page 283 for more information on displaying<br />

variables.<br />

4 To view OpenMP THREADPRIVATE common blocks or variables across all<br />

threads, use the Variable Window’s Show across > Threads command. See<br />

“Displaying a Variable in all Processes or Threads” on page 345.<br />

The following figure shows Variable Windows displaying OpenMP<br />

THREADPRIVATE common blocks. Because the Variable Window has the<br />

same thread context as the Process Window from which it was created, the<br />

title bar patterns for the same thread match. <strong>TotalView</strong> displays the values<br />

of the common block across all threads when you use the View > Show<br />

Across > Threads command. (See Figure 96 on page 137.)<br />

136 Chapter 7: Setting Up Parallel Debugging Sessions

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

Saved successfully!

Ooh no, something went wrong!