Table of Contents
This chapter explains how to compile and link MPI
applications using the adapted version of MPIch2 coming with
ParaStation MPI. Within this chapter it is assumed that this version of MPI is
installed in the default location, i.e.
/opt/parastation/mpi2. If this is not the case please
refer to the section “Installing MPI” within the ParaStation MPI Administrator's Guide
in order to setup things correctly.
Furthermore it is assumed that the directory
/opt/parastation/mpi2/bin is set within the
PATH environment variable.
This directory holds all MPI2 related commands, like
There are different versions of the ParaStation MPI environment available, depending on the hardware architecture and supported compilers. For x86, versions for GNU, Intel and Portland Group compilers are available. Likewise, for x86_64, versions for the GNU and Intel compiler are available. The libraries support all available languages and language options for the selected compiler, e.g. Fortran, Fortran90, C or C++. The different versions of the MPI library will be installed in parallel, thus it is possible to compile and run applications using different compilers at the same node. For information about the directory structure used by ParaStation MPI, refer to ParaStation MPI Administrator's Guide .
This chapter is not intended to be a tutorial on how to use the MPI message passing interface. It is assumed that the reader knows how to write MPI applications and how to compile programs in general on the platform ParaStation MPI is running on. If you don't know about MPI yet the MPI homepage is a good starting point to learn more about the Message Passing Interface.
Within this section it is assumed to have a working C source code stored
prog.c, which uses MPI to exchange messages between
the different processes of the parallel task. In order to create an
executable from this source code, all that has to be done is:
$ mpicc prog.c -o prog
This will create the executable
prog from the source
code. Notice that the header file
mpi.h and the
libraries needed to link the programs are found automatically.
Furthermore you don't have to deal with the names of the libraries needed
for linking. The actual MPI library and further libraries containing the
low level communication calls are also linked automatically.
If your code is scattered to various source files, building is as easy as in the example above. First compile all the source files using
$ mpicc -c *.c
and afterwards link everything together:
$ mpicc *.o -o prog
Compiling of Fortran 77, Fortran 90 or C++ codes is very similar. Just replace the command mpicc by mpif77, mpif90 and mpiCC respectively.