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 need to first set your focus to the OpenMP master thread.
A Variable Window is launched that displays the value of the OpenMP shared variable, as shown in Figure 245.
Figure 245, 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.