Changes between Version 12 and Version 13 of ScramblerPaper
- Timestamp:
- 05/16/11 16:39:09 (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ScramblerPaper
v12 v13 45 45 * Hyperbolic engine 46 46 * Currently AstroBEAR's hyperbolic solver uses a Gudonov type unsplit integrator that utilizes the CTU+CT integration scheme (Stone & Gardiner 08). Unsplit integrators however, often require many intermediate variables be stored globally during a grid update which can require 10-50x the space required for storing the array of conservative variables. For GPU type systems, this would considerably restrict the size of a grid that could be updated. In AstroBEAR we implement a sweep method that essentially pipelines any sequence of calculations into a one dimensional pass across the grid where variables are only stored as long as they are needed. This is ideally suited for GPU calculations in which a CPU could constantly be sending in new field values and retrieving updated field values while the GPU uses a minimum of memory. 47 * The pipelining is done automatically provided that the dependencies between stencil pieces is explicitly stated. For example consider a simple 1D 1st order Gudonov in which the initial state is stored in {{{q}}}, and the updated fields are stored in {{{Q}}}. The fluxes are stored in {{{fx}}}, and the left and right interface states are stored in {{{qLx}}} and {{{qRx}}} respectively. We also adopt the convention that stencil pieces stored on cell edges ({{{qLx, qRx, fx}}}) at position {{{i-1/2}}} are stored in their respective arrays with the index {{{i}}}47 * The pipelining is done automatically provided that the dependencies between stencil pieces is explicitly stated. For example consider a simple 2D 1st order Gudonov method in which the initial state is stored in {{{q}}}, and the updated fields are stored in {{{Q}}}. The x and y fluxes are stored in {{{fx,fy}}}, and the left and right interface states are stored in {{{qLx,qLy}}} and {{{qRx,qRy}}} respectively. We also adopt the convention that stencil pieces stored on cell edges ( ie {{{qLx, qRx, fx}}}) at position {{{i-1/2}}} are stored in their respective arrays with the index {{{i}}} 48 48 49 49 || Stated dependency || Actual calculation || 50 ||Set_Dependency(qLx, q, (/-1,-1/))||qLx%data(i)=q%data(i-1)|| 51 ||Set_Dependency(qRx, q, (/0,0/))||qRx%data(i)=q%data(i)|| 52 ||Set_Dependency(fx, qLx, (/0,0/))|| fx%data(i)=riemann(qLx%data(i),qRx%data(i))|| 53 ||Set_Dependency(fx, qRx, (/0,0/)) || || 54 ||Set_Dependency{Q, fx, (/0,1/))|| Q%data(i)=q%data(i)+fx%data(i)-fx%data(i+1) || 50 ||Set_Dependency(qLx, q, (/-1,-1,0,0/))||qLx%data(i,j)=q%data(i-1,j)|| 51 ||Set_Dependency(qRx, q, (/0,0,0,0/))||qRx%data(i,j)=q%data(i,j)|| 52 ||Set_Dependency(qLy, q, (/0,0,-1,-1/))||qLy%data(i,j)=q%data(i,j-1)|| 53 ||Set_Dependency(qRy, q, (/0,0,0,0/))||qRy%data(i,j)=q%data(i,j)|| 54 ||Set_Dependency(fx, qLx, (/0,0,0,0/))|| fx%data(i,j)=riemann(qLx%data(i,j),qRx%data(i,j))|| 55 ||Set_Dependency(fx, qRx, (/0,0,0,0/)) || || 56 ||Set_Dependency(fx, qLy, (/0,0,0,0/))|| fy%data(i,j)=riemann(qLy%data(i,j),qRy%data(i,j))|| 57 ||Set_Dependency(fx, qRy, (/0,0,0,0/)) || || 58 ||Set_Dependency{Q, fx, (/0,1,0,0/))|| Q%data(i,j)=q%data(i,j)+fx%data(i,j)-fx%data(i+1,j) || 59 ||Set_Dependency(Q, fy, (/0,0,0,1/))|| +fy%data(i,j)-fy%data(i,j+1)|| 55 60 ||Set_Dependency(Q, q, (/0,0/))|| || 56 * Then assuming that we have the size of Q we want updated we can set {{{Q%range=(/1,mx, 1, my, 1, mz/)}}} and work backwards to determine what range of values we need to calculate {{{fx, qRx, qLx,}}} & {{{q}}}. Without pipelining we would then simply do the following: 61 * Then assuming that we have the size of Q we want updated we can set {{{Q%range=(/1,mx, 1, my, 1, mz/)}}} and work backwards to determine what range of values we need to calculate {{{fx, fy, qRx, qLx, qRy, qLy}}} & {{{q}}}. To pipeline we first determine windows for each stencil that slide across the grid from left to right. As the window crosses the stencils range we begin calculated the values for the stencil along the right edge of the window. We then hang on to the calculated values as long as they are within the stencil's window. 62 63 64 65 Without pipelining we would then simply do the following: 57 66 {{{ 58 67 FORALL(i=Q%range(1,1):Q%range(1,2), j=Q%range(2,1):Q$range(2,2), k=Q%range(3,1):Q%range(3,2))