Coarrays in the Context of XcalableMP
101
2.4 Synchronization
The access order of coarrays between images is explicitly controlled by the
programmer using the image control statement, such as SYNC ALL and SYNC
IMAGES statements. The statement allows the compiler system to make PUT/GET
communication asynchronous. The sequence of execution between the image
control statements is called as a segment. An asynchronous communication must
be completed by the end of the segment.
Inside each image, the compiler must maintain data dependency as before,
even if the program contains coarray communications. The compiler must suppress
the non-blocking communication, which postpones waiting for communication
completion. In order to keep data dependency among the definitions and references
to the same coarray in the same segment, non-blocking communication should be
restricted. The example below in which the same remote coarray is accessed a
number of times inside the same segment.
1
if (this_image()==1) then
2
a[2]=
3
=a[2]
4
a[2]=
5
a[2]=
6
endif
Between lines 2 and 3, the completion wait for PUT communication is necessary
in order to avoid referencing data that is not defined completely. Similarly, between
lines 3 and 4, the completion wait for GET communication is necessary in order to
avoid referencing data that is being updated. However, between lines 4 and 5, the
completion wait is not necessary. The issue of race condition on image 2 cannot be
avoided by the completion wait on image 1 in general, and avoiding this issue is up
to the programmer.
Requirement for the Implementation Unless the same remote data is accessed
from the same segment, non-blocking completion can be delayed until the end
of the segment. Since the data received by the GET communication is usually
referenced soon, non-blocking GET communication is hard to use. Therefore,
if GET communication is always on blocking, then only the flow dependency
(between lines 2 and 3) should be considered.
2.5 Subarrays and Data Contiguity
Except for a dummy argument, an array is fully contiguous across the dimensions.
A subarray of the array can be fully or partially contiguous or non-contiguous. For
example, if an array is declared with the shape a(1:M,1:N), then the whole array
(referenced as a or a(:,:) or a(1:M,1:N)) is fully contiguous and a subarray
a(2:5,3) is partially contiguous. We defined a term contiguous length as the
Précédent

- 108/265

Suivant