• Aucun résultat trouvé

Ordonnancement pour le parallélisme

N/A
N/A
Protected

Academic year: 2022

Partager "Ordonnancement pour le parallélisme"

Copied!
123
0
0

Texte intégral

(1)

Ordonnancement pour le parallélisme

Denis Trystram [email protected]

ID-IMAG

november 2003

(2)

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

(3)

Scheduling problem

Scheduling

(4)

Scheduling problem

Computational units are identifed and their relations are analyzed. We determine when and

where they will be executed.

Scheduling

(5)

Target systems

1980: shared-memory parallel systems and vector machines.

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

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

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

(6)

Taxinomy of Applications

off-line Regular

off-line (batch)

mixed clairvoyant

on-line unpredictible (not clairvoyant) Irregular

on-line

multi-applications Applications

(7)

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 transfered from a task to another.

E j

i, )!

( i<< j

(8)

Data-flow Graph

T

T ’ T ’ ’

(9)

Data-flow Graph

bipartite graph

T

T ’ T ’ ’

T

T ’ T ’ ’ x ’ x ’ ’

(10)

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

(11)

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 ;

(12)

Strassen’s Task Graph

(13)

Formal Definition

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

(without communication)

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

•respect of precedences

•objective: to minimize the makespan

)) ( ,

( ) ( )

( :

) ,

(i j "E date j !date i +t i proc i

#

Cmax

(14)

3 fields notation

[Graham,Lenstra-Lageweg-Veltman1990]

b1|b2|b3

(15)

[Lenstra-Lageweg-Veltman,1990]

b1|b2|b3

•b1- resources and model

(16)

[Lenstra-Lageweg-Veltman,1990]

b1|b2|b3

•b1- resources and model

•b2 - graph and schedule

(17)

[Lenstra-Lageweg-Veltman,1990]

b1|b2|b3

•b1- resources and model

•b2 - graph and schedule

•b3 - objective

(18)

[Lenstra-Lageweg-Veltman,1990]

b1|b2|b3

•b1- resources and model

•b2 - graph and schedule

•b3 - objective

Example: P! prec,pjCmax

(19)

Parameters of a Problem

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

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

•b3 - , overhead P!

!

Ci

Cmax,

(20)

Example

(21)

Scheduling without

communication (m=3)

(22)

Theoretical Models

PRAM: modèles de référence pour la classification.

Shared-memory: ordonnancement pur, sans délais de communication. Grain fin et

faiblement couplé.

Distributed-memory: prise en compte des communications (UET-UCT) explicites et modèles élargis (linéaires, LogP, etc..).

Grappes et Grilles: nouveaux paramètres.

(23)

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(")#!

(24)

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]

(25)

List scheduling

Principle: build first the list of ready tasks and execute them with any greedy policy (in any order when they are available).

Pm | prec, pj | Cmax is 2-competitive

(26)

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 idle midle

W+

!=

(27)

While there exist some time slots with idle periods:

there is one active task which is linked with Tj

Tj m

(28)

We continue from Ti until it remains no idle time

Tj Ti

(29)

Proof:

" !

#

"

# m l m t

idle ( 1) ch ( 1)

" !

+

#$* mm1t

$

!*

"

Wm

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

( )

2 1 !*

!# "m

(30)

Worst case

The bound is tight:

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

1 2 !

= m

" !*=m

m

(31)

Anomalies [Graham]

2 1

4

3 5

6

7

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

1

2 3

4 5

6

7 C=14

(32)

Anomalies [Graham]

2 1

4

3 5

6

7

All weights have one unit less:

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

1 2 3

5 4

7 6 C=20

(33)

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 in less than c times, then there is no schedule with a competitive ratio lower than (c+1)/c.

(34)

Application

Proposition

The problem of deciding (for any UET graph) if there exists a valid schedule of length at most 3 is NP-complete.

Proof: by reduction from CLIQUE

(35)

Application

Proposition

The problem of deciding (for any UET graph) if there exists a valid schedule of length at most 3 is NP-complete.

Proof: by reduction from CLIQUE

Corollary: a lower bound for the competitive ratio of is 4/3.Pm prec,pj=1Cmax

(36)

(finer) Upper Bound

Consider problem P |prec, pj=1 | Cmax

Proposition

There exists a (list-)algorithm whose performance guarantee is 2-2/m [Lam-Sethi,77] [Braschi-

Trystram,94].

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

(37)

Taking communications into account:

the delay model

Introduced by [Rayward-Smith, 89]

•Total overlap of communications by local computations

•Possible duplication

•Simplified communications (unitary in the basic paper)

•No preemption allowed

(38)

Formal Definition

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

(with communication)

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

•respect of precedences

•objective: to minimize the makespan

) , ( ))

( ,

( ) ( )

( :

) ,

(i j "E date j !date i +t i proc i +c i j

#

Cmax

(39)

Basic delay model

Comparing with no communication:

•Handling explicitly the communications is harder than the basic scheduling model

(40)

Scheduling with small delay with

and without duplication

(41)

Scheduling with UCT delay with

and without duplication

(42)

Brent’s Lemma

• Property:

let be the competitive ratio of an

algorithm with an unbounded number of processors. There exists an algorithm with performance ratio for an abritrary

number of processors.

!

+1

!

(43)

Principle

Gantt chart for m* processors

time

(44)

m processors

(45)

m processors

(46)

Thus,

Proof

!

!+

"# #

#m *

!

!"#$*

$

*m

* !

! #"

(Similar to Graham’s bound)

( )

m

m " 1!*

! # +

(47)

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

(48)

List scheduling

with communication delays

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

Better solution for general graphs:

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

(49)

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

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

More sophisticated algorithms

than list-algorithms

(50)

Objective: minimize (C) Constraints:

Solving as an ILP

C i

date V

i" + !

# , ( ) 1

) ( 1

) ( ,

) ,

(i j "E date i + +Xi,j!date j

#

) ( deg

, ree i

X

j

j

i !

"

1 , 0

,j= Xi

0 ) (

, !

"

#i V date i

(51)

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

(52)

Principle: unbounded number of processors.

Starting from the smallest granularity, the tasks are gathered into subsets of tasks.

Property:

Critical path or maximum independent sets.

Clustering Algorithms

(53)

Pinf|prec,pj,cij<=1,dup|Cmax

is polynomial [Colin-Chretienne,90]

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

Influence of the duplication

(54)

Colin-Chrétienne

(55)
(56)
(57)

P|prec,pj=1,cij=1,dup|Cmax

is 2-competitive [Hanen-Munier,97]

Idea: by applying a list scheduling with duplication of parts of paths.

Duplication with a fixed number

of processors

(58)

Synthesis

small 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

(59)

Scheduling with large delay

This problem is harder than with small communication delay

No competitive algorithm is known at this time

with a constant ratio (linear in the granularity factor)

(60)

Detailed result

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

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

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

(61)

Large communication delays upper 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 and systematically insert a communication between the computation steps...

(62)

Synthèse

grands 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

(63)

Processeurs Uniformes (hétérogène)

Two natural extensions of the delay models are

towards uniform (Q) and unrelated (R) processors.

NP-hard for very simple problems

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

(64)

Scheduling independent chains

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

(65)

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

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

n1=7 n2=6 n3=2

Total n=15

10 1

2 , 11 2) (

max 2 !=

"

$ #

%

&

+

' + n

v vn n ( v

(66)

*

1

2 " !

"v +n # <

=2

!

10

(67)
(68)

Alternative models: BSP

BSP is a programming paradigm [Valiant,90] whose principle is a series of independent steps of

computations and communication-synchronization.

computations computations

(69)

Alternative models: BSP

BSP is a programming paradigm [Valiant,90] whose principle is a series of independent steps of

computations and communication-synchronization.

computations computations

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

(70)

Coming back to the example

(71)

Scheduling in BSP

(72)

Parameters of BSP

•Latency (minimum time between communications)

•computing an h-relation (hg+s)

•based on a cost function

(73)

Complexity under BSP

•Simple problems under the delay model become hard under BSP

•However, it seems possible to design good

competitive algorithms (for instance for scheduling independent chains).

(74)

Alternative models: LogP

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

•L latency

•o overhead

•g gap

•P number of processors

(75)

Alternative models: LogP

No overlap.

O + L + O

(76)

Alternative models: LogP

No overlap. g

(77)

Alternative models: LogP

No overlap.

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

g

(78)

Scheduling the previous

example in LogP

(79)

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

(80)

Scheduling a fork graph under LogP

LogP is harder.

2 3 5 1 2

(81)

Alternative models :

Malleable Tasks

(82)

Malleable Tasks

Natural link with applications:

• Partitioning the graph into routines.

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

Communications are implicit

(83)

Malleable Tasks

Informal definition:

A malleable task (MT) is a computational unitthat can itself be executed in parallel on an arbitrary number of processors.

(84)

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]

(85)

Exemple

(86)

Advantage of MT

The granularity is large, thus, it allows to neglect communications between MT or at least to consider the SCT assumption…

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

(87)

Taking into account the communications

We introduce a penalty factor for representing the global overhead (communications plus

synchronizations plus sequential character).

(88)

Penalty

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

(89)

More Formally

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

Expected Properties:

) 1 , (

) ,

) (

,

(T i = execexec TT i i

µ

) ! (., i µ

i ! i)

µ

(.,

(90)

Formal definition

Scheduling 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

"

!

#

$

%

%

slot i

m i

allot ( ) :

: )

,

(i j !E

"

j

Ci

i allot i

t i date j

date( )! ( )+ ( , ( ))+ , Cmax

(91)

Scheduling MT

Two types of algorithms:

• simple allotment – complex multi-processor scheduling

• sophisticated allotment – simple multi-processor scheduling

Principle in two successive phases (allocation et packing)

(92)

General approach

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

•Utilisation d’un algorithme d’ordonnancement

« simple » (liste).

To focus on the allotment

(93)

K dual Approximation

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

•On applique un algorithme, si la garantie obtenue est plus mauvaise que kd, on

recommence (dichotomie).

(94)

Independent MT

as a case study

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

(95)

Canonical Allotment

W/m

1

(96)

Canonical Allotment

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

1

m

(97)

2-shelves scheduling

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

Thus, we will try to fill two shelves with these tasks.

(98)

How to select the tasks?

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

1

m

1/2

(99)

Transformations et ordonnancement

1

m

1/2

(100)

Jobs rigides

(non clairvoyant)

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

(101)

Ordonnancement rigide

J1 J2 J3 J4

(102)

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

(1) m

(103)

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

m

(2)

(104)

Performance garantie

4-approximation avec l’heuristique FFD.

Technique : adversaire clairvoyant.

(105)

Ordonnancement MT général

Généralisation à des graphes avec structures de précédence : même méthodologie avec un

ordonnancement plus complexe (liste avec garantie).

Structures spécifiques (chaines, arbres, SP, …) Garanties en (3+sqrt(5))/2

(106)

On-line scheduling

(107)

Constructing a batch scheduling

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

batches.

(108)

Analysis [Shmoys]

previous last batch last batch

Cmax r

(last job) n

(109)

Proposition

*

max

max 2

C

C

" !

(110)

Analysis

Tk is the duration of the last batch

On another hand, and

Thus:

T C *

max

! r

n

+

k

"

r

D

k"1

!

n

T T

C

max=

D

k!1+ k!1+ k

*

max

max 2

C

C

" !

*

max

,

T

i

C

i "!

#

(111)

Multi criteria

The Makespan is not always the adequate criterion.

System point of view:

Average completion time (weighted) Other criteria: Stretch, Asymptotic

throughput

(112)

A first solution

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

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

(113)

Schedules s and s’

Schedule s (min sum)

3 5

4

1 2

6 7

Schedule s’

(makespan)

7

2

1 4

6 3

5

(114)

New schedule

3 5

4

1 2

6 7

7

2

1 4

6 3

5

r’Cmax

(115)

New schedule

3 5

4

1 2

6 7

7

6 5

(116)

New schedule

3

4

1 2

7

6 5

(117)

New schedule

3

4

1 2

7

6 5

2r’Cmax

(118)

New schedule

3

4

1 2

7

6 5

2r’Cmax

Similar bound for the first criterion

(119)

Analysis

The best known schedules are:

8.53 [Schwiegelsohn] for minsum and 3/2 [Mounie et al.] for makespan leading to (17.06,3).

(120)

Improvement

We can improve this result by determining the Pareto curves (of the best compromises):

(1+λ)/ λ r and (1+ λ)r’

Idea:

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

(121)

Pareto curve

(122)

Another way for better schedules

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

(123)

Conclusion

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

There is an important impact of the computational model on the performances.

Communications are crucial and have to be

optimized. Partitioning is more important than internal scheduling.

Références

Documents relatifs

It is expected that the result is not true with = 0 as soon as the degree of α is ≥ 3, which means that it is expected no real algebraic number of degree at least 3 is

However, from the complexity point of view, better results can be obtained for structural restricted Petri nets: for example, the complexity of the reachability problem boils down

Unit´e de recherche INRIA Rennes, Irisa, Campus universitaire de Beaulieu, 35042 RENNES Cedex Unit´e de recherche INRIA Rh ˆone-Alpes, 46 avenue F´elix Viallet, 38031 GRENOBLE Cedex

As a first result towards the 1-2-3 Conjecture, Karo´ nski, Luczak and Thomason proved that there is a set W of 183 real weights such that any graph with no isolated edge admits

It is very important that your meeting addresses the multisectoral aspect of viral hepatitis control and prevention, and that the national focal points seize the opportunity and

In order to take maximal advantage of sparse data sets, the Flawed SGD-QN algorithm (see Figure 2 in the original paper) splits the stochastic parameter update (1) in two halves

The same with the serial and parallel generation schemes, the PASS requires each activity to have a priority, and it is based on these priorities that, subject to the precedence

In the so-called standalone MANETs scenario on the other hand (see Fig. 2), the MANET does not contain any router able to provide other routers requesting configuration with