Part 3: Memory-Aware DAG Scheduling CR05: Data Aware Algorithms - - PowerPoint PPT Presentation

part 3 memory aware dag scheduling
SMART_READER_LITE
LIVE PREVIEW

Part 3: Memory-Aware DAG Scheduling CR05: Data Aware Algorithms - - PowerPoint PPT Presentation

Part 3: Memory-Aware DAG Scheduling CR05: Data Aware Algorithms October 12 & 15, 2020 Summary of the course Part 1: Pebble Games models of computations with limited memory Part 2: External Memory and Cache Oblivous Algoritm 2-level


slide-1
SLIDE 1

Part 3: Memory-Aware DAG Scheduling

CR05: Data Aware Algorithms October 12 & 15, 2020

slide-2
SLIDE 2

2 / 22

Summary of the course

◮ Part 1: Pebble Games models of computations with limited memory ◮ Part 2: External Memory and Cache Oblivous Algoritm 2-level memory system, some parallelism (work stealing) ◮ Part 3: Streaming Algoritms Deal with big data, distributed computing ◮ Part 4: DAG scheduling (today) structured computations with limited memory ◮ Part 5: Communication Avoiding Algorithms regular computations (lin. algebra) in distributed setting

slide-3
SLIDE 3

3 / 22

Introduction

◮ Directed Acyclic Graphs: express task dependencies

◮ nodes: computational tasks ◮ edges: dependencies (data = output of a task = input of another task)

◮ Formalism proposed long ago in scheduling ◮ Back into fashion thanks to task based runtimes ◮ Decompose an application (scientific computations) into tasks ◮ Data produced/used by tasks created dependancies ◮ Task mapping and scheduling done at runtime ◮ Numerous projects:

◮ StarPU (Inria Bordeaux) – several codes for each task to execute on any computing resource (CPU, GPU, *PU) ◮ DAGUE, ParSEC (ICL, Tennessee) – task graph expressed in symbolic compact form, dedicated to linear algebra ◮ StartSs (Barcelona), Xkaapi (Grenoble), and others. . . ◮ Now included in OpenMP API

slide-4
SLIDE 4

3 / 22

Introduction

◮ Directed Acyclic Graphs: express task dependencies

◮ nodes: computational tasks ◮ edges: dependencies (data = output of a task = input of another task)

◮ Formalism proposed long ago in scheduling ◮ Back into fashion thanks to task based runtimes ◮ Decompose an application (scientific computations) into tasks ◮ Data produced/used by tasks created dependancies ◮ Task mapping and scheduling done at runtime ◮ Numerous projects:

◮ StarPU (Inria Bordeaux) – several codes for each task to execute on any computing resource (CPU, GPU, *PU) ◮ DAGUE, ParSEC (ICL, Tennessee) – task graph expressed in symbolic compact form, dedicated to linear algebra ◮ StartSs (Barcelona), Xkaapi (Grenoble), and others. . . ◮ Now included in OpenMP API

slide-5
SLIDE 5

4 / 22

Task graph scheduling and memory

◮ Consider a simple task graph ◮ Tasks have durations and memory demands

A B C D E F

◮ Peak memory: maximum memory usage ◮ Trade-off between peak memory and performance (time to solution)

slide-6
SLIDE 6

4 / 22

Task graph scheduling and memory

◮ Consider a simple task graph ◮ Tasks have durations and memory demands

A B C D E F

duration memory

◮ Peak memory: maximum memory usage ◮ Trade-off between peak memory and performance (time to solution)

slide-7
SLIDE 7

4 / 22

Task graph scheduling and memory

◮ Consider a simple task graph ◮ Tasks have durations and memory demands

A B C D E F

time Processor 1: Processor 2:

◮ Peak memory: maximum memory usage ◮ Trade-off between peak memory and performance (time to solution)

slide-8
SLIDE 8

4 / 22

Task graph scheduling and memory

◮ Consider a simple task graph ◮ Tasks have durations and memory demands

  • ut of memory!

A B C D E F

time Processor 1: Processor 2:

◮ Peak memory: maximum memory usage ◮ Trade-off between peak memory and performance (time to solution)

slide-9
SLIDE 9

4 / 22

Task graph scheduling and memory

◮ Consider a simple task graph ◮ Tasks have durations and memory demands

A B C D E F

time Processor 1: Processor 2:

◮ Peak memory: maximum memory usage ◮ Trade-off between peak memory and performance (time to solution)

slide-10
SLIDE 10

5 / 22

Going back to sequential processing

◮ Temporary data require memory ◮ Scheduling influences the peak memory

A B C D E F

When minimum memory demand > available memory: ◮ Store some temporary data on a larger, slower storage (disk) ◮ Out-of-core computing, with Input/Output operations (I/O) ◮ Decide both scheduling and eviction scheme

slide-11
SLIDE 11

5 / 22

Going back to sequential processing

◮ Temporary data require memory ◮ Scheduling influences the peak memory

A B C D E F A B C D E F

When minimum memory demand > available memory: ◮ Store some temporary data on a larger, slower storage (disk) ◮ Out-of-core computing, with Input/Output operations (I/O) ◮ Decide both scheduling and eviction scheme

slide-12
SLIDE 12

5 / 22

Going back to sequential processing

◮ Temporary data require memory ◮ Scheduling influences the peak memory

A B C D E F A B C D E F

When minimum memory demand > available memory: ◮ Store some temporary data on a larger, slower storage (disk) ◮ Out-of-core computing, with Input/Output operations (I/O) ◮ Decide both scheduling and eviction scheme

slide-13
SLIDE 13

6 / 22

Research problems

Several interesting questions: ◮ For sequential processing:

◮ Minimum memory needed to process a graph ◮ In case of memory shortage, minimum I/Os required

◮ In case of parallel processing:

◮ Tradeoffs between memory and time (makespan) ◮ Makespan minimization under bounded memory

Most (all?) of these problems: NP-hard on general graphs Sometimes restrict on simpler graphs:

  • 1. Trees (single output, multiple inputs for each task)

Arise in sparse linear algebra (sparse direct solvers), with large data to handle: memory is a problem

  • 2. Series-Parallel graphs

Natural generalization of trees, close to actual structure of regular codes

slide-14
SLIDE 14

6 / 22

Research problems

Several interesting questions: ◮ For sequential processing:

◮ Minimum memory needed to process a graph ◮ In case of memory shortage, minimum I/Os required

◮ In case of parallel processing:

◮ Tradeoffs between memory and time (makespan) ◮ Makespan minimization under bounded memory

Most (all?) of these problems: NP-hard on general graphs Sometimes restrict on simpler graphs:

  • 1. Trees (single output, multiple inputs for each task)

Arise in sparse linear algebra (sparse direct solvers), with large data to handle: memory is a problem

  • 2. Series-Parallel graphs

Natural generalization of trees, close to actual structure of regular codes

slide-15
SLIDE 15

6 / 22

Research problems

Several interesting questions: ◮ For sequential processing:

◮ Minimum memory needed to process a graph ◮ In case of memory shortage, minimum I/Os required

◮ In case of parallel processing:

◮ Tradeoffs between memory and time (makespan) ◮ Makespan minimization under bounded memory

Most (all?) of these problems: NP-hard on general graphs Sometimes restrict on simpler graphs:

  • 1. Trees (single output, multiple inputs for each task)

Arise in sparse linear algebra (sparse direct solvers), with large data to handle: memory is a problem

  • 2. Series-Parallel graphs

Natural generalization of trees, close to actual structure of regular codes

slide-16
SLIDE 16

6 / 22

Research problems

Several interesting questions: ◮ For sequential processing:

◮ Minimum memory needed to process a graph ◮ In case of memory shortage, minimum I/Os required

◮ In case of parallel processing:

◮ Tradeoffs between memory and time (makespan) ◮ Makespan minimization under bounded memory

Most (all?) of these problems: NP-hard on general graphs Sometimes restrict on simpler graphs:

  • 1. Trees (single output, multiple inputs for each task)

Arise in sparse linear algebra (sparse direct solvers), with large data to handle: memory is a problem

  • 2. Series-Parallel graphs

Natural generalization of trees, close to actual structure of regular codes

slide-17
SLIDE 17

7 / 22

Outline

Minimize Memory for Trees Minimize Memory for Series-Parallel Graphs Minimize I/Os for Trees under Bounded Memory

slide-18
SLIDE 18

8 / 22

Outline

Minimize Memory for Trees Minimize Memory for Series-Parallel Graphs Minimize I/Os for Trees under Bounded Memory

slide-19
SLIDE 19

9 / 22

Notations: Tree-Shaped Task Graphs

f3 f2 f5 f4 n3 n2 n5 n4 n1 4 5 2 3 1

◮ In-tree of n nodes ◮ Output data of size fi ◮ Execution data of size ni ◮ Input data of leaf nodes have null size ◮ Memory for node i: MemReq(i) =  

  • j∈Children(i)

fj   + ni + fi

slide-20
SLIDE 20

9 / 22

Notations: Tree-Shaped Task Graphs

f3 f2 f5

f4

n3 n2 n5

n4

n1 1 4 5 2 3

◮ In-tree of n nodes ◮ Output data of size fi ◮ Execution data of size ni ◮ Input data of leaf nodes have null size ◮ Memory for node i: MemReq(i) =  

  • j∈Children(i)

fj   + ni + fi

slide-21
SLIDE 21

9 / 22

Notations: Tree-Shaped Task Graphs

f3 f2

f5 f4

n3 n2

n5

n4 n1 4 5 2 3 1

◮ In-tree of n nodes ◮ Output data of size fi ◮ Execution data of size ni ◮ Input data of leaf nodes have null size ◮ Memory for node i: MemReq(i) =  

  • j∈Children(i)

fj   + ni + fi

slide-22
SLIDE 22

9 / 22

Notations: Tree-Shaped Task Graphs

f3

f2 f5 f4

n3

n2

n5 n4 n1 4 5 2 3 1

◮ In-tree of n nodes ◮ Output data of size fi ◮ Execution data of size ni ◮ Input data of leaf nodes have null size ◮ Memory for node i: MemReq(i) =  

  • j∈Children(i)

fj   + ni + fi

slide-23
SLIDE 23

9 / 22

Notations: Tree-Shaped Task Graphs

f3 f2

f5 f4

n3

n2 n5 n4 n1 4 5 2 3 1

◮ In-tree of n nodes ◮ Output data of size fi ◮ Execution data of size ni ◮ Input data of leaf nodes have null size ◮ Memory for node i: MemReq(i) =  

  • j∈Children(i)

fj   + ni + fi

slide-24
SLIDE 24

9 / 22

Notations: Tree-Shaped Task Graphs

f3 f2

f5 f4 n3 n2 n5 n4

n1

4 5 2 3 1

◮ In-tree of n nodes ◮ Output data of size fi ◮ Execution data of size ni ◮ Input data of leaf nodes have null size ◮ Memory for node i: MemReq(i) =  

  • j∈Children(i)

fj   + ni + fi

slide-25
SLIDE 25

10 / 22

Liu’s Best Post-Order Traversal for Trees

Post-Order: entirely process one subtree after the other (DFS)

fn f2 r P1 P2 . . . Pn f1

◮ For each subtree Ti: peak memory Pi, residual memory fi ◮ For a given processing order 1, . . . , n, the peak memory is: max{P1, }

slide-26
SLIDE 26

10 / 22

Liu’s Best Post-Order Traversal for Trees

Post-Order: entirely process one subtree after the other (DFS)

fn f2 r P1 P2 . . . Pn f1

◮ For each subtree Ti: peak memory Pi, residual memory fi ◮ For a given processing order 1, . . . , n, the peak memory is: max{P1, f1 + P2, }

slide-27
SLIDE 27

10 / 22

Liu’s Best Post-Order Traversal for Trees

Post-Order: entirely process one subtree after the other (DFS)

fn f2 r P1 P2 . . . Pn f1

◮ For each subtree Ti: peak memory Pi, residual memory fi ◮ For a given processing order 1, . . . , n, the peak memory is: max{P1, f1 + P2, f1 + f2 + P3, }

slide-28
SLIDE 28

10 / 22

Liu’s Best Post-Order Traversal for Trees

Post-Order: entirely process one subtree after the other (DFS)

fn f2 r P1 P2 . . . Pn f1

◮ For each subtree Ti: peak memory Pi, residual memory fi ◮ For a given processing order 1, . . . , n, the peak memory is: max{P1, f1 + P2, f1 + f2 + P3, . . . ,

  • i<n

fi + Pn, }

slide-29
SLIDE 29

10 / 22

Liu’s Best Post-Order Traversal for Trees

Post-Order: entirely process one subtree after the other (DFS)

fn f2 r P1 P2 . . . Pn f1

◮ For each subtree Ti: peak memory Pi, residual memory fi ◮ For a given processing order 1, . . . , n, the peak memory is: max{P1, f1 + P2, f1 + f2 + P3, . . . ,

  • i<n

fi + Pn,

  • fi + nr + fr}
slide-30
SLIDE 30

10 / 22

Liu’s Best Post-Order Traversal for Trees

Post-Order: entirely process one subtree after the other (DFS)

fn f2 r P1 P2 . . . Pn f1

◮ For each subtree Ti: peak memory Pi, residual memory fi ◮ For a given processing order 1, . . . , n, the peak memory is: max{P1, f1 + P2, f1 + f2 + P3, . . . ,

  • i<n

fi + Pn,

  • fi + nr + fr}

◮ Optimal order: non-increasing Pi − fi

slide-31
SLIDE 31

11 / 22

Proof for best post-order

Theorem (Best Post-Order).

The best post-order traversal is obtain by processing subtrees in non-increasing order Pi − fi.

slide-32
SLIDE 32

11 / 22

Proof for best post-order

Theorem (Best Post-Order).

The best post-order traversal is obtain by processing subtrees in non-increasing order Pi − fi. Proof: ◮ Consider an optimal traversal which does not respect the

  • rder:

◮ subtree j is processed right before subtree k ◮ Pk − fk ≥ Pj − fj peak when j, then k peak when k, then j during first subtree mem before + Pj mem before + Pk during second subtree mem before + fj + Pk mem before + fk + Pj

◮ fk + Pj ≤ fj + Pk ◮ Transform the schedule step by step without increasing the memory.

slide-33
SLIDE 33

12 / 22

Post-Order is not optimal

Post-Order traversals are arbitrarily bad in the general case

There is no constant k such that the best post-order traversal is a k-approximation.

ǫ

M M . . . . . . . . . M/b M/b M/b M/b

ǫ ǫ ǫ

M M

◮ Minimum post-order peak memory:

slide-34
SLIDE 34

12 / 22

Post-Order is not optimal

Post-Order traversals are arbitrarily bad in the general case

There is no constant k such that the best post-order traversal is a k-approximation.

ǫ ǫ ǫ ǫ

M/b M M M . . . . . . . . . M/b M/b M/b M

◮ Minimum post-order peak memory: Mmin = M + ǫ + (b − 1)M/b ◮ Minimum peak memory:

slide-35
SLIDE 35

12 / 22

Post-Order is not optimal

Post-Order traversals are arbitrarily bad in the general case

There is no constant k such that the best post-order traversal is a k-approximation.

ǫ ǫ ǫ ǫ

M/b M M M . . . . . . . . . M/b M/b M/b M

◮ Minimum post-order peak memory: Mmin = M + ǫ + (b − 1)M/b ◮ Minimum peak memory: Mmin = M + ǫ + (b − 1)ǫ

slide-36
SLIDE 36

12 / 22

Post-Order is not optimal

Post-Order traversals are arbitrarily bad in the general case

There is no constant k such that the best post-order traversal is a k-approximation.

M/b . . . M/b M/b . . .

ǫ ǫ ǫ ǫ

M/b . . . M M M M

◮ Minimum post-order peak memory: Mmin = M +ǫ+ (b−1)M/b+? ◮ Minimum peak memory: Mmin = M + ǫ + (b − 1)ǫ+?

slide-37
SLIDE 37

12 / 22

Post-Order is not optimal

Post-Order traversals are arbitrarily bad in the general case

There is no constant k such that the best post-order traversal is a k-approximation.

M/b . . . M/b M/b . . .

ǫ ǫ ǫ ǫ

M/b . . . M M M M

◮ Minimum post-order peak memory: Mmin = M + ǫ + 2(b − 1)M/b ◮ Minimum peak memory: Mmin = M + ǫ + 2(b − 1)ǫ

slide-38
SLIDE 38

12 / 22

Post-Order is not optimal

Post-Order traversals are arbitrarily bad in the general case

There is no constant k such that the best post-order traversal is a k-approximation.

M/b . . . M/b M/b . . .

ǫ ǫ ǫ ǫ

M/b . . . M M M M

◮ Minimum post-order peak memory: Mmin = M + ǫ + 2(b − 1)M/b ◮ Minimum peak memory: Mmin = M + ǫ + 2(b − 1)ǫ

actual assembly trees random trees Non optimal traversals 4.2% 61% Maximum increase compared to optimal 18% 22% Average increased compared to optimal 1% 12%

slide-39
SLIDE 39

13 / 22

Liu’s optimal traversal – sketch

◮ Recursive algorithm: at each step, merge the optimal ordering

  • f each subtree (sequence)

◮ Sequence: divided into segments:

◮ H1: maximum over the whole sequence (hill) ◮ V1: minimum after H1 (valley) ◮ H2: maximum after H1 ◮ V2: minimum after H2 ◮ . . . ◮ The valleys Vis are the boundaries of the segments

◮ Combine the sequences by non-increasing H − V ◮ Complex proof based on a partial order on the cost-sequences: (H1, V1, H2, V2, . . . , Hr, Vr) ≺ (H′

1, V ′ 1, H′ 2, V ′ 2, . . . , H′ r′, V ′ r′)

if for each 1 ≤ i ≤ r, there exists 1 ≤ j ≤ r′ with Hi ≤ H′

j and

Vi ≤ V ′

j .

slide-40
SLIDE 40

14 / 22

Outline

Minimize Memory for Trees Minimize Memory for Series-Parallel Graphs Minimize I/Os for Trees under Bounded Memory

slide-41
SLIDE 41

15 / 22

Series-Parallel Graphs: Motivation

◮ Not all scientific workflows are trees ◮ But most workflows exhibit some regularity ◮ Large class of workflows: Series-Parallel graphs

slide-42
SLIDE 42

15 / 22

Series-Parallel Graphs: Motivation

◮ Not all scientific workflows are trees ◮ But most workflows exhibit some regularity ◮ Large class of workflows: Series-Parallel graphs

slide-43
SLIDE 43

15 / 22

Series-Parallel Graphs: Motivation

◮ Not all scientific workflows are trees ◮ But most workflows exhibit some regularity ◮ Large class of workflows: Series-Parallel graphs

SP2 SP1

slide-44
SLIDE 44

15 / 22

Series-Parallel Graphs: Motivation

◮ Not all scientific workflows are trees ◮ But most workflows exhibit some regularity ◮ Large class of workflows: Series-Parallel graphs

SP1 SP2 SP2 SP1

slide-45
SLIDE 45

16 / 22

First Step: Parallel-Chain Graphs

s t

slide-46
SLIDE 46

16 / 22

First Step: Parallel-Chain Graphs

emin

i

umin

i

v min

i

s t

Select edges with minimal weight on each branch: emin

1

, . . . , emin

B

slide-47
SLIDE 47

16 / 22

First Step: Parallel-Chain Graphs

emin

i

umin

i

v min

i

s t

Select edges with minimal weight on each branch: emin

1

, . . . , emin

B

Theorem

There exists a schedule with minimal memory which synchronises at emin

1

, . . . , emin

B .

slide-48
SLIDE 48

16 / 22

First Step: Parallel-Chain Graphs

S T umin

i

v min

i

t s

Select edges with minimal weight on each branch: emin

1

, . . . , emin

B

Theorem

There exists a schedule with minimal memory which synchronises at emin

1

, . . . , emin

B .

Sketch of an optimal algorithm:

  • 1. Apply optimal algorithm for out-trees on the left part
  • 2. Apply optimal algorithm for in-trees on the right part
slide-49
SLIDE 49

17 / 22

Synchronization on minimal cut – proof

◮ Consider optimal schedule σ1 ◮ Transform it into σ2:

  • 1. Schedule all nodes from S (following σ1)
  • 2. Then, schedule all nodes from T

◮ New schedule respect precedence constraints (processing order not changed within each branch) ◮ After scheduling all vertices from S, all emin

i

in memory ◮ Consider the memory when processing u ∈ L from branch i: in σ1 in σ2 edge from branch j = i some edge (v, w)

  • (v, w)

if v ∈ L emin

j

  • therwise

⇒ Memory needed when processing u not larger in σ2 ◮ Same analysis if u ∈ T

slide-50
SLIDE 50

17 / 22

Synchronization on minimal cut – proof

◮ Consider optimal schedule σ1 ◮ Transform it into σ2:

  • 1. Schedule all nodes from S (following σ1)
  • 2. Then, schedule all nodes from T

◮ New schedule respect precedence constraints (processing order not changed within each branch) ◮ After scheduling all vertices from S, all emin

i

in memory ◮ Consider the memory when processing u ∈ L from branch i: in σ1 in σ2 edge from branch j = i some edge (v, w)

  • (v, w)

if v ∈ L emin

j

  • therwise

⇒ Memory needed when processing u not larger in σ2 ◮ Same analysis if u ∈ T

slide-51
SLIDE 51

17 / 22

Synchronization on minimal cut – proof

◮ Consider optimal schedule σ1 ◮ Transform it into σ2:

  • 1. Schedule all nodes from S (following σ1)
  • 2. Then, schedule all nodes from T

◮ New schedule respect precedence constraints (processing order not changed within each branch) ◮ After scheduling all vertices from S, all emin

i

in memory ◮ Consider the memory when processing u ∈ L from branch i: in σ1 in σ2 edge from branch j = i some edge (v, w)

  • (v, w)

if v ∈ L emin

j

  • therwise

⇒ Memory needed when processing u not larger in σ2 ◮ Same analysis if u ∈ T

slide-52
SLIDE 52

17 / 22

Synchronization on minimal cut – proof

◮ Consider optimal schedule σ1 ◮ Transform it into σ2:

  • 1. Schedule all nodes from S (following σ1)
  • 2. Then, schedule all nodes from T

◮ New schedule respect precedence constraints (processing order not changed within each branch) ◮ After scheduling all vertices from S, all emin

i

in memory ◮ Consider the memory when processing u ∈ L from branch i: in σ1 in σ2 edge from branch j = i some edge (v, w)

  • (v, w)

if v ∈ L emin

j

  • therwise

⇒ Memory needed when processing u not larger in σ2 ◮ Same analysis if u ∈ T

slide-53
SLIDE 53

17 / 22

Synchronization on minimal cut – proof

◮ Consider optimal schedule σ1 ◮ Transform it into σ2:

  • 1. Schedule all nodes from S (following σ1)
  • 2. Then, schedule all nodes from T

◮ New schedule respect precedence constraints (processing order not changed within each branch) ◮ After scheduling all vertices from S, all emin

i

in memory ◮ Consider the memory when processing u ∈ L from branch i: in σ1 in σ2 edge from branch j = i some edge (v, w)

  • (v, w)

if v ∈ L emin

j

  • therwise

⇒ Memory needed when processing u not larger in σ2 ◮ Same analysis if u ∈ T

slide-54
SLIDE 54

17 / 22

Synchronization on minimal cut – proof

◮ Consider optimal schedule σ1 ◮ Transform it into σ2:

  • 1. Schedule all nodes from S (following σ1)
  • 2. Then, schedule all nodes from T

◮ New schedule respect precedence constraints (processing order not changed within each branch) ◮ After scheduling all vertices from S, all emin

i

in memory ◮ Consider the memory when processing u ∈ L from branch i: in σ1 in σ2 edge from branch j = i some edge (v, w)

  • (v, w)

if v ∈ L emin

j

  • therwise

⇒ Memory needed when processing u not larger in σ2 ◮ Same analysis if u ∈ T

slide-55
SLIDE 55

17 / 22

Synchronization on minimal cut – proof

◮ Consider optimal schedule σ1 ◮ Transform it into σ2:

  • 1. Schedule all nodes from S (following σ1)
  • 2. Then, schedule all nodes from T

◮ New schedule respect precedence constraints (processing order not changed within each branch) ◮ After scheduling all vertices from S, all emin

i

in memory ◮ Consider the memory when processing u ∈ L from branch i: in σ1 in σ2 edge from branch j = i some edge (v, w)

  • (v, w)

if v ∈ L emin

j

  • therwise

⇒ Memory needed when processing u not larger in σ2 ◮ Same analysis if u ∈ T

slide-56
SLIDE 56

18 / 22

From in-trees to out-trees

f3 f2 f5 f4 n3 n2 n5 n4 n1 4 5 2 3 1 f3 f2 f5 f4 n3 n2 n5 n4 n1 5 4 1 2 3

◮ Given a schedule σ1 with memory M for the left in-tree, derive a schedule σ2 for the right out-tree, obtained by reversing all edges?

slide-57
SLIDE 57

18 / 22

From in-trees to out-trees f3 f2

f5 f4 n3 n2 n5 n4

n1

4 5 2 3 1

f3 f2

f5 f4 n3 n2 n5 n4

n1

1 2 3 5 4

◮ Given a schedule σ1 with memory M for the left in-tree, derive a schedule σ2 for the right out-tree, obtained by reversing all edges?

slide-58
SLIDE 58

18 / 22

From in-trees to out-trees f3 f2

f5 f4

n3

n2 n5 n4 n1 4 5 2 3 1

f3 f2

f5 f4

n3

n2 n5 n4 n1 5 4 1 2 3

◮ Given a schedule σ1 with memory M for the left in-tree, derive a schedule σ2 for the right out-tree, obtained by reversing all edges?

slide-59
SLIDE 59

18 / 22

From in-trees to out-trees

f3

f2 f5 f4

n3

n2

n5 n4 n1 4 5 2 3 1 f3

f2 f5 f4

n3

n2

n5 n4 n1 5 4 1 2 3

◮ Given a schedule σ1 with memory M for the left in-tree, derive a schedule σ2 for the right out-tree, obtained by reversing all edges?

slide-60
SLIDE 60

18 / 22

From in-trees to out-trees

f3 f2

f5 f4

n3 n2

n5

n4 n1 4 5 2 3 1 f3 f2

f5 f4

n3 n2

n5

n4 n1 5 4 1 2 3

◮ Given a schedule σ1 with memory M for the left in-tree, derive a schedule σ2 for the right out-tree, obtained by reversing all edges?

slide-61
SLIDE 61

18 / 22

From in-trees to out-trees

f3 f2 f5

f4

n3 n2 n5

n4

n1 2 3 1 4 5 f3 f2 f5

f4

n3 n2 n5

n4

n1 3 5 4 1 2

◮ Given a schedule σ1 with memory M for the left in-tree, derive a schedule σ2 for the right out-tree, obtained by reversing all edges?

slide-62
SLIDE 62

18 / 22

From in-trees to out-trees

f3 f2 f5

f4

n3 n2 n5

n4

n1 2 3 1 4 5 f3 f2 f5

f4

n3 n2 n5

n4

n1 3 5 4 1 2

◮ Given a schedule σ1 with memory M for the left in-tree, derive a schedule σ2 for the right out-tree, obtained by reversing all edges? ◮ Choose σ2 = reverse(sigma1)

slide-63
SLIDE 63

19 / 22

General Series-Parallel Graphs

Principle: ◮ Follow the recursive definition of the SP-graph ◮ Compute both optimal schedule and minimal cut ◮ Replace subgraphs by chains of nodes (based on opt. sched.) For sequential composition: ◮ Select minimal cut ◮ Concatenate schedules For parallel composition (as for Parallel-Chains): ◮ Merge cuts ◮ On the left part, use algo. for out-trees for merging schedules ◮ On the right, use algo. for in-trees for merging schedules Simple algorithm vs. very complex proof of optimality

slide-64
SLIDE 64

19 / 22

General Series-Parallel Graphs

Principle: ◮ Follow the recursive definition of the SP-graph ◮ Compute both optimal schedule and minimal cut ◮ Replace subgraphs by chains of nodes (based on opt. sched.) For sequential composition: ◮ Select minimal cut ◮ Concatenate schedules For parallel composition (as for Parallel-Chains): ◮ Merge cuts ◮ On the left part, use algo. for out-trees for merging schedules ◮ On the right, use algo. for in-trees for merging schedules Simple algorithm vs. very complex proof of optimality

slide-65
SLIDE 65

19 / 22

General Series-Parallel Graphs

Principle: ◮ Follow the recursive definition of the SP-graph ◮ Compute both optimal schedule and minimal cut ◮ Replace subgraphs by chains of nodes (based on opt. sched.) For sequential composition: ◮ Select minimal cut ◮ Concatenate schedules For parallel composition (as for Parallel-Chains): ◮ Merge cuts ◮ On the left part, use algo. for out-trees for merging schedules ◮ On the right, use algo. for in-trees for merging schedules Simple algorithm vs. very complex proof of optimality

slide-66
SLIDE 66

19 / 22

General Series-Parallel Graphs

Principle: ◮ Follow the recursive definition of the SP-graph ◮ Compute both optimal schedule and minimal cut ◮ Replace subgraphs by chains of nodes (based on opt. sched.) For sequential composition: ◮ Select minimal cut ◮ Concatenate schedules For parallel composition (as for Parallel-Chains): ◮ Merge cuts ◮ On the left part, use algo. for out-trees for merging schedules ◮ On the right, use algo. for in-trees for merging schedules Simple algorithm vs. very complex proof of optimality

slide-67
SLIDE 67

20 / 22

Outline

Minimize Memory for Trees Minimize Memory for Series-Parallel Graphs Minimize I/Os for Trees under Bounded Memory

slide-68
SLIDE 68

21 / 22

Minimizing I/Os for Trees

Problem: ◮ Available memory M too small to compute the whole tree ◮ Some data needs to be written to disk, and read back later ◮ Objective: minimize the amount of I/Os (total volume)

Theorem.

When data must either be kept in memory or fully evicted to disk, deciding which data to write to disk is NP-complete.

Tbig Ti

. . . . . .

Tn

. . . . . .

S S S S/2 ai S an T ′

big

T ′

n

T ′

i

T ′

1

T1 a1 Tend

ni = 0 for all tasks Reduction from Partition: ◮ Integers a1, . . . an, S =

i ai

◮ Split in two subsets of sum S/2 Memory M = 2S Is it possible to schedule the tree with a volume of I/O at most S/2?

slide-69
SLIDE 69

22 / 22

Minimizing I/O for Trees – with Paging

With paging: ◮ Partial data may be written to disk ◮ I/O cost metric: volume of data written to disk Simpler model of memory/computation: ◮ memory weight only on edges output of i= wi ◮ When processing a node, max(input, output) is needed ◮ Can easily emulate previous model (on the board)

4 2 1 3 3 Memory: 0 / 5 Disk: 0 I/Os: 0

slide-70
SLIDE 70

22 / 22

Minimizing I/O for Trees – with Paging

With paging: ◮ Partial data may be written to disk ◮ I/O cost metric: volume of data written to disk Simpler model of memory/computation: ◮ memory weight only on edges output of i= wi ◮ When processing a node, max(input, output) is needed ◮ Can easily emulate previous model (on the board)

4 2 1 3 3 Memory: 3 / 5 Disk: 0 I/Os: 0

slide-71
SLIDE 71

22 / 22

Minimizing I/O for Trees – with Paging

With paging: ◮ Partial data may be written to disk ◮ I/O cost metric: volume of data written to disk Simpler model of memory/computation: ◮ memory weight only on edges output of i= wi ◮ When processing a node, max(input, output) is needed ◮ Can easily emulate previous model (on the board)

4 2 1 3 3 Memory: 4 / 5 Disk: 0 I/Os: 0

slide-72
SLIDE 72

22 / 22

Minimizing I/O for Trees – with Paging

With paging: ◮ Partial data may be written to disk ◮ I/O cost metric: volume of data written to disk Simpler model of memory/computation: ◮ memory weight only on edges output of i= wi ◮ When processing a node, max(input, output) is needed ◮ Can easily emulate previous model (on the board)

4 2 1 3 3

  • 2 I/Os

Memory: 5 / 5 Disk: 2 I/Os: 2

slide-73
SLIDE 73

22 / 22

Minimizing I/O for Trees – with Paging

With paging: ◮ Partial data may be written to disk ◮ I/O cost metric: volume of data written to disk Simpler model of memory/computation: ◮ memory weight only on edges output of i= wi ◮ When processing a node, max(input, output) is needed ◮ Can easily emulate previous model (on the board)

4 2 1 3 3

  • 2 I/Os

Memory: 3 / 5 Disk: 2 I/Os: 2

slide-74
SLIDE 74

22 / 22

Minimizing I/O for Trees – with Paging

With paging: ◮ Partial data may be written to disk ◮ I/O cost metric: volume of data written to disk Simpler model of memory/computation: ◮ memory weight only on edges output of i= wi ◮ When processing a node, max(input, output) is needed ◮ Can easily emulate previous model (on the board)

4 2 1 3 3 Memory: 5 / 5 Disk: 0 I/Os: 2

slide-75
SLIDE 75

22 / 22

Minimizing I/O for Trees – with Paging

With paging: ◮ Partial data may be written to disk ◮ I/O cost metric: volume of data written to disk Simpler model of memory/computation: ◮ memory weight only on edges output of i= wi ◮ When processing a node, max(input, output) is needed ◮ Can easily emulate previous model (on the board)

4 2 1 3 3 Memory: 4 / 5 Disk: 0 I/Os: 2