The basic outline of an MPI program follows these general steps:
- Initialize communications
- Communicate to share data between processes
- Exit in a "clean" fashion from the message-passing system when done communicating
A programmer new to MPI can usually make do with only six functions.
These functions, illustrated and discussed in our sample program are:
- Initialize communications
- MPI_INIT initializes the MPI environment
- MPI_COMM_SIZE returns the number of processes
- MPI_COMM_RANK returns this process's number (rank)
- Communicate to share data between processes
-
MPI_SEND sends a message
-
MPI_RECV receives a message
- Exit from the message-passing system
-
MPI_FINALIZE