Most programs written for distributed memory, parallel computers, including Beowulf clusters, utilize the Message Passing Interface (MPI) or Parallel Virtual Machine (PVM) programming interfaces to exchange data or messages among processes. In the past, this column has presented many of the fundamentals of message passing and has shown a number of programming examples using both MPI and PVM. Last month’s column focused on the master/slave model of parallelism using MPI, and introduced the MPI_Probe() routine. This month, let’s discuss another advanced feature of MPI: how to use derived data types.
Most programs written for distributed memory, parallel computers, including Beowulf clusters, utilize the Message Passing Interface (MPI) or Parallel Virtual Machine (PVM) programming interfaces to exchange data or messages among processes. In the past, this column has presented many of the fundamentals of message passing and has shown a number of programming examples using both MPI and PVM. Last month’s column focused on the master/slave model of parallelism using MPI, and introduced the MPI_Probe() routine. This month, let’s discuss another advanced feature of MPI: how to use derived data types.
Data Is More than Elementary
Up to now, all of the parallel code examples you’ve seen in this column have exchanged (as messages) contiguous data from simple homogeneous data types such as integers or doubles. But the elementary data types built into MPI, listed in Table One, inadequately represent the diverse kinds of data structures used in most parallel codes. While it’s true that data can be copied into (and back out of) contiguous and homogeneous buffers of these fundamental data types for message passing, additional coding effort is required, additional memory is needed on both the sending and receiving nodes, and additional CPU time is consumed by the sending and receiving processes.
Table One: Elementary MPI data types for C and FORTRAN
C
FORTRAN
MPI_CHAR
MPI_INTEGER
MPI_SHORT
MPI_REAL
MPI_INT
MPI_DOUBLE_PRECISION
MPI_LONG
MPI_COMPLEX
MPI_UNSIGNED_CHAR
MPI_DOUBLE_COMPLEX
MPI_UNSIGNED_SHORT
MPI_LOGICAL
MPI_UNSIGNED
MPI_CHARACTER
MPI_UNSIGNED_LONG
MPI_BYTE
MPI_FLOAT
MPI_PACKED
MPI_DOUBLE
MPI_LONG_DOUBLE
MPI_BYTE
MPI_PACKED
…
Please log in to view this content.
Not Yet a Member?
Register with LinuxMagazine.com and get free access to the entire archive, including: