XcalableMP Programming Model and Language
43
on the lower bound on p[0]; in XMP/Fortran, node p(1) sends an element a(1)
to the shadow area on the upper bound on node p(4), and p(4) sends a(16) to
the shadow area on the lower bound on p(1).
The shadow directive and reflect construct can be applied to arrays
distributed in multiple dimensions. The following programs are the examples for
two-dimensional distribution.
XcalableMP C
#pragma xmp nodes p[3][3]
#pragma xmp template t[9][9]
#pragma xmp distribute t[block][block] onto p
double a[9][9];
5 #pragma xmp align a[i][j] with t[i][j]
#pragma xmp shadow a[1][1]
:
#pragma xmp reflect (a)
XcalableMP Fortran
!$xmp nodes p(3,3)
!$xmp template t(9,9)
!$xmp distribute t(block,block) onto p
real :: a(9,9)
5 !$xmp align a(j,i) with t(j,i)
!$xmp shadow a(1,1)
:
!$xmp reflect (a)
The central node receives data from the surrounding eight nodes to update its
shadow areas (Fig. 32). The shadow areas of the other nodes are also updated, which
is omitted in the figure.
For some applications, data from ordinal directions are not necessary. In such
a case, the data communication from/to the ordinal directions can be avoided by
adding the orthogonal clause to a reflect construct (Fig. 33).
XcalableMP C
#pragma xmp reflect (a) orthogonal
XcalableMP Fortran
!$xmp reflect (a) orthogonal
Note The orthogonal clause is effective only for arrays more than one dimension of which is distributed.
43
on the lower bound on p[0]; in XMP/Fortran, node p(1) sends an element a(1)
to the shadow area on the upper bound on node p(4), and p(4) sends a(16) to
the shadow area on the lower bound on p(1).
The shadow directive and reflect construct can be applied to arrays
distributed in multiple dimensions. The following programs are the examples for
two-dimensional distribution.
XcalableMP C
#pragma xmp nodes p[3][3]
#pragma xmp template t[9][9]
#pragma xmp distribute t[block][block] onto p
double a[9][9];
5 #pragma xmp align a[i][j] with t[i][j]
#pragma xmp shadow a[1][1]
:
#pragma xmp reflect (a)
XcalableMP Fortran
!$xmp nodes p(3,3)
!$xmp template t(9,9)
!$xmp distribute t(block,block) onto p
real :: a(9,9)
5 !$xmp align a(j,i) with t(j,i)
!$xmp shadow a(1,1)
:
!$xmp reflect (a)
The central node receives data from the surrounding eight nodes to update its
shadow areas (Fig. 32). The shadow areas of the other nodes are also updated, which
is omitted in the figure.
For some applications, data from ordinal directions are not necessary. In such
a case, the data communication from/to the ordinal directions can be avoided by
adding the orthogonal clause to a reflect construct (Fig. 33).
XcalableMP C
#pragma xmp reflect (a) orthogonal
XcalableMP Fortran
!$xmp reflect (a) orthogonal
Note The orthogonal clause is effective only for arrays more than one dimension of which is distributed.
