HW5: Parallel Programming In Practice
Here's a sequential heat flow simulator, also on the powerwall in ~olawlor/641_demo/hw5.
In this simulator, we impose heat flow on the external boundaries, and watch it diffuse into the interior.
This program outputs a PPM image to a file named "out.ppm".
On NetRun, this image should show up in the browser
automatically. On a UNIX or MacOS machine, you can view the
resulting fractal image via SSH X forwarding with:
xv out.ppm
Otherwise, you can copy the files off the powerwall for local display; you may prefer to
convert out.ppm out.jpg
to get a normal JPEG before copying.
Here's what the image looks like after 1000 steps, for a 800x400 simulation, which takes about 5 seconds on the powerwall:

I'd like you to:
- Write an OpenMP version of the simulator, and benchmark it on up
to two processors of the powerwall. (Compile with "g++ main.cpp
-o main -O5 -ffast-math -fopenmp ". Time with "time
./main".) Measure your speedup with and without OpenMP--it should
be possible to get decent speedup!
- Write an MPI version of the simulator, and benchmark it on up to ten processors. Again, measure speedup.
Both versions should still create a single correct "out.ppm" file.
Please turn in:
- Your OpenMP heat flow simulator.
- Your MPI heat flow simulator.
- A very short README.txt file, describing your benchmarks and results.
You can email the source code and README.txt to me directly, or just leave them on the powerwall in your "~/hw5" directory. This homework is due at midnight Tuesday, March 31.