Presentation is loading. Please wait.

Presentation is loading. Please wait.

Programming Models for Blue Gene/L : Charm++, AMPI and Applications

Similar presentations


Presentation on theme: "Programming Models for Blue Gene/L : Charm++, AMPI and Applications"— Presentation transcript:

1 Programming Models for Blue Gene/L : Charm++, AMPI and Applications
Laxmikant Kale Parallel Programming Laboratory Dept. of Computer Science University of Illinois at Urbana Champaign

2 Processor virtualization
Outline BG/L Prog. Development env Emulation setup Simulation and Perf Prediction Timestamp correction Sdag and determinacy Applications using BG/C,BG/L NAMD on Lemieux LeanMD, 3D FFT Ongoing research: Load balancing Communication optimization Other models: Converse Compiler support Scaling to BG/L Communication, Mapping, reliability/FT, Critical paths & load imbalance The virtualization model Basic ideas Charm++ and AMPI Virtualization: a magic bullet: Logical decomposition, Software eng., Flexible map Message driven execution: Principle of persistence Runtime optimizations November 13, 2018 Processor virtualization

3 Processor virtualization
Technical Approach Seek optimal division of labor between “system” and programmer: Decomposition done by programmer, everything else automated Specialization MPI HPF Automation Expression Scheduling Mapping Decomposition Charm++ November 13, 2018 Processor virtualization

4 Object-based Decomposition
Idea: Divide the computation into a large number of pieces Independent of number of processors Typically larger than number of processors Let the system map objects to processors Old idea? Fox (’86?), DRMS, Our approach is “virtualization++” Language and runtime support for virtualization Exploitation of virtualization to the hilt November 13, 2018 Processor virtualization

5 Object-based Parallelization
User is only concerned with interaction between objects System implementation User View November 13, 2018 Processor virtualization

6 Realizations: Charm++
Parallel C++ with Data Driven Objects (Chares) Object Arrays/ Object Collections Object Groups: Global object with a “representative” on each PE Asynchronous method invocation Prioritized scheduling Information sharing abstractions: readonly, tables,.. Mature, robust, portable ( November 13, 2018 Processor virtualization

7 Processor virtualization
Chare Arrays Elements are data-driven objects Elements are indexed by a user-defined data type-- [sparse] 1D, 2D, 3D, tree, ... Send messages to index, receive messages at element. Reductions and broadcasts across the array Dynamic insertion, deletion, migration-- and everything still has to work! November 13, 2018 Processor virtualization

8 Processor virtualization
Object Arrays A collection of data-driven objects (aka chares), With a single global name for the collection, and Each member addressed by an index Mapping of element objects to processors handled by the system User’s view A[0] A[1] A[2] A[3] A[..] November 13, 2018 Processor virtualization

9 Processor virtualization
Object Arrays A collection of chares, with a single global name for the collection, and each member addressed by an index Mapping of element objects to processors handled by the system User’s view A[0] A[1] A[2] A[3] A[..] System view A[0] A[3] November 13, 2018 Processor virtualization

10 Processor virtualization
Object Arrays A collection of chares, with a single global name for the collection, and each member addressed by an index Mapping of element objects to processors handled by the system User’s view A[0] A[1] A[2] A[3] A[..] System view A[0] A[3] November 13, 2018 Processor virtualization

11 Processor virtualization
Comparison with MPI Advantage: Charm++ Modules/Abstractions are centered on application data structures, Not processors Several other… Advantage: MPI Highly popular, widely available, industry standard “Anthropomorphic” view of processor Many developers find this intuitive But mostly: There is no hope of weaning people away from MPI There is no need to choose between them! November 13, 2018 Processor virtualization

12 Processor virtualization
Adaptive MPI A migration path for legacy MPI codes Allows them dynamic load balancing capabilities of Charm++ AMPI = MPI + dynamic load balancing Uses Charm++ object arrays and migratable threads Minimal modifications to convert existing MPI programs Automated via AMPizer Based on Polaris Compiler Framework Bindings for C, C++, and Fortran90 November 13, 2018 Processor virtualization

13 Processor virtualization
AMPI: 7 MPI processes November 13, 2018 Processor virtualization

14 Processor virtualization
AMPI: 7 MPI “processes” Implemented as virtual processors (user-level migratable threads) Real Processors November 13, 2018 Processor virtualization

15 II: Consequences of Virtualization
Better Software Engineering Message Driven Execution Flexible and dynamic mapping to processors November 13, 2018 Processor virtualization

16 Processor virtualization
Modularization Logical Units decoupled from “Number of processors” E.G. Oct tree nodes for particle data No artificial restriction on the number of processors Cube of power of 2 Modularity: Software engineering: cohesion and coupling MPI’s “are on the same processor” is a bad coupling principle Objects liberate you from that: E.G. Solid and fluid moldules in a rocket simulation November 13, 2018 Processor virtualization

17 Processor virtualization
Rocket Simulation Large Collaboration headed Mike Heath DOE supported center Challenge: Multi-component code, with modules from independent researchers MPI was common base AMPI: new wine in old bottle Easier to convert Can still run original codes on MPI, unchanged November 13, 2018 Processor virtualization

18 Rocket simulation via virtual processors
Rocflo Rocface Rocsolid Rocflo Rocface Rocsolid November 13, 2018 Processor virtualization

19 AMPI and Roc*: Communication
Rocflo Rocflo Rocflo Rocflo Rocflo Rocface Rocsolid Rocface Rocsolid Rocface Rocsolid Rocface Rocsolid Rocface Rocsolid November 13, 2018 Processor virtualization

20 Message Driven Execution
Scheduler Scheduler Message Q Message Q November 13, 2018 Processor virtualization

21 Adaptive Overlap via Data-driven Objects
Problem: Processors wait for too long at “receive” statements Routine communication optimizations in MPI Move sends up and receives down Sometimes. Use irecvs, but be careful With Data-driven objects Adaptive overlap of computation and communication No object or threads holds up the processor No need to guess which is likely to arrive first November 13, 2018 Processor virtualization

22 Adaptive overlap and modules
This is very nicely illustrated in a figure I borrowed from Attila Gursoy’s thesis. Module A needs to avail services from Module B and C. In a message-passing paradigm, these modules cannot execute concurrently, thus idle times in one modules cannot be substituted by computations from another module. This is possible in message-driven paradigm. We therefore base our component architecture on a message-driven runtime system, called Converse. We describe Converse next. SPMD and Message-Driven Modules (From A. Gursoy, Simplified expression of message-driven programs and quantification of their impact on performance, Ph.D Thesis, Apr 1994.) November 13, 2018 Processor virtualization

23 Handling OS Jitter via MDE
MDE encourages asynchrony Asynchronous reductions, for example Only data dependence should force synchronization One benefit: Consider an algorithm with N steps Each step has different load balance:Tij Loose dependence between steps (on neighbors, for example) Sum-of-max (MPI) vs max-of-sum (MDE) OS Jitter: Causes random processors to add delays in each step Handled Automatically by MDE November 13, 2018 Processor virtualization

24 Virtualization/MDE leads to predictability
Ability to predict: Which data is going to be needed and Which code will execute Based on the ready queue of object method invocations So, we can: Prefetch data accurately Prefetch code if needed Out-of-core execution Caches vs controllable SRAM S Q November 13, 2018 Processor virtualization

25 Flexible Dynamic Mapping to Processors
The system can migrate objects between processors Vacate workstation used by a parallel program Dealing with extraneous loads on shared workstations Shrink and Expand the set of processors used by an app Adaptive job scheduling Better System utilization Adapt to speed difference between processors E.g. Cluster with 500 MHz and 1 Ghz processors Automatic checkpointing Checkpointing = migrate to disk! Restart on a different number of processors November 13, 2018 Processor virtualization

26 Principle of Persistence
Once the application is expressed in terms of interacting objects: Object communication patterns and computational loads tend to persist over time In spite of dynamic behavior Abrupt and large,but infrequent changes (eg:AMR) Slow and small changes (eg: particle migration) Parallel analog of principle of locality Heuristics, that holds for most CSE applications Learning / adaptive algorithms Adaptive Communication libraries Measurement based load balancing November 13, 2018 Processor virtualization

27 Measurement Based Load Balancing
Based on Principle of persistence Runtime instrumentation Measures communication volume and computation time Measurement based load balancers Use the instrumented data-base periodically to make new decisions Many alternative strategies can use the database Centralized vs distributed Greedy improvements vs complete reassignments Taking communication into account Taking dependences into account (More complex) November 13, 2018 Processor virtualization

28 Load balancer in action
Automatic Load Balancing in Crack Propagation 1. Elements Added 3. Chunks Migrated 2. Load Balancer Invoked November 13, 2018 Processor virtualization

29 “Overhead” of Virtualization
November 13, 2018 Processor virtualization

30 Optimizing for Communication Patterns
The parallel-objects Runtime System can observe, instrument, and measure communication patterns Communication is from/to objects, not processors Load balancers use this to optimize object placement Communication libraries can optimize By substituting most suitable algorithm for each operation Learning at runtime E.g. Each to all individualized sends Performance depends on many runtime characteristics Library switches between different algorithms V. Krishnan, MS Thesis, 1996 November 13, 2018 Processor virtualization

31 Example: All to all on Lemieux
November 13, 2018 Processor virtualization

32 The Other Side: Pipelining
A sends a large message to B, whereupon B computes Problem: B is idle for a long time, while the message gets there. Solution: Pipelining Send the message in multiple pieces, triggering a computation on each Objects makes this easy to do: Example: Ab Initio Computations using Car-Parinello method Multiple 3D FFT kernel Recent collaboration with: R. Car, M. Klein, G. Martyna, M, Tuckerman, N. Nystrom, J. Torrellas November 13, 2018 Processor virtualization

33 Processor virtualization
November 13, 2018 Processor virtualization

34 Processor virtualization
Effect of Pipelining Multiple Concurrent 3D FFTs, on 64 Processors of Lemieux V. Ramkumar (PPL) November 13, 2018 Processor virtualization

35 Control Points: learning and tuning
The RTS can automatically optimize the degree of pipelining If it is given a control point (knob) to tune By the application Controlling pipelining between a pair of objects: S. Krishnan, PhD Thesis, 1994 Controlling degree of virtualization: Orchestration Framework: M. Bhandarkar PhD thesis, 2002 November 13, 2018 Processor virtualization

36 So, What Are We Doing About It?
How to develop any programming environment for a machine that isn’t built yet Blue Gene/C emulator using charm++ Completed last year Implememnts low level BG/C API Packet sends, extract packet from comm buffers Emulation runs on machines with hundreds of “normal” processors Charm++ on blue Gene /C Emulator November 13, 2018 Processor virtualization

37 So, What Are We Doing About It?
How to develop any programming environment for a machine that isn’t built yet Blue Gene/C emulator using charm++ Completed last year Implememnts low level BG/C API Packet sends, extract packet from comm buffers Emulation runs on machines with hundreds of “normal” processors Charm++ on blue Gene /C Emulator November 13, 2018 Processor virtualization

38 Structure of the Emulators
Charm++ Blue Gene/C Low-level API Charm++ BG/C low level API Charm++ Converse Converse November 13, 2018 Processor virtualization

39 Structure of the Emulators
Charm++ Blue Gene/C Low-level API Charm++ BG/C low level API Charm++ Converse Converse November 13, 2018 Processor virtualization

40 Emulation on a Parallel Machine
BG/C Nodes Simulating (Host) Processor Hardware thread November 13, 2018 Processor virtualization

41 Emulation on a Parallel Machine
BG/C Nodes Simulating (Host) Processor Hardware thread November 13, 2018 Processor virtualization

42 Extensions to Charm++ for BG/C
Microtasks: Objects may fire microtasks that can be executed by any thread on the same node Increases parallelism Overhead: sub-microsecond Issue: Object affinity: map to thread or node? Thread, currently. Microtasks alleviate load balancing within a node November 13, 2018 Processor virtualization

43 Extensions to Charm++ for BG/C
Microtasks: Objects may fire microtasks that can be executed by any thread on the same node Increases parallelism Overhead: sub-microsecond Issue: Object affinity: map to thread or node? Thread, currently. Microtasks alleviate load balancing within a node November 13, 2018 Processor virtualization

44 Processor virtualization
Emulation efficiency How much time does it take to run an emulation? 8 Million processors being emulated on 100 In addition, lower cache performance Lots of tiny messages On a Linux cluster: Emulation shows good speedup November 13, 2018 Processor virtualization

45 Processor virtualization
Emulation efficiency How much time does it take to run an emulation? 8 Million processors being emulated on 100 In addition, lower cache performance Lots of tiny messages On a Linux cluster: Emulation shows good speedup November 13, 2018 Processor virtualization

46 Emulation efficiency 1000 BG/C nodes (10x10x10) Each with 200 threads
(total of 200,000 user-level threads) But Data is preliminary, based on one simulation November 13, 2018 Processor virtualization

47 Emulation efficiency 1000 BG/C nodes (10x10x10) Each with 200 threads
(total of 200,000 user-level threads) But Data is preliminary, based on one simulation November 13, 2018 Processor virtualization

48 Processor virtualization
Emulator to Simulator Step 1: Coarse grained simulation Simulation: performance prediction capability Models contention for processor/thread Also models communication delay based on distance Doesn’t model memory access on chip, or network How to do this in spite of out-of-order message delivery? Rely on determinism of Charm++ programs Time stamped messages and threads Parallel time-stamp correction algorithm November 13, 2018 Processor virtualization

49 Processor virtualization
Emulator to Simulator Step 1: Coarse grained simulation Simulation: performance prediction capability Models contention for processor/thread Also models communication delay based on distance Doesn’t model memory access on chip, or network How to do this in spite of out-of-order message delivery? Rely on determinism of Charm++ programs Time stamped messages and threads Parallel time-stamp correction algorithm November 13, 2018 Processor virtualization

50 Processor virtualization
Emulator to Simulator Step 2: Add fine grained procesor simulation Sarita Adve: RSIM based simulation of a node SMP node simulation: completed Also: simulation of interconnection network Millions of thread units/caches to simulate in detail? Step 3: Hybrid simulation Instead: use detailed simulation to build model Drive coarse simulation using model behavior Further help from compiler and RTS November 13, 2018 Processor virtualization

51 Processor virtualization
Emulator to Simulator Step 2: Add fine grained procesor simulation Sarita Adve: RSIM based simulation of a node SMP node simulation: completed Also: simulation of interconnection network Millions of thread units/caches to simulate in detail? Step 3: Hybrid simulation Instead: use detailed simulation to build model Drive coarse simulation using model behavior Further help from compiler and RTS November 13, 2018 Processor virtualization

52 Applications on the current system
Using BG Charm++ LeanMD: Research quality Molecular Dyanmics Version 0: only electrostatics + van der Vaal Simple AMR kernel Adaptive tree to generate millions of objects Each holding a 3D array Communication with “neighbors” Tree makes it harder to find nbrs, but Charm makes it easy November 13, 2018 Processor virtualization

53 Modeling layers Applications
For each: need a detailed simulation and a simpler (e.g. table-driven) “model” Libraries/RTS Chip Architecture Network model And methods for combining them November 13, 2018 Processor virtualization

54 Modeling layers Applications
For each: need a detailed simulation and a simpler (e.g. table-driven) “model” Libraries/RTS Chip Architecture Network model And methods for combining them November 13, 2018 Processor virtualization

55 Processor virtualization
Timestamp correction Basic execution: Timestamped messages Correction needed when: A message arrives with an earlier timestamp than other messages “processed” already Cases: Messages to Handlers or simple objects MPI style threads, without wildcard or irecvs Charm++ with dependence expressed via structured dagger November 13, 2018 Processor virtualization

56 Timestamps Correction
RecvTime Execution TimeLine M8 November 13, 2018 Processor virtualization

57 Timestamps Correction
RecvTime Execution TimeLine M8 November 13, 2018 Processor virtualization

58 Timestamps Correction
RecvTime Execution TimeLine M8 Execution TimeLine M1 M7 M6 M5 M4 M3 M2 M8 RecvTime Correction Message November 13, 2018 Processor virtualization

59 Timestamps Correction
RecvTime Execution TimeLine Correction Message (M4) M4 Correction Message (M4) M4 M1 M7 M6 M4 M3 M2 RecvTime Execution TimeLine M5 Correction Message M1 M7 M4 M3 M2 RecvTime Execution TimeLine M5 M6 Correction Message November 13, 2018 Processor virtualization

60 Performance of correction Algorithm
Without correction 15 seconds to emulate a 18msec timstep 10x10x10 nodes with k threads each (200?) With correction Version 1: 42 minutes per step! Version 2: “Chase” and correct messages still in queues Optimize search for messages in the log data Currently at 30 secs per step November 13, 2018 Processor virtualization

61 Applications on the current system
Using BG Charm++ LeanMD: Research quality Molecular Dyanmics Version 0: only electrostatics + van der Vaal Simple AMR kernel Adaptive tree to generate millions of objects Each holding a 3D array Communication with “neighbors” Tree makes it harder to find nbrs, but Charm makes it easy November 13, 2018 Processor virtualization

62 Example: Molecular Dynamics in NAMD
Collection of [charged] atoms, with bonds Newtonian mechanics Thousands of atoms (1, ,000) 1 femtosecond time-step, millions needed! At each time-step Calculate forces on each atom Bonds: Non-bonded: electrostatic and van der Waal’s Calculate velocities and advance positions Multiple Time Stepping : PME (3D FFT) every 4 steps Collaboration with K. Schulten, R. Skeel, and coworkers November 13, 2018 Processor virtualization

63 NAMD: Molecular Dynamics
Collection of [charged] atoms, with bonds Newtonian mechanics At each time-step Calculate forces on each atom Bonds: Non-bonded: electrostatic and van der Waal’s Calculate velocities and advance positions 1 femtosecond time-step, millions needed! Thousands of atoms (1, ,000) Collaboration with K. Schulten, R. Skeel, and coworkers November 13, 2018 Processor virtualization

64 Processor virtualization
Further MD Use of cut-off radius to reduce work Å Faraway charges ignored! 80-95 % work is non-bonded force computations Some simulations need faraway contributions November 13, 2018 Processor virtualization

65 Processor virtualization
Scalability The Program should scale up to use a large number of processors. But what does that mean? An individual simulation isn’t truly scalable Better definition of scalability: If I double the number of processors, I should be able to retain parallel efficiency by increasing the problem size November 13, 2018 Processor virtualization

66 Processor virtualization
Isoefficiency Quantify scalability How much increase in problem size is needed to retain the same efficiency on a larger machine? Efficiency : Seq. Time/ (P · Parallel Time) parallel time = computation + communication + idle November 13, 2018 Processor virtualization

67 Traditional Approaches
Replicated Data: All atom coordinates stored on each processor Non-bonded Forces distributed evenly Analysis: Assume N atoms, P processors Computation: O(N/P) Communication: O(N log P) Communication/Computation ratio: P log P Fraction of communication increases with number of processors, independent of problem size! Not Scalable November 13, 2018 Processor virtualization

68 Processor virtualization
Atom decomposition Partition the Atoms array across processors Nearby atoms may not be on the same processor Communication: O(N) per processor Communication/Computation: O(P) Not Scalable November 13, 2018 Processor virtualization

69 Processor virtualization
Force Decomposition Distribute force matrix to processors Matrix is sparse, non uniform Each processor has one block Communication: N/sqrt(P) Ratio: sqrt(P) Better scalability (can use 100+ processors) Hwang, Saltz, et al: 6% on 32 Pes % on 128 processor Not Scalable November 13, 2018 Processor virtualization

70 Spatial Decomposition
Allocate close-by atoms to the same processor Three variations possible: Partitioning into P boxes, 1 per processor Good scalability, but hard to implement Partitioning into fixed size boxes, each a little larger than the cutoff disctance Partitioning into smaller boxes Communication: O(N/P) November 13, 2018 Processor virtualization

71 Spatial Decomposition in NAMD
NAMD 1 used spatial decomposition Good theoretical isoefficiency, but for a fixed size system, load balancing problems For midsize systems, got good speedups up to 16 processors…. Use the symmetry of Newton’s 3rd law to facilitate load balancing November 13, 2018 Processor virtualization

72 Spatial Decomposition
November 13, 2018 Processor virtualization

73 Processor virtualization
Spatial Decomposition November 13, 2018 Processor virtualization

74 Processor virtualization
FD + SD Now, we have many more objects to load balance: Each diamond can be assigned to any processor Number of diamonds (3D): 14·Number of Patches November 13, 2018 Processor virtualization

75 Processor virtualization
Bond Forces Multiple types of forces: Bonds(2), Angles(3), Dihedrals (4), .. Luckily, each involves atoms in neighboring patches only Straightforward implementation: Send message to all neighbors, receive forces from them 26*2 messages per patch! November 13, 2018 Processor virtualization

76 Processor virtualization
Bonded Forces: Assume one patch per processor A C B November 13, 2018 Processor virtualization

77 Optimizations in scaling to 1000
Parallelization is based on parallel objects Charm++ : a parallel C++ Series of optimizations were implemented to scale performance to processors Examples: Load Balancing: Grainsize distributions November 13, 2018 Processor virtualization

78 Grainsize and Amdahls’s law
A variant of Amdahl’s law, for objects: The fastest time can be no shorter than the time for the biggest single object! How did it apply to us? Sequential step time was 57 seconds To run on 2k processors, no object should be more than 28 msecs. Analysis using our tools showed: November 13, 2018 Processor virtualization

79 Processor virtualization
Grainsize analysis Solution: Split compute objects that may have too much work: using a heuristics based on number of interacting atoms Problem November 13, 2018 Processor virtualization

80 Processor virtualization
Grainsize reduced November 13, 2018 Processor virtualization

81 NAMD performance using virtualization
Written in Charm++ Uses measurement based load balancing Object level performance feedback using “projections” tool for Charm++ Identifies problems at source level easily Almost suggests fixes Attained unprecedented performance November 13, 2018 Processor virtualization

82 Processor virtualization
November 13, 2018 Processor virtualization

83 Processor virtualization
November 13, 2018 Processor virtualization

84 Processor virtualization
PME parallelization Impor4t picture from sc02 paper (sindhura’s) November 13, 2018 Processor virtualization

85 Processor virtualization
November 13, 2018 Processor virtualization

86 Processor virtualization
November 13, 2018 Processor virtualization

87 Performance: NAMD on Lemieux
ATPase: 320,000+ atoms including water November 13, 2018 Processor virtualization

88 Processor virtualization
LeanMD for BG/L Need many more objects: Generalize hybrid decompostion scheme 1-away to k-away November 13, 2018 Processor virtualization

89 Processor virtualization
November 13, 2018 Processor virtualization

90 Processor virtualization
Role of compilers New uses of compiler analysis Apparently simple, but then again, data flow analysis must have seemed simple Supporting Threads, Shades of global variables Minimizing state at migration Border fusion Split-phase semantics (UPC). Components (separately compiled) Compiler – RTS collaboration needed! November 13, 2018 Processor virtualization

91 Processor virtualization
Summary Virtualization as a magic bullet Logical decomposition, better software eng. Flexible and dynamic mapping to processors Message driven execution: Adaptive overlap, modularity, predictability Principle of persistence Measurement based load balancing, Adaptive communication libraries Future: Compiler support Realize the potential: Strategies and applications More info: November 13, 2018 Processor virtualization

92 Component Frameworks Seek optimal division of labor between “system” and programmer: Decomposition done by programmer, everything else automated Develop standard library of reusable parallel components Domain specific frameworks Specialization MPI expression Scheduling Mapping Decomposition HPF Charm++ November 13, 2018 Processor virtualization


Download ppt "Programming Models for Blue Gene/L : Charm++, AMPI and Applications"

Similar presentations


Ads by Google