50
H. Murai et al.
integer :: a(16), b(16)
!$xmp align a(i) with t1(i)
!$xmp align b(i) with t2(i)
10
:
!$xmp gmove
a(:) = b(:)
In this example (Fig. 37), the elements of an array b that is distributed in a block
manner are copied to the corresponding elements of an array a that is distributed in
a generalized-block manner. For the arrays a and b, communication occurs if the
corresponding elements reside in different nodes (arrows illustrate communication
between nodes in the figures).
In the assignment statement, if a scalar (i.e. one element of an array or a variable)
is specified on the right-hand side and an array section is specified on the left-hand
side, a broadcast communication occurs for it.
XcalableMP C
#pragma xmp nodes p[4]
#pragma xmp template t[16]
#pragma xmp distribute t[block] onto p
int a[16], b[16];
5 #pragma xmp align a[i] with t[i]
#pragma xmp align b[i] with t[i]
:
#pragma xmp gmove
a[9:5] = b[0];
XcalableMP Fortran
!$xmp nodes p(4)
!$xmp template t(16)
!$xmp distribute t(block) onto p
integer :: a(16), b(16)
5 !$xmp align a(i) with t(i)
!$xmp align b(i) with t(i)
:
!$xmp gmove
a(10:14) = b(1)
In this example (Fig. 38), in XMP/C, an array element b[0] of node p[0] will
be broadcasted to the specified array section on node p[2] and p[3]. Similarly,
in XMP/Fortran, an array element b(1) of node p(1) will be broadcasted to the
specified array section on node p(3) and p(4).
Not only distributed arrays but also replicated arrays can be specified on the
right-hand side.
XcalableMP C
#pragma xmp nodes p[4]
#pragma xmp template t[16]
Précédent

- 58/265

Suivant