Cisco Systems ST373307LC Computer Drive User Manual


 
7-12
Cisco SFS InfiniBand Host Drivers User Guide for Linux
OL-12309-01
Chapter 7 MVAPICH MPI
Compiling MPI Programs
Compiling MPI Programs
This section describes how to compile MPI programs. Compiling MPI applications from source code
requires adding several compiler and linker flags. MVAPICH MPI provides wrapper compilers that add
all appropriate compiler and linker flags to the command line and then invoke the appropriate underlying
compiler, such as the GNU or Intel compilers, to actually perform the compile and/or link. This section
also provides examples of how to use the wrapper compilers. To compile MPI programs, perform the
following steps:
Step 1 Log in to your local host.
Step 2 Copy the example files to your $HOME directory.
The example files can be copied as follows:
host1$ cp -r /usr/local/topspin/mpi/examples $HOME/mpi/mpich/src/examples/hello
The files in the /usr/local/topspin/mpi/examples directory are sample MPI applications that are provided
both as a trivial primer to MPI as well as simple tests to ensure that your MPI installation works properly.
There are two MPI examples in the directory, each in four programming languages.
The following example shows Hello world:
The following example sends a trivial message around in a ring:
Note A comprehensive MPI tutorial is available at the following URL:
http://webct.ncsa.uiuc.edu:8900/public/MPI/
C hello_c.c
C++ hello_cxx.cc
F77 hello_f77.f
F90 hello_f90.f90
C ring_c.c
C++ ring_cxx.cc
F77 ring_f77.f
F90 ring_f90.f90