Dynamic X10 Resource-Aware Programming for Higher Efficiency Manuel - - PowerPoint PPT Presentation

dynamic x10
SMART_READER_LITE
LIVE PREVIEW

Dynamic X10 Resource-Aware Programming for Higher Efficiency Manuel - - PowerPoint PPT Presentation

Dynamic X10 Resource-Aware Programming for Higher Efficiency Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun Chair for Programming Paradigms, Institute for Program Structures and Data Organization, Karlsruhe Institute of


slide-1
SLIDE 1

1

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD

Chair for Programming Paradigms, Institute for Program Structures and Data Organization, Karlsruhe Institute of Technology (KIT)

Dynamic X10

Resource-Aware Programming for Higher Efficiency Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun

KIT – University of the State of Baden-Wuerttemberg and National Research Center of the Helmholtz Association

www.kit.edu

slide-2
SLIDE 2

Motivation

2

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD

slide-3
SLIDE 3

Motivation

2

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD

slide-4
SLIDE 4

Motivation

2

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD Resource Need Time

slide-5
SLIDE 5

Motivation

2

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD Resource Need Time

Static exclusive resource allocation decreases overall efficiency

slide-6
SLIDE 6

Dynamic Exclusive Resource Allocation

3

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD

Allocate resources exclusively But make the allocation dynamically changeable (i.e., at run-time) ⇒ Resizable claims

Resource Need Time

slide-7
SLIDE 7

Dynamic Exclusive Resource Allocation

3

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD

Allocate resources exclusively But make the allocation dynamically changeable (i.e., at run-time) ⇒ Resizable claims

Resource Need Time

slide-8
SLIDE 8

Dynamic Exclusive Resource Allocation

3

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD

Allocate resources exclusively But make the allocation dynamically changeable (i.e., at run-time) ⇒ Resizable claims

Resource Need Time

slide-9
SLIDE 9

Dynamic Exclusive Resource Allocation

3

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD

Allocate resources exclusively But make the allocation dynamically changeable (i.e., at run-time) ⇒ Resizable claims

Resource Need Time

slide-10
SLIDE 10

Dynamic Exclusive Resource Allocation

3

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD

Allocate resources exclusively But make the allocation dynamically changeable (i.e., at run-time) ⇒ Resizable claims

Resource Need Time

slide-11
SLIDE 11

Scope of This Talk

4

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD

Dynamic X10: framework for programming with resizable claims Integration into existing X10: what needs to change? Resource management for improving global efficiency Brief evaluation of programming effort for developers

slide-12
SLIDE 12

Claim Concept and X10

5

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD

Claim: set of cores with exclusive access

In general: different kinds of resources

Application’s view is restricted to resources in its claim

slide-13
SLIDE 13

Claim Concept and X10

5

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD

Claims can be resized with method reinvade() Claims can span multiple shared-memory domains ⇒ can contain multiple places

slide-14
SLIDE 14

Claim Concept and X10

5

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD

Claims can be resized with method reinvade() Claims can span multiple shared-memory domains ⇒ can contain multiple places

slide-15
SLIDE 15

Claim Concept and X10

5

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD

Claims can be resized with method reinvade() Claims can span multiple shared-memory domains ⇒ can contain multiple places Dynamic X10: places can appear and disappear at runtime

slide-16
SLIDE 16

Claim Concept and X10

5

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD

Natural Embedding: Traditional X10 program behaves like Dynamic X10 program running inside claim containing all cores

slide-17
SLIDE 17

Isolation using Multiple Claims

6

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD

Alternative to resizing existing claim: creating a new claim Useful property: isolation

Concurrent resizing requests using reinvade() ⇒ bad

Method to create and destroy claims: invade() and retreat()

slide-18
SLIDE 18

Multiple Claims and X10

7

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD

slide-19
SLIDE 19

Multiple Claims and X10

7

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD

slide-20
SLIDE 20

Multiple Claims and X10

7

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD

infect() infect() ˆ

= at on claim-level Closure as argument (with deep copy semantics) Closure runs inside the new claim Navigation inside new claim with at and async

slide-21
SLIDE 21

Example Usage

8

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD

val claim = Claim . getCurrentClaim ( ) ; claim . reinvade ( . . . ) ; at ( here . next ( ) ) async { /∗ do work ∗/ } ; val newClaim = Claim . invade ( . . . ) ; newClaim . i n f e c t ( ( ) => { /∗ do more work ∗/ } ) ;

slide-22
SLIDE 22

Example Usage

8

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD

val claim = Claim . getCurrentClaim ( ) ; claim . reinvade ( . . . ) ; at ( here . next ( ) ) async { /∗ do work ∗/ } ; val newClaim = Claim . invade ( . . . ) ; newClaim . i n f e c t ( ( ) => { /∗ do more work ∗/ } ) ; Question: Who changes the allocation? And how? The application No information about other claims ⇒ Does not optimize well in multi-application scenario

slide-23
SLIDE 23

Example Usage

8

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD

val claim = Claim . getCurrentClaim ( ) ; claim . reinvade ( . . . ) ; at ( here . next ( ) ) async { /∗ do work ∗/ } ; val newClaim = Claim . invade ( . . . ) ; newClaim . i n f e c t ( ( ) => { /∗ do more work ∗/ } ) ; Question: Who changes the allocation? And how? The application No information about other claims ⇒ Does not optimize well in multi-application scenario The operating system Not enough information about applications ⇒ Does not optimize well in multi-application scenario

slide-24
SLIDE 24

Constraints

9

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD

Idea: pass application-specific information to OS ⇒ invade()/reinvade() take resource description: constraints Modeled as class hierarchy in X10, can be combined using && and || Most important: PEQuantity and ScalabilityCurve Claim . invade (new PEQuantity (1 , 3) && new ScalabilityCurve ([130 , 150 , 1 6 0 ] ) ) ; Scalability information via offline experiments or online monitoring

slide-25
SLIDE 25

Necessary X10 Adaptions

10

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD

  • 1. Static fields → methods

Place.MAX_PLACES → Place.maxPlaces() to query current claim

  • 2. Adapt method implementations

Place.places() must query current claim

  • 3. Usage of DistArrays
slide-26
SLIDE 26

DistArrays

11

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD

slide-27
SLIDE 27

DistArrays

11

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD

slide-28
SLIDE 28

DistArrays

11

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD

Create new DistArray, move data (library routine)

slide-29
SLIDE 29

DistArrays

11

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD

Create new DistArray, move data (library routine)

slide-30
SLIDE 30

DistArrays

11

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD

What if we lose places? ⇒ data inaccessible

slide-31
SLIDE 31

DistArrays

11

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD

Solution 1: “Sticky claims” Forbid losing places Simple, but severely restricts reallocation ⇒ decreased efficiency

slide-32
SLIDE 32

DistArrays

11

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD

Solution 2: Give opportunity to redistribute Requires programmer effort More flexible resource reallocation

slide-33
SLIDE 33

DistArrays

11

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD

Solution 2: Give opportunity to redistribute Requires programmer effort More flexible resource reallocation

slide-34
SLIDE 34

DistArrays

11

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD

Solution 2: Give opportunity to redistribute Requires programmer effort More flexible resource reallocation

slide-35
SLIDE 35

Preliminary Evaluation: Multigrid

12

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD

Resource Need Time restrict restrict interpolate interpolate

Prototype implementation of Dynamic X10 Multigrid: Calls reinvade() when resizing grid

Uses grid size to compute number of cores

Prototype uses sticky claims ⇒ no disappearing places DistArray redistribution after reinvade() ≈ 50 lines of additional code compared to traditional X10

slide-36
SLIDE 36

Conclusion

13

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD

We have: Integrated claim concept and dynamic exclusive allocation into X10 Adapted X10 to deal with varying number of places Shown that constraints can solve resource management problem Implemented a first version of “Dynamic X10” Given a preliminary evaluation of programming effort

slide-37
SLIDE 37

Backup: Shared Memory Systems

14

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD

Neither exclusive, nor static resource allocation: Resource virtualization: threads instead of CPUs Threads multiplexed onto physical cores Not for free: #threads ≫ #cores Cache issues Scheduler has no application-specific knowledge (e.g., barrier synchronization)

slide-38
SLIDE 38

Backup: Invasive Computing

15

June 12, 2014 Manuel Mohr, Andreas Zwinkau, Sebastian Buchwald, Matthias Braun – Dynamic X10 IPD

Dynamic X10 implemented in the scope of “Invasive Computing” project Looks at future tiled many-core architectures (> 1000 cores)

Share characteristics of supercomputers

Custom operating system

Claims as central data structure Claim-aware scheduler