XcalableMP Programming Model and Language
63
Fig. 49 Remote write to a coarray
XcalableMP C
int a[10]:[ * ], b[10];
if (xmpc_this_image() == 0)
a[0:3]:[1] = b[3:3];
XcalableMP Fortran
integer a(10)[ * ]
integer b(10)
if (this_image() == 1) then
5
a(1:3)[2] = b(3:5)
end if
The integer in the square bracket specifies the target image index. The
image index is zero-based, in XMP/C, or one-based, in XMP/Fortran.
xmpc_this_image() in XMP/C and this_image() in XMP/Fortran return
the current image index.
In the above example, in XMP/C, an image zero puts b[3:3] to a[0:3] on
image one; in XMP/Fortran, an image one puts b(3:5) to a(1:3) on image two.
Figure 49 illustrates the put communication performed in the example.
5.4 Get Communication
When a coarray appears in the right-hand side of an assignment statement, it
involves get communication.
XcalableMP C
int a[10]:[ * ], b[10];
if (xmpc_this_image() == 0)
b[3:3] = a[0:3]:[1];
Précédent

- 71/265

Suivant