MPI

The standard API for message-passing parallel programs.

The Resources web page has a link to a good online API reference for MPI.

Basic functions:

MPI_Init
Must preceed the use of any other MPI functions

MPI_Comm_rank
Find out the “rank” of a process. The rank is between 0 and p - 1, where p is the total number of processes.

MPI_Comm_size
Find out the total number of processes.

MPI_Send
Send a message. Messages are arrays of data elements. The recipient process is identified by its rank.

MPI_Recv
Receive a message sent by another process. The sender from which the process wants to receive is identified by its rank.

MPI_Finalize
Called when the program is done and ready to clean-up any MPI-related resouces.

Lab 1

Link: Lab 1

Using MPI, write a parallel program to compute the sum of the integers from 1..n, for a value of n input by the user.