







Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!








MPI defines a standard library for message-passingthat can be used to develop portable message-passing programs using either C or Fortran.
-^
The MPI standard defines both the syntax as well asthe semantics of a core set of library routines.
-^
Vendor implementations of MPI are available onalmost all commercial parallel computers.
-^
It is possible to write (min) fully-functional message-passing programs by using only the six routines.
The minimal set of MPI routines.
MPI_Init
Initializes MPI.
MPI_Finalize
Terminates MPI.
MPI_Comm_size
Determines the number of processes.
MPI_Comm_rank
Determines the label of calling process.
MPI_Send
Sends a message.
MPI_Recv
Receives a message.
A communicator defines a
communication
domain
to communicate with each other.
-^
Information about communication domains isstored in variables of type MPI_Comm.
-^
Communicators are used as arguments to allmessage transfer MPI routines.
-^
A process can belong to many different(possibly overlapping) communicationdomains.
-^
MPI defines a default communicator calledMPI_COMM_WORLD which includes all theprocesses.
-^
-^
-^
MPI Datatype
C Datatype
MPI_CHAR
signed char
MPI_SHORT
signed short int
MPI_INT
signed int
MPI_LONG
signed long int
MPI_UNSIGNED_CHAR
unsigned char
MPI_UNSIGNED_SHORT
unsigned short int
MPI_UNSIGNED
unsigned int
MPI_UNSIGNED_LONG
unsigned long int
MPI_FLOAT
float
MPI_DOUBLE
double
MPI_LONG_DOUBLE
long double
MPI_BYTEMPI_PACKED
MPI provides equivalent datatypes for all C datatypes. This is done for portability reasons.The datatype MPI_BYTE corresponds to a byte (8 bits) and MPI_PACKED correspondsto a collection of data items that has been created by packing non-contiguous data.
The basic functions for sending and receiving messages inMPI are the MPI_Send and MPI_Recv, respectively.
-^
The calling sequences of these routines are as follows: int MPI_Send (void *buf, int count, MPI_Datatype datatype,
int dest, int tag, MPI_Comm comm)
int MPI_Recv (void *buf, int count, MPI_Datatype datatype,
int source, int tag, MPI_Comm comm,
MPI_Status *status)
On the receiving end, the status variable can be usedto get information about the
MPI_Recv
operation.
The corresponding data structure contains:
typedef struct MPI_Status {
int MPI_SOURCE;int MPI_TAG;int MPI_ERROR; };
The MPI_Get_count function returns the precise countof data items received.
**int MPI_Get_count(MPI_Status status,MPI_Datatype datatype, int count)
(N > p , N mod p = 0)