• Aucun résultat trouvé

Turn Model Routing

Dans le document Parallel Programming (Page 61-64)

4. Multiple-Instruction, Multiple-Data (MIMD): There are multiple processing elements each of which has a separate instruction and data access to a (shared

2.6 Routing and Switching

2.6.1 Routing Algorithms

2.6.1.5 Turn Model Routing

The turn model [68, 125] tries to avoid deadlocks by a suitable selection of turns that are allowed for the routing. Deadlocks occur if the paths for message transmission contain turns that may lead to cyclic waiting in some situations. Deadlocks can

Fig. 2.22 Illustration of turns for a two-dimensional mesh with all possible turns (top), allowed turns for X Y routing (middle), and allowed turns for west-first routing (bottom)

possible turns in a 2D mesh

turns allowed for XY−Routing

turn allowed for West−First−Routing

turns allowed:

turns not allowed:

be avoided by prohibiting some of the turns. An example is the X Y routing on a two-dimensional mesh. From the eight possible turns, see Fig. 2.22 (top), only four are allowed for X Y routing, prohibiting turns from vertical into horizontal direction, see Fig. 2.22 (middle) for an illustration. The remaining four turns are not allowed in order to prevent cycles in the networks. This not only avoids the occurrence of deadlocks, but also prevents the use of adaptive routing. For n-dimensional meshes and, in the general case, k-ary d-cubes, the turn model tries to identify a minimum number of turns that must be prohibited for routing paths to avoid the occurrence of cycles. Examples are the west-first routing for two-dimensional meshes and the

P-cube routing for n-dimensional hypercubes.

The west-first routing algorithm for a two-dimensional mesh prohibits only two of the eight possible turns: Turns to the west (left) are prohibited, and only the turns shown in Fig. 2.22 (bottom) are allowed. Routing paths are selected such that messages that must travel to the west must do so before making any turns.

Such messages are sent to the west first until the requested x-coordinate is reached.

Then the message can be adaptively forwarded to the south (bottom), east (right), or north (top). Figure 2.23 shows some examples for possible routing paths [125].

West-first routing is deadlock free, since cycles are avoided. For the selection of minimal routing paths, the algorithm is adaptive only if the target node lies to the east (right). Using non-minimal routing paths, the algorithm is always adaptive.

Fig. 2.23 Illustration of path selection for west-first routing in an 8×8 mesh. The links shown as blocked are used for other message transmissions and are not available for the current transmission. One of the paths shown is minimal, the other two are non-minimal, since some of the links are blocked

source node target node mesh node blocked channel

Routing in the n-dimensional hypercube can be done with P-cube routing. To send a message from a sender A with bit representationα=α0. . . αn1to a receiver B with bit representationβ =β0. . . βn1, the bit positions in whichαandβdiffer are considered. The number of these bit positions is the Hamming distance between A and B which determines the minimum length of a routing path from A to B. The set E = {i |αi =βi,i =0, . . . ,n−1}of different bit positions is partitioned into two sets E0 = {i ∈E |αi =0 andβi =1}and E1= {i ∈ E |αi =1 andβi =0}.

Message transmission from A to B is split into two phases accordingly: First, the message is sent into the dimensions in E0and then into the dimensions in E1. 2.6.1.6 Virtual Channels

The concept of virtual channels is often used for minimal adaptive routing algo-rithms. To provide multiple (virtual) channels between neighboring network nodes, each physical link is split into multiple virtual channels. Each virtual channel has its own separate buffer. The provision of virtual channels does not increase the number of physical links in the network, but can be used for a systematic avoidance of deadlocks.

Based on virtual channels, a network can be split into several virtual networks such that messages injected into a virtual network can only move in one direction for each dimension. This can be illustrated for a two-dimensional mesh which is split into two virtual networks, a +X network and a −X network, see Fig. 2.24 for an illustration. Each virtual network contains all nodes, but only a subset of the virtual channels. The+X virtual network contains in the vertical direction all virtual channels between neighboring nodes, but in the horizontal direction only the virtual channels in positive direction. Similarly, the−X virtual network contains in the horizontal direction only the virtual channels in negative direction, but all virtual channels in the vertical direction. The latter is possible by the definition of a suitable number of virtual channels in the vertical direction. Messages from a node A with x-coordinate xA to a node B with x-coordinate xB are sent in the+X network, if xA < xB. Messages from A to B with xA > xB are sent in the−X network. For

(0,0) (1,0) (0,1) (1,1) (0,2) (1,2)

(2,0) (2,1)

(2,2) (3,2)

(3,1)

(3,0)

(0,0) (1,0)

(0,1) (1,1) (0,2) (1,2)

(2,0) (2,1)

(2,2) (3,2)

(3,1)

(3,0) (0,0) (1,0) (0,1) (1,1) (0,2) (1,2)

(2,0) (2,1)

(2,2) (3,2)

(3,1)

(3,0) 2D mesh with virtual channels in y direction

+X network −X network

Fig. 2.24 Partitioning of a two-dimensional mesh with virtual channels into a+X network and a

X network for applying a minimal adaptive routing algorithm

xA = xB, one of the two networks can be selected arbitrarily, possibly using load information for the selection. The resulting adaptive routing algorithm is deadlock free [125]. For other topologies like hypercubes or tori, more virtual channels might be needed to provide deadlock freedom [125].

A non-minimal adaptive routing algorithm can send messages over longer paths if no minimal path is available. Dimension reversal routing can be applied to arbitrary meshes and k-ary d-cubes. The algorithm uses r pairs of virtual channels between any pair of nodes that is connected by a physical link. Correspondingly, the network is split into r virtual networks where network i for i =0, . . . ,r−1 uses all virtual channels i between the nodes. Each message to be transmitted is assigned a class c with initialization c = 0 which can be increased to c = 1, . . . ,r −1 during message transmission. A message with class c = i can be forwarded in network i in each dimension, but the dimensions must be traversed in increasing order. If a message must be transmitted in opposite order, its class is increased by 1 (reverse dimension order). The parameter r controls the number of dimension reversals that are allowed. If c =r is reached, the message is forwarded according to dimension-ordered routing.

Dans le document Parallel Programming (Page 61-64)