The basic outline of an MPI program follows these general steps:

  1. Initialize communications
  2. Communicate to share data between processes
  3. 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
leave the MPI environment
 
©   Cornell University  |  Center for Advanced Computing  |  Copyright Statement  |  Inclusivity Statement