XcalableMP Programming Model and Language
39
Since it involves large overhead to copy a[i+1] from the neighboring node
to update each a[i], a technique of copying collectively the elements on the
neighboring node to the area added to the distributed array on each node is usually
adopted. In XMP, such additional area is called “shadow.”
4.1.1 Declaring Shadow
Shadow areas can be declared with the shadow directive. In the example below, an
array a has shadow areas of width one on both the lower and upper bounds.
XcalableMP C
#pragma xmp nodes p[4]
#pragma xmp template t[16]
#pragma xmp distribute t[block] onto p
double a[16];
5 #pragma xmp align a[i] with t[i]
#pragma xmp shadow a[1]
XcalableMP Fortran
!$xmp nodes p(4)
!$xmp template t(16)
!$xmp distribute t(block) onto p
real :: a(16)
5 !$xmp align a(i) with t(i)
!$xmp shadow a(1)
In the Fig. 27, shaded elements are those that each node owns and white ones are
shadow.
Note Arrays distributed in a cyclic manner cannot have shadow.
In some programs, it is natural that the widths of the shadow area on the lower
and upper bounds are different. There is also a case where the shadow area exists
Fig. 27 Example of shadow directive (1)
39
Since it involves large overhead to copy a[i+1] from the neighboring node
to update each a[i], a technique of copying collectively the elements on the
neighboring node to the area added to the distributed array on each node is usually
adopted. In XMP, such additional area is called “shadow.”
4.1.1 Declaring Shadow
Shadow areas can be declared with the shadow directive. In the example below, an
array a has shadow areas of width one on both the lower and upper bounds.
XcalableMP C
#pragma xmp nodes p[4]
#pragma xmp template t[16]
#pragma xmp distribute t[block] onto p
double a[16];
5 #pragma xmp align a[i] with t[i]
#pragma xmp shadow a[1]
XcalableMP Fortran
!$xmp nodes p(4)
!$xmp template t(16)
!$xmp distribute t(block) onto p
real :: a(16)
5 !$xmp align a(i) with t(i)
!$xmp shadow a(1)
In the Fig. 27, shaded elements are those that each node owns and white ones are
shadow.
Note Arrays distributed in a cyclic manner cannot have shadow.
In some programs, it is natural that the widths of the shadow area on the lower
and upper bounds are different. There is also a case where the shadow area exists
Fig. 27 Example of shadow directive (1)
