pipelining to create parallel algorithms

Pipelining is a functional decomposition strategy to create parallel programs. We gave two illustrations of pipelines. A p-stage pipeline can complete m instances in m+p-1 pipeline cycles. The pipeline latency in a p-stage pipeline is p-1. The speedup is the fraction m*p over m+p-1. For large m (usually m is always much larger than p), the speedup converges to p.

The program pipe_ring.c illustrates a pipeline implemented using a ring topology, doubling a user given number in each stage. The output of the program is

prompt]$ mpirun -np 10 pipe_ring
Give a number : 3
Manager sends 3 to the pipe...
Processor 1 receives 3 from node 0.
Processor 2 receives 6 from node 1.
Processor 3 receives 12 from node 2.
Processor 4 receives 24 from node 3.
Processor 5 receives 48 from node 4.
Processor 6 receives 96 from node 5.
Processor 7 receives 192 from node 6.
Processor 8 receives 384 from node 7.
Processor 9 receives 768 from node 8.
Manager received 1536.
prompt]$

We considered a parallel addition program using a pipeline. The program pipe_one_sum.c completes one sum of the first p+1 numbers. This program has distributed all the adding operations. We ended the lecture sketching how to build a parallel program using the pipelining to sum sequences of numbers efficiently.