The Message Passing Interface (MPI) is a
standard interface for parallel
programming. MPI is good, because it means
you only have to learn one standard for
writing parallel programs across many types
of machines from many vendors. However, it
is not exactly portable, since certain
semantics are left undefined in the
standard. Furthermore, performance is not
portable with MPI -- what works for one
cluster with Myrinet may not work well on a
shared memory machine. MPI has bindings
for C, C++, and Fortran.
The best way to get started with MPI is
by example. There are several tutorials
available on line. This
site has a listing of several. An
excellent tutorial can be found a the NCSA.
More general documentation can be found at
site for MPI. There are also several
written about MPI.
is an MPI implementation.
Here is an example of using mpich to call a program
called factor which has a source file mpich.c:
[bargle@brood01 factor]$ /opt/topspin/mpi/mpich/bin/mpicc -lm -o factor-mpich factor.c
We submit the following file.
# Special PBS control comments
#PBS -l nodes=4,walltime=60
# Set up the path
# Run the program
mpirun -np $( wc -l < $PBS_NODEFILE ) -hostfile $PBS_NODEFILE factor-mpich 2305843009213693953
The resulting output is:
Warning: no access to tty (Bad file descriptor).
Thus no job control in this shell.
Prime factors of 2305843009213693953: