This material is part of the course Practical Introduction to Parallel Programming and meant for educational purposes only.
Task
Use non-blocking point-to-point communication operations to implement a parallel, circular array shift.
Here is the serial implementation of the algorithm:
const int N = 100; double a[N]; double t; int i; t = a[N - 1]; for ( i = N - 1; i >= 1; i-- ) a[i] = a[i - 1]; a[0] = t;
In the parallel implementation of the program each process stores a sub-section of the array a
. The processes need to exchange data in order to process the first and last element in their sub-array.
Try to start the non-blocking receive operations as soon as possible.
The original array and the shifted array are printed by the program. Try to print the array elements in the correct order. That is, the processes should print their sub-section one after another.