Section: 3.9 Good programming practice with SMC
3.9 Good programming practice with SMC
3.9.1 Matching MPI_Recv() with MPI_Probe()
During development and testing of SMC, Scali has come across several application programs with the following code sequence:
while (...) {
MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, comm, sts); if
MPI_Recv(buf, cnt, dtype, MPI_ANY_SOURCE, MPI_ANY_TAG, comm, sts); doStuff();
}
doOtherStuff();
}
For MPI implementations that have one, and only one,
To make the program work as expected, the code sequence should be corrected to:
while (...) {
MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, comm, sts); if
MPI_Recv(buf, cnt, dtype,
}
doOtherStuff();
}
3.9.2 Using MPI_Isend(), MPI_Irecv()
If communication and calculations do not overlap, using immediate calls, e.g., MPI_Isend() and MPI_Irecv(), is usually performance ineffective.
3.9.3 Using MPI_Bsend()
Using buffered send, e.g., MPI_Bsend(), usually degrade performance significantly in comparison with their unbuffered relatives.
3.9.4 Avoid starving MPI-processes - fairness
MPI programs may, if not special care is taken, be unfair and may starve
3.16in the MPI 1.1 standard [1]. Fairness can also be enforced, e.g. through the use of several tags or separate communicators.
Scali MPI Connect Release 4.4 Users Guide | 32 |