Collective operations are building blocks for interaction patterns, that are often used in SPMD algorithms in the parallel programming context. Hence, there is an interest in efficient realizations of these operations.
A realization of the collective operations is provided by the Message Passing Interface [1] (MPI).
In all asymptotic runtime functions, we denote the latency (or startup time per message, independent of message size), the communication cost per word , the number of processing units and the input size per node . In cases where we have initial messages on more than one node we assume that all local messages are of the same size. To address individual processing units we use .
If we do not have an equal distribution, i.e. node has a message of size , we get an upper bound for the runtime by setting .
A distributed memory model is assumed. The concepts are similar for the shared memory model. However, shared memory systems can provide hardware support for some operations like broadcast (§ Broadcast) for example, which allows convenient concurrent read. [2] Thus, new algorithmic possibilities can become available.
The broadcast pattern [3] is used to distribute data from one processing unit to all processing units, which is often needed in SPMD parallel programs to dispense input or global values. Broadcast can be interpreted as an inverse version of the reduce pattern (§ Reduce). Initially only root with stores message . During broadcast is sent to the remaining processing units, so that eventually is available to all processing units.
Since an implementation by means of a sequential for-loop with iterations becomes a bottleneck, divide-and-conquer approaches are common. One possibility is to utilize a binomial tree structure with the requirement that has to be a power of two. When a processing unit is responsible for sending to processing units , it sends to processing unit and delegates responsibility for the processing units to it, while its own responsibility is cut down to .
Binomial trees have a problem with long messages . The receiving unit of can only propagate the message to other units, after it received the whole message. In the meantime, the communication network is not utilized. Therefore pipelining on binary trees is used, where is split into an array of packets of size . The packets are then broadcast one after another, so that data is distributed fast in the communication network.
Pipelined broadcast on balanced binary tree is possible in , whereas for the non-pipelined case it takes cost.
The reduce pattern [4] is used to collect data or partial results from different processing units and to combine them into a global result by a chosen operator. Given processing units, message is on processing unit initially. All are aggregated by and the result is eventually stored on . The reduction operator must be associative at least. Some algorithms require a commutative operator with a neutral element. Operators like , , are common.
Implementation considerations are similar to broadcast (§ Broadcast). For pipelining on binary trees the message must be representable as a vector of smaller object for component-wise reduction.
Pipelined reduce on a balanced binary tree is possible in .
The all-reduce pattern [5] (also called allreduce) is used if the result of a reduce operation (§ Reduce) must be distributed to all processing units. Given processing units, message is on processing unit initially. All are aggregated by an operator and the result is eventually stored on all . Analog to the reduce operation, the operator must be at least associative.
All-reduce can be interpreted as a reduce operation with a subsequent broadcast (§ Broadcast). For long messages a corresponding implementation is suitable, whereas for short messages, the latency can be reduced by using a hypercube (Hypercube (communication pattern) § All-Gather/ All-Reduce) topology, if is a power of two. All-reduce can also be implemented with a butterfly algorithm and achieve optimal latency and bandwidth. [6]
All-reduce is possible in , since reduce and broadcast are possible in with pipelining on balanced binary trees. All-reduce implemented with a butterfly algorithm achieves the same asymptotic runtime.
The prefix-sum or scan operation [7] is used to collect data or partial results from different processing units and to compute intermediate results by an operator, which are stored on those processing units. It can be seen as a generalization of the reduce operation (§ Reduce). Given processing units, message is on processing unit . The operator must be at least associative, whereas some algorithms require also a commutative operator and a neutral element. Common operators are , and . Eventually processing unit stores the prefix sum . In the case of the so-called exclusive prefix sum, processing unit stores the prefix sum . Some algorithms require to store the overall sum at each processing unit in addition to the prefix sums.
For short messages, this can be achieved with a hypercube topology if is a power of two. For long messages, the hypercube (Hypercube (communication pattern) § Prefix sum, Prefix sum § Distributed memory: Hypercube algorithm) topology is not suitable, since all processing units are active in every step and therefore pipelining can't be used. A binary tree topology is better suited for arbitrary and long messages (Prefix sum § Large Message Sizes: Pipelined Binary Tree).
Prefix-sum on a binary tree can be implemented with an upward and downward phase. In the upward phase reduction is performed, while the downward phase is similar to broadcast, where the prefix sums are computed by sending different data to the left and right children. With this approach pipelining is possible, because the operations are equal to reduction (§ Reduce) and broadcast (§ Broadcast).
Pipelined prefix sum on a binary tree is possible in .
The barrier [8] as a collective operation is a generalization of the concept of a barrier, that can be used in distributed computing. When a processing unit calls barrier, it waits until all other processing units have called barrier as well. Barrier is thus used to achieve global synchronization in distributed computing.
One way to implement barrier is to call all-reduce (§ All-Reduce) with an empty/ dummy operand. We know the runtime of All-reduce is . Using a dummy operand reduces size to a constant factor and leads to a runtime of .
The gather communication pattern [9] is used to store data from all processing units on a single processing unit. Given processing units, message on processing unit . For a fixed processing unit , we want to store the message on . Gather can be thought of as a reduce operation (§ Reduce) that uses the concatenation operator. This works due to the fact that concatenation is associative. By using the same binomial tree reduction algorithm we get a runtime of . We see that the asymptotic runtime is similar to the asymptotic runtime of reduce , but with the addition of a factor p to the term . This additional factor is due to the message size increasing in each step as messages get concatenated. Compare this to reduce where message size is a constant for operators like .
The all-gather communication pattern [9] is used to collect data from all processing units and to store the collected data on all processing units. Given processing units , message initially stored on , we want to store the message on each .
It can be thought of in multiple ways. The first is as an all-reduce operation (§ All-Reduce) with concatenation as the operator, in the same way that gather can be represented by reduce. The second is as a gather-operation followed by a broadcast of the new message of size . With this we see that all-gather in is possible.
The scatter communication pattern [10] is used to distribute data from one processing unit to all the processing units. It differs from broadcast, in that it does not send the same message to all processing units. Instead it splits the message and delivers one part of it to each processing unit.
Given processing units , a fixed processing unit that holds the message . We want to transport the message onto . The same implementation concerns as for gather (§ Gather) apply. This leads to an optimal runtime in .
All-to-all [11] is the most general communication pattern. For , message is the message that is initially stored on node and has to be delivered to node . We can express all communication primitives that do not use operators through all-to-all. For example, broadcast of message from node is emulated by setting for and setting empty for .
Assuming we have a fully connected network, the best possible runtime for all-to-all is in . This is achieved through rounds of direct message exchange. For power of 2, in communication round , node exchanges messages with node .
If the message size is small and latency dominates the communication, a hypercube algorithm can be used to distribute the messages in time .
This table [12] gives an overview over the best known asymptotic runtimes, assuming we have free choice of network topology.
Example topologies we want for optimal runtime are binary tree, binomial tree, hypercube.
In practice, we have to adjust to the available physical topologies, e.g. dragonfly, fat tree, grid network (references other topologies, too).
More information under Network topology.
For each operation, the optimal algorithm can depend on the input sizes . For example, broadcast for short messages is best implemented using a binomial tree whereas for long messages a pipelined communication on a balanced binary tree is optimal.
The complexities stated in the table depend on the latency and the communication cost per word in addition to the number of processing units and the input message size per node . The # senders and # receivers columns represent the number of senders and receivers that are involved in the operation respectively. The # messages column lists the number of input messages and the Computations? column indicates if any computations are done on the messages or if the messages are just delivered without processing. Complexity gives the asymptotic runtime complexity of an optimal implementation under free choice of topology.
Name | # senders | # receivers | # messages | Computations? | Complexity |
---|---|---|---|---|---|
Broadcast | no | ||||
Reduce | yes | ||||
All-reduce | yes | ||||
Prefix sum | yes | ||||
Barrier | no | ||||
Gather | no | ||||
All-Gather | no | ||||
Scatter | no | ||||
All-To-All | no | or |
In probability theory and statistics, the exponential distribution or negative exponential distribution is the probability distribution of the distance between events in a Poisson point process, i.e., a process in which events occur continuously and independently at a constant average rate; the distance parameter could be any meaningful mono-dimensional measure of the process, such as time between production errors, or length along a roll of fabric in the weaving manufacturing process. It is a particular case of the gamma distribution. It is the continuous analogue of the geometric distribution, and it has the key property of being memoryless. In addition to being used for the analysis of Poisson point processes it is found in various other contexts.
In mathematics, particularly in linear algebra, matrix multiplication is a binary operation that produces a matrix from two matrices. For matrix multiplication, the number of columns in the first matrix must be equal to the number of rows in the second matrix. The resulting matrix, known as the matrix product, has the number of rows of the first and the number of columns of the second matrix. The product of matrices A and B is denoted as AB.
In probability theory and statistics, the beta distribution is a family of continuous probability distributions defined on the interval [0, 1] or in terms of two positive parameters, denoted by alpha (α) and beta (β), that appear as exponents of the variable and its complement to 1, respectively, and control the shape of the distribution.
In probability theory and statistics, the gamma distribution is a two-parameter family of continuous probability distributions. The exponential distribution, Erlang distribution, and chi-squared distribution are special cases of the gamma distribution. There are two equivalent parameterizations in common use:
In arithmetic, long division is a standard division algorithm suitable for dividing multi-digit Hindu-Arabic numerals that is simple enough to perform by hand. It breaks down a division problem into a series of easier steps.
In group theory, a branch of mathematics, the baby-step giant-step is a meet-in-the-middle algorithm for computing the discrete logarithm or order of an element in a finite abelian group by Daniel Shanks. The discrete log problem is of fundamental importance to the area of public key cryptography.
A tree k-spanner of a graph is a spanning subtree of in which the distance between every pair of vertices is at most times their distance in .
The normal-inverse Gaussian distribution is a continuous probability distribution that is defined as the normal variance-mean mixture where the mixing density is the inverse Gaussian distribution. The NIG distribution was noted by Blaesild in 1977 as a subclass of the generalised hyperbolic distribution discovered by Ole Barndorff-Nielsen. In the next year Barndorff-Nielsen published the NIG in another paper. It was introduced in the mathematical finance literature in 1997.
The fast multipole method (FMM) is a numerical technique that was developed to speed up the calculation of long-ranged forces in the n-body problem. It does this by expanding the system Green's function using a multipole expansion, which allows one to group sources that lie close together and treat them as if they are a single source.
Cell lists is a data structure in molecular dynamics simulations to find all atom pairs within a given cut-off distance of each other. These pairs are needed to compute the short-range non-bonded interactions in a system, such as Van der Waals forces or the short-range part of the electrostatic interaction when using Ewald summation.
In mathematics, the discrete Fourier transform over a ring generalizes the discrete Fourier transform (DFT), of a function whose values are commonly complex numbers, over an arbitrary ring.
In mathematics, Montgomery's pair correlation conjecture is a conjecture made by Hugh Montgomery that the pair correlation between pairs of zeros of the Riemann zeta function is
In algebraic number theory Eisenstein's reciprocity law is a reciprocity law that extends the law of quadratic reciprocity and the cubic reciprocity law to residues of higher powers. It is one of the earliest and simplest of the higher reciprocity laws, and is a consequence of several later and stronger reciprocity laws such as the Artin reciprocity law. It was introduced by Eisenstein, though Jacobi had previously announced a similar result for the special cases of 5th, 8th and 12th powers in 1839.
In machine learning, the kernel embedding of distributions comprises a class of nonparametric methods in which a probability distribution is represented as an element of a reproducing kernel Hilbert space (RKHS). A generalization of the individual data-point feature mapping done in classical kernel methods, the embedding of distributions into infinite-dimensional feature spaces can preserve all of the statistical features of arbitrary distributions, while allowing one to compare and manipulate distributions using Hilbert space operations such as inner products, distances, projections, linear transformations, and spectral analysis. This learning framework is very general and can be applied to distributions over any space on which a sensible kernel function may be defined. For example, various kernels have been proposed for learning from data which are: vectors in , discrete classes/categories, strings, graphs/networks, images, time series, manifolds, dynamical systems, and other structured objects. The theory behind kernel embeddings of distributions has been primarily developed by Alex Smola, Le Song , Arthur Gretton, and Bernhard Schölkopf. A review of recent works on kernel embedding of distributions can be found in.
The cyclotomic fast Fourier transform is a type of fast Fourier transform algorithm over finite fields. This algorithm first decomposes a DFT into several circular convolutions, and then derives the DFT results from the circular convolution results. When applied to a DFT over , this algorithm has a very low multiplicative complexity. In practice, since there usually exist efficient algorithms for circular convolutions with specific lengths, this algorithm is very efficient.
In computational learning theory, Occam learning is a model of algorithmic learning where the objective of the learner is to output a succinct representation of received training data. This is closely related to probably approximately correct (PAC) learning, where the learner is evaluated on its predictive power of a test set.
In PAC learning, error tolerance refers to the ability of an algorithm to learn when the examples received have been corrupted in some way. In fact, this is a very common and important issue since in many applications it is not possible to access noise-free data. Noise can interfere with the learning process at different levels: the algorithm may receive data that have been occasionally mislabeled, or the inputs may have some false information, or the classification of the examples may have been maliciously adulterated.
In computer science, the reduction operator is a type of operator that is commonly used in parallel programming to reduce the elements of an array into a single result. Reduction operators are associative and often commutative. The reduction of sets of elements is an integral part of programming models such as Map Reduce, where a reduction operator is applied (mapped) to all elements before they are reduced. Other parallel algorithms use reduction operators as primary operations to solve more complex problems. Many reduction operators can be used for broadcasting to distribute data to all processors.
-dimensional hypercube is a network topology for parallel computers with processing elements. The topology allows for an efficient implementation of some basic communication primitives such as Broadcast, All-Reduce, and Prefix sum. The processing elements are numbered through . Each processing element is adjacent to processing elements whose numbers differ in one and only one bit. The algorithms described in this page utilize this structure efficiently.
In graph theory a minimum spanning tree (MST) of a graph with and is a tree subgraph of that contains all of its vertices and is of minimum weight.
Sanders, Peter; Mehlhorn, Kurt; Dietzfelbinger, Martin; Dementiev, Roman (2019). Sequential and Parallel Algorithms and Data Structures - The Basic Toolbox. Springer Nature Switzerland AG. ISBN 978-3-030-25208-3.