J. Ray, S. Lefantzi and H. Najm Sandia National Labs, Livermore Using The Common Component...

25
J. Ray, S. Lefantzi and H. Najm Sandia National Labs, Livermore Using The Common Component Architecture to Design Simulation Codes

Transcript of J. Ray, S. Lefantzi and H. Najm Sandia National Labs, Livermore Using The Common Component...

Page 1: J. Ray, S. Lefantzi and H. Najm Sandia National Labs, Livermore Using The Common Component Architecture to Design Simulation Codes.

J. Ray, S. Lefantzi and H. Najm

Sandia National Labs, Livermore

Using The Common Component Architecture to Design Simulation Codes

Page 2: J. Ray, S. Lefantzi and H. Najm Sandia National Labs, Livermore Using The Common Component Architecture to Design Simulation Codes.

What is CCACommon Component Architecture A component model for HPC and scientific

simulations Modularity, reuse of code

Lightweight specification Few, if any, HPC functionalities are provided. Performance & flexibility, even at the expense of

features. Translation …

High single-CPU performance Does not impose a parallel programming model Does not provide any parallel programming

services either But allows one to do parallel computing

Page 3: J. Ray, S. Lefantzi and H. Najm Sandia National Labs, Livermore Using The Common Component Architecture to Design Simulation Codes.

The CCA modelComponent an “object” implementing a functionality

(physical/chemical model, numerical algo etc) Provides access via interfaces (abstract classes)

ProvidesPorts Uses other components’ functionality via pointers

to their interfaces UsesPorts

Framework Loads and instantiates components on a given

CPU Connects uses and provides ports Driven by a script or GUI No numerical/parallel computing etc support.

Page 4: J. Ray, S. Lefantzi and H. Najm Sandia National Labs, Livermore Using The Common Component Architecture to Design Simulation Codes.

Details of the architecture 4 CCA-compliant frameworks exist Ccaffeine (Sandia) & Uintah (Utah) used for

HPC routinely XCAT (Indiana) & decaff (LLNL) mostly in

distributed computing environments

CCAFFEINE Component writer deals wil performance issues Also deals with MPI calls amongst components Supports SPMD computing; no distributed

computing yet. Allows language interoperability.

Page 5: J. Ray, S. Lefantzi and H. Najm Sandia National Labs, Livermore Using The Common Component Architecture to Design Simulation Codes.

A CCA code

Page 6: J. Ray, S. Lefantzi and H. Najm Sandia National Labs, Livermore Using The Common Component Architecture to Design Simulation Codes.

Pictorial example

Page 7: J. Ray, S. Lefantzi and H. Najm Sandia National Labs, Livermore Using The Common Component Architecture to Design Simulation Codes.

Guidelines regarding apps

HydrodynamicsP.D.E

Spatial derivatives Finite differences, finite volumes

TimescalesLength scales

)(,...),,( 2 GFt

Page 8: J. Ray, S. Lefantzi and H. Najm Sandia National Labs, Livermore Using The Common Component Architecture to Design Simulation Codes.

Solution strategy

Timescales Explicit integration of slow ones Implicit integration of fast ones

Strang-splitting

},ˆ{,2/),(.3

}ˆ,~{,....),,,(.2

}~,{2/),(.1

)(....),,(

1

2

2

nnnt

nnt

nnnt

t

ttttG

tttF

tttG

GF

Page 9: J. Ray, S. Lefantzi and H. Najm Sandia National Labs, Livermore Using The Common Component Architecture to Design Simulation Codes.

Solution strategy (cont’d)

Wide spectrum of length scales Adaptive mesh refinement Structured axis-aligned patches GrACE.

Start with a uniform coarse mesh Identify regions needing refinement,

collate into rectangular patches Impose finer mesh in patches Recurse; mesh hierarchy.

Page 10: J. Ray, S. Lefantzi and H. Najm Sandia National Labs, Livermore Using The Common Component Architecture to Design Simulation Codes.

A mesh hierarchy

Page 11: J. Ray, S. Lefantzi and H. Najm Sandia National Labs, Livermore Using The Common Component Architecture to Design Simulation Codes.

App 1. A reaction-diffusion system.

A coarse approx. to a flame.

H2-Air mixture; ignition via 3 hot-

spots

9-species, 19 reactions, stiff chemistry

1cm X 1cm domain, 100x100 coarse mesh, finest mesh = 12.5 micron.

Timescales : O(10ns) to O(10 microseconds)

iii wY

Dt

DY .

Page 12: J. Ray, S. Lefantzi and H. Najm Sandia National Labs, Livermore Using The Common Component Architecture to Design Simulation Codes.

App. 1 - the code

Page 13: J. Ray, S. Lefantzi and H. Najm Sandia National Labs, Livermore Using The Common Component Architecture to Design Simulation Codes.

Evolution

Page 14: J. Ray, S. Lefantzi and H. Najm Sandia National Labs, Livermore Using The Common Component Architecture to Design Simulation Codes.

Details

H2O2 mass fraction

profiles.

Page 15: J. Ray, S. Lefantzi and H. Najm Sandia National Labs, Livermore Using The Common Component Architecture to Design Simulation Codes.

App. 2 shock-hydrodynamics

Shock hydrodynamics

Finite volume method (Godunov)

},,,,{)()( EvuUUGUFU yxt

Page 16: J. Ray, S. Lefantzi and H. Najm Sandia National Labs, Livermore Using The Common Component Architecture to Design Simulation Codes.

Interesting features

Shock & interface are sharp

discontinuities

Need refinement

Shock deposits vorticity – a governing

quantity for turbulence, mixing, …

Insufficient refinement – under predict

vorticity, slower mixing/turbulence.

Page 17: J. Ray, S. Lefantzi and H. Najm Sandia National Labs, Livermore Using The Common Component Architecture to Design Simulation Codes.

App 2. The code

Page 18: J. Ray, S. Lefantzi and H. Najm Sandia National Labs, Livermore Using The Common Component Architecture to Design Simulation Codes.

Evolution

Page 19: J. Ray, S. Lefantzi and H. Najm Sandia National Labs, Livermore Using The Common Component Architecture to Design Simulation Codes.

Convergence

Page 20: J. Ray, S. Lefantzi and H. Najm Sandia National Labs, Livermore Using The Common Component Architecture to Design Simulation Codes.

Are components slow ?

C++ compilers << Fortran compilersVirtual pointer lookup overhead when accessing a derived class via a pointer to base classY’ = F ; [ I - t/2 J ] Y = H(Yn) + G(Ym) ; used Cvode to solve this systemJ & G evaluation requires a call to a component (Chemistry mockup)t changed to make convergence harder – more J & G evaluationResults compared to plain C and cvode library

Page 21: J. Ray, S. Lefantzi and H. Najm Sandia National Labs, Livermore Using The Common Component Architecture to Design Simulation Codes.

Components versus library

tG

evaluations

Component time(sec)

Library time(sec)

0.1 66 1.18 1.23

1.0 150 2.34 2.38

100 405 6.27 6.14

1000 501 7.66 7.67

Page 22: J. Ray, S. Lefantzi and H. Najm Sandia National Labs, Livermore Using The Common Component Architecture to Design Simulation Codes.

Really so ?

Difference in calling overhead

Test : F77 versus

components 500 MHz

Pentium III Linux 2.4.18 Gcc 2.95.4-15

Function arg type f77

Component

Array 80 ns 224ns

Complex 75ns 209ns

Double complex 86ns 241ns

Page 23: J. Ray, S. Lefantzi and H. Najm Sandia National Labs, Livermore Using The Common Component Architecture to Design Simulation Codes.

Scalability

Shock-hydro codeNo refinement200 x 200 & 350 x 350 meshesCplant cluster 400 MHz EV5

Alphas 1 Gb/s Myrinet

Worst perf : 73 % scaling eff. For 200x200 on 48 procs

Page 24: J. Ray, S. Lefantzi and H. Najm Sandia National Labs, Livermore Using The Common Component Architecture to Design Simulation Codes.

Summary

Components, code

Very different physics/numerics by replacing physics components

Single cpu performance not harmed by componentization

Scalability – no effect

Flexible, parallel, etc. etc. …

Success story …? Not so fast …

Page 25: J. Ray, S. Lefantzi and H. Najm Sandia National Labs, Livermore Using The Common Component Architecture to Design Simulation Codes.

Pros and cons

Cons : A set of components solve a PDE subject to a particular

numerical scheme Numerics decides the main subsystems of the component

assembly Variation on the main theme is easy Too large a change and you have to recreate a big

percentage of components

Pros : Physics components appear at the bottom of the hierarchy Changing physics models is easy. Note : Adding new physics, if requiring a brand-new numerical

algorithm is NOT trivial.