Fortran Programming Guide

REDUCTION(varlist)

The REDUCTION(varlist) qualifier specifies that all variables in the list varlist are reduction variables for the DOALL loop. A reduction variable (or array) is one whose partial values can be individually computed on various processors, and whose final value can be computed from all its partial values.

The presence of a list of reduction variables can aid the compiler in identifying if a DOALL loop is a reduction loop and in generating parallel reduction code for it.

Example: Specify a reduction variable:


C$PAR DOALL REDUCTION(x)
      do i = 1, n
        x = x + a(i)
      end do

In the preceding example, the variable x is a (sum) reduction variable; the i loop is a (sum) reduction loop.