Displaying a Variable in all Processes or Threads
When you’re debugging a parallel program running many instances of the same executable, you usually need to view or update the value of a variable in all of the processes or threads at once.
Before displaying a variable’s value in all threads or processes, you must display an instance of the variable in a Variable Window. In this window, use one of the following commands:
View > Show Across > None, returns the window to what it was before you used other Show Across commands.
NOTE: You cannot simultaneously Show Across processes and threads in the same Variable Window.
After selecting a command, the Variable Window provides an array-like display of the value of the variable in each process or thread.
Figure 167 shows a simple, scalar variable in each of the processes in an OpenMP program.
When looking for a matching stack frame, TotalView matches frames starting from the top
frame, and considers calls from different memory or stack locations to be different calls. For example, the following definition of
recurse() contains two additional calls to
recurse(). Each of these calls generates a nonmatching
call frame.
void recurse(int i) {
if (i <= 0)
return;
if (i & 1)
recurse(i - 1);
else
recurse(i - 1);
}
If the variables are at different addresses in the different processes or threads, the field to the left of the Address field displays Multiple, and the unique addresses appear with each data item.
TotalView also lets you Show Across arrays and structures. When you Show Across an array, TotalView displays each element in the array across all processes. You can use a slice to select elements to be displayed in an “across” display. The following figure shows the result of applying a Show Across > Processes command to an array of structures.