Advanced Shortest Paths Algorithms on a Massively-Multithreaded Architecture

Advanced Shortest Paths Algorithms on a Massively-Multithreaded Architecture

Advanced Shortest Paths Algorithms on a Massively-Multithreaded Architecture Joseph R. Crobak1, Jonathan W. Berry2, Kamesh Madduri3, and David A. Bader3 1Rutgers University 2Sandia National Laboratories Dept. of Computer Science Albuquerque, NM USA Piscataway, NJ 08854 USA [email protected] [email protected] 3Georgia Institute of Technology College of Computing Atlanta, GA 30332 USA kamesh,bader @cc.gatech.edu { } Abstract information about the input graph in a data structure called the Component Hierarchy (CH). Based upon information We present a study of multithreaded implementations of in the CH, Thorup’s algorithm identifies vertices that can Thorup’s algorithm for solving the Single Source Shortest be settled in arbitrary order. This strategy is well suited to Path (SSSP) problem for undirected graphs. Our implemen- a shared-memory environment since the component hierar- tations leverage the fledgling MultiThreaded Graph Library chy can be constructed only once, then shared by multiple (MTGL) to perform operations such as finding connected concurrent SSSP computations. components and extracting induced subgraphs. To achieve Thorup’s SSSP algorithm and the data structures that good parallel performance from this algorithm, we devi- it uses are complex. The algorithm has been generalized ate from several theoretically optimal algorithmic steps. In to run on directed graphs in O(n + m log w) time [8] this paper, we present simplifications that perform better in (where w is word-length in bits) and in the pointer-addition practice, and we describe details of the multithreaded im- model of computation in O(mα(m, n) + n log log r) time plementation that were necessary for scalability. [13] (where α(m, n) is Tarjan’s inverse-Ackermann func- We study synthetic graphs that model unstructured net- tion and r is the ratio of the maximum-to-minimum edge works, such as social networks and economic transaction length). networks. Most of the recent progress in shortest path algo- In this paper, we perform an experimental study of Tho- rithms relies on structure that these networks do not have. rup’s original algorithm. In order to achieve good perfor- In this work, we take a step back and explore the synergy be- mance, our implementation uses simple data structures and tween an elegant theoretical algorithm and an elegant com- deviates from some theoretically optimal algorithmic strate- puter architecture. Finally, we conclude with a prediction gies. Thorup’s SSSP algorithm is complex, and we direct that this work will become relevant to shortest path compu- the reader to his original paper for a complete explanation. tation on structured networks. In the following section, we summarize related work and describe in detail the Component Hierarchy and Thorup’s algorithm. Next, we discuss the details of our multithreaded implementation of Thorup’s algorithm and detail the exper- 1. Introduction imental setup. Finally, we present experimental results and plans for future work. Thorup’s algorithm [15] solves the SSSP problem for undirected graphs with positive integer weights in linear 2. Background and Related Work time. To accomplish this, Thorup’s algorithm encapsulates The Cray MTA-2 and its successor, the XMT [4], are 1-4244-0910-1/07/$20.00 c 2007 IEEE. massively multithreaded machines that provide elaborate ! 1 hardware support for latency tolerance, as opposed to la- v w tency mitigation. Specifically, a large amount of chip space is devoted to supporting many thread contexts in hardware Comp(v,4) rather than providing cache memory and its associated com- 5 5 5 5 plexity. This architecture is ideal for graph algorithms, as 5 10 5 they tend to be dominated by latency and to benefit little Comp(v,3) Comp(w,3) from cache. We are interested in leveraging such architectures to solve large shortest paths problems of various types. Mad- duri, et al. [11] demonstrate that for certain inputs, delta- Figure 1. An example component hierarchy. stepping [12], a parallel Dijkstra variant, can achieve rel- Component(v,4), the root of this hierarchy, rep- ative speedups of roughly 30 in 40-processor runs on the resents the entire graph. MTA-2. This performance is achieved while finding single- source shortest paths on an unstructured graph of roughly one billion edges in roughly 10 seconds. However, their Component(w,i). study showed that there is not enough parallelism in smaller The root CH-node of the CH is a component containing unstructured instances to keep the MTA-2 busy. In particu- the entire graph, and each leaf represents a singleton ver- lar, similar instances of roughly one million edges yielded tices. The children of Component(v,i) in the CH are com- relative speedups of only about 3 on 40 processors of the ponents representing the connected components formed i 1 MTA-2. Furthermore, structured instances with large diam- when removing all the edges with weight > 2 − from eter, such as road networks, prove to be very difficult for Component(v,i). See Figure 1 for an example CH. parallel delta stepping regardless of instance size. Finding shortest paths in these structured road network 2.2. Thorup’s SSSP Algorithm instances has become an active research area recently [1, 9]. When geographical information is available, precomputa- tions to identify “transit nodes” [1] make subsequent s-t Given an undirected graph G = (V, E), a source vertex s V , and a length function " : E Z+, the Single shortest path queries extremely fast. However, depending ∈ → Source Shortest Path (SSSP) problem is to find δ(v) for v on the parameters of the algorithms, serial precomputation ∈ V s. The value δ(v) is the length of the shortest path from times range from 1 to 11 hours on modern 3Ghz worksta- \ s to v in G. By convention, δ(v) = if v is unreachable tions. We know of no work to parallelize these precompu- ∞ tations. from s. Although we do not explicitly address that challenge in Most shortest path problems maintain a tentative dis- tance value, d(v), for each v V . This value is updated by this paper, we do note that the precomputations tend to ∈ consist of Dijkstra-like searches through hierarchical data. relaxing the edges out of a vertex v while visiting v. Relax- These serial searches could be batched trivially into paral- ing an edge e = (u, v) sets d(v) = min(d(v), d(u) + "(e)). lel runs, but we conjecture that this process could be accel- Dijkstra [6] noted in his famous paper that the problem can erated even further by the basic idea of allowing multiple be solved by visiting vertices in nondecreasing order of their searches to share a common component hierarchy. In this d-values. Dijkstra’s algorithm maintains three sets of ver- paper, we explore the utility of this basic idea. tices: unreached, queued, and settled. A vertex v is settled when d(v) = δ(v) (initially only s is settled), is queued when d(v) < , and is unreached when a path to v has ∞ 2.1. The Component Hierarchy not yet been found (d(v) = ). Dijkstra’s algorithm re- ∞ peatedly selects vertex v such that d(v) is minimum for all The Component Hierarchy (CH) is a tree structure that queued vertices and visits v. encapsulates information about a graph G. The CH of Thorup’s algorithm uses the CH to identify vertices that an undirected graph with positive edge weights can be can be visited in arbitrary order (d(v) = δ(v)). His major computed directly, but preprocessing is needed if G con- insight is presented in the following Lemma. tains zero-weight edges. Each CH-node represents a sub- graph of G called a component, which is identified by a Lemma 1 (From Thorup [15]). Suppose the vertex set V vertex v and a level i. Component(v,i) is the subgraph divides into disjoint subsets V1, . , Vk and that all edges of G composed of vertex v, the set S of vertices reach- between subsets have weight at least ∆. Let S be the set of able from v when traversing edges with weight < 2i, settled vertices. Suppose for some i such that v V S, that ∈ i\ and all edges adjacent to v S of weight less than 2i. d(v) = min d(x) x V S min d(x) x V S +δ. { } ∪ { | ∈ i\ } ≤ { | ∈ \ } Note that if w Component(v,i), then Component(v,i) = Then d(v) = δ(v) (see Figure 2). ∈ V V V Input: G(V, E), length function " : E Z+ 1 2 k → !" !" Output: CH(G), the Component Hierarchy of G foreach v V do ... ∈ Create leaf CH-node n and set component(v) to n G" G ← !" for i = 1 to log C do ( ) i Remove edges of weight 2 from G" ≥ Find the connected components of G Figure 2. The vertex set V divided into k sub- " Create a new graph G sets. ∗ foreach connected component c of G" do Create a vertex x in G∗ Create new CH-node n for x Based upon this Lemma, Thorup’s algorithm identi- component(x) n ← fies vertices that can be visited in arbitrary order. Let foreach v c do ∈ α = log ∆. Component V buckets each of it’s children rep(v) x 2 ← V . V according to min d(x) x V S α. Note parent(component(v)) n 1 k { | ∈ i\ } & ← that (min d(x) x Vi S α) (min d(x) x { | ∈ \ } & ≤ { | ∈ foreach edge (u, v) G do V S α) implies that (min d(x) x Vi S ) ∈ \ } & { | ∈ \ } ≤ rep(u) rep(v) G (min d(x) x V S + ∆). Consider bucket B[j] such Create an edge ( , ) in ∗ { | ∈ \ } that j is the smallest index of a non-empty bucket.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    8 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us