148
M. Nakao
strong and weak points, it is difficult to develop all parallel applications using just
one programming language.
In order to exploit the advantages of a PGAS language, it is important to
consider the linkage between the PGAS language and other languages. For example,
modifying only a part where the performance or code outlook will be better using
a PGAS language has the potential to partially alleviate the two problems listed in
the previous paragraph because the programming cost of partial re-implementation
is smaller than that of whole re-implementation.
We have designed an XMP language, and developed Omni compiler described in
Chapter 2. This chapter describes the development of linkage functions between
XMP and MPI library for Omni compiler. Moreover, it also describes how to
call XMP program from Python program. Especially, since Python has numerous
scientific computing libraries, we believe that linking Python and XMP will lead to
a significant reduction in programming cost when developing HPC applications.
2 Translation by Omni Compiler
Figure 1 shows an example of a code translation for XMP in C language, where
the code of the left figure is translated into that of the right figure. 2 Omni
compiler inserts xmp_init_all() and xmp_finalize_all() automatically to perform
the initialization and finalization processes, respectively. These functions are defined
in Omni compiler runtime library. Since xmp_init_all() calls MPI_Init() and
MPI_Comm_dup() internally to duplicate MPI_COMM_WORLD. Since the
newly duplicated communicator is used to perform XMP communication, user
MPI communication does not conflict with XMP communication. Additionally,
xmp_finalize_all() calls MPI_Finalize() function internally.
In an XMP program, the task directive can divide a node set. The implementation
of the task directive creates a new communicator based on the duplicated communicator by MPI_Comm_split(). If communication occurs within the range of the
task directive, then the new communicator is used to perform the communication.
Omni compiler renames a user main() as xmpc_main() in order to place the
xmpc_main() between xmp_init_all() and xmp_finalize_all(). New main() calls
xmpc_main(). The above special translation is performed only for main(). For other
functions (such as foo()), renaming is not performed.
2 Since Omni compiler performs almost the same operation for an XMP in Fortran code, these
examples are omitted in this chapter.
Précédent

- 155/265

Suivant