Recap: Pregel Superstep 0 3 6 2 1 Superstep 1 6 6 2 6 - - PowerPoint PPT Presentation

recap pregel
SMART_READER_LITE
LIVE PREVIEW

Recap: Pregel Superstep 0 3 6 2 1 Superstep 1 6 6 2 6 - - PowerPoint PPT Presentation

Asynchronous Graph Processing CompSci 590.03 Instructor: Ashwin Machanavajjhala (slides adapted from Graphlab talks at UAI10 & VLDB 12 and


slide-1
SLIDE 1

Asynchronous ¡Graph ¡Processing ¡

CompSci ¡590.03 ¡ Instructor: ¡Ashwin ¡Machanavajjhala ¡ ¡

(slides ¡adapted ¡from ¡Graphlab ¡talks ¡at ¡UAI’10 ¡& ¡VLDB ¡’12 ¡ ¡ ¡ and ¡Gouzhang ¡Wang’s ¡talk ¡at ¡CIDR ¡2013) ¡

1 ¡ Lecture ¡15 ¡: ¡590.02 ¡Spring ¡13 ¡

slide-2
SLIDE 2

Recap: ¡Pregel ¡

3 6 2 1 Superstep 0 6 6 2 6 Superstep 1 6 6 6 6 Superstep 2 6 6 6 6 Superstep 3 Figure 2: Maximum Value Example. Dotted lines are messages. Shaded vertices have voted to halt.

Lecture ¡15 ¡: ¡590.02 ¡Spring ¡13 ¡ 2 ¡

slide-3
SLIDE 3

Graph ¡Processing ¡

Lecture ¡15 ¡: ¡590.02 ¡Spring ¡13 ¡ 3 ¡

Dependency ¡ Graph ¡ IteraBve ¡ ComputaBon ¡

My Interests Friends Interests

Local ¡ Updates ¡

slide-4
SLIDE 4

This ¡Class ¡

  • Asynchronous ¡Graph ¡Processing ¡

Lecture ¡15 ¡: ¡590.02 ¡Spring ¡13 ¡ 4 ¡

slide-5
SLIDE 5

Example: ¡Belief ¡PropagaBon ¡

  • Want ¡to ¡compute ¡marginal ¡distribuBon ¡at ¡each ¡node. ¡ ¡

Lecture ¡15 ¡: ¡590.02 ¡Spring ¡13 ¡ 5 ¡

p(x1, x2, · · · , xn) / Y

u∈V

φu(xu) · Y

(u,v)∈E

φu,v(xu, xv)

slide-6
SLIDE 6

Belief ¡PropagaBon ¡

  • Belief ¡at ¡a ¡vertex ¡depends ¡on ¡messages ¡received ¡from ¡

neighboring ¡verBces ¡

Lecture ¡15 ¡: ¡590.02 ¡Spring ¡13 ¡ 6 ¡

  • f of each

𝑤 𝑛→ ¡(𝑦) 𝑣

𝑐 𝑦 ∝ ϕ(𝑦) 𝑛→(𝑦)

,∈

1)

  • 𝑤

𝑛→ ¡(𝑦) 𝑣

𝑐 𝑦 ∝ ϕ(𝑦) 𝑛→(𝑦)

,∈

(

slide-7
SLIDE 7

Belief ¡PropagaBon ¡

  • Belief ¡at ¡a ¡vertex ¡depends ¡on ¡messages ¡received ¡from ¡

neighboring ¡verBces ¡

Lecture ¡15 ¡: ¡590.02 ¡Spring ¡13 ¡ 7 ¡

  • ng to

f of each

𝑤 𝑛→ ¡(𝑦) 𝑣

𝑐 𝑦 ∝ 𝜚(𝑦) 𝑛→(𝑦)

,∈

𝑛→(𝑦) ∝ 𝜚,(𝑦, 𝑦) ∙

𝑐(𝑦) 𝑛→(𝑦)

1) (2)

  • 𝑤

𝑛→ ¡(𝑦) 𝑣

𝑐 𝑦 ∝ ϕ(𝑦) 𝑛→(𝑦)

,∈

(

  • 𝑤

𝑛→ ¡(𝑦) 𝑣

𝑐 𝑦 ∝ 𝜚(𝑦) 𝑛→(𝑦)

,∈

𝑛→(𝑦) ∝ 𝜚,(𝑦, 𝑦) ∙

𝑐(𝑦) 𝑛→(𝑦) (2)

slide-8
SLIDE 8

Original ¡BP ¡Algorithm ¡

16

E A C I D B G H F

Lecture ¡15 ¡: ¡590.02 ¡Spring ¡13 ¡ 8 ¡

slide-9
SLIDE 9

Original ¡BP ¡Algorithm ¡can ¡be ¡inefficient ¡ ¡

  • Spends ¡Bme ¡updaBng ¡nodes ¡which ¡have ¡already ¡converged ¡

Lecture ¡15 ¡: ¡590.02 ¡Spring ¡13 ¡ 9 ¡

Challenge ¡= ¡Boundaries ¡

slide-10
SLIDE 10

Residual ¡BP ¡ImplementaBon ¡

E A C I D B G H F

Scheduler

Lecture ¡15 ¡: ¡590.02 ¡Spring ¡13 ¡ 10 ¡

slide-11
SLIDE 11

Residual ¡BP ¡ImplementaBon ¡

E A C I D B G H F

Scheduler

Lecture ¡15 ¡: ¡590.02 ¡Spring ¡13 ¡ 11 ¡

slide-12
SLIDE 12

Residual ¡BP ¡ImplementaBon ¡

E A C I D B G H F

Scheduler

Lecture ¡15 ¡: ¡590.02 ¡Spring ¡13 ¡ 12 ¡

slide-13
SLIDE 13

Residual ¡BP ¡ImplementaBon ¡

E A C I D B G H F

Scheduler B D

Lecture ¡15 ¡: ¡590.02 ¡Spring ¡13 ¡ 13 ¡

Ordering ¡based ¡on ¡residual ¡(max ¡change ¡in ¡message ¡value) ¡

slide-14
SLIDE 14

Residual ¡BP ¡ImplementaBon ¡

E A C I D B G H F

Scheduler D

Lecture ¡15 ¡: ¡590.02 ¡Spring ¡13 ¡ 14 ¡

slide-15
SLIDE 15

Residual ¡BP ¡ImplementaBon ¡

E A C I D B G H F

Scheduler B D C E G F B

B A D B E

Lecture ¡15 ¡: ¡590.02 ¡Spring ¡13 ¡ 15 ¡

slide-16
SLIDE 16

Residual ¡BP ¡converges ¡faster ¡

300 500 700 900 0.2 0.4 0.6 0.8 1

time in seconds % of runs converged

AGBP RGBP AGBP RGBP

Lecture ¡15 ¡: ¡590.02 ¡Spring ¡13 ¡ 16 ¡

[Elidan ¡et ¡al ¡UAI ¡2006] ¡

slide-17
SLIDE 17

Summary ¡

  • Asynchronous ¡serial ¡graph ¡algorithms ¡can ¡converge ¡faster ¡than ¡

synchronous ¡parallel ¡graph ¡algorithms ¡ ¡

  • Is ¡there ¡a ¡way ¡to ¡correctly ¡transform ¡asynchronous ¡serial ¡

algorithms ¡to ¡run ¡in ¡a ¡parallel ¡seYng? ¡

Lecture ¡15 ¡: ¡590.02 ¡Spring ¡13 ¡ 17 ¡

slide-18
SLIDE 18

GRAPHLAB ¡

Lecture ¡15 ¡: ¡590.02 ¡Spring ¡13 ¡ 18 ¡

slide-19
SLIDE 19

GraphLab ¡

19 ¡

Data ¡Graph ¡ Shared ¡Data ¡Table ¡ Scheduling ¡ Update ¡FuncBons ¡and ¡Scopes ¡

slide-20
SLIDE 20

Data ¡Graph ¡

20 ¡

A ¡Graph ¡with ¡data ¡associated ¡with ¡every ¡vertex ¡and ¡edge. ¡ :Data ¡

x3: ¡current ¡belief ¡ Φ(X6,X9): ¡Binary ¡potenBal ¡ ¡

X1 ¡ X2 ¡ X3 ¡ X5 ¡ X6 ¡ X7 ¡ X8 ¡ X9 ¡ X10 ¡ X4 ¡ X11 ¡

slide-21
SLIDE 21

Update ¡FuncBons ¡

21 ¡

Update ¡Func=ons ¡are ¡operaBons ¡which ¡are ¡applied ¡on ¡a ¡vertex ¡and ¡transform ¡the ¡data ¡in ¡ the ¡scope ¡of ¡the ¡vertex ¡ BP ¡Update: ¡

¡-­‑ ¡Read ¡messages ¡on ¡adjacent ¡ ¡ ¡ ¡ ¡edges ¡ ¡-­‑ ¡Read ¡edge ¡potenBals ¡ ¡-­‑ ¡Compute ¡a ¡new ¡belief ¡for ¡ ¡ ¡ ¡ ¡the ¡current ¡vertex ¡ ¡

¡-­‑ ¡Write ¡new ¡messages ¡on ¡edges ¡

slide-22
SLIDE 22

Update ¡FuncBon ¡Schedule ¡

22 ¡

e f g k j i h d c b a

CPU 1 CPU 2

a h a i b d

slide-23
SLIDE 23

Update ¡FuncBon ¡Schedule ¡

23 ¡

e f g k j i h d c b a

CPU 1 CPU 2

a i b d

slide-24
SLIDE 24

StaBc ¡Schedule ¡

Scheduler ¡determines ¡the ¡ ¡

  • rder ¡of ¡Update FuncBon ¡EvaluaBons ¡

¡

24 ¡

Synchronous ¡Schedule: ¡ ¡ ¡ ¡Every ¡vertex ¡updated ¡simultaneously ¡ Round ¡Robin ¡Schedule: ¡ ¡ ¡Every ¡vertex ¡updated ¡sequenBally ¡

slide-25
SLIDE 25

Converged ¡ Slowly ¡Converging ¡ Focus ¡Effort ¡

Need ¡for ¡Dynamic ¡Scheduling ¡

25 ¡

slide-26
SLIDE 26

Dynamic ¡Schedule ¡

26 ¡

e f g k j i h d c b a

CPU 1 CPU 2

a h a b b i

slide-27
SLIDE 27

Dynamic ¡Schedule ¡

Update ¡FuncBons ¡can ¡insert ¡new ¡tasks ¡into ¡the ¡schedule ¡ ¡

27 ¡

FIFO ¡Queue ¡ Wildfire ¡BP ¡[SelvaBci ¡et ¡al.] ¡ Priority ¡Queue ¡ Residual ¡BP ¡[Elidan ¡et ¡al.] ¡ ¡ Splash ¡Schedule ¡ Splash ¡BP ¡[Gonzalez ¡et ¡al.] ¡

slide-28
SLIDE 28

Global ¡InformaBon ¡

What ¡if ¡we ¡need ¡global ¡informaBon? ¡

28 ¡

Sum ¡of ¡all ¡the ¡verBces? ¡ Algorithm ¡Parameters? ¡ Sufficient ¡StaBsBcs? ¡

slide-29
SLIDE 29

Shared ¡Data ¡Table ¡(SDT) ¡

  • Global ¡constant ¡parameters ¡

29 ¡

Constant: Total # Samples

Constant: Temperature

slide-30
SLIDE 30

Accumulate ¡FuncBon: ¡

Sync ¡OperaBon ¡

  • Sync ¡is ¡a ¡fold/reduce ¡operaBon ¡over ¡the ¡graph ¡

30 ¡

Sync! ¡ 1 3 2 1 2 1 1 3 2 5 1

Apply ¡FuncBon: ¡ Add ¡

Divide ¡by ¡|V| ¡

9 22 2

  • Accumulate ¡performs ¡an ¡aggregaBon ¡over ¡verBces ¡
  • Apply ¡makes ¡a ¡final ¡modificaBon ¡to ¡the ¡accumulated ¡data ¡
  • Example: ¡Compute ¡the ¡average ¡of ¡all ¡the ¡verBces ¡
slide-31
SLIDE 31

Shared ¡Data ¡Table ¡(SDT) ¡

  • Global ¡constant ¡parameters ¡
  • Global ¡computaBon ¡(Sync ¡Opera=on) ¡

31 ¡

Constant: Total # Samples Sync: Sample

Statistics Sync: Loglikelihood Constant: Temperature

slide-32
SLIDE 32

Safety ¡ and ¡ Consistency ¡

32 ¡

slide-33
SLIDE 33

Write-­‑Write ¡Race ¡

33 ¡

Write-­‑Write ¡Race ¡ ¡ If ¡adjacent ¡update ¡funcBons ¡write ¡simultaneously ¡ Lek ¡update ¡writes: ¡ Right ¡update ¡writes: ¡ Final ¡Value ¡

slide-34
SLIDE 34

Race ¡CondiBons ¡+ ¡Deadlocks ¡

  • Just ¡one ¡of ¡the ¡many ¡possible ¡races ¡
  • Race-­‑free ¡code ¡is ¡extremely ¡difficult ¡to ¡write ¡

¡

34 ¡

GraphLab ¡design ¡ensures ¡ ¡ race-­‑free ¡operaBon ¡

slide-35
SLIDE 35

Scope ¡Rules ¡

35 ¡

Guaranteed ¡safety ¡for ¡all ¡update ¡funcBons ¡

slide-36
SLIDE 36

Full ¡Consistency ¡

36 ¡

Only ¡allow ¡update ¡funcBons ¡two ¡verBces ¡apart ¡to ¡be ¡run ¡in ¡parallel ¡ Reduced ¡opportuniBes ¡for ¡parallelism ¡

slide-37
SLIDE 37

Obtaining ¡More ¡Parallelism ¡

37 ¡

Not ¡all ¡update ¡funcBons ¡will ¡modify ¡the ¡enBre ¡scope! ¡ Belief ¡Propaga=on: ¡Only ¡uses ¡edge ¡data ¡ Gibbs ¡Sampling: ¡Only ¡needs ¡to ¡read ¡adjacent ¡verBces ¡ ¡

slide-38
SLIDE 38

Edge ¡Consistency ¡

38 ¡

slide-39
SLIDE 39

Obtaining ¡More ¡Parallelism ¡

39 ¡

“Map” ¡opera=ons. ¡Feature ¡extracBon ¡on ¡vertex ¡data ¡

slide-40
SLIDE 40

Vertex ¡Consistency ¡

40 ¡

slide-41
SLIDE 41

SequenBal ¡Consistency ¡

GraphLab ¡guarantees ¡sequen=al ¡consistency ¡

41 ¡

For ¡every ¡parallel ¡execu=on, ¡there ¡exists ¡a ¡sequen=al ¡execu=on ¡of ¡update ¡funcBons ¡ which ¡will ¡produce ¡the ¡same ¡result. ¡ ¡

CPU 1 CPU 2 CPU 1

Parallel ¡ SequenBal ¡ Bme ¡

slide-42
SLIDE 42

GraphLab ¡

42 ¡

Data ¡Graph ¡ Shared ¡Data ¡Table ¡ Scheduling ¡ Update ¡FuncBons ¡and ¡Scopes ¡

slide-43
SLIDE 43

DISTRIBUTED ¡GRAPHLAB ¡

Lecture ¡15 ¡: ¡590.02 ¡Spring ¡13 ¡ 43 ¡

slide-44
SLIDE 44

DistribuBng ¡GraphLab ¡

  • NOT ¡SHARED-­‑NOTHING ¡(unlike ¡MapReduce ¡/ ¡Pregel) ¡ ¡

– Need ¡to ¡have ¡distributed ¡shared ¡memory ¡ ¡

  • No ¡change ¡to ¡the ¡update ¡step ¡
  • Need ¡to ¡to ¡distributed ¡scheduling ¡
  • Need ¡to ¡ensure ¡distributed ¡consistency ¡
  • Need ¡to ¡ensure ¡fault ¡tolerance ¡

Lecture ¡15 ¡: ¡590.02 ¡Spring ¡13 ¡ 44 ¡

slide-45
SLIDE 45

Distributed ¡Graph ¡

45 ¡

ParBBon ¡the ¡graph ¡across ¡mulBple ¡machines. ¡

slide-46
SLIDE 46

Distributed ¡Graph ¡

46 ¡

  • Ghost ¡verBces ¡maintain ¡adjacency ¡structure ¡and ¡replicate ¡

remote ¡data. ¡

“ghost” ¡verBces ¡

slide-47
SLIDE 47

Distributed ¡Graph ¡

47 ¡

  • Cut ¡efficiently ¡using ¡HPC ¡Graph ¡parBBoning ¡tools ¡

(ParMeBs ¡/ ¡Scotch ¡/ ¡…) ¡

“ghost” ¡verBces ¡

slide-48
SLIDE 48

Pagerank(scope){ ¡ ¡ ¡// ¡Update ¡the ¡current ¡vertex ¡data ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡// ¡Reschedule ¡Neighbors ¡if ¡needed ¡ ¡ ¡if ¡vertex.PageRank ¡changes ¡then ¡ ¡ ¡ ¡ ¡ ¡reschedule_all_neighbors; ¡ ¡ } ¡

vertex.PageRank = α ForEach inPage: vertex.PageRank += (1−α)×inPage.PageRank

Update ¡FuncBons ¡

User-­‑defined ¡program: ¡applied ¡to ¡a ¡ vertex ¡and ¡transforms ¡data ¡in ¡scope ¡of ¡vertex ¡

48 ¡

slide-49
SLIDE 49

Distributed ¡Scheduling ¡

e i h b a f g k j d c a h f g j c b i

Each ¡machine ¡maintains ¡a ¡schedule ¡over ¡the ¡verBces ¡it ¡owns. ¡

49 ¡

Distributed Consensus used to identify completion

slide-50
SLIDE 50

SoluBon ¡1 ¡

Graph ¡Coloring ¡

Distributed ¡ Consistency ¡

SoluBon ¡2 ¡

Distributed ¡Locking ¡

slide-51
SLIDE 51

Edge ¡Consistency ¡via ¡Graph ¡Coloring ¡

VerBces ¡of ¡the ¡same ¡color ¡are ¡all ¡at ¡least ¡one ¡vertex ¡apart. ¡ Therefore, ¡All ¡verBces ¡of ¡the ¡same ¡color ¡can ¡be ¡run ¡in ¡parallel! ¡

51 ¡

slide-52
SLIDE 52

ChromaBc ¡Distributed ¡Engine ¡

Time ¡

Execute tasks

  • n all vertices of

color 0 Execute tasks

  • n all vertices of

color 0 Ghost Synchronization Completion + Barrier Execute tasks

  • n all vertices of

color 1 Execute tasks

  • n all vertices of

color 1 Ghost Synchronization Completion + Barrier

52 ¡

slide-53
SLIDE 53

Problems ¡

  • Require ¡a ¡graph ¡coloring ¡to ¡be ¡available. ¡

¡ ¡

  • Frequent ¡Barriers ¡make ¡it ¡extremely ¡inefficient ¡for ¡highly ¡

dynamic ¡systems ¡where ¡only ¡a ¡small ¡number ¡of ¡verBces ¡are ¡ acBve ¡in ¡each ¡round. ¡

53 ¡

slide-54
SLIDE 54

SoluBon ¡1 ¡

Graph ¡Coloring ¡

Distributed ¡ Consistency ¡

SoluBon ¡2 ¡

Distributed ¡Locking ¡

slide-55
SLIDE 55

Distributed ¡Locking ¡

Edge ¡Consistency ¡can ¡be ¡guaranteed ¡through ¡locking. ¡

: ¡RW ¡Lock ¡

55 ¡

slide-56
SLIDE 56

Consistency ¡Through ¡Locking ¡

Acquire ¡write-­‑lock ¡on ¡center ¡vertex, ¡read-­‑lock ¡on ¡adjacent. ¡

56 ¡

slide-57
SLIDE 57

Solution

Pipelining

CPU

Machine 1 Machine 2

A C B D

Consistency ¡Through ¡Locking ¡

Multicore Setting

  • PThread ¡RW-­‑Locks ¡

Distributed Setting

  • Distributed ¡Locks ¡

Challenges

Latency

A C B D A C B D A

57

slide-58
SLIDE 58

No ¡Pipelining ¡

lock scope 1 Process request 1 scope ¡1 ¡acquired update_funcBon ¡1 release ¡scope ¡1 Process release 1

Time ¡

58 ¡

slide-59
SLIDE 59

Pipelining ¡/ ¡Latency ¡Hiding ¡

Hide ¡latency ¡using ¡pipelining ¡

lock scope 1 Process request 1 scope ¡1 ¡acquired update_funcBon ¡1 release ¡scope ¡1 Process release 1 lock scope 2

Time ¡

lock scope 3 Process request 2 Process request 3 scope ¡2 ¡acquired scope ¡3 ¡acquired update_funcBon ¡2 release ¡scope ¡2

59 ¡

slide-60
SLIDE 60

Checkpoints ¡for ¡Fault ¡Tolerance ¡

1: ¡Stop ¡the ¡world ¡ 2: ¡Write ¡state ¡to ¡disk ¡

slide-61
SLIDE 61

Snapshot ¡Performance ¡

50 100 150 0.5 1 1.5 2 2.5x 10

8

time elapsed(s) vertices updated

  • sync. snapshot

no snapshot

  • async. snapshot

61 ¡

No Snapshot

Snapshot ¡ One ¡slow ¡ machine ¡

Because ¡we ¡have ¡to ¡stop ¡the ¡world, ¡ ¡ One ¡slow ¡machine ¡slows ¡everything ¡down! ¡

Snapshot ¡=me ¡ Slow ¡machine ¡

slide-62
SLIDE 62

Bexer ¡CheckpoinBng ¡

  • Based ¡on ¡[Chandy, ¡Lamport ¡‘85] ¡
  • Edge ¡consistent ¡update ¡funcBon ¡

Lecture ¡15 ¡: ¡590.02 ¡Spring ¡13 ¡ 62 ¡

Algorithm 5: Snapshot Update on vertex v

if v was already snapshotted then Quit Save Dv // Save current vertex foreach u ∈ N[v] do // Loop over neighbors if u was not snapshotted then Save data on edge Du↔v Schedule u for a Snapshot Update Mark v as snapshotted

slide-63
SLIDE 63
  • Async. ¡Snapshot ¡Performance ¡

50 100 150 0.5 1 1.5 2 2.5x 10

8

time elapsed(s) vertices updated

  • sync. snapshot

no snapshot

  • async. snapshot

63 ¡

No Snapshot

Snapshot ¡ One ¡slow ¡ machine ¡

No ¡penalty ¡incurred ¡by ¡the ¡slow ¡machine! ¡

slide-64
SLIDE 64

Summary ¡

  • Asynchronous ¡serial ¡graph ¡algorithms ¡can ¡converge ¡faster ¡than ¡

synchronous ¡parallel ¡graph ¡algorithms ¡ ¡

  • GraphLab ¡provides ¡high ¡level ¡abstracBons ¡for ¡wriBng ¡

asynchronous ¡graph ¡algorithms ¡

– Takes ¡care ¡of ¡consistency ¡and ¡scheduling ¡

  • Distributed ¡GraphLab ¡ ¡

– Graph ¡processing ¡using ¡color-­‑steps ¡ – Consistency ¡ensured ¡via ¡pipelined ¡distributed ¡locking ¡ – Fault ¡tolerance ¡via ¡fine ¡grained ¡checkpoinBng ¡

Lecture ¡15 ¡: ¡590.02 ¡Spring ¡13 ¡ 64 ¡