250 likes | 409 Views
C TADEL. A Generator of Efficient Numerical Code. Physical processes. Can be described by a set of equations Can be simulated on a computer High-level languages for efficiency. Maintaining Models. Large amount of code Out of date documentation Debugging. Multi-Architecture.
E N D
CTADEL A Generator of Efficient Numerical Code
Physical processes • Can be described by a set of equations • Can be simulated on a computer • High-level languages for efficiency
Maintaining Models • Large amount of code • Out of date documentation • Debugging
Multi-Architecture • Different computer architectures require different optimizations • Default libraries are to generic
Overview • Motivation • Ctadel system • Examples • Current work
Motivation • Problems can be described on an abstract level • Maintaining of specification easier then large program • Code generator takes care of architecture dependent optimizations • Automatic documentation generation
Model specification • Mathematical oriented • Application Driven Code • Fortran 77 • Fortran 90 • HPF CTADEL Transformation Database • Solving methods • Optimizing transformations Documentation • LaTeX • HTML Black-box
Scripts Parser Symbolic evaluator Inference engine DICE GPAS Synthesizer LaTex Generator HTML Generator Code Generator Rule-base Internal
Inference Engine • Type information • primary types (integer,floating points,...) • units (m/s,...) • grid types (staggered,…) • For example, discrete solution based on grid type
GPAS Reduction System • Simplify and optimize expressions with a given set of rules df(atan(X), 1) => {1}/({1} + X^{2})
DICE • Common subexpression elimination on high-level -- array based • Usage of domain/range information • Hardware cost model: • costs of load/stores: temporaries • avoid ‘expensive’ operations
Ex. Specifications xfo :: float field(x,y,z) on surface_o. xfo = (ra - atmrad - ocnrad - sl % local radiation itensity where ra = rad((j-1)*dyo+(ny1-1)*dya+0.5*dyo) % atmospheric radiation where atmrad=xb*asto % sensible and latent flux where sl = lambda*(sst-asto) % ocean infrared where ocnrad = xc * sst ).
Example Application • Dynamic routines for a weather forecast model (hirlam) [Robert van Engelen] • Turbulence scheme (hirlam) • Dynamics for a coupled Atmosphere/Ocean model • Convection scheme • …..
30% Experiments (1) Quasi-geostrophic climate dynamics
Experiments (2) Convection scheme
Future Extensions/Work • Templates • abstraction to the developer • implementation of numerical optimized code at backend • Semi-lagrangian methods
CPU X t 0 t CPU Y 1 t 2 Semi-Lagrangian Formulations v
Semi-Lagrangian S.L. drawbacks : computational expensive • Iterative search for • Interpolation to find A’ • Communication cost S.L. advantages • Less time-steps needed compared with Eulerian
cpu1 cpu2 cpu3 Halo on Demand Full Halo cpu4 cpu6 cpu5 cpu7 cpu8 cpu9 Communication patterns
Halo On Demand • Analyze data at runtime • Determine wind direction • Only transmit/receive necessary data • Experiments • 2 different sizes input data grids (114x100x31 and 456x400x31) • DAS2 with 1x1,2x2,….,11x11 nodes • MPI library for communication
Conclusions • Code generated from a high-level specification can compete with hand-written code • Automatic documentation generation • Dissertation: soon