531/735 Programming Assignment 3 - 20032

Due Date: Wednesday, January 28, 2004

Purpose:

This programming assignment is designed to provide you with experience working in a MIMD distributed memory environment.

A five point bonus will be awarded to the person who shows the best speedup on 8 and 16 processors in combination with the fastest time. Another five point bonus will be given to the person who is able to sort the most numbers and in the fastest time.

Coding in MPI:

You are to program the ODD-EVEN TRANSPOSITION SORT (below) in MPI to run on SUN 450's (parasite/paradise 8 processors) and the paranoia cluster (16 processors) to sort a number of integers (both positive and negative) in ascending order. (For a VRML simulation of the sort, see http://www.cs.rit.edu/~icss571/parallelwrl/oets.wrl.)

Program the ODD-EVEN Transposition Sort to sort any number of integers ( at least 2 ), using a single "sorter" process per processor. It will probably be easiest to debug if you start by trying to sort 8 numbers on 8 processors.

To make it easier both for you to debug and me to grade, let's agree on a convention for input/output control. Order matters.

  1. Where will the input come from
  2. What kind of output do we want
  3. How many numbers to sort (Should be at least 2 - with random only)
Example Commands:
mprun -np 8 OE stdin IO
mprun -np 8 OE stdin Sorted
mprun -np 8 OE stdin TimingOnly
mprun -np 8 OE random IO 8
mprun -np 8 OE random Sorted 8
mprun -np 8 OE random TimingOnly 8

Output:

If Sorted or IO is selected, make sure that you print out ALL sorted numbers in order, not just a range per processor!

What to Submit:

  1. The hardcopy should include a listing of your program,
  2. A discussion of the algorithm you implemented,
  3. A timing study of problem size versus number of processors, This should include charts and graphs of sorting various data set sizes (try at least 100, 1000, 10000, 100,000, 500,000, 1,000,000 and 10,000,000) on various numbers of processors (1 - 8 on parasite/paradise; 1-16 on paranoia) Since the metrics often used in parallel computing are speedup and efficiency, these should also be calculated and plotted. (Please note that traditionally, the number of processors is plotted on the x-axis and the time/speedup/efficiency are on the y-axis.) Discuss the results of your timing study.
    NOTE: You SHOULD be able to achieve speedup!
  4. Contrast and compare programming in mpi, parallaxis, and linda. (You might consider doing this in table format.) Include items such as SIMD/MIMD, memory type, ease of programming, flexibility in the types of programming that can be handled, whether or not topology must be explicitly specified, and did the programmer have to be concerned about synchronization, termination and deadlock issues in your discussion.
  5. Compare your experience of executing c-linda and mpi on a parallel machine. Which gave you the most speedup? Discuss why you think this was the case.

You are to electronically submit a directory called lab3dir using the command:

or This directory will contain a makefile and the source code. Please make the target that creates the executable file OE first, so that it is "made" when "make" is typed. (NOTE: For the stdin option, the input file will contain the number of numbers to sort followed by a list of numbers. Your program should check that the number of numbers to sort is reasonable! For timing purposes, use the random option to randomly generate the unsorted list.)

The grading sheet used is available here.


ODD-EVEN TRANSPOSITION SORT


SETUP { Each EQUATION needs EQUATION as local A, and n. } { SETUP is an inherently sequential procedure. }

for EQUATION to EQUATION do

IF EQUATION then

if ( EQUATION ) then { Odd-even exchange; Get value from the adjacent processor } RECEIVE( ProcID + 1, Temp ) SEND( ProcId + 1, MAX( Temp, A ) ) { Keep smaller value } A EQUATION MIN( Temp, A ) endif

SEND( ProcId - 1, A ) { Retrieve larger value } RECEIVE( ProcID - 1, A )

else

{ Even-odd exchange; steps as above }

if ( EQUATION ) then SEND( ProcId - 1, A ) RECEIVE( ProcID - 1, A ) endif

if ( EQUATION ) then RECEIVE( ProcID + 1, Temp ) SEND( ProcId + 1, MAX( Temp, A ) ) A EQUATION MIN( Temp, A ) endif

endif

endfor

OUTPUT { Inherently sequential }


Nan C. Schaller
Rochester Institute of Technology
Computer Science Department
102 Lomb Memorial Dr.
Rochester, NY 14623-5608
telephone: +1.585.475.2139
fax: +1.585.475.7100
e-mail: ncs@cs.rit.edu
November 25, 2004