Talk:OpenMP
From CSI 702
I created an initial outline so we can start editing individual sections without (hopefully) overwriting each other's work. Feel free to change the outline if you think something else makes more sense.
-thomas Tboggs 20:19, 9 April 2010 (EDT)
I removed the following from the page to avoid confusion because it is a review of MPI (not OpenMP) and the same material is already presented on the Basic MPI - Few Paradigms page.
-thomas Tboggs 18:27, 14 April 2010 (EDT)
Overview
Definition of Terms
- node - a box usually containing a processor, local memory, and a disk
- cluster - a group of nodes held together by networking
The ESSENTIAL Truths
EACH NODE IS RUNNING THE PROGRAM SEPARATELY ALL DATA NEEDED MUST BE EXPLICITLY PASSED BETWEEN PROCESSORS.
Example 1
Imagine you have to read a data file before the program can executes. You have two choices:
- read the data from the root node and pass information to all other nodes
- copy the data file to all other nodes, and let them read itlocally
Both of these have disadvantages and advantages, depending on your application.
Example 2
Imagine that you have completed some local calculation, but other nodes need to have this updated data.
YOU MUST EXPLICITLY COMMUNICATE THE DATA TO THE OTHER PROCESSORS.
Very Basic MPI - Fortran
All Fortran and Fortran 90 MPI codes have four calls in common.
include "mpif.h" call MPI_INIT(ierr) call MPI_COMM_RANK(MPI_COMM_WORLD, my_id, ierr) call MPI_COMM_SIZE(MPI_COMM_WORLD, nproc, ierr) do something useful call MPI_FINALIZE(ierr)
Advanced MPI
- defining new COMM groups for processing
- creating virtual domains
- defining new MPI data types
- gather and scatter operations
- all to all operations
Parallel Algorithms
- one-dimensional integration - a EP problem
- elliptical PDE solver
MPI Overview
- startup / shutdown
- local information - node id, number of nodes
- global operations
- broadcasts
- reductions
- synchronization
- sends and receives
- block vs non-blocking
- domain decomposition tools
- new comm types
- virtual domains
- data type creation tools
Exchanging Data - P1
Exchanging data can be a bit complex. Mostly, this is just a set of bookkeeping exercises that need to be done.
Assume we are shipping some part of an array on processor p1 to processor p2. On p1, we need to:
- determine the data that needs to be sent from p1
- copy the data into a temporary array on p1
- sending the data from p1
- deleting the data from the original p1 array
Exchanging Data- P2
- prepare a temporary array to receive data from p1
- set up a receive to accept the data
- integrate the data from the temporary array into p2's array
- make sure there is enough space to receive the new data
- re-index the new data, if needed
- copy the new data into p2's array
- delete the temporary array
Message Passing Summary
