Jump to my Home Page Send me a message Check out stuff on GitHub Check out my photography on Instagram Check out my profile on LinkedIn Check me out on Facebook

Example MPI Programs

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.cpp 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.
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

Simple example of send/recv as typically used with no error checking.
Illustrates a simple way to avoid deadlock in the face of slave failure while using point to point blocking I/O.

Collective Communication

Illustrates the MPI_Gather, MPI_Bcast, and MPI_Reduce functions.

Communication Groups

Illustrates a typical use of MPI groups and communicators.

Miscellaneous Topics

Simple synchronization with the MPI_Barrier function.

MPI Implementation Specific

Simple little script that creates a host file and runs an MPI job with Open MPI. Note that the runLAMjob.sh and runMPICHjob.sh scripts are no longer here as I no longer use LAM or MPICH.
© 2009 Mitch Richling