Cornell Theory Center

Presentation:
Basics of MPI Programming

3/97

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 calls
    2.2 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
  6. Lab exercise
  7. References
  8. Evaluation

[Next Page] [More Detail]


1. Overview

1.1 What Is MPI?

[Previous Page] [Table of Contents] [Next Page] [More Detail]


1.2 What does MPI offer?

[Previous Page] [Table of Contents] [Next Page] [More Detail]


1.3 MPI at the Cornell Theory Center

[Previous Page] [Table of Contents] [Next Page] [More Detail]


1.4 How to Use MPI

[Previous Page] [Table of Contents] [Next Page] [More Detail]


2. MPI programs

2.1 Format of MPI calls

[Previous Page] [Table of Contents] [Next Page] [More Detail]

2.2 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

[Previous Page] [Table of Contents] [Next Page] [More Detail]


3. MPI messages

Message = data + envelope

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

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

[Previous Page] [Table of Contents] [Next Page] [More Detail]


3.1 Data

[Previous Page] [Table of Contents] [Next Page] [More Detail]


3.2 Envelope

Arguments

[Previous Page] [Table of Contents] [Next Page] [More Detail]


4. Communicators

4.1 Why have communicators?

Animation

[Previous Page] [Table of Contents] [Next Page] [More Detail]


4.2 Communicators and process groups

[Previous Page] [Table of Contents] [Next Page] [More Detail]


5. Summary

[Previous Page] [Table of Contents] [Next Page] [More Detail]


6. Lab exercise

[Exercise] Basics of MPI Programming: Lab

[Previous Page] [Table of Contents] [Next Page]


7. References

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

[Previous Page] [Table of Contents] [Next Page]


8. Evaluation

Congratulations! You've completed this module, Basics of MPI Programming. Please be kind enough to complete this short evaluation form. If you are planning to do the lab exercise, please return to the evaluation form after completing the lab. Thank you!

[Previous Page] [Table of Contents]


Return to: Workshop Materials * Virtual Workshop Modules * MPI Documentation

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

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