Docsity

Scientific Computing and Compiler Technology, Lecture notes of Compiler Design

Partial preview of the text

Download Scientific Computing and Compiler Technology and more Lecture notes Compiler Design in PDF only on Docsity!

David A. PaduaUniversity of Illinois at Urbana-Champaign

ï Although clock rate gains have beenimpressive, architectural features have alsocontributed significantly to performanceimprovement.ï At the instruction level, compilers play acrucial role in exploiting the power of thetarget machine.

ï^ Advances in compiler technology can have aprofound impactñ By improving performance.ñ By facilitating programming without hinderingperformance.ï^ For example, average performance improvementof advanced compiler techniques at the instructionlevel for the IA-64 is ~3.

This is beyond what can

be achieved by traditional optimizations

ï Scientific Computing has had a veryimportant influence on compilertechnology.ñ Fortran I (1957)ñ Many classical optimizationsï strength reductionï Common subexpression eliminationï Öñ Dependence analysis

ï^ Every optimizing compiler does:ñ Program analysisñ Transformationsï^ The result of the analysis determines whichtransformations are possible, but the number ofpossible valid transformations is unlimited.ï^ Implicit or explicit heuristics are used todetermine which transformations to apply.

ï^ Program analysis is well understood for someclasses of computations such as simple densecomputations.ï^ However, compilers usually do a poor job in somecases, especially in the presence of irregularmemory accesses.ï^ Program analysis and transformation is built on asolid mathematical foundation, but building theengine that drives the transformations is anobscure craft.

1. Compiling Interactive ArrayLanguages (MATLAB)^ Joint work withGeorge Almasi (Illinois), Luiz De Rose (IBM Research),Vijay Menon (Cornell), Keshav Pingali (Cornell)

ï Many computational science applicationsinvolve matrix manipulations.ï It is, therefore, appropriate to use arraylanguages to program them.ï Furthermore, interactive array languageslike APL and MATLAB are very populartoday.

ï Generation of high-performance code forserial and parallel architecturesï Efficient extraction of information from thehigh-level semantics of MATLABï Use of the semantic information in order toimprove compilation

ï MATLAB does not require declarationsñ Static and dynamic type inferenceï Variables can change characteristics duringexecution time

Test programs^

Problem size^ Source Successive Overrelaxation^

420x420^ a (SOR) Preconditioned CG^

(CG)^ 420x420^ a Generation of a 3D-Surface^

51x31x21^ d (3D) Quasi-Minimal Residual^

(QMR)^ 420x420^ a Adaptive Quadrature^

1Dim (7)^ b (AQ) Incomplete Cholesky Factorization (IC)

400x400^ d Galerkin (Poisson equation)^

40x40^ c (Ga) Crank-Nicholson (heat equation)^

(CN)^ 321x321^ b Two body problemth^4 order Runge-Kutta^

(^3200) (RK) steps^ c Two body problemEuler-Cromer method^

(^6240) (EC) steps^ c Dirichlet (Laplace’s equation)^

41x41^ b (Di) Finite Difference (wave equation)^

(FD)^ 451x451^ b Source:a. “Templates for the Solution of Linear SystemsBuilding Blocks for Iterative Methods”, Barrett et. Al.b. “Numerical Methods for Mathematics, Science andEngineering, John H. Mathewsc. “Numerical Methods for Physics”, A. Garciad. Colleagues

Prog.^ MATLAB^

  • SOR 18. MCC F 90 H. W.
  • 18.14 2.733 0.
    • CG 5.
    • 5.51 0.588 0.
      • 3D 34.
      • 11.14 3.163 3.
        • QMR 7.
        • 6.24 0.611 0.
          • AQ 19.
          • 2.30 1.477 0.
            • IC 32.
            • 1.35 0.245 0.
              • Ga 31.
              • 0.56 0.156 0.
                • CN 44.
                • 0.70 0.098 0.
                  • RK 20.
                  • 5.77 0.038 0.
                    • EC 8. - 3.38 0.012 0; - Di 44. - 1.50 0.052 0. - FD 34. - 0.37 0.031 0.

1.21.1 1 SOR^ CG^ 3D^ QMR^ AQ^ IC^ Ga

CN^ RK^ EC^ Di^ FD SGI Power Challenge (^5432) Speedup of hand−written over FALCON 1 0

ï MAJIC: (MAtlab Just-In-Time Compiler)interactive and fastñ combination interpreter/JIT compilerñ builds on top of FALCON techniques