Totalview Examining Arrays
Totalview Examining Arrays
Totalview Examining Arrays
Examining Arrays
version 8.6
Contents
Examining Arrays
Examining and Analyzing Arrays ......................................................................................... 1
Displaying Array Slices ................................................................................................. 2
Using Slices and Strides ............................................................................................ 2
Using Slices in the Lookup Variable Command ........................................................ 4
Array Slices and Array Sections .................................................................................... 4
Filtering Array Data Overview ....................................................................................... 5
Filtering by Comparison ............................................................................................ 6
Filtering for IEEE Values ............................................................................................ 7
Filtering a Range of Values ........................................................................................ 9
Creating Array Filter Expressions .............................................................................. 9
Using Filter Comparisons ........................................................................................ 10
Sorting Array Data ...................................................................................................... 10
Obtaining Array Statistics ........................................................................................... 11
Displaying a Variable in all Processes or Threads ............................................................. 13
Diving on a Show Across Pointer ............................................................................ 14
Editing a Show Across Variable ............................................................................... 14
Visualizing Array Data ....................................................................................................... 15
Visualizing a Show Across Variable Window ............................................................ 15
INDEX ........................................................................................................................................ 17
iii
iv
Contents
Examining Arrays
This chapter explains how to examine and change array data as you
debug your program. Since arrays also appear in the Variable Window, you need to be familiar with the information in Chapter 2,
Examining and Changing Data, on page v.
The topics in this chapter are:
Q
Q
Q
dprint an_array(n:m:p,q:r:s)
This syntax differs from Fortran 90 syntax in that Fortran 90 requires that
you explicitly enter the upper and lower bounds when youre reversing the
order for displaying array elements.
Because the default value for the stride is 1, you can omit the stride (and
the colon that precedes it) from your definition. For example, the following
two definitions display array elements 0 through 9:
[0:9:1]
[0:9]
If the lower and upper bounds are the same, just use a single number. For
example, the following two definitions tell TotalView to display array element 9:
[9:9:1]
[9]
The lower_bound, upper_bound, and stride must be constants. They cannot be expressions.
Example 1
A slice declaration of [::2] for a C or C++ array (with a default lower bound
of 0) tells TotalView to display elements with even indices of the array; that
is, 0, 2, 4, and so on. However, if this were defined for a Fortran array
(where the default lower bound is 1), TotalView displays elements with odd
indices of the array; that is, 1, 3, 5, and so on.
Example 2
The following figure displays a stride of (::9,::9). This definition displays the
four corners of a ten-element by ten-element Fortran array.
Example 3
You can use a stride to invert the order and skip elements. For example, the
following slice begins with the upper bound of the array and displays every
other element until it reaches the lower bound of the array:
(::2)
Using (::2) with a Fortran integer(10) array tells TotalView to display the
elements 10, 8, 6, 4, and 2.
Example 4
You can simultaneously invert the arrays order and limit its extent to display a small section of a large array. The following figure shows how to
After you enter this slice value, TotalView only shows elements in rows 2
and 3 of the array, beginning with column 10 and ending with column 7.
dprint small_array(5,5)
You can, of course, type an expression into the View > Lookup Variable
dialog box; for example, you could type small_array(i-1,j-1).
While the data in both is identical, notice that the array numbering is different. In addition, the array slice shows an address for the array. The section,
however, only exists within TotalView. Consequently, there is no address
associated with it.
Q
Q
If the filter operand or array element type is floating point, TotalView converts the operand to a double-precision floating-point value. TotalView
truncates extended-precision values to double precision. Converting integer or unsigned integer values to double-precision values might result in a
loss of precision. TotalView converts unsigned integer values to nonnegative double-precision values.
If the filter operand or the array element is an unsigned integer, TotalView
converts the operand to an unsigned 64-bit integer.
If both the filter operand and array element are of type integer, TotalView
converts the values to type 64-bit integer.
Filtering by Comparison
The simplest filters are ones whose formats are as follows:
operator value
where operator is either a C/C++ or Fortran-style comparison operator, and
value is a signed or unsigned integer constant or a floating-point number.
For example, the filter for displaying all values greater than 100 is:
> 100
C/C++ Operator
==
!=
<
<=
>
>=
Fortran Operator
.eq.
.ne.
.lt.
.le.
.gt.
.ge.
The following figure shows an array whose filter is < 0. This tells TotalView
to only display array elements whose value is less than 0 (zero). See
Figure 4 on page 7.
Meaning
NaN (Not a number), either quiet or signaling
Quiet NaN
Signaling NaN
Infinity, either positive or negative
Positive Infinity
Negative Infinity
Denormalized number, either positive or negative
Positive denormalized number
Negative denormalized number
If you are writing an expression, you can use the following Boolean functions to check for a particular type of value:
IEEE Intrinsic
$is_denorm(value)
$is_finite(value)
$is_inf(value)
$is_nan(value)
$is_ndenorm(value)
$is_ninf(value)
$is_nnorm(value)
$is_norm(value)
$is_nzero(value)
$is_pdenorm(value)
$is_pinf(value)
$is_pnorm(value)
$is_pzero(value)
$is_qnan(value)
$is_snan(value)
$is_zero(value)
Meaning
Is a denormalized number, either positive or negative
Is finite
Is Infinity, either positive or negative
Is a NaN (Not a number), either quiet or signaling
Is a negative denormalized number
Is negative Infinity
Is a negative normalized number
Is a normalized number, either positive or negative
Is negative zero
Is a positive denormalized number
Is positive Infinity
Is a positive normalized number
Is positive zero
Is a quiet NaN
Is a signaling NaN
Is zero, either positive or negative
The $value variable is a special TotalView variable that represents the current
array element. You can use this value when creating expressions.
Examining Arrays: version 8.6
Notice how the and and or operators are used in these expressions. The
way in which TotalView computes the results of an expression is identical
to the way it computes values at an eval point. For more information, see
Defining Eval Points and Conditional Breakpoints on page 18.
The only difference is that the first method is easier to type than the second, so youre more likely to use the second method when youre creating
more complicated expressions.
The first time you click, TotalView sorts the arrays values into ascending
order.
The next time you click on the header, TotalView reverses the order, sorting
the arrays values into descending order.
If you click again on the header, TotalView returns the array to its unsorted
order.
When you sort an arrays values, you are just rearranging the information
thats displayed in the Variable Window. Sorting does not change the order
10
in which values are stored in memory. If you alter what TotalView is displaying by using a filter or a slice, TotalView just sorts the values that could be
displayed; it doesnt sort all of the array.
If you are displaying the array created by a Show across commandsee
Displaying a Variable in all Processes or Threads on page 13 for more informationyou can sort your information by process or thread.
If you have added a filter or a slice, these statistics describe only the information currently being displayed; they do not describe the entire unfiltered
array. For example, if 90% of an arrays values are less than 0 and you filter
the array to show only values greater than 0, the median value is positive
even though the arrays real median value is less than 0.
TotalView displays the following statistics:
Q
Checksum
A checksum value for the array elements.
Count
The total number of displayed array values. If youre displaying a floatingpoint array, this number doesnt include NaN or Infinity values.
Denormalized Count
A count of the number of denormalized values found in a floating-point
array. This includes both negative and positive denormalized values as
defined in the IEEE floating-point standard. Unlike other floating-point
statistics, these elements participate in the statistical calculations.
11
12
Infinity Count
A count of the number of infinity values found in a floating-point array.
This includes both negative and positive infinity as defined in the IEEE
floating-point standard. These elements dont participate in statistical
calculations.
Lower Adjacent
This value provides an estimate of the lower limit of the distribution. Values below this limit are called outliers. The lower adjacent value is the first
quartile value minus the value of 1.5 times the difference between the first
and third quartiles.
Maximum
The largest array value.
Mean
The average value of array elements.
Median
The middle value. Half of the arrays values are less than the median, and
half are greater than the median.
Minimum
The smallest array value.
NaN Count
A count of the number of NaN (not a number) values found in a floatingpoint array. This includes both signaling and quiet NaNs as defined in the
IEEE floating-point standard. These elements dont participate in statistical calculations.
Quartiles, First and Third
Either the 25th or 75th percentile values. The first quartile value means
that 25% of the arrays values are less than this value and 75% are greater
than this value. In contrast, the third quartile value means that 75% of the
arrays values are less than this value and 25% are greater.
Standard Deviation
The standard deviation for the arrays values.
Sum
The sum of all the displayed arrays values.
Upper Adjacent
This value provides an estimate of the upper limit of the distribution. Values above this limit are called outliers. The upper adjacent value is the third
quartile value plus the value of 1.5 times the difference between the first
and third quartiles.
Zero Count
The number of elements whose value is 0.
View > Show Across > Process, displays the value of the variable in all
processes.
Q
Q
View > Show Across > Thread, displays the value of a variable in all
threads within a single process.
View > Show Across > None, returns the window to what it was before
you used other Show Across commands.
You cannot simultaneously Show Across processes and threads in the same Variable
Window.
After using one of these commands, the Variable Window switches to an
array-like display of information, and displays the value of the variable in
each process or thread. Figure 9 shows a simple, scalar variable in each of
the processes in an OpenMP program.
Figure 9: Viewing Across
Threads
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
13
14
15
16
Index
Symbols
$denorm filter 7
$inf filter 7
$is_denorm intrinsic function 8
$is_finite intrinsic function 8
$is_inf intrinsic function 8
$is_nan intrinsic function 8
$is_ndenorm intrinsic function 8
$is_ninf intrinsic function 8
$is_nnorm intrinsic function 8
$is_norm intrinsic function 8
$is_pdenorm intrinsic function 8
$is_pinf intrinsic function 8
$is_pnorm intrinsic function 8
$is_pzero intrinsic function 8
$is_qnan intrinsic function 8
$is_snan intrinsic function 8
$is_zero intrinsic function 8
$nan filter 7
$nanq filter 7
$nans filter 7
$ndenorm filter 7
$ninf filter 7
$pdenorm filter 7
$pinf filter 7
: as array separator 2
A
Array Data Filter by Range of Values
figure 9
array data filtering
by comparison 5
by range of values 9
for IEEE values 7
see also arrays, filtering
Array Data Filtering by Comparison figure 7
Array Data Filtering for IEEE Values figure 8
Array Statistics Window figure 11
arrays
C
C/C++
filter expression 9
checksum array statistic 11
CLI commands
dprint 2, 4
closed loop, see closed loop
colons as array separators 2
commands
Tools > Statistics 11
View > Lookup Variable 4
View > View Across > None 13
View > View Across > Process 13
View > View Across > Thread 13
comparisons in filters 10
conversion rules for filters 6
count array statistic 11
D
data filtering, see arrays, filtering
deferred shape array
definition 2
denorm filter 7
denormalized count array statistic 11
DENORMs 5
displaying
arrays 1, 2
diving
in a "view acrosss" pane 14
dprint command 2, 4
E
editing
view across data 14
F
figures
Array Data Filter by Range of Values 9
Array Data Filtering by Comparison 7
Array Data Filtering for IEEE Values
8
17
I
Array Statistics Window 11
Fortran Array with Inverse Order
and Limited Extent 4
Sorted Variable Window 10
Stride Displaying the Four Corners
of an Array 3
Viewing Across an Array of Structures 14
Viewing Across Threads 13
filter expression, matching 5
filtering
array data 5, 6
array expressions 9
by comparison 6
comparison operators 6
conversion rules 6
example 6
IEEE values 7
options 5
ranges of values 9
unsigned comparisons 7
filters 10
$denorm 7
$inf 7
$nan 7
$nanq 7
$nans 7
$ninf 7
$pdenorm 7
$pinf 7
comparisons 10
Fortran
filter expression 9
Fortran Array with Inverse Order and
Limited Extent figure 4
functions
IEEE 8
I
IEEE functions 8
inf filter 7
infinite loop, see loop, infinite
infinity count array statistic 12
INFs 5
intrinsic functions
$is_Inf 8
$is_inf 8
$is_nan 8
$is_ndenorm 8
$is_ninf 8
$is_nnorm 8
$is_norm 8
$is_pdenorm 8
$is_pinf 8
$is_pnom 8
$is_pzero 8
$is_qnan 8
$is_snan 8
$is_zero 8
inverting array order 3
18
L
limiting array display 3
Lookup Variable command
specifying slices 4
loop infinite, see infinite loop
lower adjacent array statistic 12
lower bounds
of array slices 2
M
matching stack frames 13
maximum array statistic 12
mean array statistic 12
median array statistic 12
minimum array statistic 12
Multiple indicator 14
N
nan filter 7
nanq filter 7
NaNs 5, 7
array statistic 12
nans filter 7
ndenorm filter 7
ninf filter 7
None (lView Across) command 13
O
omitting array stride 3
outliers 12
P
pdenorm filter 7
pinf filter 7
pthreads, see threads
Q
quartiles array statistic 12
S
skipping elements 3
slices
defining 2
descriptions 4
examples 2, 3
lower bound 2
of arrays 2
stride elements 2
upper bound 2
with the variable command 4
Sorted Variable Window figure 10
sorting
array data 10
stack frame
matching 13
standard deviation array statistic 12
statistics for arrays 11
stride 2
default value of 3
elements 2
in array slices 2
omitting 3
Stride Displaying the Four Corners of
an Array figure 3
structures
viewing across 14
sum array statistic 12
T
testing for IEEE values 8
Tools > Statistics command 11
Tools > Visualize command 15
U
upper adjacent array statistic 12
upper bounds
of array slices 2
V
Variable Window
lView Across display 13
view across 14
variables
at different addresses 14
View Across display 13
View > Lookup Variable command
specifying slices 4
View > View Across > None command 13
View Across
arrays and structures 14
view across
editing data 14
View Across None command 13
viewing across
variables 13
Viewing Across an Array of Structures
figure 14
Viewing Across Threads figure 13
Viewing Across Variable Window 14
viewing across variables and processes 13
viewing acrosscross
diving in pane 14
Visualize command 15
Visualizer 15
Z
zero count array statistic 12