CPSC 626: Parallel Algorithm Design and Analysis
Programming Assignment #1
Fall 2008

Due: Thursday October 2, 2008 before class


General Guidelines for Programming Assignments


The objective of this programming assignment is to get you familiar with parallel programming in general, and with the IBM p575 cluster hydra.tamu.edu in particular. You will use two different styles of parallel programming - shared memory (OpenMP) and message passing (MPI). So, you will actually need to write two different programs.

Recall the prefix sums problem: given a sequence of numbers x1, x2, ..., xn, the prefix sums are the partial sums

      s1 = x1
      s2 = x1 + x2
        ...
      sn = x1 + x2 + ... + xn

The Assignment

You should write programs to compute the prefix sums on hydra.tamu.edu. Actually, you will write two programs, one in shared memory (OpenMP) and one in message passing (MPI).

Sample Programs

You can find below sample programs for summing n numbers using the OpenMP and MPI packages.

You should find things self explanatory. There is a README file which tells you how to compile and run the programs. The summation program itself is called sum.openmp.c or sum.mpi.c for the C programs (or sum.openmp.cpp or sum.mpi.cpp for the C++ programs). It is suggested that you start with these programs and modify them to perform the parallel prefix. The sample programs generate a random sequence of integers, print out each processor's sum, and print out timing statistics - so you should be able to reuse much of that.

Useful Resources

You may find the following web resourses helpful: