Hypercube (communication pattern)

d -dimensional hypercube is a network topology for parallel computers with 2^d processing elements.

Uses your system voice; voice and rate in settings.

Snapshot

≈ 7 min read

Names in other languages

No names in other languages are held for this entry yet.

Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.

d-dimensional hypercube is a network topology for parallel computers with 2d processing elements. The topology allows for an efficient implementation of some basic communication primitives such as Broadcast, All-Reduce, and Prefix sum.[1] The processing elements are numbered 0 through 2d−1. 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.

Contents

Algorithm outline

edit edit source

Most of the communication primitives presented in this article share a common template.[2] Initially, each processing element possesses one message that must reach every other processing element during the course of the algorithm. The following pseudo code sketches the communication steps necessary. Hereby, Initialization, Operation, and Output are placeholders that depend on the given communication primitive (see next section).

Input: message m. Output: depends on Initialization, Operation and Output. Initialization s:=m for 0≤k<d do y:=i XOR 2k Send s to y Receive m from y Operation(s,m) endfor Output

Each processing element iterates over its neighbors (the expression i XOR 2k negates the k-th bit in i's binary representation, therefore obtaining the numbers of its neighbors). In each iteration, each processing element exchanges a message with the neighbor and processes the received message afterwards. The processing operation depends on the communication primitive.

Communication primitives

edit edit source

Prefix sum

edit edit source

In the beginning of a prefix sum operation, each processing element i owns a message mi. The goal is to compute ⨁0≤j≤imj, where ⊕ is an associative operation. The following pseudo code describes the algorithm.

Input: message mi of processor i. Output: prefix sum ⨁0≤j≤imj of processor i. x:=mi σ:=mi for 0≤k≤d−1 do y:=i XOR 2k Send σ to y Receive m from y σ:=σ⊕m if bit k in i is set then x:=x⊕m endfor

The algorithm works as follows. Observe that hypercubes of dimension d can be split into two hypercubes of dimension d−1. Refer to the sub cube containing nodes with a leading 0 as the 0-sub cube and the sub cube consisting of nodes with a leading 1 as 1-sub cube. Once both sub cubes have calculated the prefix sum, the sum over all elements in the 0-sub cube has to be added to the every element in the 1-sub cube, since every processing element in the 0-sub cube has a lower rank than the processing elements in the 1-sub cube. The pseudo code stores the prefix sum in variable x and the sum over all nodes in a sub cube in variable σ. This makes it possible for all nodes in 1-sub cube to receive the sum over the 0-sub cube in every step.

This results in a factor of log⁡p for Tstart and a factor of nlog⁡p for Tbyte: T(n,p)=(Tstart+nTbyte)log⁡p.

All-gather / all-reduce

edit edit source

All-gather operations start with each processing element having a message mi. The goal of the operation is for each processing element to know the messages of all other processing elements, i.e. x:=m0⋅m1…mp where ⋅ is concatenation. The operation can be implemented following the algorithm template.

Input: message x:=mi at processing unit i. Output: all messages m1⋅m2…mp. x:=mi for 0≤k<d do y:=i XOR 2k Send x to y Receive x′ from y x:=x⋅x′ endfor

With each iteration, the transferred message doubles in length. This leads to a runtime of T(n,p)≈∑j=0d−1(Tstart+n⋅2jTbyte)=log⁡(p)Tstart+(p−1)nTbyte.

The same principle can be applied to the all-reduce operations, but instead of concatenating the messages, it performs a reduction operation on the two messages. So it is a reduce operation, where all processing units know the result. Compared to a normal reduce operation followed by a broadcast, all-reduce in hypercubes reduces the number of communication steps.

All-to-all

edit edit source

Here every processing element has a unique message for all other processing elements.

Input: message mij at processing element i to processing element j. for d>k≥0 do Receive from processing element i XOR 2k: all messages for my k-dimensional sub cube Send to processing element i XOR 2k: all messages for its k-dimensional sub cube endfor

With each iteration a messages comes closer to its destination by one dimension, if it hasn't arrived yet. Hence, all messages have reached their target after at most d=log⁡p steps. In every step, p/2 messages are sent: in the first iteration, half of the messages aren't meant for the own sub cube. In every following step, the sub cube is only half the size as before, but in the previous step exactly the same number of messages arrived from another processing element.

This results in a run-time of T(n,p)≈log⁡p(Tstart+p2nTbyte).

ESBT-broadcast

edit edit source

The ESBT-broadcast (Edge-disjoint Spanning Binomial Tree) algorithm[3] is a pipelined broadcast algorithm with optimal runtime for clusters with hypercube network topology. The algorithm embeds d edge-disjoint binomial trees in the hypercube, such that each neighbor of processing element 0 is the root of a spanning binomial tree on 2d−1 nodes. To broadcast a message, the source node splits its message into k chunks of equal size and cyclically sends them to the roots of the binomial trees. Upon receiving a chunk, the binomial trees broadcast it.

Runtime

edit edit source

In each step, the source node sends one of its k chunks to a binomial tree. Broadcasting the chunk within the binomial tree takes d steps. Thus, it takes k steps to distribute all chunks and additionally d steps until the last binomial tree broadcast has finished, resulting in k+d steps overall. Therefore, the runtime for a message of length n is T(n,p,k)=(nkTbyte+Tstart)(k+d). With the optimal chunk size k∗=nd⋅TbyteTstart, the optimal runtime of the algorithm is T∗(n,p)=n⋅Tbyte+log⁡(p)⋅Tstart+nlog⁡(p)⋅Tstart⋅Tbyte.

Construction of the binomial trees

edit edit source

This section describes how to construct the binomial trees systematically. First, construct a single binomial spanning tree von 2d nodes as follows. Number the nodes from 0 to 2d−1 and consider their binary representation. Then the children of each nodes are obtained by negating single leading zeroes. This results in a single binomial spanning tree. To obtain d edge-disjoint copies of the tree, translate and rotate the nodes: for the k-th copy of the tree, apply a XOR operation with 2k to each node. Subsequently, right-rotate all nodes by k digits. The resulting binomial trees are edge-disjoint and therefore fulfill the requirements for the ESBT-broadcasting algorithm.

See also

edit edit source

References

edit edit source
  1. ^ Grama, A.(2003). Introduction to Parallel Computing. Addison Wesley; Auflage: 2 ed. ISBN 978-0201648652.
  2. ^ Foster, I.(1995). Designing and Building Parallel Programs: Concepts and Tools for Parallel Software Engineering. Addison Wesley; ISBN 0201575949.
  3. ^ Johnsson, S.L.; Ho, C.-T. (1989). "Optimum broadcasting and personalized communication in hypercubes". IEEE Transactions on Computers. 38 (9): 1249–1268. doi:10.1109/12.29465. ISSN 0018-9340.

Text derived from https://en.wikipedia.org/w/index.php?oldid=1353036110 under CC BY-SA 4.0; modifications have been made.

Provenance

snapshot enwiki-001353036110 · captured 1778175959.0 · version history

Cite this page as: encyclopegia.org, “Hypercube (communication pattern)”, snapshot enwiki-001353036110. https://encyclopegia.org/a/hypercube-communication-pattern