Cisco Systems ST373307LC Computer Drive User Manual


 
7-13
Cisco SFS InfiniBand Host Drivers User Guide for Linux
OL-12309-01
Chapter 7 MVAPICH MPI
Compiling MPI Programs
Step 3 Select the language and compiler of your choice from the selection of compiler wrappers available in
Table 7-2.
Step 4 Compile the examples as shown here:
host1$ cd $HOME/mpi-examples
host1$ mpicc.i -o hello_c hello_c.c
host1$ mpiCC.i -o hello_cxx hello_cxx.cc
host1$ mpif77.i -o hello_f77 hello_f77.f
host1$ mpif90.i -o hello_f90 hello_f90.f90
Note The example above uses the Intel compiler. Change the command names as listed in Table 7-2
if you are using the GNU or the PGI compiler.
Step 5 If the $HOME/mpi-examples directory is not shared across all hosts in the cluster, copy the executables
to a directory that is shared across all hosts, such as to a directory on a network file system.
Step 6 Run the MPI program.
The following example shows how to run an MVAPICH MPI C program Hello World:
host1$ mpirun_rsh -np 2 -hostfile /tmp/hostfile $HOME/mpi-examples/hello_c
Hello, world, I am 0 of 2
Hello, world, I am 1 of 2
Table 7-2 Selecting Language and Compiler Wrappers
Language Compiler
GNU Intel PGI
C mpicc mpicc.i not applicable
C++ mpiCC mpiCC.i not applicable
Fortran 77 mpif77 mpif77.i mpif77.p
Fortran 90 not applicable mpif90.i mpif90.p