CS 480 Introduction to Parallel Computing

Fall 1999

Programming Assignment #4

Due:   11/18 12 pm.



  • to use the information we have discussed to create a parallel application, including:
    • use PVM on a SharedMemory machine
    • practice using PVM group functions
    • practice using synchronization primitives
    • practice parallelizing an existing program

This assignment is to be completed individually.

Problem: Parallelizing a solution to the 2D heat equation.

You are to parallelize the heat2d.c program and get it to correctly run on the OSC orgin 2000. To practice using group functions, follow the following outline:

Use the master slave approach; where the master will:

  • spawn the slaves
  • for each time step:
    • broadcast current temperature distribution to slaves
    • collect results from slaves (use gather + barrier )
  • collect the final computed solution - save to a file

Since C uses row-major ordering for arrays - you will want to decomose the problem in a row-wise fashion ( as discussed in class and in the text ). You must use the pvm_barrier function for the synchronization amongst processes. As part of the assignment you should collect data on how much time ( on average ) a process waits at its barrier.


Use the following command line syntax to run your program

parheatmaster N Tinc Tfinal

  • Where N is the number of processes to spawn
  • Tinc is the time step increment
  • Tfinal is the Length of the simulation


  • Your final version must run correctly on the OSC origin. Timing data must be obtained from runs on the Origin.
  • To avoid buffer problems, use a grid size of 128x128.
  • Run you program using 3 different numbers of processors (use 2, 4, 8 or 16) and compute the speedup obtained.

Some coding details.

a procedure will be made available to you which you can use to create an image file from your final computed solution. Details to follow.


In your ALPHA class directory, create a subdirectory called prog4. In this directory place:

  1. a copy of the final programs parheatmaster.c, parheatslave.c
  2. a text file containing:
    1. speedup results
    2. barrier timing results
    3. a brief discussion of why the suggested approach is not optimal for this machine.
  3. an image file for two sample runs (include the runtime parameters used in the report file)

Last modified:9/30/99
Author: G.Zimmerman