Mixed-Language Programming with XcalableMP
151
Since Omni compiler uses an MPI compiler as a native compiler internally, MPI
programs can also be compiled with the “xmpcc” command as follows:
$ xmpcc mpi.c -o mpi.o
Thus, it is also possible to execute all the compilation work using a single
command as follows:
$ xmpcc mpi.c xmp.c -o a.out
The execution binary is executed using the execution command provided by
user’s MPI environment as follows:
$ mpirun -np 4 a.out
3.2 Function to Call XMP Program from MPI Program
Table 2 shows the functions to call an XMP program from an MPI program.
These functions are defined in Appendix A.2 of the XMP specification version
1.4. Figure 3 shows an example of how to use these functions. In line 1 of the
left figure, an XMP header file is included to use functions in Table 2. In line 7,
xmp_init() initializes an XMP environment, and creates the XMP node set based
on the communicator specified in its argument. In line 8, foo() in the right figure is
called. In line 9, xmp_finalize() finalizes the XMP environment. Note that the XMP
functions must be placed between xmp_init() and xmp_finalize().
Though the xmp_init() is implemented to call the xmp_init_all() function
described in Sect. 2, it also performs the following ingenuities:
Table 2 Functions to call XMP program from MPI program [19]
Language Return value type Function
Description
XMP/C
Void
xmp_init(MPI_Comm) Initialize XMP environment
XMP/F
(None)
xmp_init(Integer)
XMP/C
Void
xmp_finalize(void)
Finalize XMP environment
XMP/F
(None)
xmp_finalize()
Précédent

- 158/265

Suivant