x
Loading
 Loading
Hello, Guest | Login | Register

Using Derived Data Types with MPI

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

Please log in to view this content.

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

Not Yet a Member?

Register with LinuxMagazine.com and get free access to the entire archive, including:

  • Hands-on Content
  • White Papers
  • Community Features
  • And more.
Already a Member?
Log in!
Username

Password

Remember me

Forgotten your password?
Forgotten your username?
Read More
  1. Scheduling HPC In The Cloud
  2. GP-GPUs: OpenCL Is Ready For The Heavy Lifting
  3. HPC Madness: March Is More Cores Month
  4. HPC Turn-Offs: Power Control
  5. The Cost to Play: CUDA Programming
Follow Linux Magazine
Rackspace