110 likes | 251 Views
Programming in AMPI. Laxmikant Kale CS320 Spring 2003 Kale@cs.uiuc.edu http://charm.cs.uiuc.edu Parallel Programming Laboratory Department of Computer Science University of Illinois at Urbana Champaign. System implementation. Virtualization: Object-based Parallelization.
E N D
Programming in AMPI Laxmikant Kale CS320 Spring 2003 Kale@cs.uiuc.edu http://charm.cs.uiuc.edu Parallel Programming Laboratory Department of Computer Science University of Illinois at Urbana Champaign Virtualization for CS320: AMPI/Charm
System implementation Virtualization: Object-based Parallelization User is only concerned with interaction between objects (VPs) User View Virtualization for CS320: AMPI/Charm
Object Arrays • A collection of data-driven objects • With a single global name for the collection • Each member addressed by an index • [sparse] 1D, 2D, 3D, tree, string, ... • Mapping of element objects to procS handled by the system User’s view A[0] A[1] A[2] A[3] A[..] Virtualization for CS320: AMPI/Charm
Object Arrays • A collection of data-driven objects • With a single global name for the collection • Each member addressed by an index • [sparse] 1D, 2D, 3D, tree, string, ... • Mapping of element objects to procS handled by the system User’s view A[0] A[1] A[2] A[3] A[..] System view A[0] A[3] Virtualization for CS320: AMPI/Charm
Object Arrays • A collection of data-driven objects • With a single global name for the collection • Each member addressed by an index • [sparse] 1D, 2D, 3D, tree, string, ... • Mapping of element objects to procS handled by the system User’s view A[0] A[1] A[2] A[3] A[..] System view A[0] A[3] Virtualization for CS320: AMPI/Charm
Adaptive MPI • A migration path for legacy MPI codes • AMPI = MPI + Virtualization • 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 Virtualization for CS320: AMPI/Charm
7 MPI processes AMPI: Virtualization for CS320: AMPI/Charm
7 MPI “processes” Real Processors AMPI: Implemented as virtual processors (user-level migratable threads) Virtualization for CS320: AMPI/Charm
Writing AMPI programs • Same as MPI programming, except: • Do not use global variables. • Why? • How to: • Move all global variables into a “module” in f90 • Called globals, for example • Class or struct in C++/C • Dynamically allocate one instance of globals • Make any reference to a (former) global variable x as: • globals%x (or globals->x in C) Virtualization for CS320: AMPI/Charm
Handling global variables in AMPI • More refined methods for getting rid of global variables: • Esp. when converting existing MPI programs • Classes of global variables: • Really local (are “live” only inside subroutines) • Read-only • Truly global, but short lived • Move to functions, and pass as parameters • Others: move to one or more dynamically allocated modules Virtualization for CS320: AMPI/Charm
Load Balancing • Call load balancer periodically Virtualization for CS320: AMPI/Charm