Lecture 8 - Message Passing Interface
- Announcements
- Homework/Lab 4
- MPI
- Sample Applications
- Conway's Game of Life
- Computing the Mandelbrot set
- NCSA account information is in, at least for some. Pick up
forms, try logging in.
- TotalView is back.
The first part of the notes on MPI are available in Lecture
7.
mpicoll.tgz Also available in /home/faculty/terescoj/shared/cs338/lect08.
- MPI_Barrier(MPI_Comm comm) - synchronize procs
- MPI_Bcast(void *buf,int count,MPI_Datatype type,int
root,MPI_Comm comm) - broadcast - sends count copies of data
of type type located in buf on proc root to buf on all others.
- MPI_Reduce(void *sendbuf,void *recvbuf,int count,
MPI_Datatype type,MPI_Op op,int root,MPI_Comm comm) - combines
data in sendbuf on each proc using operation op and stores
the result in recvbuf on proc root
- MPI_Allreduce() - same as reduce except result is stored
in recvbuf on all procs.
- MPI_Op values - MPI_MAX, MPI_MIN, MPI_SUM,
MPI_PROD, MPI_LAND, MPI_BAND, MPI_LOR, MPI_BOR, MPI_LXOR,
MPI_BXOR, MPI_MAXLOC, MPI_MINLOC plus user-defined.
- MPI_Scan(void *sendbuf,void *recvbuf,int
count,MPI_Datatype type,MPI_Op op,MPI_Comm comm) - parallel prefix
scan operations
mpiscatgath.tgz Also available in /home/faculty/terescoj/shared/cs338/lect08.
- MPI_Scatter(void *sendbuf,int sendcount,MPI_Datatype
sendtype,void *recvbuf,int recvcount,MPI_Datatype
recvtype,int
root,MPI_Comm comm) - root sends sendcount items from
sendbuf to each processor. Each processor receives recvcount items into recvbuf
- MPI_Gather(void *sendbuf,int sendcount,MPI_Datatype
sendtype,void *recvbuf,int recvcount,MPI_Datatype
recvtype,int
root,MPI_Comm comm) - each proc sends sendcount items from
sendbuf to root. root receives recvcount
items into recvbuf from each proc
- MPI_Scatterv/MPI_Gatherv work with variable-sized chunks
of data
- MPI_Allgather/MPI_Alltoall variations of scatter/gather
To understand what is going on with the various broadcast and
scatter/gather functions, consider this figure, taken from the
MPI Standard,
p.91
The Game of Life was invented by John Conway in 1970. The game is
played on a field of cells, each of which has eigh neighbors (adjacent
cells). A cell is either occupied (by an organism) or not. The rules
for deriving a generation from the previous one are:
- Death: If an occupied cell has 0, 1, 4, 5, 6, 7, or 8 occupied
neighbors, it dies (of either boredom or overcrowding, as the case
may be)
- Survival: If an occupied cell has 2 or 3 occupied neighbors,
it survives to the next generation
- Birth: If an unoccupied cell has 3 occupied neighbors, it
becomes occupied.
The game is very interesting in that complex patterns and cycles
arise. Do a google
search
to find plenty of Java applets you can try out.
Serial version: life.tgz Also available in /home/faculty/terescoj/shared/cs338/lect08.
MPI version: mpilife.tgz Also available in /home/faculty/terescoj/shared/cs338/lect08.
Some Mandelbrot Set Information and
pictures
Java Threads version: mand-java.tgz Also available in /home/faculty/terescoj/shared/cs338/lect08.
MPI version: mand-mpi.tgz Also available in /home/faculty/terescoj/shared/cs338/lect08.