Download presentation
Presentation is loading. Please wait.
Published bySarah Foat Modified over 9 years ago
1
Pipeline Computations Increasing Throughput By Using More Processes
2
Original Pipeline 2 22468 P2P6P4P5P3P1 time P2P6P4P5P3P1
3
latency throughput 24 sec 1 every 8 sec
4
2 22468 P2P6P4P5P3P1
5
Add More Processes 2 22468 P2-1 & P2-2P6 P4-1, P4-2 & P4-3 P5-1, P5-2, P5-3 & P5-4 P3P1 46 6 8 8 8 P2 takes twice as long as the fastest, so make 2 of those. P4 three times as long, so make 3. P5 four times as long, so make 4 of those.
6
Add More Processes 2 22468 P2P6P4P5P3P1 46 6 8 8 8 Does half the work
7
Add More Processes 2 4 P2-1P1 4 Gets every second message (the even ones) Gets every second message (the odd ones) P2-2
8
Add Dispersers and Collectors 2 4 P2-1 P1 4 DisperserCollector P1 P2-2 P2-1P2-2 2 P3
9
New Pipeline P1 P2 P3 P4 P5 P6 Time = 0
10
New Pipeline Can move from P1 to P2-1 P1 P2 P3 P4 P5 P6 Time = 2
11
New Pipeline Can move from P1 to P2-2 P1 P2 P3 P4 P5 P6 Time = 4
12
New Pipeline Can move from P1 to P2-1 Can move from P2-1 to P3 P1 P2 P3 P4 P5 P6 Time = 6
13
New Pipeline Can move from P1 to P2-2 Can move from P2-2 to P3 Can move from P3 to P4-1 P1 P2 P3 P4 P5 P6 Time = 8
14
New Pipeline Can move from P1 to P2-1 Can move from P2-1 to P3 Can move from P3 to P4-2 P1 P2 P3 P4 P5 P6 Time = 10
15
New Pipeline Can move from P1 to P2-2 Can move from P2-2 to P3 Can move from P3 to P4-3 P1 P2 P3 P4 P5 P6 Time = 12
16
New Pipeline Can move from P1 to P2-1 Can move from P2-1 to P3 Can move from P3 to P4-1 Can move from P4-1 to P5-1 P1 P2 P3 P4 P5 P6 Time = 14
17
New Pipeline Can move from P4-2 to P5-2 Can move from P1 to P2-2 Can move from P2-2 to P3 Can move from P3 to P4-2 P1 P2 P3 P4 P5 P6 Time = 16
18
New Pipeline Time = 18 Can move from P4-3 to P5-3 Can move from P2 to P3 Can move from P3 to P4-3
19
New Pipeline Time = 20 Can move from P4-1 to P5-4 Can move from P2 to P3 Can move from P3 to P4-1
20
New Pipeline Time = 22 Can move from P3 to P4-2 Can move from P4-2 to P5-1 Can move from P5-1 to P6
21
New Pipeline Time = 24 Can move from P4-3 to P5-2 Can move from P5-2 to P6
22
New Pipeline Time = 26 Can move from P4-1 to P5-3 Can move from P5-3 to P6
23
New Pipeline Time = 28 Can move from P4-2 to P5-4 Can move from P5-4 to P6
24
New Pipeline Time = 30 Can move from P5-1 to P6
25
New Pipeline Time = 32 Can move from P5-2 to P6
26
New Pipeline Time = 34 Can move from P5-3 to P6
27
New Pipeline Time = 36 Can move from P5-4 to P6
28
Result Latency: 24 secs. (same as before) Throughput: 1 every 2 secs. (1 every 8 secs. before) Input rate: 1 every 2 secs. (1 every 8 secs. before)
29
Simulation in MPI void proc(int delay, int from, int too) { while (true) { MPI_Recv(…, from, …); // work for ‘delay’ secs. MPI_Send(…, to, …); } A process:
30
Simulation in MPI void disperser(int noProc, int from, int procs[]) { while (true) { for (i=0;i<noProc; i++) { MPI_Recv(…, from, …); MPI_Send(…, procs[i], …); } A disperser:
31
Simulation in MPI void collector(int noProc, int procs[], int to) { while (true) { for (i=0;i<noProc; i++) { MPI_Recv(…, procs[i], …); MPI_Send(…, to, …); } A collector:
32
New Pipeline Diagram 1 2 3 4 5 6 7 8 9 10 1112 13 14 15 16 17 18
33
New Pipeline Diagram 1 2 3 4 5 6 7 8 9 10 1112 13 14 15 16 17 18 switch (rank) { 1: proc(2, input, 2); break;
34
New Pipeline Diagram 1 2 3 4 5 6 7 8 9 10 1112 13 14 15 16 17 18 switch (rank) { 1: proc(2, input, 2); break; 2: disperser(2, 1, [3,4]); break;
35
New Pipeline Diagram 1 2 3 4 5 6 7 8 9 10 1112 13 14 15 16 17 18 switch (rank) { 1: proc(2, input, 2); break; 2: disperser(2, 1, [3,4]); break; 3,4: proc(4, 2, 5); break;
36
New Pipeline Diagram 1 2 3 4 5 6 7 8 9 10 1112 13 14 15 16 17 18 switch (rank) { 1: proc(2, input, 2); break; 2: disperser(2, 1, [3,4]); break; 3,4: proc(4, 2, 5); break; 5: collector(2, [3,4], 6); break;
37
New Pipeline Diagram 1 2 3 4 5 6 7 8 9 10 1112 13 14 15 16 17 18 switch (rank) { 1: proc(2, input, 2); break; 2: disperser(2, 1, [3,4]); break; 3,4: proc(4, 2, 5); break; 5: collector(2, [3,4], 6); break; 6: proc(2, 5, 7); break;
38
New Pipeline Diagram 1 2 3 4 5 6 7 8 9 10 1112 13 14 15 16 17 18 switch (rank) { 1: proc(2, input, 2); break; 2: disperser(2, 1, [3,4]); break; 3,4: proc(4, 2, 5); break; 5: collector(2, [3,4], 6); break; 6: proc(2, 5, 7); break; 7: disperser(3, 7, [8,9,10]); break;
39
New Pipeline Diagram 1 2 3 4 5 6 7 8 9 10 1112 13 14 15 16 17 18 switch (rank) { 1: proc(2, input, 2); break; 2: disperser(2, 1, [3,4]); break; 3,4: proc(4, 2, 5); break; 5: collector(2, [3,4], 6); break; 6: proc(2, 5, 7); break; 7: disperser(3, 7, [8,9,10]); break; 8,9,10: proc(6, 7, 11); break;
40
New Pipeline Diagram 1 2 3 4 5 6 7 8 9 10 1112 13 14 15 16 17 18 switch (rank) { 1: proc(2, input, 2); break; 2: disperser(2, 1, [3,4]); break; 3,4: proc(4, 2, 5); break; 5: collector(2, [3,4], 6); break; 6: proc(2, 5, 7); break; 7: disperser(3, 7, [8,9,10]); break; 8,9,10: proc(6, 7, 11); break; 11: collector(3, [8,9,10], 12); break;
41
New Pipeline Diagram 1 2 3 4 5 6 7 8 9 10 1112 13 14 15 16 17 18 switch (rank) { 1: proc(2, input, 2); break; 2: disperser(2, 1, [3,4]); break; 3,4: proc(4, 2, 5); break; 5: collector(2, [3,4], 6); break; 6: proc(2, 5, 7); break; 7: disperser(3, 7, [8,9,10]); break; 8,9,10: proc(6, 7, 11); break; 11: collector(3, [8,9,10], 12); break; 12: disperser(4, 11, [13,14,15,16]); break;
42
16 New Pipeline Diagram 1 2 3 4 5 6 7 8 9 10 1112 13 14 15 17 18 switch (rank) { 1: proc(2, input, 2); break; 2: disperser(2, 1, [3,4]); break; 3,4: proc(4, 2, 5); break; 5: collector(2, [3,4], 6); break; 6: proc(2, 5, 7); break; 7: disperser(3, 7, [8,9,10]); break; 8,9,10: proc(6, 7, 11); break; 11: collector(3, [8,9,10], 12); break; 12: disperser(4, 11, [13,14,15,16]); break; 13,14,15,16: proc(8,12,17); break; 16
43
New Pipeline Diagram 1 2 3 4 5 6 7 8 9 10 1112 13 14 15 16 17 18 switch (rank) { 1: proc(2, input, 2); break; 2: disperser(2, 1, [3,4]); break; 3,4: proc(4, 2, 5); break; 5: collector(2, [3,4], 6); break; 6: proc(2, 5, 7); break; 7: disperser(3, 7, [8,9,10]); break; 8,9,10: proc(6, 7, 11); break; 11: collector(3, [8,9,10], 12); break; 12: disperser(4, 11, [13,14,15,16]); break; 13,14,15,16: proc(8,12,17); break; 17: collector(4, [13,14,15,16], 18); break;
44
New Pipeline Diagram 1 2 3 4 5 6 7 8 9 10 1112 13 14 15 16 17 18 switch (rank) { 1: proc(2, input, 2); break; 2: disperser(2, 1, [3,4]); break; 3,4: proc(4, 2, 5); break; 5: collector(2, [3,4], 6); break; 6: proc(2, 5, 7); break; 7: disperser(3, 7, [8,9,10]); break; 8,9,10: proc(6, 7, 11); break; 11: collector(3, [8,9,10], 12); break; 12: disperser(4, 11, [13,14,15,16]); break; 13,14,15,16: proc(8,12,17); break; 17: collector(4, [13,14,15,16], 18); break; 18: proc(2, 17, output); break; }
45
Improvement ? Theory: We went from 1 packet every 8 seconds to 1 every 2 seconds Practice: Run the program and see
46
Original Pipeline Results donald-duck.cs.unlv.edu(5) mpirun -np 8 pipe 10 Packet 0 - Transport Time: 293547 Elapsed since last packet: 293382 Packet 1 - Transport Time: 383411 Elapsed since last packet: 89947 Packet 2 - Transport Time: 450002 Elapsed since last packet: 89995 Packet 3 - Transport Time: 489977 Elapsed since last packet: 89989 Packet 4 - Transport Time: 536127 Elapsed since last packet: 96105 Packet 5 - Transport Time: 571027 Elapsed since last packet: 84923 Packet 6 - Transport Time: 579882 Elapsed since last packet: 98802 Packet 7 - Transport Time: 579911 Elapsed since last packet: 89933 Packet 8 - Transport Time: 579906 Elapsed since last packet: 89946 Packet 9 - Transport Time: 579957 Elapsed since last packet: 90010 Latency...............: 293382 Total Time............: 1113504 Average Transport Time: 504374 Average Rate..........: 91072
47
Improved Pipeline Results donald-duck.cs.unlv.edu(6) mpirun -np 20 pipe2 10 Packet 0 - Transport Time: 294756 Elapsed since last packet: 294443 Packet 1 - Transport Time: 324442 Elapsed since last packet: 29996 Packet 2 - Transport Time: 330051 Elapsed since last packet: 30049 Packet 3 - Transport Time: 330063 Elapsed since last packet: 29957 Packet 4 - Transport Time: 330068 Elapsed since last packet: 29987 Packet 5 - Transport Time: 330053 Elapsed since last packet: 29970 Packet 6 - Transport Time: 330004 Elapsed since last packet: 29952 Packet 7 - Transport Time: 329992 Elapsed since last packet: 29982 Packet 8 - Transport Time: 329926 Elapsed since last packet: 29996 Packet 9 - Transport Time: 329989 Elapsed since last packet: 30031 Latency...............: 294443 Total Time............: 564527 Average Transport Time: 325934 Average Rate..........: 29991
48
Results Original (1000 packets): Latency...............: 296,258 Total Time............: 90,209,466 Average Transport Time: 569,236 Average Rate..........: 89,986 Improved Pipeline (1000 packets): Latency...............: 293,727 Total Time............: 30,264,697 Average Transport Time: 329,841 Average Rate..........: 29,974
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.