42
H. Murai et al.
Similarly, in XMP/Fortran, node p(2) sends an element a(5) to the shadow
area on the upper bound on node p(1) and a(8) to the shadow area on the lower
bound on p(3); p(1) sends an element a(4) to the shadow area on the lower
bound on p(2), and p(3) sends a(9) to the shadow area on the upper bound on
p(2).
The default behavior of a reflect directive is to update the whole of
the shadow area declared by the shadow directive. However, there are some
cases where a specific part of the shadow area is to be updated to reduce the
communication cost at a point of the code.
To update only a specific part of the shadow area, add the width clause to the
reflect directive.
The values on the left- and right-hand sides of a colon in the width clause
designate the widths on the lower and upper bounds to be updated, respectively. In
the example below, only the shadow area on the upper bound is updated (Fig. 30).
XcalableMP C
#pragma xmp reflect (a) width(0:1)
XcalableMP Fortran
!$xmp reflect (a) width(0:1)
Note If the widths of the shadow areas to be updated on the upper and lower bounds
are equal, that is, for example, width(1:1), you can abbreviate it as width(1).
Note It is not possible to update the shadow area on a particular node because
reflect is a collective operation.
The reflect directive does not update either the shadow area on the lower
bound on the leading node or that on the upper bound on the last node. However,
the values in such areas are needed for stencil computation if periodic boundary
conditions are used in the computation.
To update such areas, add a periodic qualifier into the width clause. Let’s
look at the following example where an array a having shadow areas of width one
on both the lower and upper bounds appears (Fig. 31).
XcalableMP C
#pragma xmp reflect (a) width(/periodic/1:1)
XcalableMP Fortran
!$xmp reflect (a) width(/periodic/1:1)
The periodic qualifier has the following effects, in addition to that of a normal
reflect directive: in XMP/C, node p[0] sends an element a[0] to the shadow
area on the upper bound on node p[3], and p[3] sends a[15] to the shadow area
Précédent

- 50/265

Suivant