basic communication operations cont
play

Basic Communication Operations (cont.) Alexandre David B2-206 - PowerPoint PPT Presentation

Basic Communication Operations (cont.) Alexandre David B2-206 Today Scatter and Gather (4.4). All-to-All Personalized Communication (4.5). Circular Shift (4.6). Improving the Speed of Some Communication Operations (4.7).


  1. Basic Communication Operations (cont.) Alexandre David B2-206

  2. Today � Scatter and Gather (4.4). � All-to-All Personalized Communication (4.5). � Circular Shift (4.6). � Improving the Speed of Some Communication Operations (4.7). 07-03-2006 Alexandre David, MVP'06 2

  3. Scatter and Gather � Scatter: A node sends a unique message to every other node – unique per node . � Gather: Dual operation but the target node does not combine the messages into one. M 2 Scatter M 1 Gather M 0 M 0 M 1 M 2 … … 0 1 2 0 1 2 07-03-2006 Alexandre David, MVP'06 3

  4. 07-03-2006 Alexandre David, MVP'06 4

  5. Cost Analysis � Number of steps: log p . � Size transferred: pm/2, pm/4,…,m . � Geometric sum 1 − 1 + p p p n 1 2 + + + + = ... p p n 1 2 4 2 − 1 2 1 1 p p p + + + = − − = − − = − ... 2 p ( 1 ) p 2 p ( 1 ) p p 1 + n n 1 2 4 2 2 2 p + + = = 1 1 log n p ( 2 2 2 p ) � Cost T=t s log p+t w m(p-1). 07-03-2006 Alexandre David, MVP'06 5

  6. All-to-All Personalized Communication � Each node sends a distinct message to every other node. M 1,2 M 2,2 M 2,0 M 2,1 M 2,2 M 0,2 M 1,1 M 2,1 M 1,0 M 1,1 M 1,2 M 0,1 M 0,0 M 1,0 M 2,0 M 0,0 M 0,1 M 0,2 … … 0 1 2 0 1 2 07-03-2006 Alexandre David, MVP'06 6

  7. Example: Transpose 07-03-2006 Alexandre David, MVP'06 7

  8. Total Exchange on a Ring 4 0 1 2 3 4 5 0 1 2 3 4 5 0 1 2 3 4 5 5 4 3 5 0 1 2 4 5 3 0 1 2 3 5 0 1 3 4 5 0 1 2 3 4 1 2 3 4 5 0 2 3 4 5 0 1 2 3 4 5 0 1 2 0 1 2 3 4 5 0 2 0 1 2 3 4 5 1 07-03-2006 Alexandre David, MVP'06 8

  9. Total Exchange on a Ring 4 4 4 0 1 2 5 5 3 5 4 3 0 1 4 5 5 3 0 3 4 5 5 3 0 1 2 3 1 2 3 4 2 3 4 5 0 0 1 2 2 0 2 1 0 2 1 1 07-03-2006 Alexandre David, MVP'06 9

  10. Cost Analysis � Number of steps: p-1 . � Size transmitted: m(p-1),m(p-2)…,m . − 1 p ∑ = − + = + − ( 1 ) ( / 2 )( 1 ) T t p it m t t mp p s w s w = 1 i Optimal 07-03-2006 Alexandre David, MVP'06 10

  11. Total Exchange on a Mesh 6 7 8 3 4 5 0 1 2 07-03-2006 Alexandre David, MVP'06 11

  12. Total Exchange on a Mesh 6 7 8 3 4 5 0 1 2 07-03-2006 Alexandre David, MVP'06 12

  13. Total Exchange on a Mesh 6 7 8 3 4 5 0 1 2 07-03-2006 Alexandre David, MVP'06 13

  14. Cost Analysis � Substitute p by √ p (number of nodes per dimension). � Substitute message size m by m √ p . � Cost is the same for each dimension. � T=(2t s +t w mp)( √ p-1) 07-03-2006 Alexandre David, MVP'06 14

  15. Total Exchange on a Hypercube � Generalize the mesh algorithm to log p steps = number of dimensions, with 2 nodes per dimension. � Same procedure as all-to-all broadcast. 07-03-2006 Alexandre David, MVP'06 15

  16. Total Exchange on a Hypercube 6 7 2 3 4 5 0 1 07-03-2006 Alexandre David, MVP'06 16

  17. Total Exchange on a Hypercube 6 7 2 3 4 5 0 1 07-03-2006 Alexandre David, MVP'06 17

  18. Total Exchange on a Hypercube 6 7 2 3 4 5 0 1 07-03-2006 Alexandre David, MVP'06 18

  19. Total Exchange on a Hypercube 6 7 2 3 4 5 0 1 07-03-2006 Alexandre David, MVP'06 19

  20. Cost Analysis � Number of steps: log p . � Size transmitted per step: pm/2 . � Cost: T=(t s +t w mp/2) log p . � Optimal? NO � Each node sends and receives m(p-1) words. Average distance = ( log p)/2 . Total traffic = p*m(p-1)* log p/2 . � Number of links = p log p/2 . � Time lower bound = t w m(p-1). 07-03-2006 Alexandre David, MVP'06 20

  21. An Optimal Algorithm � Have every pair of nodes communicate directly with each other – p-1 communication steps – but without congestion. � At j th step node i communicates with node (i xor j) with E-cube routing. 07-03-2006 Alexandre David, MVP'06 21

  22. Total Exchange on a Hypercube 6 7 2 3 4 5 0 1 07-03-2006 Alexandre David, MVP'06 22

  23. Total Exchange on a Hypercube 6 7 2 3 4 5 0 1 07-03-2006 Alexandre David, MVP'06 23

  24. Total Exchange on a Hypercube 6 7 2 3 4 5 0 1 07-03-2006 Alexandre David, MVP'06 24

  25. Total Exchange on a Hypercube 6 7 2 3 4 5 0 1 07-03-2006 Alexandre David, MVP'06 25

  26. Total Exchange on a Hypercube 6 7 2 3 4 5 0 1 07-03-2006 Alexandre David, MVP'06 26

  27. Total Exchange on a Hypercube 6 7 2 3 4 5 0 1 Etc… 07-03-2006 Alexandre David, MVP'06 27

  28. Cost Analysis � Remark: Transmit less, only what is needed, but more steps. � Number of steps: p-1 . � Transmission: size m per step. � Cost: T=(t s +t w m)(p-1) . � Compared with T=(t s +t w mp/2) log p. � Previous algorithm better for small messages. 07-03-2006 Alexandre David, MVP'06 28

  29. Circular Shift � It’s a particular permutation. � Circular q-shift: Node i sends data to node (i+q) mod p (in a set of p nodes). � Useful in some matrix operations and pattern matching. � Ring: intuitive algorithm in min{q,p-q} neighbor to neighbor communication steps. Why? 07-03-2006 Alexandre David, MVP'06 29

  30. Circular 5-shift on a mesh. q mod √ p on rows compensate ⎣ q / √ p ⎦ on colums 07-03-2006 Alexandre David, MVP'06 30

  31. Circular Shift on a Hypercube � Map a linear array with 2 d nodes onto a hypercube of dimension d . � Expand q shift as a sum of powers of 2 (e.g. 5-shift = 2 0 +2 2 ). � Perform the decomposed shifts. � Use bi-directional links for “forward” (shift itself) and “backward” (rotation part)… log p steps. 07-03-2006 Alexandre David, MVP'06 31

  32. Or better: Direct E-cube routing. q-shifts on a 8-node hypercube. 07-03-2006 Alexandre David, MVP'06 32

  33. Improving Performance � So far messages of size m were not split. � If we split them into p parts: � One-to-all broadcast = scatter + all-to-all broadcast of messages of size m/p . � All-to-one reduction = all-to-all reduce + scatter of messages of size m/p . � All-reduce = all-to-all reduction + all-to-all broadcast of messages of size m/p . 07-03-2006 Alexandre David, MVP'06 33

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend