Homework 4

Tom Kelliher, CS 325

30 points, due Mar. 9, 2012

The Assignment

The figure below shows a room that has four walls and a fireplace. The temperature of the wall is 0 degrees C. and the temperature of the fireplace is 100 degrees C. Write a parallel program using Jacobi iteration to compute the temperatures inside the room on a 3 in. by 3 in. grid. (In other words, the room is represented by a $41 \times
41$ array of temperature points.) Your program should use four processes and a four strip partition. Use horizontal strips to take advantage of the fact that C stores two-dimensional arrays in row major order.

Your program should output a temperature plot of the room showing 10 degree C. intervals. The plot should simply be a $41 \times
41$ block of characters. Use the character 0 to represent the $[0, 10)$ interval, 1 to represent the $[10, 20)$ interval, etc., and 9 to represent the $[90, 100]$ interval.

\includegraphics{Figures/room.eps}

Documentation Requirements

Minimally, your program must contain your name and an overview at its top similar to this:

/***********************************************************************
 * Tom Kelliher, Goucher College.
 *
 * mandelbrot.c --- Serial program to generate a PPM image
 *                  representation of the Mandelbrot set for some
 *                  rectangular portion of the complex plane.
 *
 * Due to the use of sqrtf(), the math library needs to be compiled-in:
 *
 *    gcc -lm -o mandelbrot mandelbrot.c
 *
 * The PPM image is written to stdout.  It will be HUGE, so it is
 * advisable to pipe the output to pnmtojpeg (on a Linux system)
 * and redirect the filter's output to a file:
 *
 *    ./mandelbrot | pnmtojpeg > image.jpg
 *
 * The pack()/unpack() routines, unnecessary in a serial environment,
 * _might_ be useful in a message passing environment, but that is a
 * claim that ought to be tested.
 ***********************************************************************/
If the program you submit for a grade does not work, I will need further documentation within the program itself in order to assign partial credit. (You risk receiving no partial credit if you do not provide sufficient documentation.) One component of this documentation should be an analysis, to the best of your ability, of why the program is not working.

Compiling and Running Your Program

No special libraries are required for this problem:

mpicc -o room room.c
Restricting your program to run on four processes is a simple matter:
mpirun -n 4 room

Seeking Assistance

I strongly encourage you to begin this assignment as soon as it is issued and to come to my office if you need assistance. If you email me to describe a problem, describe the problem carefully and attach your source code. If extensive debugging will be required to determine the cause of the problem, I will let you know that you will need to visit me in person to resolve the problem. (In other words, I will not debug your program for you.)

Submitting Your Assignment

By the start of class on the 9th, send me your source code. Debugging messages in your source code should be commented-out. Late work will be penalized 15% per day; Saturday does not count, but Sunday does. (An unforeseen circumstance preventing you from finishing an assignment on time, while rare, may warrant a request for a deadline extension. Any such request must be made in writing, state the length of the extension requested, explain the nature of the unforeseen circumstance, include a strong justification for the requested extension, and be made at least 24 hours in advance of the assignment deadline. The strength of your justification and the nature of your unforeseen circumstance will determine whether or not the request is granted.)



Thomas P. Kelliher 2012-03-01
Tom Kelliher