Totalview® for HPC User Guide : PART IV Advanced Tools and Customization : Chapter 21 Setting Up Parallel Debugging Sessions : Debugging OpenMP Applications : Viewing OpenMP THREADPRIVATE Common Blocks
Viewing OpenMP THREADPRIVATE Common Blocks
Some compilers implement OpenMP THREADPRIVATE common blocks by using the thread local storage system facility. This facility stores a variable declared in OpenMP THREADPRIVATE common blocks at different memory locations in each thread in an OpenMP process. This allows the variable to have different values in each thread. In contrast, IBM and other compilers use the pthread key facility.
To view a variable in an OpenMP THREADPRIVATE common block or the OpenMP THREADPRIVATE common block:
1. In the Threads Tab of the Process Window, select the thread that contains the private copy of the variable or common block you want to view.
2. In the Stack Trace Pane of the Process Window, select the stack frame that lets you access the OpenMP THREADPRIVATE common block variable. You can select either the outlined routine or the original routine for an OpenMP master thread. You must, however, select the outlined routine for an OpenMP worker thread.
3. From the Process Window, dive on the variable name or common block name, or select the View > Lookup Variable command. When prompted, enter the name of the variable or common block. You may need to append an underscore character (_) after the common block name.
CLI: dprint
A Variable Window opens that displays the value of the variable or common block for the selected thread.
See "Displaying Variables" for more information on displaying variables.
4. To view OpenMP THREADPRIVATE common blocks or variables across all threads, use the Variable Window’s Show across > Threads command. See "Displaying a Variable in all Processes or Threads".
Figure 246 shows Variable Windows displaying OpenMP THREADPRIVATE common blocks. Because the Variable Window has the same thread context as the Process Window from which it was created, the title bar patterns for the same thread match. TotalView displays the values of the common block across all threads when you use the View > Show Across > Threads command.
Figure 246 – OpenMP THREADPRIVATE Common Block Variables