Parallel Programming With Message-Passing Interface (MPI)
Parallel Programming With Message-Passing Interface (MPI)
Melbourne, Australia
P P P Processors
www.gridbus.org
Interconnection Network
Messages Messages
1
Collective Communications MPI Routines – C and Fortran
2
Communicators Routines Derived Type Routines
3
Point-to-Point Communication Standard Send
Completes once the message has been sent
Communication between two processes Note: it may or may not have been received
Source process sends message to Programs should obey the following rules:
destination process It should not assume the send will complete before the
Communication takes place within a receive begins - can lead to deadlock
It should not assume the send will complete after the
communicator receive begins - can lead to non-determinism
Destination process is identified by its rank processes should be eager readers - they should guarantee
to receive all messages sent to them - else network
in the communicator overload
MPI provides four communication modes Can be implemented as either a buffered
for sending messages send or synchronous send
standard, synchronous, buffered, and ready
Only one mode for receiving
4
Buffered Send Ready Send
To be used on the sender only if he knows the
Guarantees to complete immediately matching receive has been posted
Copies message to buffer if necessary May improve performance on particular
implementation
To use buffered mode the user must Completes immediately
explicitly attach buffer space Guaranteed to succeed if receive is already posted
MPI_Bsend(void *buf, int count, MPI_Datatype Outcome is undefined in no receive posted
datatype, int dest, int tag, MPI_Comm comm) Requires careful attention to messaging patterns
MPI_Buffer_attach(void *buf, int size) MPI_Rsend(buf, count, datatype, dest, tag, comm)
process 0 process 1
Only one buffer can de attached at any one non-blocking receive with tag 0
5
This document was created with Win2PDF available at http://www.daneprairie.com.
The unregistered version of Win2PDF is for evaluation or non-commercial use only.