Lectures 8/9. 1 Overview. 2 Prelude:Routing on the Grid. 3 A couple of networks.

Similar documents
Efficient Bufferless Packet Switching on Trees and Leveled Networks

CS174 Lecture 11. Routing in a Parallel Computer

From Routing to Traffic Engineering

SDSU CS 662 Theory of Parallel Algorithms Networks part 2

Assignment 4 Solutions of graph problems

CS 258, Spring 99 David E. Culler Computer Science Division U.C. Berkeley Wide links, smaller routing delay Tremendous variation 3/19/99 CS258 S99 2

Treewidth and graph minors

GIAN Course on Distributed Network Algorithms. Network Topologies and Interconnects

GIAN Course on Distributed Network Algorithms. Network Topologies and Local Routing

MC 302 GRAPH THEORY 10/1/13 Solutions to HW #2 50 points + 6 XC points

ALGORITHMS EXAMINATION Department of Computer Science New York University December 17, 2007

Recall: The Routing problem: Local decisions. Recall: Multidimensional Meshes and Tori. Properties of Routing Algorithms

Constant Queue Routing on a Mesh

The Encoding Complexity of Network Coding

Notes for Lecture 24

EE/CSCI 451 Spring 2018 Homework 2 Assigned: February 7, 2018 Due: February 14, 2018, before 11:59 pm Total Points: 100

CS 498 Hot Topics in High Performance Computing. Networks and Fault Tolerance. 9. Routing and Flow Control

Interconnection topologies (cont.) [ ] In meshes and hypercubes, the average distance increases with the dth root of N.

The Probabilistic Method

Reducing Directed Max Flow to Undirected Max Flow and Bipartite Matching

U.C. Berkeley CS170 : Algorithms, Fall 2013 Midterm 1 Professor: Satish Rao October 10, Midterm 1 Solutions

22 Elementary Graph Algorithms. There are two standard ways to represent a

Crossbar - example. Crossbar. Crossbar. Combination: Time-space switching. Simple space-division switch Crosspoints can be turned on or off

LECTURE NOTES OF ALGORITHMS: DESIGN TECHNIQUES AND ANALYSIS

Today. Types of graphs. Complete Graphs. Trees. Hypercubes.

Treaps. 1 Binary Search Trees (BSTs) CSE341T/CSE549T 11/05/2014. Lecture 19

Direct Routing: Algorithms and Complexity

22 Elementary Graph Algorithms. There are two standard ways to represent a

Direct Routing: Algorithms and Complexity

Interconnection networks

DO NOT RE-DISTRIBUTE THIS SOLUTION FILE

Notes for Lecture 20

Topology basics. Constraints and measures. Butterfly networks.

Emulation of a PRAM on Leveled Networks

2386 IEEE TRANSACTIONS ON INFORMATION THEORY, VOL. 52, NO. 6, JUNE 2006

2.1 Greedy Algorithms. 2.2 Minimum Spanning Trees. CS125 Lecture 2 Fall 2016

Matching and Planarity

CSE 417 Network Flows (pt 4) Min Cost Flows

Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1

Interconnection Networks: Topology. Prof. Natalie Enright Jerger

Optimal Oblivious Path Selection on the Mesh

1 Linear programming relaxation

Basic Combinatorics. Math 40210, Section 01 Fall Homework 4 Solutions

Greedy Homework Problems

Problem Set 1. Solution. CS4234: Optimization Algorithms. Solution Sketches

Question 7.11 Show how heapsort processes the input:

Formal Methods of Software Design, Eric Hehner, segment 24 page 1 out of 5

Advanced Algorithms Class Notes for Monday, October 23, 2012 Min Ye, Mingfu Shao, and Bernard Moret

From Static to Dynamic Routing: Efficient Transformations of Store-and-Forward Protocols

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Priority Queues / Heaps Date: 9/27/17

1 The range query problem

Trapezoidal decomposition:

Dynamic Programming Algorithms

CS256 Applied Theory of Computation

CS 4349 Lecture October 18th, 2017

managing an evolving set of connected components implementing a Union-Find data structure implementing Kruskal s algorithm

F. THOMSON LEIGHTON INTRODUCTION TO PARALLEL ALGORITHMS AND ARCHITECTURES: ARRAYS TREES HYPERCUBES

A COMPARISON OF MESHES WITH STATIC BUSES AND HALF-DUPLEX WRAP-AROUNDS. and. and

CS70 - Lecture 6. Graphs: Coloring; Special Graphs. 1. Review of L5 2. Planar Five Color Theorem 3. Special Graphs:

Exemples of LCP. (b,3) (c,3) (d,4) 38 d

Catalan Numbers. Table 1: Balanced Parentheses

Dr. Amotz Bar-Noy s Compendium of Algorithms Problems. Problems, Hints, and Solutions

Figure 1: An example of a hypercube 1: Given that the source and destination addresses are n-bit vectors, consider the following simple choice of rout

8 Matroid Intersection

CPSC 536N: Randomized Algorithms Term 2. Lecture 4

Hypercubes. (Chapter Nine)

Counting the Number of Eulerian Orientations

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Sorting lower bound and Linear-time sorting Date: 9/19/17

Artificial Intelligence

Line Arrangements. Applications

Trees and Tree Encodings

Trees. 3. (Minimally Connected) G is connected and deleting any of its edges gives rise to a disconnected graph.

Intro to Algorithms. Professor Kevin Gold

Lecture 3: Topology - II

Lecture 28: Networks & Interconnect Architectural Issues Professor Randy H. Katz Computer Science 252 Spring 1996

implementing the breadth-first search algorithm implementing the depth-first search algorithm

UC Berkeley CS 170: Efficient Algorithms and Intractable Problems Handout 8 Lecturer: David Wagner February 20, Notes 8 for CS 170

CPSC 536N: Randomized Algorithms Term 2. Lecture 5

Erdös-Rényi Graphs, Part 2

4.1 Review - the DPLL procedure

Project and Production Management Prof. Arun Kanda Department of Mechanical Engineering Indian Institute of Technology, Delhi

Data Structures and Algorithms Dr. Naveen Garg Department of Computer Science and Engineering Indian Institute of Technology, Delhi.

Parallel and Sequential Data Structures and Algorithms Lecture (Spring 2012) Lecture 16 Treaps; Augmented BSTs

Basic Communication Ops

CMPSCI 311: Introduction to Algorithms Practice Final Exam

CSE 431/531: Algorithm Analysis and Design (Spring 2018) Greedy Algorithms. Lecturer: Shi Li

Beyond Counting. Owen Kaser. September 17, 2014

Maximal Monochromatic Geodesics in an Antipodal Coloring of Hypercube

introduction to Programming in C Department of Computer Science and Engineering Lecture No. #40 Recursion Linear Recursion

Oblivious Deadlock-Free Routing in a Faulty Hypercube

Introduction III. Graphs. Motivations I. Introduction IV

Prefix Computation and Sorting in Dual-Cube

Welcome to the course Algorithm Design

Lecture notes on: Maximum matching in bipartite and non-bipartite graphs (Draft)

Exercise set 2 Solutions

Optimal Parallel Randomized Renaming

Vertex Cover Approximations

Notes on Minimum Spanning Trees. Red Rule: Given a cycle containing no red edges, select a maximum uncolored edge on the cycle, and color it red.

c 1999 Society for Industrial and Applied Mathematics

Name: Lirong TAN 1. (15 pts) (a) Define what is a shortest s-t path in a weighted, connected graph G.

Transcription:

U.C. Berkeley CS273: Parallel and Distributed Theory Lectures 8/9 Professor Satish Rao September 23,2010 Lecturer: Satish Rao Last revised October 23, 2010 Lectures 8/9 1 Overview We will give a couple of networks that can be used for routing messages. We will illustrate their use in implementing a BSP computer that was described in the previous lecture. 2 Prelude:Routing on the Grid We illustrate routing and scheduling strategies (which we will be studying over the next few lectures) by showing how to route a permutation (a packet starts and is destined for each node) on a k k grid (i.e., implementing the BSP routing for h = 1). We route each message first along its starting row to its destination column and then down its destination column. We assume edges are bidirectional, i.e., that a message can traverse left to right at the same time as a message traverse right to left. Furthermore, a node can send out a message out of all its links in any one step. Finally, the queue sizes are infinite; this ensures that a packet only waits if another packet uses the edge that it is waiting for. Note that at most k messages cross any edge; only k messages can use an row edge as only k messsages start in a row, and only k messages can use any column as k messages are destined for any column. Now, how long does it take to route? If one always sends a message along a link if one is waiting (in class we sketched a switch design that implements this property); one can only wait k steps at any link, and there are at most 2k links in any path, thus we finish in 2k 2 steps. This is terrible though, as the lower bounds are the maximum congestion and the maximum length or 2k. We can achieve O(k) by using the straight-first routing strategy. That is for each outgoing row (column) edge, we give priority to the message going along the single incoming row (column) we forward it; delaying any packet waiting to turn into the column. Thus, we only wait at the turn. Since the congestion is k, we can only wait k steps. Thus the total routing time with this row-column routing and straight first scheduling is at most 3k. This is O( N) for an N-node mesh. 3 A couple of networks. Today, we will talk about a particular parallel network; the butterfly and its brother the hypercube. The hypercube in n dimensions consists of a set of nodes labeled with the binary n-bit strings, thus it has 2 n nodes. Each node is connected to any node whose label differs in exactly one bit. (Would you advise drawing your own figure here.)

Notes for Lectures 8/9: September 23,2010 2 To route a message from node a = a 1,..., a n to b = b 1,..., b n proceeds by correcting the bits in some order, say from bit 1 to bit n. Of course, there are many (shortest) paths depending on the order of bit corrections, and of course many many non shortest paths. A butterfly is the network that embodies fixing the bits in the most significant bit order in the hypercube. Here, the nodes are labeled with a pair (i, x) where i is an integer in {0,... n} and x is a n bit string. One can view the first index as the row and the second as the column. The edges basically form a line on the row, i.e., (i, x) is connected to (i+1, x). We also have hypercube edges. That is (i, x 1,... x n ) is connected to (i+1, x 1,... x i... x n ). That is, at the ith place you can flip the i bit of your row. (Here a figure would be drawn in class.) Typically, for the butterfly network, the first node in a row is viewed as the input and the last node is viewed as an output. One can also collapse the rows, and obtain the hypercube. Routing from an input (0, x) to output (n, y) by correcting bits in order corresponds to the canonical shortest path routing algorithm above. 4 What is totally excellent? Are these good routing networks? Small degree. Easy to build. The complete graph is very good in many senses, but has very high complexity. The hypercube has log N degree where the degree grows moderately with the size of the network. The butterfly has degree four which has the property of being able to be made from the same kind of switch, regardless of the size of the network. It has short paths. Any graph with degree at most k, has diameter at least log k N. The hypercube diameter is close to optimal with respect to degree, i.e., log N versus log log n N = log N/ log log N. (De Bruijn networks have optimal diameter.) The butterfly has very near optimal diameter, O(log N). A binary tree has both properties. What else? Perhaps, you want to have more properties. Hard to cut? No, the binary tree is easy to cut. When you route many messages one would like not to congest any link too much. Is this true? Not for the binary tree, routing messages across the root is very bad. How about the butterfly. (For now, we leave the hypercube.) Hard to cut? We will address this later. First, we restrict the routings a bit. Say a single message starts at each input and is destined for each output. That is, no output is the destination of more than one message, and no input is the destination of more than one message. Let s consider the following pattern? Route a message from each input (1, x{0, 1}y) to (n, y{0, 1}x) where x is the first half (actually (n 1)/2) of the bits and y is the second (actually (n 1)/2) of the bits. This pattern is one to one as required. Theorem 1 The transpose pattern gives congestion Ω( N) on an N-input butterfly, using greedy routing.

Notes for Lectures 8/9: September 23,2010 3 This theorem follows by cutting the butterfly at level n/2. This leaves 2 (n 1)/2 separate 2 (n 1)/2 input butterflies on the left and on the right, each of size 2 (n 1) /2. The ith sub butterfly on the left have a common (n 1)/2 bit prefix representing i for the row identifier, while the jth sub butterfly on the right has a common suffix j. There is a single edge from the ith sub butterfly on the left to the jth sub butterfly on the right. But, all the messages from the ith sub butterfly on the left are destined for the jth sub butterfly on the right? (Note actually there is a i, 0 sub butterfly on the left and a i, 1 on the left, and similarly (0,j;1,j...) for the right.) This causes a congestion of 2 (n 1)/2 on a single edge. Yet, most edges in the middle layer are empty? Can we do better? 5 Benes Routing A Benes network is a butterfly network connected to a reversed butterfly network. Or one, can view it as a network that goes up the butterfly and back down. This network gives many natural shortest paths from input, one for each of N intermediate outputs. This choice allows us to overcome the problem from the last section. Theorem 2 Any (partial) permutation can be routed on a Benes network, with no congestion. Proof: Notice the following recursive nature of the Benes network. If one removes all the inputs and outputs, that one obtains two separate Benes networks. We note that for a trivial Benes network (i.e., one node) it is easy to route a permutation. Do nothing!! So, now we reduce the problem of routing a permutation on an N input Benes network to one of routing on a permutation on a N/2 input Benes network. What to do? Well, at the first step, we must choose to route message at input i (and destined for say j) to the top sub-benes or to the bottom. This decision then forces us to route the packet to a particular output of the sub-benes based on its destination j. We wish to coordinate the decisions so that Each input of a sub-benes is chosen by a single input of the original. Each output of a sub-benes is forced to be used by a single message. Either is easy to enforce. For example, only two inputs of the original can choose any particular input of a sub-benes and there are two sub-benes networks. Same for outputs. But the choice at the inputs forces the choice at the outputs. We encode these dependencies in a bipartite graph each side of which contains N/2 nodes. For each message, which starts at i = i 1... i n and is destined for j = j 1... j n, we add an edge from node i 2... i n to node j 1... j n 1. This encodes the fact, that either original input 0i 2... i n or 1i 2... i n can choose input i 2... i n of a sub-benes network. A similar statement hold for the outputs. The degree of this graph is at most two. If we can partition the edges (messages) into two sets each of which induces degree at most 1 in the graph, we can assign each of the two

Notes for Lectures 8/9: September 23,2010 4 sets of messages to the two sub-benes networks in a manner where the induced message source, destinations is a permutation. Clearly, since the degree of the graph is two, the graph consists of a set of cycles. Moreover, the length of the cycles is even since the graph is bipartite. Thus, we can partition the cycles into two sets to meet this degree condition. Note that in class, I did a different proof where we formed a conflict graph among messages and showed that it could be two colored. (It is essentially the same argument except that the edges in the conflict graph are the nodes in the graph in this proof.) Question 1: Prove that separating any k of the inputs from any k outputs in the Benes network requires one to cut at least k edges. (That is, it is much harder to cut than a binary tree, or for that matter planar graphs. It is a two line argument that follows from the theorem above.) Question 2: Show that for permutation routing on a N-node mesh ( N N grid of nodes), that there exists is a row-column-row routing where only one message turns at any one point. That is, in each row exactly one packet turns into any column from that row, and in each column exactly one packet turns into any row from that column. (Hint. Consider a bipartite graph whose nodes correspond to starting rows and destination rows, put an edge between two nodes r and r corresponding to a message that starts in row r and ends in row r. What is the degree of this graph? For any matching of edges (messages), show that they can be routed in a single column. Can the graph be decomposed into matchings? How many?) This has applications in VLSI routing where messages correspond to wires and turns correspond to physical connections. One wishes to limit such connections at each junction. 5.1 Some comments. This along with much of modern engineering science was invented at Bell Labs in the fifties. It is the basis of routing in the telephone network switches called Clos networks (which are essentially high degree butterflies.) This particular observation was the basis of the parallel computer built by IBM in the eighties to do quantum chromodynamics computations. This computation proceeded as did the relaxation algorithms of the previous lecture. The pattern of communication in that lecture as well as in QCD computations is fixed in every step. Thus, one could implement the BSP model by precomputing the switch settings in the network. For example, with very fast switches (say as fast as the processors) and p computers, this network essentially implemented the BSP model with g being one. And L being log p. One can also view the old-style CRAY supercomputers in this light. They had tremendous processor to memory networks. We will look at this more later. 6 On-line solutions: Valiant/Brebner routing. Benes routing in some sense says that the hypercube/butterfly are great networks. On the other hand, the algorithm is not very parallel, i.e., for each pattern of messages one needs to figure out how to route them.

Notes for Lectures 8/9: September 23,2010 5 Here we consider a really parallel algorithm for routing permutations in the Benes network. Route to a random intermediate destination in the first butterfly. Then route greedily to the final destination. This method was proposed by Valiant and Brebner for the hypercube. (Valiant has done many truly amazing things. This being merely a comment of wide reaching consequences.) Theorem 3 The maximum number of packets that use any edge is O(log n) with high probability. What is the expected number of messages that use any edge? Consider the ith level in the first butterfly. The number of inputs that could use it are 2 i. That is the load can be expressed as the sum of 2 i 0 1 random variables. The number of outputs it can get to is 2 n i (within a factor of 2). The probability of any of the inputs choosing this output is thus 2 n i /2 n = 2 i Thus, the expected number of messages is 1. 7 On-line solutions: Valiant/Brebner routing. Benes routing in some sense says that the hypercube/butterfly are great networks. On the other hand, the algorithm is not very parallel, i.e., for each pattern of messages one needs to figure out how to route them. Here we consider a truly locally controlled and thus parallel algorithm for routing permutations in the Benes network. Route to a random intermediate destination in the first butterfly. Then route greedily to the final destination. This method was proposed by Valiant and Brebner for the hypercube. By the way, one can view this equivalently, as flipping a coin at each level in the butterfly and deciding whether to route up or down. Before analysing this method, let s get some basics. What is the highest load on any intermediate destinations? This is just the question of what the maximum load on any of n bins when one throws n balls into them. With high probability, we know it to be O(log n/ log log n). (BTW, Valiant has done several truly amazing things in complexity, learning, algorithms, and parallel computing. This is simple but elegant example of his contributions.) Theorem 4 The maximum number of packets that use any edge is O(log n) with high probability. What is the expected number of messages that use any edge? Consider the ith level in the first butterfly. The number of inputs that could use it are 2 i. That is the load can be expressed as the sum of 2 i 0 1 random variables. The number of outputs it can get to is 2 n i (within a factor of 2). The probability of any of the inputs choosing this output is thus 2 n i /2 n = 2 i Thus, the expected number of messages is 1. We finish by using a Chernoff bound. Here, we have random indicator variables X 1,..., X k, where k = 2 i for a level i edge. Here the expectation of X = i X i is 1 and we wish to show that max load is at most O(log n), thus we will choose δ = 2 log N. We then use the form that states that P [X > (1 + δ)µ] 2 µδ.

Notes for Lectures 8/9: September 23,2010 6 Plugging in, we get that the max load is at more (2 log n+1) with probability than 1/N 2. This allows us to conclude that any of the N log N edges is congested with probability at most log N/N using the union bound. Thus, the theorem follows. Actually, we can show with high probability that max load is O(log n/ log log n). The probability that the load on a level i edge exceeds congestion k is at most ( K k ) ( 1/K k e ) k. k This is less than 1/N 2, when one chooses, for example, k 4 log N/ log log N. Question 3: Show that permutation routing on a mesh where one chooses a random column and then routes the message along the starting row and turns into the random column and then proceeds to the destination row creates O(log N) congestion at each turn, with high probability. (This ensures that the queuesize needed for straight first routing is of size O(log N).)