Biomedical Engineering Reference
In-Depth Information
Figure 6. Typical structure of an MPI parallel program.
Using point-to-point communication subroutines, a message is sent by one
process and received by another. We distinguish between unidirectional and bidi-
rectional communications. At the sending process, the data are first collected into
the user sendbuffer (scalar variables or arrays used in the program), and then one
of the MPI send subroutines is called, the system copies the data from the user
sendbuffer to system buffer , and finally the system sends the data from the sys-
tem buffer to the destination process. During the receiving process, one of the
MPI receive subroutines is called, the system receives the data from the source
process, and copies it to the system buffer , and then the system copies the data
from the system buffer to the user recvbuffer , and finally the data can be used by
the receiving process. In MPI, there are two modes of communication: blocking
and non-blocking. Using blocking communication subroutines, the program will
not return from the subroutine call until the copy to/from the system buffer has
finished. Using non-blocking communication subroutines such as MPI Isend and
MPI Irecv, the program immediately returns from the subroutine call. This indi-
cates that the copy to/from the system buffer is only initiated, so one has to assure
that it is also completed by using the MPI Wait subroutine. In other cases, incor-
rect data could be copied to the system buffer. In spite of the higher complexity of
non-blocking subroutines, we generally prefer them, because their usage is more
safe from deadlock in bidirectional communication. Deadlocks can take place
either due to the incorrect order of blocking send and receive subroutines or due
to the limited size of the system buffer, and when a deadlock occurs, the involved
processes will not proceed any further.
In the next subsection we show how the message-passing subroutines men-
tioned above are employed to parallelize the 3D semi-implicit co-volume subjec-
tive surface segmentation method.
 
Search WWH ::




Custom Search