Assignment 3: Sharing Mandelbrot

In this project, you will simply implement a dynamically load balanced shared-memory parallel version of the well-known Mandelbrot computation given in mandel.c using OpenMP. Note that OpenMP trivially supports this type of load ballancing. In fact, this code is actually also using mmap() "shared something" memory -- but only to memory map the image file.

The program takes a single command line argument, which must be a P6-format PPM image file. That file is mapped and overwritten by the color Madelbrot image. A smallish (1024x1024) image generated by the program is mandel.ppm. It looks like:

What To Do

The parallelism should come in parallelizing the loop:

for (y=0; y<tall; ++y) { ... }

A static load balance would simply give each thread tall/NPROC of the rows in the image to compute. The dynamic load balance you are to implement will essentially use a counter to keep track of which is the next as yet unprocessed row. As each thread completes a row, it will simply perform the equivalent of an atomic fetch-and-add of 1 to this unprocessed row counter in order to claim another row to process. If the system does not directly provide fetch-and-op, you could use a lock to control access to the counter. The cool thing is, OpenMP can basically do all that for you with just a simple directive!

So that we can see what's being done by who, use the tint facility in the code to tint each pixel by the IPROC value of the PE that computed it. The code change needed for this is fairly obvious, requiring you to change tint to be IPROC and make sure that MAXTINT is NPROC.

Due Dates, Submission Procedure, & Such

You will be submitting source code, a make file, and a simple HTML-formatted "implementor's notes" document called a3.html, which should explicitly describe how and why you do the message passing as you do (i.e., why did you pick blocking or non-blocking). Please arrange your make file so that the executable file, which should be called a3, is compiled when one simply types make. All of the things needed should be packed into a single tar file for submission by a command like tar -zcvf a3.tgz files -- and that tar is all you submit. Do not include executable files, or other things that can be generated by make, in the tar you submit.

For full consideration, your project should be submitted no later than April 23, 2015. Submit your project tar file here:

Your email address is .
Your password is .

Your section is EE599-001 (undergrad) EE699-001 (grad)


EE599/699 Cluster/Multi-Core Computing