Efficient Parameterized Algorithms for Data Packing Krishnendu - - PowerPoint PPT Presentation

efficient parameterized algorithms for data packing
SMART_READER_LITE
LIVE PREVIEW

Efficient Parameterized Algorithms for Data Packing Krishnendu - - PowerPoint PPT Presentation

Data Packing Tree Decompositions Our Algorithm Experimental Results Efficient Parameterized Algorithms for Data Packing Krishnendu Chatterjee, Amir Goharshady , Nastaran Okati, Andreas Pavlogiannis January 22, 2019 1 / 30 Data Packing Tree


slide-1
SLIDE 1

Data Packing Tree Decompositions Our Algorithm Experimental Results

Efficient Parameterized Algorithms for Data Packing

Krishnendu Chatterjee, Amir Goharshady, Nastaran Okati, Andreas Pavlogiannis January 22, 2019

1 / 30

slide-2
SLIDE 2

Data Packing Tree Decompositions Our Algorithm Experimental Results

Overview

Data Packing is a classical problem in Cache Management

2 / 30

slide-3
SLIDE 3

Data Packing Tree Decompositions Our Algorithm Experimental Results

Overview

Data Packing is a classical problem in Cache Management NP-hard and Hard-to-approximate → Heuristics are used

3 / 30

slide-4
SLIDE 4

Data Packing Tree Decompositions Our Algorithm Experimental Results

Overview

Data Packing is a classical problem in Cache Management NP-hard and Hard-to-approximate → Heuristics are used The heuristics provide no guarantee of optimality

4 / 30

slide-5
SLIDE 5

Data Packing Tree Decompositions Our Algorithm Experimental Results

Overview

Data Packing is a classical problem in Cache Management NP-hard and Hard-to-approximate → Heuristics are used The heuristics provide no guarantee of optimality We reduce Data Packing to a graph problem

5 / 30

slide-6
SLIDE 6

Data Packing Tree Decompositions Our Algorithm Experimental Results

Overview

Data Packing is a classical problem in Cache Management NP-hard and Hard-to-approximate → Heuristics are used The heuristics provide no guarantee of optimality We reduce Data Packing to a graph problem We show that this problem can be solved in linear time if the underlying graph has a specific structural property

6 / 30

slide-7
SLIDE 7

Data Packing Tree Decompositions Our Algorithm Experimental Results

Overview

Data Packing is a classical problem in Cache Management NP-hard and Hard-to-approximate → Heuristics are used The heuristics provide no guarantee of optimality We reduce Data Packing to a graph problem We show that this problem can be solved in linear time if the underlying graph has a specific structural property We experimentally show that graphs obtained from many common algorithms have this property

7 / 30

slide-8
SLIDE 8

Data Packing Tree Decompositions Our Algorithm Experimental Results

Overview

Data Packing is a classical problem in Cache Management NP-hard and Hard-to-approximate → Heuristics are used The heuristics provide no guarantee of optimality We reduce Data Packing to a graph problem We show that this problem can be solved in linear time if the underlying graph has a specific structural property We experimentally show that graphs obtained from many common algorithms have this property → We provide the first positive theoretical result for Data Packing

8 / 30

slide-9
SLIDE 9

Data Packing Tree Decompositions Our Algorithm Experimental Results

The Setting

A two-level memory system with:

large but slow main memory small but fast cache

The cache can hold up to m blocks (pages) Each block can hold up to p data items When accessing a data item, its block must be in the cache

9 / 30

slide-10
SLIDE 10

Data Packing Tree Decompositions Our Algorithm Experimental Results

The Goal

A sequence R of accesses to data elements is given The goal is to minimize cache misses over R N := |R|, n :=number of distinct data items

10 / 30

slide-11
SLIDE 11

Data Packing Tree Decompositions Our Algorithm Experimental Results

Two Distinct Problems

Minimizing cache misses can be broken in two parts:

Paging: Choosing which block to evict from the cache when a cache-miss occurs (LRU, FIFO, etc.) Data Packing: Choosing a data placement scheme, i.e. choosing how to divide the data items into blocks and which data items to put together

Data Packing is the focus of this work

11 / 30

slide-12
SLIDE 12

Data Packing Tree Decompositions Our Algorithm Experimental Results

Access Graph

R = a, b, c, a, b, b, d, b, d, e, c, b, f a b c d e f

12 / 30

slide-13
SLIDE 13

Data Packing Tree Decompositions Our Algorithm Experimental Results

Access Graph

R = a, b, c, a, b, b, d, b, d, e, c, b, f a b c d e f 2 1 3 1 1 2 1

13 / 30

slide-14
SLIDE 14

Data Packing Tree Decompositions Our Algorithm Experimental Results

Access Hypergraph

R = a, b, c, a, b, b, d, b, d, e, c, b, f

a, b, c, a, b, b, d, b, d, e, c, b, f

14 / 30

slide-15
SLIDE 15

Data Packing Tree Decompositions Our Algorithm Experimental Results

Nice Tree Decompositions

a b c d e f

15 / 30

slide-16
SLIDE 16

Data Packing Tree Decompositions Our Algorithm Experimental Results

Previous Results

Theorem (Lavaee, POPL 2016) Assuming either LRU or FIFO as the replacement policy, we have the following hardness results: For any m and any p ≥ 3, Data Packing is NP-hard. Unless P=NP, for any m ≥ 5, p ≥ 2 and any constant ǫ > 0, there is no polynomial algorithm that can approximate the Data Packing problem within a factor of O(N1−ǫ).

16 / 30

slide-17
SLIDE 17

Data Packing Tree Decompositions Our Algorithm Experimental Results

Our Results

H a r d t

  • A

p p r

  • x

i m a t e T h e

  • r

e m 4 . 3 ← ( m − 5 ) p + 1 → NP-hard Theorem 4.2 ← (m − 1)p + 2 → Linear-time Theorem 4.1 Hard to Approximate Theorem 2.1 NP-hard Theorem 2.1 Linear-time Theorem 3.1 | 1 | 5 | 6 | 2 m q

17 / 30

slide-18
SLIDE 18

Data Packing Tree Decompositions Our Algorithm Experimental Results

Minimum-weight p-partitioning

m = 1, p = 2 R = a, b, c, a, b, b, d, b, d, e, c, b, f a b c d e f 2 1 3 1 1 2 1 Cross edge: An edge that goes from one partition to another

18 / 30

slide-19
SLIDE 19

Data Packing Tree Decompositions Our Algorithm Experimental Results

States

Let G = (V , E) and A ⊆ V . A state over A is a pair (ϕ, sz) where:

ϕ is a partitioning of A in which every equivalence class has a size of at most p sz is a size enlargement function sz : A/ϕ → {0, . . . , p − 1} that maps each equivalence class [v]ϕ to a number which is at most p − |[v]ϕ|

a b c a b c a b c a b c a b c a b c a b c a b c a b c a b c a c b a c b b c a b c a

19 / 30

slide-20
SLIDE 20

Data Packing Tree Decompositions Our Algorithm Experimental Results

States

  • Realization. We say that a p-partitioning ψ realizes the state

s = (ϕ, sz) over A, if ψ partitions the vertices in A in the same manner as ϕ if a partition [v]ψ of ψ intersects A, then [v]ψ contains as many vertices from outside of A as fixed by sz.

  • Compatibility. Two states are compatible iff there exists a

p-partitioning that realizes both of them.

a b c d e f 2 1 3 1 1 2 1 a c b d e f

a c b d e f

20 / 30

slide-21
SLIDE 21

Data Packing Tree Decompositions Our Algorithm Experimental Results

The Algorithm

Step 0: Initialization. We define several variables at each node of

  • ur tree decomposition T.

For every t ∈ T and every state s over the boundary Xt, we define a variable dp[t, s] and initialize it to +∞.

  • Invariant. dp[t, s] = The minimum total weight of cross edges
  • ver all p-partitionings of Gt that realize s.

21 / 30

slide-22
SLIDE 22

Data Packing Tree Decompositions Our Algorithm Experimental Results

The Algorithm

Step 1: Computation of dp . The dp variables are computed in a bottom-up order. Each dp value at a tree node t can be computed based on the dp values at its children.

if t is a Leaf: dp[t, s] = 0; if t is a Join node with children t1 and t2: dp[t, s] = min

sz1+sz2≡sz dp[t1, (ϕ, sz1)] + dp[t2, (ϕ, sz2)];

if t is an Introduce Vertex node, introducing v, with a single child t1: dp[t, s] = dp[t1, (ϕ|Xt1 , sz|Xt1 )]; if t is an Introduce Edge node, introducing e, with a single child t1: dp[t, s] = dp[t1, s] + w(e, ϕ), where w(e, ϕ) is equal to w(e) if e is a cross edge in ϕ and 0 otherwise; if t is a Forget Vertex node, forgetting v, with a single child t1: dp[t, s] = min

s′ . =s

dp[t1, s′]. 22 / 30

slide-23
SLIDE 23

Data Packing Tree Decompositions Our Algorithm Experimental Results

The Algorithm: Introduce Edge Nodes

dp[t, s] = dp[t1, s] + w(e, ϕ) t t1

23 / 30

slide-24
SLIDE 24

Data Packing Tree Decompositions Our Algorithm Experimental Results

The Algorithm: Join Nodes

dp[t, (ϕ, sz)] = min

sz1+sz2≡sz dp[t1, (ϕ, sz1)] + dp[t2, (ϕ, sz2)]

t t1 t2

24 / 30

slide-25
SLIDE 25

Data Packing Tree Decompositions Our Algorithm Experimental Results

The Algorithm

Step 2: Computing the Output. The algorithm computes and return the following output: min

s∈SXr

dp[r, s].

25 / 30

slide-26
SLIDE 26

Data Packing Tree Decompositions Our Algorithm Experimental Results

Theorem If the access graph has constant treewidth, then Data Packing can be solved in linear time.

H a r d t

  • A

p p r

  • x

i m a t e T h e

  • r

e m 4 . 3 NP-hard Theorem 4.2 Linear-time Theorem 4.1 Hard to Approximate Theorem 2.1 NP-hard Theorem 2.1 Linear-time Theorem 3.1 | | | |

26 / 30

slide-27
SLIDE 27

Data Packing Tree Decompositions Our Algorithm Experimental Results

Theorem If the access graph has constant treewidth, then Data Packing can be solved in linear time.

H a r d t

  • A

p p r

  • x

i m a t e T h e

  • r

e m 4 . 3 ← ( m − 5 ) p + 1 → NP-hard Theorem 4.2 ← (m − 1)p + 2 → Linear-time Theorem 4.1 Hard to Approximate Theorem 2.1 NP-hard Theorem 2.1 Linear-time Theorem 3.1 | 1 | 5 | 6 | 2 m q

27 / 30

slide-28
SLIDE 28

Data Packing Tree Decompositions Our Algorithm Experimental Results

Experimental Results

Inner-product of two vectors Computation of Fibonacci Numbers Insertion Sort Random Insertions in a Heap Random Binary Searches on a Sorted Array Closest Pair of Points in 2D

28 / 30

slide-29
SLIDE 29

Data Packing Tree Decompositions Our Algorithm Experimental Results

Comparison of the Number of Cache Misses

Linear Algebra Sorting Dynamic Programming Recursion String Matching Computational Geometry Trees Sorted Arrays Total Ours 100 100 100 100 100 100 100 100 100 CCDP 129.12 114.65 113.24 128.57 115.04 135.27 136.16 136.8 122.1 CPACK 138.77 106.95 110.62 124.02 114.4 140.31 123.04 127.75 124.61 CPACK+/GPART+/CApRI+ 139.07 148.78 121.9 139.13 101.87 135.01 117.38 136.08 119.78 Sampling 106.28 152.71 118.95 175.78 115.4 128.06 142 154.69 115.2 k-Distance 146.32 170.54 122.88 167.49 114.55 131.12 143.15 161.18 131.23 20 40 60 80 100 120 140 160 180 200

29 / 30

slide-30
SLIDE 30

Data Packing Tree Decompositions Our Algorithm Experimental Results

Conclusion

H a r d t

  • A

p p r

  • x

i m a t e T h e

  • r

e m 4 . 3 ← ( m − 5 ) p + 1 → NP-hard Theorem 4.2 ← (m − 1)p + 2 → Linear-time Theorem 4.1 Hard to Approximate Theorem 2.1 NP-hard Theorem 2.1 Linear-time Theorem 3.1 | 1 | 5 | 6 | 2 m q

30 / 30