+ All Categories
Home > Technology > Teaching Graph Algorithms in the Field - Bipartite Matching in optical datacenters

Teaching Graph Algorithms in the Field - Bipartite Matching in optical datacenters

Date post: 02-Jul-2015
Category:
Upload: kostas-katrinis
View: 151 times
Download: 0 times
Share this document with a friend
Description:
Guest Lecture performed at Trinity College Dublin, Ireland in Spring 2014
29
© 2014 IBM Corporation Bipartite Matching and Optical Clouds - what? Kostas Katrinis Guest Lecture – CS2012 Programming Techniques Trinity College Dublin April 14, 2014
Transcript
Page 1: Teaching Graph Algorithms in the Field - Bipartite Matching in optical datacenters

© 2014 IBM Corporation

Bipartite Matching and Optical Clouds - what?

Kostas Katrinis

Guest Lecture – CS2012 Programming TechniquesTrinity College DublinApril 14, 2014

Page 2: Teaching Graph Algorithms in the Field - Bipartite Matching in optical datacenters

© 2014 IBM Corporation2

Outline

• Scope & Background

• Motivation & Challenges

• Hybrid Network Architecture

• MEMS Optical Switch Operation Brief

• Bipartite Graphs

• Matchings

• Make the connection!

• Hungarian Algorithm

Part I - Introduction

Part II – Modeling

Part III – Theory & Algorithm

Page 3: Teaching Graph Algorithms in the Field - Bipartite Matching in optical datacenters

© 2014 IBM Corporation3

Scope Part I - Background

• Target Markets– (Cloud) Datacenters - Θ(10K) Servers– HPC Clusters (82% in Nov'12 Top-500)

• Target Systems:– Data Network Fabric

Page 4: Teaching Graph Algorithms in the Field - Bipartite Matching in optical datacenters

© 2014 IBM Corporation4

DC Traffic Trends

• 76% of the traffic is

intra-datacenter *

• Total DC traffic CAGR

33% to 2015 *

• Traffic percentage exiting the rack

is high (up to 90%) **– ...and we expect it to increase (scale-out workloads)

* Cisco Global Cloud Index: Forecast and Methodology, 2011–2016** Benson et al., “Network Traffic Characteristics of Data Centers in the Wild”, IMC'10

Part I - Background

Page 5: Teaching Graph Algorithms in the Field - Bipartite Matching in optical datacenters

© 2014 IBM Corporation5

Design Trade-offs (Performance)

Performance

Co

st

Highlyoversubcr.

HighBisection

Trad

e-off

• We need high-capacity between any two points in the DC

• and at various scales (incremental deployment)

• ... we need $$$

Part I - Background

Page 6: Teaching Graph Algorithms in the Field - Bipartite Matching in optical datacenters

© 2014 IBM Corporation6

Motivating Example

Item Item List Price (USD)** Qty Total List Price (USD)

BNT G8264 (64-port switch) 30,000 5,120 153,600,000

BNT SFP+ SR Transceiver 665 262,164 174,325,760

MM Fiber Cable 28 131,072 3,670,016

Estimated List Prices

**Source: ibm.com

Fabric Price331M USD

≈ Compute Price(@5K/server)

• Full-bisection fat-tree @ 65k servers

• Building block: 64-port Ethernet switches (ala VL2*)

• Denser switches will not help you (e.g. 288-port Mellanox Vantage)

Greenberg et al., “VL2: A Scalable and Flexible Data Center Network”, SIGCOMM 2009

Part I - Background

Page 7: Teaching Graph Algorithms in the Field - Bipartite Matching in optical datacenters

© 2014 IBM Corporation7

Motivating Example (cont.)

Total Price331m USD

AND.....

#Cables to route131,000

Can you count the birds in this nest?

Part I - Background

Page 8: Teaching Graph Algorithms in the Field - Bipartite Matching in optical datacenters

© 2014 IBM Corporation8

Paradigm Shift - Switch Light

Tiltable Mirrors implemented via MEMS (Micro-Electrical Mechanical Systems)

+ High-radix (320 ports you can buy, 1024 feasible)

+ No transceivers

+ Decreasing $/port

+ 50x less Watts/port vs. electronics

+ Can switch up to ~1Tbps

+ Protocol Agnostic

Electronic Switch (Ethernet) Optical MEMS switch

Price/Port (USD) 1100 (includes TxRx cost) 350

Bandwidth/Port 10Gbps “Rate-free”

Power/Port (W) 10 0.2

Requires TxRxs Yes No

x3

x∞

x50

Part I - Background

Page 9: Teaching Graph Algorithms in the Field - Bipartite Matching in optical datacenters

© 2014 IBM Corporation9

Hybrid Fabric Architecture Part I - Architecture

Page 10: Teaching Graph Algorithms in the Field - Bipartite Matching in optical datacenters

© 2014 IBM Corporation 10

Dublin Prototype - Photos

Single-mode fiber links, 25m length,10GBASE-LR

96x96-Port 3D-MEMS Switch

Shamrock Server Rack, Chelsio T4 NIC cards

G8264 TOR Switch

Redirect traffic from over-subscribed electrical network to optical circuits.

Packet forwarding removes bandwidth limitation of over-subscribed electrical network.

Max. Latency <13 ns

Part I - Architecture

Page 11: Teaching Graph Algorithms in the Field - Bipartite Matching in optical datacenters

© 2014 IBM Corporation11

High-level Functionality

• Bijective TE:– Mice are routed via the 1G electronic fabric– Elephants are routed via the 10G optical fabric

Optical Fabric is reconfigurable– Centralized control optimizes topology against traffic pattern and

demand volume

Part I - Architecture

Page 12: Teaching Graph Algorithms in the Field - Bipartite Matching in optical datacenters

© 2014 IBM Corporation12

Optical MEMS Switch Part II – MEMS Switch

• Focus on the “Optical MEMS Switch”

• NxN ports (N inputs to connect to N outputs)

• Each input port is dynamically “crossconnected” to at most one output port based on the rack pair we need to connect (decide every X seconds)

• E.g. Crossconnect port-13 to port-45 to connect rack-2 with rack-5 above

Page 13: Teaching Graph Algorithms in the Field - Bipartite Matching in optical datacenters

© 2014 IBM Corporation13

Bipartite Graphs

Definition (Bipartite Graphs)

G=(V,E) is bipartite if we can partition its vertex set V to two disjoing sets X and Y, s.t. there are no edges between X and Y. We say that (X,Y) is a bipartion of G.

Note: During this lecture, we will constrain our focus for the sake of understanding to undirected graphs. Applying the concepts to directed graphs as food for thought.

Part II – Bipartite

Page 14: Teaching Graph Algorithms in the Field - Bipartite Matching in optical datacenters

© 2014 IBM Corporation14

Matchings

Definition (Matching)

A matching M of a graph G=(V,E) is a set of edges of G such that no two edges in M share a common vertex.

• If a vertex u is matched by M, then we say that u is saturated by M. Otherwise, a vertex u is unsaturated by M

Example: In M1, v2 is saturated, whereas v1 is unsaturated

Part II – Matchings

Page 15: Teaching Graph Algorithms in the Field - Bipartite Matching in optical datacenters

© 2014 IBM Corporation15

Maximum Matchings

• Greediness strikes back: we want a matching to have as many edges as possible

Definition (Maximum Matching)

A matching M of a graph G=(V,E) is a maximum matching if no matching in G has more edges.

Example: M2 is a maximum matching (|G|=8 and |M2|=4). Since |M1|=3, M1 is not maximum.

Part II – Matchings

Page 16: Teaching Graph Algorithms in the Field - Bipartite Matching in optical datacenters

© 2014 IBM Corporation16

Technology ↔ Theory: Connection Part II – Model

Page 17: Teaching Graph Algorithms in the Field - Bipartite Matching in optical datacenters

© 2014 IBM Corporation17

Maximum Matching – Optical Switch

• Remember that our Greediness keeps striking back, can't get rid of it!

• If we find a maximum matching (maximum number of edges), then we have maximized the number of crossconnections in our optical switch

• .... thus we have maximized throughput (aggregate bandwidth that crosses the optical switch)

Part II – Model

Page 18: Teaching Graph Algorithms in the Field - Bipartite Matching in optical datacenters

© 2014 IBM Corporation18

Maximum Matching in Bipartite Graphs

• So this is what we need (see title above) to maximize utilization of our optical switch. We need an algorithm to find a maximum matching on a bipartite graph. But how? Some theory first (and more definitions)

Definition (Alternating and Augmenting Paths)

Let G=(V,E) have a matching M. An alternating path P with respect to M is any path whose edges are alternately in M and not in M (E-M). If the start and end vertices of P are not saturated by M, then P is an augmenting path.

Example: P= (v1,v2,v3,v4,v5) is an alternating path

P'= (v1,v2,v3,v4,v5,v6) is an augmenting path

Part III – T&A

Page 19: Teaching Graph Algorithms in the Field - Bipartite Matching in optical datacenters

© 2014 IBM Corporation19

Matching expansion

Definition (Symmetric Difference)

Let E and E' be two edge sets. Then we define as the symmetric difference M=E ◘ E' of the two sets the operation M = (E-E') U (E'-E) = (E U E') – (E ∩ E')

• Let G and M a matching (see below). P = (v1,v2,v3,v4,v5,v6) is an augmentic path. E(P) are the edges of P.

• |M|=3

• Define M' = M ◘ E(P)

• Observe: |M'|=4 … wow! We obtained a larger matching M' starting from a non-maximum one (M)

Part III – T&A

Page 20: Teaching Graph Algorithms in the Field - Bipartite Matching in optical datacenters

© 2014 IBM Corporation20

Expansion Lemma

Lemma –1 (Matching Expansion)

Let G have a matching M and let P be an augmenting path with respect to M. Then M' = M ◘ E(P) is a matching with one more edge than M – or equivalently – |M'|=|M|+1.

Proof

M' contains all the edges of M, plus all the edges in E(P) that are not in M. Thus M' is per construction a matching of G.

Let u and v be the start and end vertices of P. Then u and v are unsaturated in M, because P is an augmenting path. Because of the symmetric difference operator, u and v are now saturated in M'. The rest of the edges of M that were not in E(P) are still in M'. Thus, |M'|=|M|+1

Part III – T&A

Page 21: Teaching Graph Algorithms in the Field - Bipartite Matching in optical datacenters

© 2014 IBM Corporation21

Berge's Theorem

Theorem-1 (Berge's Theorem)

A matching M in G is maximum if and only if G has no augmenting path with respect to M.

Proof

Left as an exercise (aka we don't have the time budget in class :-)). Reference Textbook has a rigorous, easy-to-follow proof

• Theorems and lemmas are tools to an end. Let's use them!

• Back to our goal: We need an algorithm to find a maximum matching on a bipartite graph

• Strategy:

1) Start with an arbitrary (even empty) matching M. If M is not maximum, there will be an unsaturated vertex u.

2) Follow alternating paths from u until we identify another unsaturated vertex v. Then the u-v path P is an augmentic path.

3) Set M'=M ◘ E(P). By the expansion Lemma, M' is a larger matching.

4) Repeat

Part III – T&A

Page 22: Teaching Graph Algorithms in the Field - Bipartite Matching in optical datacenters

© 2014 IBM Corporation22

Hungarian Algorithm - Preliminaries

Data Structures

• Integer Match[n]; // n is the number of vertices or n=|V| of G=(V,E)– i.e. Match[u]=v if the matching matches vertex u to vertex v for all u in V

• Default: Match[u]=0 if u is unsaturated (not matched) by the matching

• For Breadth-First-Search (BFS) we use

Integer PrevPt[n]– i.e. PrevPt[u]=v indicates that v is a parent of u in the BFS tree

• Alternating Paths: we use a combination of Match and PrevPt data structures to store alternating paths. Example: P = (u, v2, v6, v3, v8)

• List S in X of vertices that are reachable

from a vertex u in X using alternate paths

• List NS in Y of vertices that are reachable

from a vertex u in X using alternate paths

Part III – T&A

PrevPt(v3)

PrevPt(v2)

Match(v6)

Match(v8)

Page 23: Teaching Graph Algorithms in the Field - Bipartite Matching in optical datacenters

© 2014 IBM Corporation23

Algorithm-1 (Augment subroutine)

Augment (y)

// Input: y is the end vertex of the augmenting path

// Output: augments the edges along the augmenting path “in place”

repeat

w = PrevPt[y]

Match[y] = w

u = Match[w]

Match[w]=y

y=u

until y=0 //reached root of BFS tree ie start vertex of augm.           //path

Part III – T&AHungarian Algorithm - Augmenting

Page 24: Teaching Graph Algorithms in the Field - Bipartite Matching in optical datacenters

© 2014 IBM Corporation24

Part III – T&AHungarian Algorithm – Augm. Example

y

w

v

u

augment(y)rep.1w = PrevPt[y]Match[y] = wv = Match[w]Match[w]=yy=v

rep.2w = PrevPt[y]Match[y] = wv = Match[w]Match[w]=yy=v

Augmenting Path

Page 25: Teaching Graph Algorithms in the Field - Bipartite Matching in optical datacenters

© 2014 IBM Corporation25

Algorithm-2 (Maximum Matching of Graph G with bipartition (X,Y) and n vert.)

for i=1 to n do Match[i]=0 //initfor each u in X do {  S.append(u);  for i=1 to n do PrevPt[i]=0; //BFS rooted at u   k=1;   repeat

x = S[k];for each y adjacent to x do {

         if y not in NS {           NS.append(y);           PrevPt[y]=x;           if y is unsaturated {             // found augmented path!!!             augment(y);             go to 1; // we saturated u           } else S.append(Match[y]); // continue building the BFS tree         }     }     k = k+1;    until k > S.size(); // BFS rooted at u is now built out, no saturation :­(    Remove S and NS from the graph} 

Part III – T&AHungarian Algorithm

Page 26: Teaching Graph Algorithms in the Field - Bipartite Matching in optical datacenters

© 2014 IBM Corporation26

Part III – T&AHungarian Algorithm – Example (1)

Page 27: Teaching Graph Algorithms in the Field - Bipartite Matching in optical datacenters

© 2014 IBM Corporation27

Part III – T&AHungarian Algorithm – Example (2)

Page 28: Teaching Graph Algorithms in the Field - Bipartite Matching in optical datacenters

© 2014 IBM Corporation28

Food for Thought and Further Reading

Kocay and Kreher, “Graphs, Algorithms, and Optimization (Discrete Mathematics and Its Applications)”, Chapman and Hall/CRC

How about faster algorithms?

Hints:● Hopcroft-Karp Algorithm● Edmond's Algorithm

How about weighted demand (instead of edges with implied unit demands)?

Intellectually appealing:● Prove that Algorithm 2 finds indeed a maximum matching● Prove that the Hungarian Algorithm is O(n3)

Page 29: Teaching Graph Algorithms in the Field - Bipartite Matching in optical datacenters

© 2014 IBM Corporation29

THANK YOU!

Q&A


Recommended