Cache Efficient Data Structuresand Algorithmsfor dDimensional Problems Judith
Cache Efficient. Data Structuresand Algorithmsfor d-Dimensional. Problems Judith Hartmann TU München, Institut für Informatik V hartmanj@in. tum. de Garching – 01. 06. 05 SCCS-Kolloquium
Overview • cache hierarchies and data locality • discretization by space-filling curve • system of stacks • measured results • concluding remarks SCCS 01. 06. 05 Cache Efficient Data Structures and Algorithms for d-Dimensional Problems
Cache Hierarchy CPU registers L 1 data L 1 inst L 2 cache L 3 cache main memory SCCS 01. 06. 05 Cache Efficient Data Structures and Algorithms for d-Dimensional Problems
Cache Efficiencyas Main Objective • algorithm for solving PDEs – modern concepts (finite elements, multigrid, etc. ) – cache-efficiency • road to cache-efficiency – spacefilling curve for discretization of the domain – data transport via stack system SCCS 01. 06. 05 Cache Efficient Data Structures and Algorithms for d-Dimensional Problems
Iterative Construction of the Peano Curve • Leitmotiv L • for each dimension: decomposition of all diagonals SCCS 01. 06. 05 Cache Efficient Data Structures and Algorithms for d-Dimensional Problems
Important. Propertiesfor the Construction of a. Stack System • projection property • palindrome property • recursivity in dimension SCCS 01. 06. 05 Cache Efficient Data Structures and Algorithms for d-Dimensional Problems
Organizationof a d-Dimensional Iteration • induced discretization of the unit square and order for the grid cells • processing of data SCCS 01. 06. 05 Cache Efficient Data Structures and Algorithms for d-Dimensional Problems
Necessary. Propertiesof a Useful System of. Stacks • constant number of stacks • determinsitic data access • dimensional recursivity • self similarity SCCS 01. 06. 05 Cache Efficient Data Structures and Algorithms for d-Dimensional Problems
Numberof Stacks • number of stacks for several dimensionalities type of stack 0 D 1 D 2 D 3 D d=1 2 2 d=2 4 4 2 d=3 8 12 6 2 d=4 16 32 24 8 4 D 4 10 28 2 28 • number of i-dimensional stacks for a d-dimensional iteration • total number of lower dimensional stacks: 3 d-1 SCCS 01. 06. 05 Cache Efficient Data Structures and Algorithms for d-Dimensional Problems
Stacks and Geometrical. Boundary Elements • matching of i-dimensional stack and idimensional boundary element of the unit cube • ternary encoding of geometrical boundary elements SCCS 01. 06. 05 Cache Efficient Data Structures and Algorithms for d-Dimensional Problems
Data Access • parameters for each grid point – status: determination of the sort of the stack – stack numbers: which stack of this sort • basic stack numbers • mechanism of inheritance SCCS 01. 06. 05 Cache Efficient Data Structures and Algorithms for d-Dimensional Problems
Necessary. Propertiesof a Useful System of. Stacks • constant number of stacks • determinsitic data access • dimensional recursivity • self similarity SCCS 01. 06. 05 Cache Efficient Data Structures and Algorithms for d-Dimensional Problems
Hardware Performance Poisson. Equationon the Unit Cube • cache-hit-rates > 99, 9 % resolution d=2 d=3 d=4 d=5 d=6 • 9 processing time per degree of freedom x ··· x 9 99. 06% 99. 93% 99. 95% 99. 99% 99. 81% d=2 99. 99% d=399. 98%d=4 27–xresolution ··· x 27 99. 85% 99. 97% d=5 decreases with increasing grid size -6 1. 74· 10 -5 4. 77· 10 -5 1. 47· 10 -4 x ··· x 9 99. 98% 5. 45· 1099. 98% 81 x 9 ··· x 81 99. 96% – is augmnted by a factor ~2. 7 for each dimension -6 -5 -4 x ··· x 27 99. 99% 4. 98· 1099. 97% 1. 35· 10 - 3. 66· 10 -5 24327 x ··· x 243 - 1. 05· 1081 x ··· x 81 4. 41· 10 -6 1. 25· 10 -5 3. 32· 10 -5 • unpenalized disc-usage possible 243 x ··· x 243 4. 32· 10 -6 1. 22· 10 -5 SCCS 01. 06. 05 - Cache Efficient Data Structures and Algorithms for d-Dimensional Problems -
Adaptivity Poisson. Equationon a Sphere dim. domain resolution time per dof • no unit losscube of cache-efficiency: 243 x ··· x 243 3. 53· 10 -6 cache-hit-rates > 99, 9 % d=3 sphere 243 x ··· x 243 (regular grid) • locally refined grids: 243 x ··· x 243 sphere 99. 96% 5. 66· 10 -6 99. 98% 3. 90· 10 -6 99. 97% (only on Ω) – computing unit cube time 81 improves x ··· x 81 (if appropriately 2. 64· 10 -5 approximated) 81 x ··· x 81 sphere 1. 24· 10 -4 d=4 (regular grid) – no loss of cache-efficiency 81 x ··· x 81 sphere 3. 83· 10 -5 (only on Ω) SCCS 01. 06. 05 L 2 hit rate Cache Efficient Data Structures and Algorithms for d-Dimensional Problems 99. 96%
Conclusion& Further. Developments • method for solving d-dimensional PDEs – modern numerical methods – high cache-efficiency – complicated geometrics • further developements: – potential for parallelization – general system of PDEs, Stokes, Navier-Stokes, etc. – potential for solving time-dependent PDEs in 3 space dimensions SCCS 01. 06. 05 Cache Efficient Data Structures and Algorithms for d-Dimensional Problems
- Slides: 15