Simple example programs to get you started with the MPI (Message Passing Interface) API commonly used for massively parallel, high performance compute tasks. The makefile is here.
Hello World!
- helloC.c helloCPP.cc helloF77.f77 helloF90.f90
- In the best K&R tradition, this is the "Hello World" program for MPI! I have provided C, C++, Fortran 90, and FORTRAN 77 versions just to give you an idea what the three language interfaces to MPI look like.
- intStuffC.c
- Illustrates how to check for MPI errors (stuff left out of the "Hello World" programs for reasons of clarity).
Simple Blocking Point to Point Communication
- sendRecvC.c
- Simple example of send/recv as typically used with no error checking.
- sendRecvErrC.c
- Illustrates a simple way to avoid deadlock in the face of slave failure while using point to point blocking I/O.
Collective Communication
- reduceC.c
- Illustrates the
MPI_Gather,MPI_Bcast, andMPI_Reducefunctions.
Communication Groups
- groupsC.c
- Illustrates a typical use of MPI groups and communicators.
Miscellaneous Topics
- barrierC.c
- Simple synchronization with the
MPI_Barrierfunction.
MPI Implementation Specific
- runOpenMPIjob.sh
- Simple little script that creates a host file and runs an MPI job with Open MPI. Note that the
runLAMjob.shandrunMPICHjob.shscripts are no longer here as I no longer use LAM or MPICH.