Lec05 Higher dimensional iterative methods

# Lec05 Higher dimensional iterative methods - Lecture 5...

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

Lecture 5 Higher dimensional iterative methods Performance modeling

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

View Full Document
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
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

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

View Full Document
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
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

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

View Full Document
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
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

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

View Full Document
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
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

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

View Full Document
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
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

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.

{[ snackBarMessage ]}

### 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
Ask a homework question - tutors are online