Lec05 Higher dimensional iterative methods

Lec05 Higher dimensional iterative methods - Lecture 5...

Info iconThis preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon
Lecture 5 Higher dimensional iterative methods Performance modeling
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
10/5/06 Scott B. Baden /CSE 260/ Fall 2006 2 Announcements • A2 due today - submit hard copy and electronic copy • A3 is posted • Project proposals due Tuesday • Connected component labeling
Background image of page 2
10/5/06 Scott B. Baden /CSE 260/ Fall 2006 3 Recapping from last time • Solve the ODE -u ′′ (x) = f(x), x [0,1] • Define u i = u(i × h) at points x =i h, h=1/(N-1) • Approximate the derivatives u (u(x+h) – 2u(x) + u(x-h))/h 2 • Obtain the system of equations (u i-1 - 2u i + u i+1 )/h 2 = f i i 1..n-2 h u i-1 u i u i+1
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
10/5/06 Scott B. Baden /CSE 260/ Fall 2006 4 Iterative solution • Rewrite the system of equations (-u i-1 + 2u i - u i+1 )/h 2 = f i , i 1..n-1 • It can be shown that the following Gauss-Seidel algorithm will arrive at the solution … • …. assuming an initial guess for the u i Repeat until the result is satisfactory for i = 1 : N-1 u i = (u i+1 +u i-1 +h 2 f i )/2 end for end Repeat
Background image of page 4
10/5/06 Scott B. Baden /CSE 260/ Fall 2006 5 Parallel implementation • The first step is to partition the data • We partition the data into intervals, assigning each to a unique processor • Many to one mappings may also be useful P0 P1 P2 P3
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
10/5/06 Scott B. Baden /CSE 260/ Fall 2006 6 Data dependences • Each interval depends on two endpoint values found on neighboring processes • We add “overlap” or “ghost” cells to hold a copy of the off-processor value P0 P1 P2 P3
Background image of page 6
10/5/06 Scott B. Baden /CSE 260/ Fall 2006 7 Dependences • Our attempt to parallelize the algorithm fails since there are loop carried dependences • The value of u[i] computed in iteration i depends on u[i] computed in iteration i-1 for i = 1 : N-1 u[i] = (u[i-1]+u[i+1] +h*h*f[i])/2 end for
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
10/5/06 Scott B. Baden /CSE 260/ Fall 2006 8 Parallel implementation • Renaming the LHS of the assignment eliminates the dependences • Rename LHS as unew for i = 1 : N-1 unew[i] = (u[i-1]+u[i+1] +h*h*f[i])/2 end for Swap u and unew
Background image of page 8
10/5/06 Scott B. Baden /CSE 260/ Fall 2006 9 Tradeoffs • We can now parallelize the algorithm • However, we have decreased the convergence rate by about a factor of two • Doubles the amount of computational work • This kind of tradeoff is common, but we can do better
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
10/5/06 Scott B. Baden /CSE 260/ Fall 2006 10 Convergence check • Each process computes the error for its assigned part of the problem • We need a global error so that we compute a result that is consistent with the single processor implementation • This requires collective communication: a reduction • In MPI we use Allreduce , which leaves a copy the result in the memory of all processes
Background image of page 10
10/5/06 Scott B. Baden /CSE 260/ Fall 2006 11 Some Definitions for Solving the Poisson Equation • We call the numerical operator that sweeps over the solution array a stencil operator • In 1D we have functions of one variable • In n dimensions we have n variables
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 12
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 55

Lec05 Higher dimensional iterative methods - Lecture 5...

This preview shows document pages 1 - 12. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online