CS 240A: Applied Parallel Computing // Homework 3
Assigned April 12, 2010
Due by 11:59pm Monday, April 26
You may do this homework in groups of two—in fact, I prefer that you do so.
You may
form groups however you want, but I encourage groups that have students from two different
departments.
The object of this problem is to write a parallel program, using MPI, to use conjugate gradients
(CG) to solve the finite difference discretization of Poisson’s equation in two dimensions on a regular
square grid of
n
=
k
2
points. (This is also known as the “model problem.”)
If we write the discretized problem as
Ax
=
b
, then
•
A
is the sparse
n
by
n
matrix (whose nonzeros are all 4’s and

1’s) representing the discretized
operator. For this homework, you will
not
generate or store any of
A
explicitly.
•
b
is an
n
vector containing the boundary conditions and any forcing terms. You will write a
routine to generate
b
for debugging, and we will write one for testing and grading.
•
x
is an
n
vector giving the answer.
The CG algorithm is outlined in the course slides for April 7 and April 12, and is described in
detail in the references on the course resources page.
There is a sequential Matlab code for CG
linked to the course web page under Homework 3. You will need to write three routines:
DAXPY
(which adds a scalar multiple of one dense vector to another,
y
=
y
+
ρz
);
DDOT
(which computes
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 Fall '09
 GILBERT
 course web page, ghost cells, MatVec, sequential Matlab code

Click to edit the document details