1 Case Study I: Parallel Molecular Dynamics and NAMD: Laxmikant Kale Parallel Programming Laboratory University of Illinois at.

Slides:



Advertisements
Similar presentations
The Charm++ Programming Model and NAMD Abhinav S Bhatele Department of Computer Science University of Illinois at Urbana-Champaign
Advertisements

1 NAMD - Scalable Molecular Dynamics Gengbin Zheng 9/1/01.
Course Outline Introduction in algorithms and applications Parallel machines and architectures Overview of parallel machines, trends in top-500 Cluster.
Abhinav Bhatele, Laxmikant V. Kale University of Illinois at Urbana-Champaign Sameer Kumar IBM T. J. Watson Research Center.
Abhinav Bhatele, Laxmikant V. Kale University of Illinois at Urbana-Champaign Sameer Kumar IBM T. J. Watson Research Center.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Parallel Programming in C with MPI and OpenMP Michael J. Quinn.
Adaptive MPI Chao Huang, Orion Lawlor, L. V. Kalé Parallel Programming Lab Department of Computer Science University of Illinois at Urbana-Champaign.
Efficient Parallelization for AMR MHD Multiphysics Calculations Implementation in AstroBEAR.
Topology Aware Mapping for Performance Optimization of Science Applications Abhinav S Bhatele Parallel Programming Lab, UIUC.
A Framework for Collective Personalized Communication Laxmikant V. Kale, Sameer Kumar, Krishnan Varadarajan.
Charm++ Load Balancing Framework Gengbin Zheng Parallel Programming Laboratory Department of Computer Science University of Illinois at.
1CPSD NSF/DARPA OPAAL Adaptive Parallelization Strategies using Data-driven Objects Laxmikant Kale First Annual Review October 1999, Iowa City.
Algorithms and Software for Large-Scale Simulation of Reactive Systems _______________________________ Ananth Grama Coordinated Systems Lab Purdue University.
Scaling to New Heights Retrospective IEEE/ACM SC2002 Conference Baltimore, MD.
Martin Berzins (Steve Parker) What are the hard apps problems? How do the solutions get shared? What non-apps work is needed? Thanks to DOE for funding.
Adaptive MPI Milind A. Bhandarkar
1 Scalable Molecular Dynamics for Large Biomolecular Systems Robert Brunner James C Phillips Laxmikant Kale.
1 Introduction to Parallel Computing Issues Laxmikant Kale Parallel Programming Laboratory Dept. of Computer Science And Theoretical.
Supporting Multi-domain decomposition for MPI programs Laxmikant Kale Computer Science 18 May 2000 ©1999 Board of Trustees of the University of Illinois.
Chapter 3 Parallel Algorithm Design. Outline Task/channel model Task/channel model Algorithm design methodology Algorithm design methodology Case studies.
Molecular Dynamics Collection of [charged] atoms, with bonds – Newtonian mechanics – Relatively small #of atoms (100K – 10M) At each time-step – Calculate.
Scheduling Many-Body Short Range MD Simulations on a Cluster of Workstations and Custom VLSI Hardware Sumanth J.V, David R. Swanson and Hong Jiang University.
P ARALLELIZATION IN M OLECULAR D YNAMICS By Aditya Mittal For CME346A by Professor Eric Darve Stanford University.
Dynamic Load Balancing in Charm++ Abhinav S Bhatele Parallel Programming Lab, UIUC.
Issues Autonomic operation (fault tolerance) Minimize interference to applications Hardware support for new operating systems Resource management (global.
NIH Resource for Biomolecular Modeling and Bioinformatics Beckman Institute, UIUC NAMD Development Goals L.V. (Sanjay) Kale Professor.
NIH Resource for Biomolecular Modeling and Bioinformatics Beckman Institute, UIUC NAMD Development Goals L.V. (Sanjay) Kale Professor.
An FPGA Implementation of the Ewald Direct Space and Lennard-Jones Compute Engines By: David Chui Supervisor: Professor P. Chow.
Overcoming Scaling Challenges in Bio-molecular Simulations Abhinav Bhatelé Sameer Kumar Chao Mei James C. Phillips Gengbin Zheng Laxmikant V. Kalé.
Workshop BigSim Large Parallel Machine Simulation Presented by Eric Bohm PPL Charm Workshop 2004.
1 NAMD: Biomolecular Simulation on Thousands of Processors James C. Phillips Gengbin Zheng Sameer Kumar Laxmikant Kale Parallel.
University of Illinois at Urbana-Champaign Memory Architectures for Protein Folding: MD on million PIM processors Fort Lauderdale, May 03,
1 Scaling Applications to Massively Parallel Machines using Projections Performance Analysis Tool Presented by Chee Wai Lee Authors: L. V. Kale, Gengbin.
What’s New With NAMD Triumph and Torture with New Platforms
Lecture 4 TTH 03:30AM-04:45PM Dr. Jianjun Hu CSCE569 Parallel Computing University of South Carolina Department of.
Scalability and interoperable libraries in NAMD Laxmikant (Sanjay) Kale Theoretical Biophysics group and Department of Computer Science University of Illinois.
1 ©2004 Board of Trustees of the University of Illinois Computer Science Overview Laxmikant (Sanjay) Kale ©
Parallel Molecular Dynamics Application Oriented Computer Science Research Laxmikant Kale
Parallelizing Spacetime Discontinuous Galerkin Methods Jonathan Booth University of Illinois at Urbana/Champaign In conjunction with: L. Kale, R. Haber,
1 Scaling Molecular Dynamics to 3000 Processors with Projections: A Performance Analysis Case Study Laxmikant Kale Gengbin Zheng Sameer Kumar Chee Wai.
IPDPS Workshop: Apr 2002PPL-Dept of Computer Science, UIUC A Parallel-Object Programming Model for PetaFLOPS Machines and BlueGene/Cyclops Gengbin Zheng,
Scalable and Topology-Aware Load Balancers in Charm++ Amit Sharma Parallel Programming Lab, UIUC.
Parallelization Strategies Laxmikant Kale. Overview OpenMP Strategies Need for adaptive strategies –Object migration based dynamic load balancing –Minimal.
NGS/IBM: April2002PPL-Dept of Computer Science, UIUC Programming Environment and Performance Modeling for million-processor machines Laxmikant (Sanjay)
NGS Workshop: Feb 2002PPL-Dept of Computer Science, UIUC Programming Environment and Performance Modeling for million-processor machines Laxmikant (Sanjay)
1 Opportunities and Challenges of Modern Communication Architectures: Case Study with QsNet CAC Workshop Santa Fe, NM, 2004 Sameer Kumar* and Laxmikant.
1 Rocket Science using Charm++ at CSAR Orion Sky Lawlor 2003/10/21.
Motivation: dynamic apps Rocket center applications: –exhibit irregular structure, dynamic behavior, and need adaptive control strategies. Geometries are.
Hierarchical Load Balancing for Large Scale Supercomputers Gengbin Zheng Charm++ Workshop 2010 Parallel Programming Lab, UIUC 1Charm++ Workshop 2010.
Computer Science Overview Laxmikant Kale October 29, 2002 ©2002 Board of Trustees of the University of Illinois ©
1 Major analytical/theoretical techniques Typically involves simple algebraic formulas, and ratios –Typical variables are: data size (N), number of processors.
Dynamic Load Balancing Tree and Structured Computations.
Programming for Performance Laxmikant Kale CS 433.
Parallel Molecular Dynamics A case study : Programming for performance Laxmikant Kale
Flexibility and Interoperability in a Parallel MD code Robert Brunner, Laxmikant Kale, Jim Phillips University of Illinois at Urbana-Champaign.
Parallel Programming By J. H. Wang May 2, 2017.
Parallel Objects: Virtualization & In-Process Components
Performance Evaluation of Adaptive MPI
Implementing Simplified Molecular Dynamics Simulation in Different Parallel Paradigms Chao Mei April 27th, 2006 CS498LVK.
Programming Models for Blue Gene/L : Charm++, AMPI and Applications
Component Frameworks:
Scalable Molecular Dynamics for Large Biomolecular Systems
Milind A. Bhandarkar Adaptive MPI Milind A. Bhandarkar
Course Outline Introduction in algorithms and applications
Gengbin Zheng, Esteban Meneses, Abhinav Bhatele and Laxmikant V. Kale
IXPUG, SC’16 Lightning Talk Kavitha Chandrasekar*, Laxmikant V. Kale
Parallel Programming in C with MPI and OpenMP
An Orchestration Language for Parallel Objects
Higher Level Languages on Adaptive Run-Time System
Presentation transcript:

1 Case Study I: Parallel Molecular Dynamics and NAMD: Laxmikant Kale Parallel Programming Laboratory University of Illinois at Urbana Champaign

2 Outline Challenge of MD: Charm++: –Virtualization, load balancing, –Principle of persistence, –Measurementt based load balance NAMD parallelization –Virtual processors Optimizations and ideas: –Better load balancing: explicitly model communication cost –Refinement (cycle description) –Consistency of speedup over timesteps –Problem: commn/OS jitter Async reductions Dynamic substep balancing to handle jitter PME parallelization –PME description: 3D FFT FFTW and modifications –VP picture –Multi-timestepping Overlap Transpose optimization Performance data –Speedup –Table –Components: Angle, non-bonded, pme, integration Commn overhead:

3 NAMD: A Production MD program NAMD Fully featured program NIH-funded development Distributed free of charge (~5000 downloads so far) Binaries and source code Installed at NSF centers User training and support Large published simulations (e.g., aquaporin simulation featured in keynote)

4 NAMD, CHARMM27, PME NpT ensemble at 310 or 298 K 1ns equilibration, 4ns production Protein:~ 15,000 atoms Lipids (POPE):~ 40,000 atoms Water:~ 51,000 atoms Total:~ 106,000 atoms 3.5 days / ns O2000 CPUs 11 days / ns - 32 Linux CPUs.35 days/ns–512 LeMieux CPUs Acquaporin Simulation F. Zhu, E.T., K. Schulten, FEBS Lett. 504, 212 (2001) M. Jensen, E.T., K. Schulten, Structure 9, 1083 (2001)

5 Molecular Dynamics in NAMD Collection of [charged] atoms, with bonds –Newtonian mechanics –Thousands of atoms (10, ,000) At each time-step –Calculate forces on each atom Bonds: Non-bonded: electrostatic and van der Waal’s –Short-distance: every timestep –Long-distance: using PME (3D FFT) –Multiple Time Stepping : PME every 4 timesteps –Calculate velocities and advance positions Challenge: femtosecond time-step, millions needed! Collaboration with K. Schulten, R. Skeel, and coworkers

6 Sizes of Simulations Over Time BPTI 3K atoms Estrogen Receptor 36K atoms (1996) ATP Synthase 327K atoms (2001)

7 Parallel MD: Easy or Hard? Easy –Tiny working data –Spatial locality –Uniform atom density –Persistent repetition –Multiple timestepping Hard –Sequential timesteps –Short iteration time –Full electrostatics –Fixed problem size –Dynamic variations –Multiple timestepping!

8 Other MD Programs for Biomolecules CHARMM Amber GROMACS NWChem LAMMPS

9 Traditional Approaches: non isoefficient Replicated Data: –All atom coordinates stored on each processor Communication/Computation ratio: P log P Partition the Atoms array across processors –Nearby atoms may not be on the same processor –C/C ratio: O(P) Distribute force matrix to processors –Matrix is sparse, non uniform, – C/C Ratio: sqrt(P)

10 Spatial Decomposition Atoms distributed to cubes based on their location Size of each cube : Just a bit larger than cut-off radius Communicate only with neighbors Work: for each pair of nbr objects C/C ratio: O(1) However: Load Imbalance Limited Parallelism Cells, Cubes or“Patches” Charm++ is useful to handle this

11 Virtualization: Object-based Parallelization User View System implementation User is only concerned with interaction between objects

12 Data driven execution Scheduler Message Q

13 Measurement Based Load Balancing Principle of persistence –Object communication patterns and computational loads tend to persist over time –In spite of dynamic behavior Abrupt but infrequent changes Slow and small changes Runtime instrumentation –Measures communication volume and computation time Measurement based load balancers –Use the instrumented data-base periodically to make new decisions

14 Spatial Decomposition Via Charm Atoms distributed to cubes based on their location Size of each cube : Just a bit larger than cut-off radius Communicate only with neighbors Work: for each pair of nbr objects C/C ratio: O(1) However: Load Imbalance Limited Parallelism Cells, Cubes or“Patches” Charm++ is useful to handle this

15 Object Based Parallelization for MD: Force Decomposition + Spatial Decomposition Now, we have many objects to load balance: –Each diamond can be assigned to any proc. – Number of diamonds (3D): –14·Number of Patches

16 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! Instead, we do: –Send to (7) upstream nbrs –Each force calculated at one patch B CA

VPs NAMD Parallelization using Charm++ These 30,000+ Virtual Processors (VPs) are mapped to real processors by charm runtime system 9,800 VPs

18 Optimizing multicast

19

processors: utilization and load balancing

procs

22

23

24

25

26

27

28

29 Performance Data: SC2000

30 New Challenges New parallel machine with faster processors –PSC Lemieux –1 processor performance: 57 seconds on ASCI red to 7.08 seconds on Lemieux –Makes is harder to parallelize: E.g. larger communication-to-computation ratio Each timestep is few milliseconds on 1000’s of processors Incorporation of Particle Mesh Ewald (PME)

31 F 1 F 0 ATP-Synthase (ATP-ase) CConverts the electrochemical energy of the proton gradient into the mechanical energy of the central stalk rotation, driving ATP synthesis (  G = 7.7 kcal/mol). 327,000 atoms total, 51,000 atoms -- protein and nucletoide 276,000 atoms -- water and ions The Benchmark

32 Overview of Performance Optimizations Grainsize Optimizations Load Balancing Improvements: –Explicitly model communication cost Using Elan library instead of MPI Asynchronous reductions Substep dynamic load adjustment PME Parallelization

33 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! –Lesson from previous efforts Splitting computation objects: –30,000 nonbonded compute objects –Instead of approx 10,000

VPs NAMD Parallelization using Charm++ These 30,000+ Virtual Processors (VPs) are mapped to real processors by charm runtime system 30,000 VPs

35 Mode: 700 us Distribution of execution times of non-bonded force computation objects (over 24 steps)

36 Periodic Load Balancing Strategies Centralized strategy: –Charm RTS collects data (on one processor) about: Computational Load and Communication for each pair –Partition the graph of objects across processors Take communication into account –Pt-to-pt, as well as multicast over a subset –As you map an object, add to the load on both sending and receiving processor The red communication is free, if it is a multicast.

37 Load Balancing Steps Regular Timesteps Instrumented Timesteps Detailed, aggressive Load Balancing Refinement Load Balancing

38 Another New Challenge Jitter due small variations –On 2k processors or more –Each timestep, ideally, will be about msec for ATPase –Within that time: each processor sends and receives : Approximately messages of 4-6 KB each –Communication layer and/or OS has small “hiccups” No problem until 512 processors Small rare hiccups can lead to large performance impact –When timestep is small (10-20 msec), AND –Large number of processors are used

39 Benefits of Avoiding Barrier Problem with barriers: –Not the direct cost of the operation itself as much –But it prevents the program from adjusting to small variations E.g. K phases, separated by barriers (or scalar reductions) Load is effectively balanced. But, –In each phase, there may be slight non-determistic load imbalance –Let Li,j be the load on I’th processor in j’th phase. In NAMD, using Charm++’s message-driven execution: –The energy reductions were made asynchronous –No other global barriers are used in cut-off simulations With barrier:Without:

milliseconds

41 Substep Dynamic Load Adjustments Load balancer tells each processor its expected (predicted) load for each timestep Each processor monitors its execution time for each timestep –after executing each force-computation object If it has taken well beyond its allocated time: –Infers that it has encountered a “stretch” –Sends a fraction of its work in the next 2-3 steps to other processors Randomly selected from among the least loaded processors migrate Compute(s) away in this step

42 NAMD on Lemieux without PME ATPase: 327,000+ atoms including water

43 Adding PME PME involves: –A grid of modest size (e.g. 192x144x144) –Need to distribute charge from patches to grids –3D FFT over the grid Strategy: –Use a smaller subset (non-dedicated) of processors for PME –Overlap PME with cutoff computation –Use individual processors for both PME and cutoff computations –Multiple timestepping

VPs VP s 30,000 VPs NAMD Parallelization using Charm++ : PME These 30,000+ Virtual Processors (VPs) are mapped to real processors by charm runtime system

45 Optimizing PME Initially, we used FFTW for parallel 3D FFT –FFTW is very fast, optimizes by analyzing machine and FFT size, and creates a “plan”. –However, parallel FFTW was unsuitable for us: FFTW not optimize for “small” FFTs needed here Optimizes for memory, which is unnecessary here. Solution: –Used FFTW only sequentially (2D and 1D) –Charm++ based parallel transpose –Allows overlapping with other useful computation

46 Communication Pattern in PME 192 procs 144 procs

47 Optimizing Transpose Transpose can be done using MPI all-to-all –But: costly Direct point-to-point messages were faster –Per message cost significantly larger compared with total per-byte cost ( byte messages) Solution: –Mesh-based all-to-all –Organized destination processors in a virtual 2D grid –Message from (x1,y1) to (x2,y2) goes via (x1,y2) –2.sqrt(P) messages instead of P-1. –For us: 28 messages instead of 192.

48 All to all via Mesh Organize processors in a 2D (virtual) grid Phase 1: Each processor sends messages within its row Phase 2: Each processor sends messages within its column Message from (x1,y1) to (x2,y2) goes via (x1,y2) 2. messages instead of P-1 For us: 26 messages instead of 192

49 All to all on Lemieux for a 76 Byte Message

50 Impact on Namd Performance Namd Performance on Lemieux, with the transpose step implemented using different all-to-all algorithms

51 PME parallelization Impor4t picture from sc02 paper (sindhura’s)

52 Performance: NAMD on Lemieux ATPase: 320,000+ atoms including water

milliseconds

54 Using all 4 processors on each Node 300 milliseconds

55 Conclusion We have been able to effectively parallelize MD, –A challenging application –On realistic Benchmarks –To 2250 processors, 850 GF, and 14.4 msec timestep –To 2250 processors, 770 GF, 17.5 msec timestep with PME and multiple timestepping These constitute unprecedented performance for MD –20-fold improvement over our results 2 years ago –Substantially above other production-quality MD codes for biomolecules Using Charm++’s runtime optimizations Automatic load balancing Automatic overlap of communication/computation –Even across modules: PME and non-bonded Communication libraries: automatic optimization