























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!
























Computational science has driven demands for large-scale machine resources since the early days of com- puting. Supercomputers—collections of machines connected by a network—are used to solve the most computationally expensive problems and drive the frontier capabilities of scientific computing. Leveraging such large machines effectively is a challenge, however, for both algorithms and software systems. Numer- ical algorithms—computational methods for finding approximate solutions to mathematical problems— serve as the basis for computational science. Parallelizing these algorithms is a necessary step for deploying them on larger problems and accelerating the time to solution. Consequently, the interdependence of parallel and numerical computing has shaped the theory and practice of both fields. To study parallel numerical algo- rithms, we will first aim to establish a basic understanding of parallel computers and formulate a theoretical model for the scalability of parallel algorithms.
Connecting the latest technology chips via networks so that they can work in concert to solve larger problems has long been the method of choice for solving problems beyond the capabilities of a single computer. Improvements in microprocessor technology, hardware logic, and algorithms have expanded the scope of problems that can be solved effectively on a sequential computer. These improvements face fundamental physical barriers, however, so that parallelism has prominently made its way on-chip. Increasing the number of processing cores on a chip is now the dominant source of hardware-level performance improvement. The fundamental engineering challenge in increasing chip clock speed is to reduce both
Both of these can be improved by reducing the device size, but this is in turn ultimately limited by heat dissipation and thermal noise (degradation of signal-to-noise ratio). Moreover, transistors and gate logic cannot shrink indefinitely due to the finite granularity of atoms and quantum uncertainty in the state of physical microstructures.
(a) Moore’s law [60] (b) Architectural scaling trends [11]
Figure 1: Trends in change in numbers of transistors, sequential performance, frequency (clock rate), power consumption, and the number of cores on a chip, have varied over time. Note that single core (‘sequential’) execution still involves some parallelism, as a core generally has multiple FPUs, and the number of these has grown in recent years.
The rapid spread and disruptive emergence of computers in the modern world is due to the exponential growth in their capabilities and corresponding reduction in relative cost per component. This phenomenon is a manifestation of a famous prediction made by Gordon Moore in 1965, known as Moore’s law [27,39,51], that the density of transistors on a chip would double every two years^1. For more than 40 years, transistor size of state-of-the-art chips has indeed shrunk by a factor of two every two years (see Figure 1(a)). The commonplace interpretation of Moore’s law has been that the clock speed of microprocessors would also double every two years, and the frequency of chips did in fact almost double every two years from 1975 to 2005. The connection between Moore’s law and clock frequency can be interpreted via the notion of Dennard scaling. Based on the fundamental equations of electrodynamics, a 1974 paper by Robert Dennard and coauthors [10,18] postulated that as the density of transistors increases, current density (electric current for a given cross-section of the chip) can be kept constant, thereby increasing frequency without necessitating an increase in power consumption. In practice, however, increasing clock speed does require some increase in power due to current leakage and heat dissipation [36]. This growth in power consumption of chips is demonstrated historically in Figure 1(b). Consequently, Dennard scaling inevitably ceased around 2005, again due to limits imposed by physical laws. Cooling systems that can handle the heat dissipation of chips running at an operating frequency above 3 GHz are expensive to build and power, and at a high-enough frequency, they are impossible to engineer [45]. Fortunately, clock frequency is far from the only mechanism for achieving higher performance in hard- ware. More sophisticated hardware functionality, such as branch predictors and caching subsystems serve in- valuable roles in accelerating execution. However, additional parallelism, either via an increase in cores per chip or floating-point processing units (FPUs) per core, provides the primary way to increase the maximum achievable performance of a single chip. The replacement of Dennard scaling (clock frequency growth) by increasing core counts since 2005 can also be observed in Figure 1(b).
(^1) Actually, in 1965 Gordon Moore predicted that the density of transistors would double every year, but in 1975 revised this to two years.
2 Parallel Computer Architectures
We now provide an overview of the basic concepts of parallel computer architecture. The reader is ex- pected to have some familiarity with computer architecture basics. As our focus is on the development of algorithms, we cover only essential aspects of parallel architectures. A parallel computer consists of a collection of processors and memory banks together with an inter- connection network to enable processors to work collectively in concert. Major architectural issues in the design of parallel computer systems include the following
In the context of parallel algorithms, the organization of memory and the interconnection network are the most significant architectural features. Our motivating discussion drew attention to the presence of parallelism within each core, across cores in a multicore chip, and on networked systems of chips. Often, several chips are combined in a single process- ing node, with all having direct access to a shared memory within that node. The following terminology is commonly used to refer to these sources of parallelism:
Parallelism in computer systems can take various forms, which can be classified by Flynn’s taxonomy in terms of the numbers of instruction streams and data streams [22], where “instructions” can refer to low-level machine instructions or statements in a high-level programming language, and “data” can corre- spondingly refer to individual operands or higher-level data structures such as arrays.
SIMD execution is the backbone of vector-based architectures [48], which operate directly on vectors of floating-point values rather than on individual values. While restrictive in that the same operation must be applied to each value or pairs of values of vectors, they can often be used effectively by data parallel applications. Dense matrix computations are one domain where this type of parallelism is particularly prevalent and easy to exploit, while algorithms that access data in irregular (unstructured) patterns oftentimes cannot. Modern architectures employ SIMD vector instruction units, but also support multiple (vector) instruc- tions streams (MIMD), especially in the presence of many cores. Typical numerical algorithms and ap- plications leverage MIMD architectures not by explicitly coding different instruction streams, but by run- ning the same program on different portions of data. The instruction stream created by programs is often data-dependent (e.g., contains branches based on state of data), resulting in MIMD execution. This single- program multiple-data (SPMD) programming model is widely prevalent and will be our principal mode for specifying parallel algorithms.
In an SPMD style program, we must generally be able to move data so that different instances of the program can exchange information and coordinate. The semantics of data movement depend on the underlying memory organization of the parallel computer system. The most basic distinction is between shared-memory and distributed-memory organizations (see Figure 3), although modern clusters are almost always a mix of the two.
P 0 P 1 PN
M 0 M 1 MN
network
shared-memory multiprocessor
P 0 P 1 PN
network
M 0 M 1 • • • MN
distributed-memory multicomputer
Figure 3: Shared-memory and distributed-memory systems differ with respect to how processors (P 1 ,... PN ) are connected to memory (here partitioned in banks M 1 ,... , MN ).
bus star crossbar
1-D torus ( ring ) 2-D mesh 2-D torus
1-D mesh butterfly
binary tree
0 -cube
1 -cube 2 -cube 3 -cube 4 -cube hypercubes
Figure 4: Depiction of several types of classical network topologies.
3 Interconnection Networks
Connecting each pair of nodes directly via network wires would require O(p^2 ) wires and communication ports on a system with p processors, which is not scalable. Practical networks are much more sparsely con- nected, which implies that messages between processors must somehow be routed through the network. And yet some modern network designs are so effective that a fully-connected theoretical network model often provides reasonable predictions about algorithmic performance in relative terms. In this section we review the fundamentals of network topologies and routing, as well as discussing how parallel algorithms should view the network. In subsequent algorithmic analysis sections we will consider various network topologies, mostly as virtual abstractions for the execution of communication protocols for a given decomposition of data.
Perhaps the most fundamental issue in the design of networks for distributed-memory computers is the network topology – how nodes in a network are connected. The two basic types of network topologies are:
Figure 4 depicts some classical direct and indirect network topologies. The crossbar topology is an example of an indirect network containing p^2 / 4 switches (smaller dots in Figure 4). The most important of these classical topologies are tori and hypercubes. Torus networks are still used in modern supercomputers and are often convenient as model virtual topologies. Hypercubes are generally no longer built, but remain of significant theoretical importance. To discuss these and other networks more formally, we study their properties as graphs.
3.1.1 Graph Representation
We first review some basic graph terminology, which will form a basis for our representation and analysis of network topologies. The general definition of undirected graphs (sufficient for our purposes) and some important special cases thereof are
Network Nodes Degree Diameter Bisection Bandwidth Edge Length bus/star k + 1 k 2 1 var crossbar k^2 + 2k 4 2(k + 1) k var 1-D mesh k 2 k − 1 1 const 2-D mesh k^2 4 2(k − 1) k const 3-D mesh k^3 6 3(k − 1) k^2 const n-D mesh kn^2 n n(k − 1) kn−^1 var 1-D torus k 2 k/ 2 2 const 2-D torus k^2 4 k 2 k const 3-D torus k^3 6 3 k/ 2 2 k^2 const n-D torus kn^2 n nk/ 2 2 kn−^1 var binary tree 2 k^ − 1 3 2(k − 1) 1 var hypercube 2 k^ k k 2 k−^1 var butterfly (k + 1)2k^4 2 k 2 k^ var
Table 2: Basic properties of classical network topologies.
Critical to understanding how nodes can communicate with each other will be the notion of the distance between a pair of nodes – the number of edges (hops ) in shortest path between them. The following important properties of network topologies can also be modelled conveniently using graphs:
The (generalized versions of the) topologies in Figure 4 are characterized in terms of these properties in Table 2. Note the tradeoffs between properties associated with construction cost (degree and edge length) and properties associated with the performance of the network (diameter and bisection bandwidth).
3.1.2 Graph Embedding and Emulation
Given model graphs for network topologies, two important questions are
Figure 6: Depiction of fat-tree network [59].
/ Gray code / int gray ( int i ){ return ((i > >1)^ i ); // shift i down by one bit and take XOR of result with i }
Visiting the nodes of a hypercube in a Gray code order gives a Hamiltonian cycle, embedding a ring in the hypercube as in Figure 5. For a mesh or torus of higher dimension, concatenating Gray codes for each dimension gives an embedding in a hypercube of appropriate dimension. An important property of hypercubes is their ability to perform collective communications effectively [49]. In Section 4, we will present near-optimal butterfly communication protocols, all of which can be executed effectively on hypercube networks. More generally, with the use of randomized mappings hypercube net- works can route any parallel algorithm with logarithmic slow-down [58]. At a high level, this means that hypercubes (and many other sparsely connected networks) are no more than logarithmically worse in per- formance than a fully-connected network, yet are much more scalable in terms of the number of wires required.
3.1.4 Fat Trees
While a hypercube is sparsely connected, it is not necessarily cheap to build. In Table 2 this difficulty is reflected by the fact that the edge length of links in the hypercube network is not constant with the number of processors. The number of links also grows logarithmically with system size. Ultimately, any physical network must be embedded in physical space, which is 3-dimensional. Quan- titatively, we observe that the edge length of hypercubes necessarily grows as we construct larger networks, and the number of communication ports required per node also grows as well. Consequently, hypercubes are not used in modern systems with very large numbers of nodes. The target question of network design in this view becomes [16, 37] “How good a network can be built within a given physical volume?” Fat trees provide a universal and near-optimal solution to this question [37]. Precisely stated, no network can be constructed with the same number of components that is faster by more than a polylogarithmic factor. Figure 6 displays a fat-tree layout. The network is an indirect binary tree, with each node being a leaf. In order to maintain good bisection bandwidth, fat trees have varying link bandwidth (bandwidth available to a given edge in the network), with links near the root of the tree being ‘fatter’. For example, the fat tree will have bisection bandwidth proportional to p if the link bandwidth increases by a factor of 2 at each higher level in the binary tree. By considering any network in physical space and embedding the space in a fat tree whose bisection bandwidth scales with p^2 /^3 , it can be shown that the fat tree can emulate any exchange of messages on that
network with at most a factor of O(log(p)^3 ) more time. The generality of this result is surprising, as the only assumption necessary is that the emulated network can pass O(a) data through an area of size a. In practice, fat tree networks have been built with varying amounts of bisection bandwidth by choosing different factors of exponential growth through the levels of the tree. This makes sense, especially if many applications run only on a subset of nodes, corresponding to a subsection of the tree.
3.1.5 State of the Art: Constant-Diameter Networks While low-diameter hypercube architectures have seen success historically [28], recent supercomputers have leveraged topologies such as low-dimensional tori [1, 34], with a larger diameter but constant de- gree. More recently, the trend is network topologies is toward lower diameter, which is achieved by higher-dimensional torus networks [4, 14] or alternative network topology constructions. Dragonfly net- works [35] achieve a diameter of 3 topology that is featured in some current-generation Cray architectures. They are structured as follows
The success of the Dragonfly network topology has served to motivate other low-diameter networks, including the a peculiar diameter-2 network topology called Slim Fly [7]. The network uses a construction from graph theory that aims to minimize the degree-to-diameter ratio. In particular, the Moore bound (developed by Hoffman and Singleton) [30] states that any regular (uniform-degree) graph with degree d and diameter r, must satisfy
p ≤ 1 + d
∑^ r−^1
i=
(d − 1)i
asymptotically, p = O(dr)
a bound attained by Moore graphs. However, these are not known for general degree and diameter. So the Slim Fly construction uses a class of graphs that obtains a very close approximation to the bound [25, 40] for diameter-2 graphs.
The Slim Fly is constructed using a Galois field, in particular modular arithmetic over a prime q. We use the notation a ≡q b to mean a ≡ b mod q. The Slim Fly is designed as follows.
mx + c ≡q y,
we would like parallel algorithms to be topology oblivious, i.e., perform well on any reasonable network topology. Of course, one cannot reason about arbitrary topologies, but some abstractions (like collective communication) are sufficiently convenient to enable us to reason simultaneously about many. While the best approach differs depending on context, our analytical methodology will be to
This methodology aligns with the idea that platform-specific optimizations should be of second-order im- portance, while maintaining awareness of how challenging the desired communication pattern is to map to a realistic network.
4 Communication
To understand and compare routing protocols for networks, we must begin to think about the communica- tion cost (communication complexity) associated with movement of data messages. These measures will be defined to best correlation with the execution time. Specifically, we will work with communication time
We use a simple standard model for the time taken to communicate a message of s words across a single link of a network, T msg(s) = α + β s.
This model includes the following cost parameters:
For real parallel systems α β, so we often simplify α + β ≈ α, meaning that we approximate the cost of sending a 1-byte (constant-sized) message by the latency cost. We will generally assume a processor can send or receive only one message at a time (but can send one and receive another simultaneously). On some systems it is possible to send many messages concurrently, the main constraint being how many network links can be saturated in bandwidth, which is given by the ratio of the injection bandwidth of the node to the link bandwidth of every processor within the node. Here and later in the analysis of communication in algorithms, we assume there is a single processor per node and the link bandwidth is the same as the injection bandwidth. For low-level modelling of communication performance, this simple model is not always sufficient. The LogP [15] and LogGP [5] models provide a more refined parameterization of the latency overhead in messaging and the extent to which messages can overlap. However, it is difficult to work with a theory of algorithms that minimizes such small parameters (some known optimal algorithms in the LogP model are not described in closed form [33]). In modern network hardware, three types of messaging protocols are typically implemented, which differ in the way they manage buffering,
Our simple messaging model provides a reasonable cost representation for the first two types of messaging protocols. However, analyzing algorithms in terms of the one-sided communication model would suggest decoupling of synchronization and communication. The Bulk Synchronous Parallel (BSP) model [58] re- flects this to an extent while maintaining a simple superstep-based parallel execution model. However, the complexity of algorithms under synchronization-based and messaging-based models are closely re- lated [8, 47].
To measure the execution time of a parallel program, neither local nor cumulative measures are sufficient. In general, we would like to understand the costs (of messaging and of local computation) incurred along the critical path of the execution of a parallel program. This measure is given by considering all dependent executions in an algorithm. Generally these are data-driven, so a precedence ordering between communica- tion and computation tasks, as well as the order in which each processor executes them, provides a partial ordering (≺) (see also Figure 7): t 1 t 2 · · · tN.
If T (ti) is the time taken to execute task ti, then the execution time is given by maximizing over all totally ordered subchains in the partial ordering,
T (t 1 ,... tN ) = max {f 1 ,...fk }⊆{t 1 ,...tN },f 1 ≺f 2 ≺···≺fk
∑^ k
i=
T (fi).
We define the communication cost (communication complexity) in terms of S (the number of messages) and W (the number of words) incurred along the respective most expensive execution paths (totally ordered sequences in the partial ordering of tasks). Our communication cost/complexity bounds the communication time,
T comm(c 1 ,... cM ) = max {f 1 ,...fk }⊆{c 1 ,...cM },f 1 ≺f 2 ≺···≺fk
∑^ k
i=
T (fi) ≤ αS + βW,
where c 1 ,... cM are all communication tasks. Communication complexity can be contrasted with commu- nication volume, which is just the sum of the costs of all communication tasks. We consider an example to illustrate the importance of this distinction. We study the time taken for p processors to pass a message of size s around a ring versus the time taken for each processor to pass a different message to the next processor in the ring. In both cases, the communication volume is the same
000
010
001
100 101
011
(^110 )
2-D mesh hypercube
source
source
dest
dest
Figure 8: Minimal routes on a mesh and on a hypercube.
store-and-forward cut-through
P 0
P 1
P 2
P 3
P 0
P 1
P 2
P 3
Figure 9: Comparison of store-and-forward and wormhole routing.
4.2.2 Wormhole Routing and Virtual Channels
When a long message needs to be routed along a network path, the use of pipelining can improve perfor- mance by a factor proportional to the length of the path. Store-and-forward routing handles the entire message atomically (without breaking it up). This means that the entire message traverses its route one network link at a time, so
T route(s, D) = (α + βs)D, where D = distance in hops.
Store-and-forward routing corresponds to eager messaging protocols. Cut-through or wormhole routing breaks the message into segments that are pipelined individually through the network, with each segment forwarded as soon as it is received, so
T route(s, D) = α + βs + thD, where th = incremental time per hop.
Generally th ≤ α, so we can treat both as network latency,
T route(s, D) = αD + βs.
Figure 9 schematically depicts the two message routing techniques.
4.2.3 Network Congestion and Virtual Channels
Network congestion (network contention) is the competition for network resources due to multiple inter- secting message routes desiring to use a given link at the same time. Especially in the presence of wormhole routing, any sparse interconnection network must be able to avoid deadlock and resolve network conges- tion for any possible routing of message interchanges. Most often, network congestion is resolved via the use of virtual channels, which are labels placed on message routes [17]. Each switch alternates servicing among the virtual channels. This means that if two long-message routes pass through the same network link concurrently, each will typically take twice as long, experiencing half of the nominal link bandwidth.
5 Collective Communication
Collective communication is a concurrent interchange of a set of messages among any set of pairs of processors. Basic structured collective communication operations deserve attention due to their prevalence in algorithms and applications. They serve as effective building blocks for both algorithms and software. We can classify some of the most common collective communication operations as follows,
The distinction between the last two types is made due to their different cost characteristics. The Message- Passing Interface (MPI) standard [24] provides all of these as well as more general versions that support variable message sizes. We analyze the communication complexity of all of these algorithms, which are closely related to each other. Figure 10 provides a convenient visual matrix representation of some important collectives. The most common collective operation is broadcast, but when studying wormhole-routed collective protocols, we will see that scatter and gather are more primitive algorithmically.
We first consider collective communication protocols that function like store-and-forward routing, moving the whole message from processor to processor. In modern algorithm design, these are often used to generate small amoungs of global information, e.g.,computation of a vector norm. We subsequently study many-item (wormhole-routed) collectives, which communicate larger messages, exploiting additional parallelism to improve efficiency. The focus of this section, single-item collectives are protocols that communicate the message atomically (without subdividing it into chunks). In pratice, such protocols are also used when the messages can be subdivided but are too small for this to be beneficial.
Single-Item Broadcast – a root processor sends an indivisible message of p − 1 other processors.
The most commonly used collective communication operation is broadcast. When executed on a subset of the processors of a system, a broadcast is also sometimes called a multicast. Every single-item broadcast protocol must propagate the message along a spanning tree of p processors. Here the specifics of our com- munication cost model come into play. If a processor can send and receive only one message concurrently, then a parent must choose an ordering of children to which they pass the message. This means that the first leaf of the tree will receive the message log 2 (p) − 1 message passes before the last leaf does. Moreover, we can observe that after forwarding the message to both children, many parents in the tree could further assist algorithmic progress by passing the message to yet more processors. This intuition motivates the binomial tree construction. A binomial tree of height h is constructed by taking a binomial tree of height h − 1 and appending a leaf to each of its processors. The broadcast protocol is similar, after h message-sends, it prop- agates the message from all processors in a binomial tree of size h to their respective neighbors in a larger binomial tree of size h + 1, until reaching all processors. With p processors, the height of the binomial tree is as low as log 2 (p + 1), meaning that the communication time of a binomial tree broadcast is
T (^) pbcast-binomial (s) = (log 2 (p + 1) − 1)T msg(s) = (log 2 (p + 1) − 1)(α + β s).
Figure 11: Comparison of binary and binomial trees for single-item broadcast. The binomial tree can be used to perform a single-item broadcast over 15 processors in the same communication time as a binary tree takes to do 7.
1
2
3
3 3
3
2-D mesh hypercube
1 3
2
4 2 3 3 3
4 4 4 4
4 4 4
2
Figure 12: Example optimal broadcast trees on mesh and hypercube networks.
A binomial tree is optimal for broadcasting in synchronization cost (α prefactor in communication time) in our messaging model [20]. Figure 11 displays its advantage over a binary tree by dilating each edge in time. In the LogGP model, the best broadcast spanning tree depends nontrivially on the model parameters [33]. On a hypercube network topology, we can embed the binomial tree broadcast protocol and execute a multi-item broadcast optimally. On a mesh or torus topology of dimensions d, we can generally build a spanning tree of height proportional to the diameter O(p^1 /d). Figure 12 demonstrates examples of how these broadcast protocols are realized on these two types of networks.
Single-Item Reduction – indivisble values from each of p processors are combined by applying a specified associative operation ⊕ (e.g.,sum, product, max, min, logical OR, logical AND) to produce a single value stored on the root processor.
The dual operation to broadcast is reduction, which combines values from all processors into a single value stored on one processor. Any broadcast protocol can be reversed to construct a reduction protocol, and vice versa. The cost of the computation in reductions is often disregarded, but presents technical chal- lenges when implementing reductions directly into network hardware, causing broadcasts to be faster than reductions on typical systems. Collectives such as scatter and (all)gather, as well as reduce-scatter and all-reduce, can be done in similar ways to broadcasts and reductions in the single-item case. The hierarchy among these becomes clearer if we consider them more generally in the multi-item case.
(a) Butterfly Schematic (b) Butterfly Scatter (Recursive Halving) (c) Butterfly Gather (Recursive Doubling)
Figure 13: 8-processor butterfly collective protocol schematics for recursive-halving to scatter messages and recursive-doubling to gather messages.
Multi-item collectives can be thought of as concurrent executions of many independent single-item collec- tives. They are of independent interest, and are usually viewed as the basic general definition of collectives because they can be performed with more sophisticated and efficient protocols than simply a sequence of single-item collectives. In practice, they are also typically of greatest importance, as they can be used to achieve bulk movement of data. There are numerous protocols to consider for each collective communication operation. We choose to focus on butterfly collective communication protocols, due to their generality and near-optimality. We refer the reader to the following alternate surveys of communication collectives [13, 31, 46, 55].
5.2.1 Gather and Scatter
Scatter – a root processor sends a distinct message of size s/p to each of p − 1 other processors.
One of the simplest multi-item collectives is the scatter operation. Efficient algorithms for scatter are achieved by disseminating messages down a spanning tree, but unlike broadcast, sending different data to each child in the tree. Simply pipelining the messages down any spanning tree is one way to achieve good efficiency, and is a generic strategy we can employ on many networks. But we can also achieve near- optimality via recursive-halving, which uses a binomial spanning tree, with each processor sending half as much data at each successive algorithmic step. This strategy is demonstrated in Figure 13(b), where the binomial tree is embedded in a butterfly. The butterfly depicts all processors at each level (column) as displayed in Figure 13(a), so it does not correspond to the network topology.
Gather – each processor sends a message of size s/p to the root processor.
The dual operation to scatter is gather. Reduce-scatter and all-gather are more balanced but more ex- pensive versions of scatter and gather. They can be done with a butterfly protocol, with full utilization as demonstrated in Figure 14(a) and Figure 14(b). Such a protocol could be executed without slowdown on a hypercube network topology. All of the butterfly collective protocols we have seen thus far increase or reduce the message size sent at each level of the butterfly by a factor of two. This characteristic enables them to obtain a bandwidth cost that is linear in the overall message size s. To analyze the cost of butterfly protocols, it helps to note their