Computer Science 400 |
Lab 5: Jacobi Iteration with OpenMP
Due: 11:59 PM, Monday, October 13, 2008
Your task this week is to write a C or C++ program using OpenMP that solves Laplace's equation on a two-dimensional, uniform, square grid, using Jacobi iteration. Don't worry if none of those terms make any sense - this document tells you what little you need to know about the math and physics.
Some backgroundLaplace's equation is an elliptic partial differential equation that governs physical phenomena such as heat. In two dimensions, it can be written
Phi_xx + Phi_yy = 0.
Given a spatial region and values for points on the boundaries of the region, the goal is to approximate the steady-state solution for points in the interior. We do this by covering the region with an evenly-spaced grid of points. A grid of 8 ×8 would look like this:
* * * * * * * * * * * . . . . . . . . * * . . . . . . . . * * . . . . . . . . * * . . . . . . . . * * . . . . . . . . * * . . . . . . . . * * . . . . . . . . * * . . . . . . . . * * * * * * * * * * *
There are several iterative methods for solving Laplace's equation. Your program is to use Jacobi iteration, which is the simplest and easily parallelizable, though certainly not the most efficient in terms of convergence rate.
In Jacobi iteration, the new value for each grid point in the interior is set to the average of the old values of the four points left, right, above, and below it. This process is repeated until the program terminates. Note that some of the values used for the average will be boundary points.
What to do and how to do itWhen you are finished, submit using the turnin utility as lab5. Your submission should include an appropriate Makefile, your C or C++ source code (including the timer code from class, if you choose to use it), a brief README file expaining how to run your program and with your timings and analysis. Please do not include object files or your executable.
Grading guidelines: Your grade for the programming will bedetermined by correctness, design, documentation, and style, as well as the presentation of your timing results.