108
H. Iwashita and M. Nakao
low cost. Since the subscripts and image indices are often variable expressions, the
compiler rarely selects non-blocking communication and usually generates safe but
slow code. We do not have a reasonable solution for this issue.
In the current implementation, the user selects blocking or non-blocking for PUT
communication at runtime with the environment variable.
3.3.4 Optimization of GET Communication
A reference to an array-coindexed object is converted to a call of a runtime library
function that returns a Fortran array value. For example, array assignment statement:
b(j1:j2) = a(i1:i2)[k]
is converted to
b(j1:j2) = xmpf_coarray_get_generic(dp_a,k,a(i1:i2))
by the coarray translator, where dp_a is the descriptor of coarray a. The issue is
that the result of the library function is an array value, which causes several memory
copies. As a countermeasure, we optimized a specific but common case by the
translator. If a coindexed object is only the right-hand side of an array assignment
statement, then the entire assignment statement can be converted into a single library
call. The above example satisfies this condition and so can be converted again as
follows:
call xmpf_coarray_getsub_generic(dp_a,k,a(i1:i2),b(j1:j2))
In this runtime library subroutine, the variable b(j1:j2) is expected to be the
local target of GET communication, instead of the local buffer that would be
generated by the Fortran runtime.
3.4 Runtime Libraries
The layer of the runtime libraries is shown in Fig. 3. One of the three communication
libraries is selected at the build time of the Omni compiler. The coarray runtime
consists of three layered libraries. The Fortran wrapper mediates the arguments
and the result value of the translated user program (written in Fortran) and
the upper-layer runtime (ULR) (written in C). The (ULR) library performs the
algorithms described above in this section. The lower-layer runtime (LLR) library
abstracts the difference between the communication libraries, except for the memory
management of coarray data.
H. Iwashita and M. Nakao
low cost. Since the subscripts and image indices are often variable expressions, the
compiler rarely selects non-blocking communication and usually generates safe but
slow code. We do not have a reasonable solution for this issue.
In the current implementation, the user selects blocking or non-blocking for PUT
communication at runtime with the environment variable.
3.3.4 Optimization of GET Communication
A reference to an array-coindexed object is converted to a call of a runtime library
function that returns a Fortran array value. For example, array assignment statement:
b(j1:j2) = a(i1:i2)[k]
is converted to
b(j1:j2) = xmpf_coarray_get_generic(dp_a,k,a(i1:i2))
by the coarray translator, where dp_a is the descriptor of coarray a. The issue is
that the result of the library function is an array value, which causes several memory
copies. As a countermeasure, we optimized a specific but common case by the
translator. If a coindexed object is only the right-hand side of an array assignment
statement, then the entire assignment statement can be converted into a single library
call. The above example satisfies this condition and so can be converted again as
follows:
call xmpf_coarray_getsub_generic(dp_a,k,a(i1:i2),b(j1:j2))
In this runtime library subroutine, the variable b(j1:j2) is expected to be the
local target of GET communication, instead of the local buffer that would be
generated by the Fortran runtime.
3.4 Runtime Libraries
The layer of the runtime libraries is shown in Fig. 3. One of the three communication
libraries is selected at the build time of the Omni compiler. The coarray runtime
consists of three layered libraries. The Fortran wrapper mediates the arguments
and the result value of the translated user program (written in Fortran) and
the upper-layer runtime (ULR) (written in C). The (ULR) library performs the
algorithms described above in this section. The lower-layer runtime (LLR) library
abstracts the difference between the communication libraries, except for the memory
management of coarray data.
