Influencing policy (training slides from Fast Track Impact)
Secrets of supercomputing
1. Secrets of Supercomputing The Conservation Laws Supercomputing Challenge Kickoff October 21-23, 2007 I. Background to Supercomputing II. Get Wet! With the Shallow Water Equations Bob Robey - Los Alamos National Laboratory Randy Roberts – Los Alamos National Laboratory Cleve Moler -- Mathworks LA-UR-07-6793 Approved for public release; distribution is unlimited
8. Matrix Notation The first set of terms are state variables at time t and usually called U. The second set of terms are the flux variables in space x and usually referred to as F. This is just a system of equations a + c = 0 b + d = 0 U F
9.
10. Writing a Program Data Parallel Model Serial operations are done on every processor so that replicated data is the same on every processor. This may seem like a waste of work, but it is easier than synchronizing data values. Sections of distributed data are “owned” by each processor. This is where the parallel speedups occur. Often ghost cells around each processor’s data is a way to handle communication. P(400) – distributed Ptot -- replicated Proc 1 P(1-100) Ptot Proc 2 P(101-200) Ptot Proc 3 P(201–300) Ptot Proc 4 P(301-400) Ptot
11.
12.
13. Output from a shallow water equation model of water in a bathtub. The water experiences 5 splashes which generate surface gravity waves that propagate away from the splash locations and reflect off of the bathtub walls. Wikipedia commons, Author Dan Copsey Go to shallow water movie. http:// en.wikipedia.org/wiki/Image:Shallow_water_waves.gif
14. Mathematical Equations Mathematical Model Conservation of Mass Conservation of Momentum Shallow Water Equations Notes: mass equals height because width, depth and density are all constant h -> height u -> velocity g -> gravity References: Leveque, Randall, Finite Volume Methods for Hyperbolic Problems, p. 254 Note: Force term, Pressure P=½gh 2
15. Shallow Water Equations Matrix Notation The maximum time step is calculated so as to keep a wave from completely crossing a cell.
16.
17. The Lax-Wendroff Method Half Step Whole Step Explanation graphic courtesy of Jon Robey and Dov Shlacter, 2006-2007 Supercomputing Challenge
18. Explanation of Lax-Wendroff Model Physical model Original Half-step Full step t i t+1 i t+.5 i+.5 Explanation graphic courtesy of Jon Robey and Dov Shlacter, 2006-2007 Supercomputing Challenge. See appendix for 2D index explanation. Ghost cell Data assumed to be at the center of cell. Space index
19.
20. 2D Shallow Water Equations Note the addition of fluxes in the y direction and a flux cross term in the momentum equation. The U, F, and G are shorthand for the numerical equations on the next slide. The U terms are the state variables. F and G are the flux terms in x and y. U F G
22. 2D Shallow Water Equations Transformed for Programming Letting H = h, U = hu and V = hv so that our main variables are the state variables in the first column gives the following set of equations. H is height (same as mass for constant width, depth and density) U is x momentum (x velocity times mass) V is y momentum (y velocity times mass)
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35. C/MPI Program Diagram Update Boundary Cells MPI Communication External Boundaries First Pass x half step y half step Second Pass Swap new/old Graphics Output Conservation Check Calculate Runtime Close Display, MPI & exit Allocate memory Set Initial Conditions Initial Display Repeat
51. 0,0 -- 1,0 | 1,1 j,i -- j+1,i | j+1,i+1 0,0 -- 0,1 | 1,1 j,i -- j,i+1 | j+1,i+1 1 st Pass y y y y y y y y y y y y x x x x x x x x x x x x 0 1 2 3 4 j 0 1 2 3 4 i X step grid Main grid Y step grid Main grid
52. 1,1 1,1 -- 0,0 | 1,0 -- 0,0 | 0,1 j,i -- j-1,i-1 | j,i-1 j,i -- j-1,i-1 | j-1,i 2 nd Pass y y y y y y y y y y y y x x x x x x x x x x x x 0 1 2 3 4 j 0 1 2 3 4 i Main grid X step grid Main grid Y step grid