Technical data
Writing Parallel Fortran
73
REDUCTION
The REDUCTION clause lists those variables involved in a reduction
operation. The meaning and use of reductions are discussed in Example 4 of
“Breaking Data Dependencies” on page 85. An element of the REDUCTION
list must be an individual variable (also called a scalar variable) and may not
be an array. However, it may be an individual element of an array. In this
case, it would appear in the list with the proper subscripts.
It is possible for one element of an array to be used in a reduction operation,
while other elements of the array are used in other ways. To allow for this, if
an element of an array appears in the REDUCTION list, it is legal for that
array also to appear in the SHARE list.
There are four types of reduction supported: sum(+), product(*), min(), and
max(). Note that min(max) reductions must use the min(max) functions in
order to be recognized correctly.
The compiler makes some simple checks to confirm that the reduction
expression is legal. The compiler does not, however, check all statements in
the DO loop for illegal reductions. It is up to the programmer to assure legal
use of the reduction variable.
IF
The IF clause gives a logical expression that is evaluated just before the loop
is executed. If the expression is TRUE, the loop is executed in parallel. If the
expression is FALSE, the loop is executed serially. Typically, the expression
tests the number of times the loop will execute to be sure that there is enough
work in the loop to amortize the overhead of parallel execution. Currently,
the break-even point is about 400 CPU clocks of work, which normally
translates to about 100 floating point operations.
MP_SCHEDTYPE, CHUNK
These options affect the way the work in the loop is scheduled among the
participating tasks. They do not affect the correctness of the loop. They are
useful for tuning the performance of critical loops. See “Load Balancing” on
page 95 for more details.










