MPI implementations have a default ―cutoff message size.
If the size of a
message is
less than the cutoff, it will be buffered. If the size of the message is
greater than the
cutoff, MPI Send will block.
MPI Recv always blocks until a matching message has been received.
Thus, when a call
to MPI Recv returns, we know that there is a message stored in the receive
buffer. There
is an alternate method for receiving a message, in which the system
checks whether a
matching message is available and returns, regardless of whether there is
one.
MPI requires that messages be nonovertaking. This means that if process
q sends two
messages to process r, then the first message sent by q must be available
to r before the
second message.
4.3 Point To Point And Collective Communication
4.3.1 Point to Point Communication
▪ Communications which involve one sender and one receiver
▪ Messages are sent between two processes
▪ Example:
o MPI_Send
o MPI_RECV
▪ Sends and Receives in a program should match
▪ Each message contains
The actual data that is to be sent
▪ The datatype of each element
▪ The number of elements the data consists
CS8083 MCP Notes UNIT IV
11 B.Shanmuga Sundari, AP/CSE
▪ An identification number for the message (tag)
▪ The ranks of the source and destination process
4.3.2 Collective Communication
Involve communication among all processes in a process group. Consider
the situation to
find global sum. Each process with rank greater than 0 is “telling process
0 what to do”
and then quitting. That is, each process with rank greater than 0 is, in
effect, saying “add
this number into the total.”
Process 0 is doing nearly all the work in computing the global sum, while
the other
processes are doing almost nothing.
Tree-structured communication
We might use a “binary tree structure” like that illustrated in Figure below:
In this
diagram, initially processes 1, 3, 5, and 7 send their values to processes 0,
2, 4, and 6,
respectively. Then processes 0, 2, 4, and 6 add the received values to
their original
values, and the process is repeated twice:
1. In the first phase:
Process 1 sends to 0, 3 sends to 2, 5 sends to 4, 7 sends to 6
Process 0, 2, 4 and 6 add in the received values
Processes 2 and 6 send their new values to process 0 and 4, respectively
Processes 0 and 4 add the received values into their new values.
2. In the second phase:
Process 4 sends its newest value to process 0.
Process 0 adds the received value to its newest value
To construct a tree structured global sum that uses different ‘process
pairings’, the pair
might be 0 and 4, 1 and 5, 2 and 6, 3 and 7 in the first phase. Then the
pair could be 0 and
2, 1 and 3 in the second, and 0 and 1 in final.