Cornell Theory Center

Presentation:
Basics of MPI Programming

10/98

This is the presentation layer of a two-part module. For an explanation of the layers and how to navigate within and between them, return to the top page of this module.


Table of Contents

  1. Overview of MPI
    1.1 What Is MPI?
    1.2 What does MPI offer?
    1.3 MPI at the Cornell Theory Center
    1.4 How to use MPI
  2. MPI programs
    2.1 Format of MPI routines
    2.2 MPI routines
    2.3 An MPI sample program
  3. MPI messages
    3.1 Data
    3.2 Envelope
  4. Communicators
    4.1 Why have communicators?
    4.2 Communicators and process groups
  5. Summary

References Lab Exercises Evaluation

[Table of Contents] [Section 1] [Section 2] [Section 3] [Section 4] [Section 5] [More Detail]


1. Overview

1.1 What Is MPI?

1.2 What does MPI offer?


1.3 MPI at the Cornell Theory Center


1.4 How to Use MPI

[Table of Contents] [Section 1] [Section 2] [Section 3] [Section 4] [Section 5] [More Detail]


2. MPI programs

2.1 Format of MPI routines


2.2 MPI routines


2.3 An MPI sample program (Fortran)

Shows 6 basic calls

Click here for C version

   program hello
   include 'mpif.h'
   integer rank, size, ierror, tag, status(MPI_STATUS_SIZE)
   character(12) message
	
   call MPI_INIT(ierror)
   call MPI_COMM_SIZE(MPI_COMM_WORLD, size, ierror)
   call MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierror)
   tag = 100

   if (rank .eq. 0) then
      message = 'Hello, world'
      do i=1, size-1
         call MPI_SEND(message, 12, MPI_CHARACTER, i, tag,
  &                    MPI_COMM_WORLD, ierror)
      enddo

   else
    	 call MPI_RECV(message, 12, MPI_CHARACTER, 0, tag,
  &                    MPI_COMM_WORLD, status, ierror)
   endif

   print*, 'node', rank, ':', message
   call MPI_FINALIZE(ierror)
   end
[Table of Contents] [Section 1] [Section 2] [Section 3] [Section 4] [Section 5] [More Detail]


3. MPI messages

Message = data + envelope

 call MPI_SEND(startbuf,count,datatype,
                   \     |    /
                    ---DATA--- 

                 dest,tag,comm,  ierror)
                   \   |   /
                    ENVELOPE


3.1 Data


3.2 Envelope

Arguments [Table of Contents] [Section 1] [Section 2] [Section 3] [Section 4] [Section 5] [More Detail]


4. Communicators

4.1 Why have communicators?

Animation


4.2 Communicators and process groups

[Table of Contents] [Section 1] [Section 2] [Section 3] [Section 4] [Section 5] [More Detail]


5. Summary

[Table of Contents] [Section 1] [Section 2] [Section 3] [Section 4] [Section 5] [More Detail]


References

Message Passing Interface Forum (1995) MPI: A Message Passing Interface Standard. June 12, 1995. Available
online or in postscript.

IBM manual for their implementation of MPI is available online

CTC's MPI Documentation


[Exercise] Lab exercises for MPI Basics

[Evaluation] Please complete this short evaluation form. Thank you!


[CTC Home Page] [Search] [Education]
[Copyright Statement] [Feedback] [Resources]

URL http://www.tc.cornell.edu/Edu/Talks/MPI/Basic/less.html