MPI practice
We are going to talk about the MPI interface using the tutoral from
Lawrence Livermore National Library as a languge reference:
LLNL's MPI tutorial
Links to other MPI tutorial and references are here:
MPI links
There are also man pages for MPI library functions.
We are also going to try out some things as we go, so start by copying over
these files:
cp -r ~newhall/public/cs87/mpi_examples/* .
We will look over and do the following together:
- Environment Management Routines: try out hello_world example
after setting up environment to run applications:
using openMPI on our system.
- Collective Communication Routines (Barrier and Bcast): look
at bcast example
- Collective Communication Routines (Reduce): try approx_pi
- Point to Point Communication Routines: look at twoDarraydistr
- Try implementing game of life using what we have learned. Use a grid
layout of the array. For example, for 4 processes pid 0 would get the top
left quarter of the array, pid 1 the top right quarter of the array, pid 2
the left bottom quarter of the array, pid 3 the right bottom quarter of the
array.
- Try implementing a solution to an irregular work pattern using the
work queue idea. One problem in the book looks at computing the largest
factor of expansion of the Syracuse Sequence:
Xi+1 = Xi/2 when Xi is even
3Xi+1 when Xi is odd
if you look at this sequence for 16:
16, 8, 4, 2, 1 the largest factor of expansion is 16/16 = 1
if you look at this sequence for 15:
15, 46, 23, 70, ... 160 ... 1 the largest factor of expansion is 160/15 = 10.67
Try to find the largest factor of expansion for a large set of values
(everything up to N, where N is huge)
Because the number of terms in the sequence for different starting values
varies, you don't just want to give each process N/P values to start out
with.