ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/cours/m... ·...

123
Ordonnancement pour le parallélisme Denis Trystram [email protected] ID-IMAG november 2003

Upload: others

Post on 13-Jun-2021

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Ordonnancementpour le parallélisme

Denis [email protected]

ID-IMAG

november 2003

Page 2: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Contenu et Plan

• Context and Introduction

• Definitions and basic results

• Communication Delays

• Taking into account new characteristics

• Malleable Tasks

• On-line and multi-criteria optimization

Page 3: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Scheduling problem

Scheduling

Page 4: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Scheduling problem

Computational units are identifed and theirrelations are analyzed. We determine when and

where they will be executed.

Scheduling

Page 5: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Target systems

1980: shared-memory parallel systems andvector machines.

80-90: systèmes parallèles distribués trèsvariés.

Années 90: systèmes distribués à gros grain àréseaux dynamiques.

Actuellement: grappes (hiérarchiques), calculsur grilles hétérogènes et distantes.

Page 6: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Taxinomy of Applications

off-line

Regular

off-line

(batch)

mixed

clairvoyant

on-line

unpredictible

(not clairvoyant)

Irregular

on-line

multi-applications

Applications

Page 7: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Precedence Task Graph

Let G=(V,E) be a weighted graph

iff (ordre partiel)

The vertices are weighted by the execution times.

The arcs are weighted by the data to be transferedfrom a task to another.

Eji !),( ji<<

Page 8: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Data-flow Graph

T

T ’ T ’ ’

Page 9: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Data-flow Graph

bipartite graph

T

T ’ T ’ ’

T

T ’ T ’ ’

x ’ x ’ ’

Page 10: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Example:computing C = AB by Strassen

Matrices A and B are partitionned by quadrant.

C12 = A11 * ( B12 - B22 ) + ( A11 + A12 ) * B22

B11 B12

B21 B22

A11 A12

A21 A22

Page 11: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Strassen: computing C = AB

T1 = A11 + A12 ; T2 = A21 - A11;T3 = A12 - A22 ; T4 = A21 + A22;T5 = A11 + A22 ;U1 = B11 + B22 ; U2 = B11 + B12;U3 = B21 - B11 ; U4 = B12 - B22;U5 = B21 + B22 ;P1 = T5 * U4 ; P2 = T4 * B11 ;P3 = A11 * U4 ; P4 = A22 * U3 ;P5 = T1 * B22 ; P6 = T2 * U2 ;P7 = T3 * U5 ;C11 = P1 + P4 - P5 + P7 ; C12 = P3 + P5;C21 = P2 + P4; C22 = P1 + P3 - P2 + P6 ;

Page 12: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Strassen’s Task Graph

Page 13: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Formal Definition

The problem of scheduling graph G = (V,E) weighted byfunction t on m processors:

(without communication)

Determine the pair of functions (date,proc) subject to:

•respect of precedences

•objective: to minimize the makespan

))(,()()(:),( iprocitidatejdateEji +!"#

maxC

Page 14: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

3 fields notation

[Graham,Lenstra-Lageweg-Veltman1990]

b1|b2|b3

Page 15: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

[Lenstra-Lageweg-Veltman,1990]

b1|b2|b3

•b1- resources and model

Page 16: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

[Lenstra-Lageweg-Veltman,1990]

b1|b2|b3

•b1- resources and model

•b2 - graph and schedule

Page 17: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

[Lenstra-Lageweg-Veltman,1990]

b1|b2|b3

•b1- resources and model

•b2 - graph and schedule

•b3 - objective

Page 18: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

[Lenstra-Lageweg-Veltman,1990]

b1|b2|b3

•b1- resources and model

•b2 - graph and schedule

•b3 - objective

Example: max, CpjprecP!

Page 19: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Parameters of a Problem

•b1- implicit, BSP, LogP, , P or Pm

•b2 - prec, trees, grids - dup, pmtn, pj, Cij

•b3 - , overhead

!P

! iCC ,max

Page 20: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Example

Page 21: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Scheduling withoutcommunication (m=3)

Page 22: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Theoretical ModelsPRAM: modèles de référence pour laclassification.

Shared-memory: ordonnancement pur, sansdélais de communication. Grain fin etfaiblement couplé.

Distributed-memory: prise en compte descommunications (UET-UCT) explicites etmodèles élargis (linéaires, LogP, etc..).

Grappes et Grilles: nouveaux paramètres.

Page 23: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Central Scheduling Problem

P | prec, pj | Cmax is NP-hard [Ulmann75]

Thus, we are looking for good heuristics.

•Competitive ratio r:

maximum over all instances of

The schedule S is said -competitive iff*!!

! !" #)(r

Page 24: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Some results

Pinf | prec, pj | Cmax is polynomial (longest path)

Pm | prec, pj=1 | Cmax is still open for m>2

P2 | prec, pj=1 | Cmax is polynomial

[Coffman-Graham72]

Page 25: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

List scheduling

Principle: build first the list of ready tasks and executethem with any greedy policy (in any order when theyare available).

Pm | prec, pj | Cmax is 2-competitive

Page 26: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Analysis of list scheduling

We start from the end of the schedule:

where W is the total work

The idea of the proof is to bound the term idlem

idleW+=!

Page 27: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

While there exist some time slots with idle periods:

there is one active task which is linked with Tj

Tjm

Page 28: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

We continue from Ti until it remains no idle time

Tj

Ti

Page 29: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Proof:

!"#"# tmlmidle ch )1()1(

!"+# tm

m 1*$$

*!"m

W

As the critical path is also a lower bound of the optimum:

( )*12 !!m

"#

Page 30: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Worst case

The bound is tight:

Consider (m-1)m UET tasks and 1 task of length m

12 != m" m=*!

m

Page 31: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Anomalies [Graham]

2

1

4

3

5

6

7

Weights: (4,2,2,5,5,10,10)

1

2 345

67

C=14

Page 32: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Anomalies [Graham]

2

1

4

3

5

6

7

All weights have one unit less:

(3,1,1,4,4,9,9)

1

2 354

67C=20

Page 33: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Lower bounds

Basic tool:

Theorem of impossibility [Lenstra-Shmoys’95]

• given a scheduling problem and an integer c,if it is NP-complete to schedule this problem inless than c times, then there is no schedule witha competitive ratio lower than (c+1)/c.

Page 34: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

ApplicationProposition

The problem of deciding (for any UET graph) ifthere exists a valid schedule of length at most 3 isNP-complete.

Proof: by reduction from CLIQUE

Page 35: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

ApplicationProposition

The problem of deciding (for any UET graph) ifthere exists a valid schedule of length at most 3 isNP-complete.

Proof: by reduction from CLIQUE

Corollary: a lower bound for the competitive ratioof is 4/3.max1, CpjprecPm =

Page 36: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

(finer) Upper Bound Consider problem P |prec, pj=1 | Cmax

Proposition

There exists a (list-)algorithm whose performanceguarantee is 2-2/m [Lam-Sethi,77] [Braschi-Trystram,94].

Proof adequate labeling of the tasks plus a prioritybased on the critical path.

Page 37: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Taking communications into account:the delay model

Introduced by [Rayward-Smith, 89]

•Total overlap of communications by localcomputations

•Possible duplication

•Simplified communications (unitary in the basicpaper)

•No preemption allowed

Page 38: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Formal Definition

The problem of scheduling graph G = (V,E) weighted byfunction t on m processors:

(with communication)

Determine the pair of functions (date,proc) subject to:

•respect of precedences

•objective: to minimize the makespan

),())(,()()(:),( jiciprocitidatejdateEji ++!"#

maxC

Page 39: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Basic delay model

Comparing with no communication:

•Handling explicitly the communications isharder than the basic scheduling model

Page 40: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Scheduling with small delay withand without duplication

Page 41: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Scheduling with UCT delay withand without duplication

Page 42: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Brent’s Lemma

• Property: let be the competitive ratio of an

algorithm with an unbounded number ofprocessors. There exists an algorithm withperformance ratio for an abritrarynumber of processors.

!

1+!

Page 43: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Principle

Gantt chart for m* processors

time

Page 44: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

m processors

Page 45: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

m processors

Page 46: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Thus,

Proof

!!+" ### *m

!!" *#$$

m** !! "#

(Similar to Graham’s bound)

( ) mm *1!"! +#

Page 47: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Consequences:trivial Upper Bound

•As Pinf | prec, pj=1| Cmax is optimal(competitive ratio of 1), then:

P| prec, pj=1 | Cmax is 2-competitive.

•As Pinf | dup,prec, pj,cij| Cmax is 2-competitive,then:

P|dup, prec, pj, cij = 1 | Cmax is 3-competitive

Page 48: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

List schedulingwith communication delays

Trivial solution for UCT [Rayward-Smith]: insertsystematically a communication at each step. 3-competitive algorithm.

Better solution for general graphs:

The principle is the same: just add a term proportionalto the sum of the communications on the longest path[Hwang-Chow-Anger-Lee,89].

Page 49: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Formulation of P|prec,pj=1,cij=1|Cmaxas a ILP.

Xij are the decision variables0 if task allot(i)=allot(j)

More sophisticated algorithmsthan list-algorithms

Page 50: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Objective: minimize (C)Constraints:

Solving as an ILP

CidateVi !+"# 1)(,

)(1)(,),( , jdateXidateEji ji !++"#

)(deg, ireeXj

ji !"

1,0, =jiX

0)(, !"# idateVi

Page 51: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Solve the LP with xij real numbers in [0,1]and then, relax the solution:xij < 0.5 are set to 0, the others are set to 1

Property:this algorithm is 4/3-competitive.

Solving as an ILP

Page 52: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Principle: unbounded number of processors.Starting from the smallest granularity, thetasks are gathered into subsets of tasks.

Property:Critical path or maximum independent sets.

Clustering Algorithms

Page 53: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Pinf|prec,pj,cij<=1,dup|Cmaxis polynomial [Colin-Chretienne,90]

Idea: Find a spanning tree of minimum(local-) weights and schedule it byduplicating all the leaves.

Influence of the duplication

Page 54: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Colin-Chrétienne

Page 55: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr
Page 56: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr
Page 57: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

P|prec,pj=1,cij=1,dup|Cmaxis 2-competitive [Hanen-Munier,97]

Idea: by applying a list scheduling withduplication of parts of paths.

Duplication with a fixed numberof processors

Page 58: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Synthesissmall communication delays

trees, SP,

bipartite

polynomial

UET-UCT

NP-hard

no duplication

polynomial

duplication

unbounded number of proc.

trees,

bipartite

NP-hard

interval order

polynomial

UET-UCT

NP-hard

m processors

Page 59: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Scheduling with large delay

This problem is harder than with smallcommunication delay

No competitive algorithm is known at this time

with a constant ratio (linear in the granularity factor)

Page 60: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Detailed result

Consider P | prec, pj=1, c>1 | Cmax

The best lower bound known at this time is1+1/(g+3) [Bampis-Gianakos-Konig,98]

Practically, if g<<1 not interesting...

Page 61: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Large communication delaysupper bound

Consider again P | prec, pj=1, c>1 | Cmax

The best upper bound known at this time is (c+2)[Bampis-Gianakos-Konig,97].

Another way to obtain this result is the trivial (list)algorithm which starts with no communication andsystematically insert a communication between thecomputation steps...

Page 62: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Synthèsegrands délais de communication

duplication

pi>1 et c>1

NP-difficile

biparti

polynomial

arbres

NP-difficile

pas de duplication

infinité de processeurs

arbres binaires

complets et m=2

polynomial

arbres binaires

pi>1 et c>1 et m=2

NP-difficile

m processeurs

Page 63: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Processeurs Uniformes(hétérogène)

Two natural extensions of the delay models aretowards uniform (Q) and unrelated (R) processors.

NP-hard for very simple problems

NP-hard for 1 machine plus a set of (m-1) identicalmachines

Page 64: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Scheduling independent chains

Qm|chains,pj=1,c=1|Cmax is strongly NP-hard while

Pm|chains,pj=1,c=1|Cmax is linear.

Page 65: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Example: scheduling chainson 2 processors (v1=1,v2=2).

Idea: compute the maximum number of tasks toallocate to the slowest processor.

n1=7n2=6n3=2Total n=15

101,21)21(2

max =!"#

$%&

+

+' n

vv

nnv(

Page 66: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

*12 !"" <#+nv

2=!10

Page 67: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr
Page 68: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Alternative models: BSPBSP is a programming paradigm [Valiant,90] whoseprinciple is a series of independent steps ofcomputations and communication-synchronization.

computations computations

Page 69: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Alternative models: BSPBSP is a programming paradigm [Valiant,90] whoseprinciple is a series of independent steps ofcomputations and communication-synchronization.

computations computations

Scheduling under BSP is finding a tradeoff betweenload-balancing and number of CS

Page 70: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Coming back to the example

Page 71: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Scheduling in BSP

Page 72: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Parameters of BSP

•Latency (minimum time between communications)

•computing an h-relation (hg+s)

•based on a cost function

Page 73: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Complexity under BSP

•Simple problems under the delay model becomehard under BSP

•However, it seems possible to design goodcompetitive algorithms (for instance for schedulingindependent chains).

Page 74: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Alternative models: LogP

Need of computational models closer to the actualparallel systems [Culler et al.]: 4 parameters.

•L latency

•o overhead

•g gap

•P number of processors

Page 75: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Alternative models: LogP

No overlap.

O + L + O

Page 76: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Alternative models: LogP

No overlap. g

Page 77: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Alternative models: LogP

No overlap.

The delay model is a LogP-system where o=g=0

g

Page 78: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Scheduling the previousexample in LogP

Page 79: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Complexity of LogP

Of course, LogP seems (is?) harder.

It is true for

(LogP)Pinf | Fork,pj | Cmax and

(LogP)P=2 | Fork,pj | Cmax

Page 80: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Scheduling a fork graph under LogP

LogP is harder.

32 5 1 2

Page 81: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Alternative models :Malleable Tasks

Page 82: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Malleable Tasks

Natural link with applications:

• Partitioning the graph into routines.

• Parallel routines that can be analyzed easily(prediction of performances, using for instancePRAM algorithms or library routines).

Communications are implicit

Page 83: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Malleable Tasks

Informal definition:

A malleable task (MT) is a computational unitthat canitself be executed in parallel on an arbitrary number ofprocessors.

Page 84: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

History of MT[Du-Leung] SIAM J.Discrete Maths 89

[Turek] SPAA’92

Related to:

•Resource constraint scheduling [Graham75].

•Multiprocessor Tasks [Lloyd81], recent survey of[Drozdowski] in EJOR 86.

•Divisible Tasks [Srinivasa Prasanna-Musicus96][Robertazzi]

Page 85: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Exemple

Page 86: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Advantage of MT

The granularity is large, thus, it allows to neglectcommunications between MT or at least to considerthe SCT assumption…

The performance analysis of each MT can give arather good execution time estimation

Page 87: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Taking into account thecommunications

We introduce a penalty factor for representingthe global overhead (communications plussynchronizations plus sequential character).

Page 88: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Penalty

Le temps d’exécution parallèle décroit avec le nombre deprocesseurs et la pénalité augmente.

Page 89: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

More Formally

Definition of Inefficiency factor of task T on i processorswhose execution time is exec(T,i):

Expected Properties:

)1,(

),(),(

Texec

iiTexeciT =µ

!)(., iµ

!i

i)(.,µ

Page 90: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Formal definitionScheduling of the MT-graph G = (V,E) on m processors:

Find two functions (date,allot) suject to:

• resource constraint

• respect of precedences

•objective: minimizing the makespan

!"

#$%

%sloti

miallot )(:

:),( Eji !"

jiCiallotitidatejdate ,))(,()()( ++!

maxC

Page 91: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Scheduling MT

Two types of algorithms:

• simple allotment – complex multi-processorscheduling

• sophisticated allotment – simple multi-processorscheduling

Principle in two successive phases (allocation et packing)

Page 92: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

General approach

•L’allocation est sophistiquée, réalisée par unalgorithme de Programmation Mathématique(type Sac-à-dos).

•Utilisation d’un algorithme d’ordonnancement« simple » (liste).

To focus on the allotment

Page 93: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

K dual Approximation

•On fixe une valeur de l’objectif d (entier).

•On applique un algorithme, si la garantieobtenue est plus mauvaise que kd, onrecommence (dichotomie).

Page 94: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Independent MTas a case study

Let us consider 7 MT to be scheduled onm=10 processors.

Page 95: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Canonical Allotment

W/m1

Page 96: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Canonical Allotment

Maximal number of processors needed forexecuting the tasks in time lower than 1.

1

m

Page 97: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

2-shelves scheduling

Idea: to analyze the structure of the optimumwhere the tasks are either greater than ½ or not.

Thus, we will try to fill two shelves with thesetasks.

Page 98: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

How to select the tasks?

Knapsack: min(W*) s.c. # processeurs de S1<m

1

m

1/2

Page 99: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Transformations etordonnancement

1

m

1/2

Page 100: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Jobs rigides(non clairvoyant)

Soit n jobs indépendants à ordonnancer chacun avecune estimation du nombre de processeurs pi.

Page 101: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Ordonnancement rigide

J1 J2 J3 J4

Page 102: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

(1) (1) (1) (1)

(1)

m

Page 103: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

(2) (2) (2) (2)

m

(2)

Page 104: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Performance garantie

4-approximation avec l’heuristique FFD.

Technique : adversaire clairvoyant.

Page 105: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Ordonnancement MT général

Généralisation à des graphes avec structures deprécédence : même méthodologie avec unordonnancement plus complexe (liste avec garantie).

Structures spécifiques (chaines, arbres, SP, …)

Garanties en (3+sqrt(5))/2

Page 106: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

On-line scheduling

Page 107: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Constructing a batch scheduling

Analysis: there exists a nice result which gives aguaranty for an execution in batch function of theguaranty of the scheduling policy inside thebatches.

Page 108: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Analysis [Shmoys]

previous last batch last batch

Cmaxr(last job)

n

Page 109: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Proposition

*maxmax2 CC !"

Page 110: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Analysis

Tk is the duration of the last batch

On another hand, and

Thus:

TrC kn+!*max"

rD nk!

"1

TTDC kkk++=

!! 11max

*maxmax2 CC !"

*max, CTii !"#

Page 111: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Multi criteria

The Makespan is not always the adequatecriterion.

System point of view:Average completion time (weighted)Other criteria: Stretch, Asymptotic

throughput

Page 112: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

A first solution

Construct a feasible schedule from two schedulesof guaranty r for minsum and r’ for makespan witha guaranty (2r,2r’) [Stein et al.].

Instance: 7 jobs (moldable tasks) to be scheduledon 5 processors.

Page 113: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Schedules s and s’

Schedule s(min sum)

3 5

41 2

67

Schedule s’(makespan)

7

2

14

635

Page 114: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

New schedule

3 5

41 2

67

7

2

14

635

r’Cmax

Page 115: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

New schedule

3 5

41 2

67

7

6 5

Page 116: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

New schedule

3

41 2

7

6 5

Page 117: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

New schedule

3

41 2

7

6 5

2r’Cmax

Page 118: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

New schedule

3

41 2

7

6 5

2r’Cmax

Similar bound for the first criterion

Page 119: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Analysis

The best known schedules are:8.53 [Schwiegelsohn] for minsum and 3/2 [Mounieet al.] for makespan leading to (17.06,3).

Page 120: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Improvement

We can improve this result by determining thePareto curves (of the best compromises):(1+λ)/ λ r and (1+ λ)r’

Idea:take the first part of schedule s up to λ r’Cmax

Page 121: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Pareto curve

Page 122: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Another way for better schedules

We propose now a new solution for a better resultwhich has no to consider explicitely schedule forminsum (based on a nice dynamic framework).

Page 123: Ordonnancement pour le parallélismemoais.imag.fr/membres/jean-louis.roch/perso_html/COURS/M... · 2005. 12. 7. · Ordonnancement pour le parallélisme Denis Trystram trystram@imag.fr

Conclusion

We have presented and discussed the problem ofscheduling in the context of Parallel Processing.

There is an important impact of the computationalmodel on the performances.

Communications are crucial and have to beoptimized. Partitioning is more important thaninternal scheduling.