outline
play

Outline 0024 Spring 2010 2 :: 2 Programming problem 2 0024 - PowerPoint PPT Presentation

Outline 0024 Spring 2010 2 :: 2 Programming problem 2 0024 Spring 2010 2 :: 3 Parallel solution Given a vector X of length N, N = 2 k for some k Given P = N processors (execution units)


  1. Outline �� 0024 Spring 2010 � – 2 :: 2 – �

  2. Programming problem 2 � 0024 Spring 2010 � – 2 :: 3 – �

  3. Parallel solution � Given a vector X of length N, N = 2 k for some k � Given P = N processors (execution units) � Distribute X so that X i is stored on processor P i (for 0 <= i < N). � Compute T j = X 2*j + X 2*j+1 on P j � Rename T to X, renumber the processors so that P new i = P old 2*i and repeat until T 0 contains the result. � Note: some processors idle after fi rst step. Number of steps proportional to log N. � 0024 Spring 2010 � – 2 :: 4 – �

  4. Comments � 0024 Spring 2010 � – 2 :: 5 – �

  5. Programming problem 2a � 0024 Spring 2010 � – 2 :: 6 – �

  6. Parallel solution � Given a vector X of length N, N = 2 k for some k � Given P = N processors (execution units) � Phase 1 (like for Problem 1) � Distribute X so that X i is stored on processor P i (for 0 <= i < N). � Compute T j = X 2*j + X 2*j+1 on P j � Rename T to X, renumber the processors so that P new i = P old 2*i and repeat until T 0 contains the result. � 0024 Spring 2010 � – 2 :: 7 – �

  7. Phase 2 � Imagine the root of the tree (here P 0 ) to receive a “0” from its “parent” (which does not exist). � All non-leaf nodes receive a value from their parent. Each node relays to its left child the received value. Each node sends to its right child the sum of the (received) parent value and the value computed by the left child in Phase 1. � Leaf nodes add the value received from the parent and add it to the saved input value. � 0024 Spring 2010 � – 2 :: 8 – �

  8. Example � 55 � 25 � 30 � 7 � 18 � 10 � 20 � 4 � 3 � 7 � 11 � 9 � 1 � 12 � 8 � 0024 Spring 2010 � – 2 :: 9 – �

  9. Example � 0 � 55 � 25 � 30 � 7 � 18 � 10 � 20 � 4 � 3 � 7 � 11 � 9 � 1 � 12 � 8 � 0024 Spring 2010 � – 2 :: 10 – �

  10. Example � 55 � 0 � 25 � 25 � 30 � 7 � 18 � 10 � 20 � 4 � 3 � 7 � 11 � 9 � 1 � 12 � 8 � 0024 Spring 2010 � – 2 :: 11 – �

  11. Example � 55 � 25 � 30 � 0 � 7 � 25 � 35 � 7 � 18 � 10 � 20 � 4 � 3 � 7 � 11 � 9 � 1 � 12 � 8 � 0024 Spring 2010 � – 2 :: 12 – �

  12. Example � 55 � 25 � 30 � 7 � 18 � 10 � 20 � 35 � 47 � 4 � 3 � 7 � 11 � 9 � 1 � 12 � 8 � 0 � 4 � 7 � 14 � 25 � 34 � 0024 Spring 2010 � – 2 :: 13 – �

  13. Example � 55 � 25 � 30 � 7 � 18 � 10 � 20 � 4 � 3 � 7 � 11 � 9 � 1 � 12 � 8 � 4 � 7 � 14 � 25 � 34 � 35 � 47 � 55 � 0024 Spring 2010 � – 2 :: 14 – �

  14. Programming problem 3 � 0024 Spring 2010 � – 2 :: 15 – �

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