TotalView User Guide : Part IV: Advanced Tools, Configuration, and Customization : Setting Up Parallel Debugging Sessions : Debugging OpenMP Applications : Viewing OpenMP Private and Shared Variables
Viewing OpenMP Private and Shared Variables
You can view both OpenMP private and shared variables.
The compiler maintains OpenMP private variables in the outlined routine, and treats them like local variables. See Displaying Local Variables and Registers”. In contrast, the compiler maintains OpenMP shared variables in the master thread’s original routine stack frame.
You can display shared variables through a Process Window focused on the OpenMP master thread, or through one of the OpenMP worker threads.
To see these variables:
1 Select the outlined routine in the Stack Trace Pane, or select the original routine stack frame in the OpenMP master thread.
2 Dive on the variable name, or select the View > Lookup Variable command. When prompted, enter the variable name.
CLI: dprint
You will need to set your focus to the OpenMP master thread first.
A Variable Window is launched that displays the value of the OpenMP shared variable, as shown in Figure 234.
Figure 234: OpenMP Shared Variable
Shared variables reside in the OpenMP master thread’s stack. When displaying shared variables in OpenMP worker threads, TotalView uses the stack context of the OpenMP master thread to find the shared variable. TotalView uses the OpenMP master thread’s context when displaying the shared variable in a Variable Window.
You can also view OpenMP shared variables in the Stack Frame Pane by selecting either of the following:
*Original routine stack frame in the OpenMP master thread.
*Stack parent token line in the Stack Trace Pane of OpenMP worker threads.