Informations

Auteur(s) Erik-Jan Lingen, Matthias Möller
Date limite Pas de date limite
Limite de soumission Pas de limite

Se connecter

[MPI] Solution 4 : Circular Shift

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.


Question 1: Circular Shift
Question 2: Number of MPI processes

Specify the number of MPI processes (1-64) that should be used for running your program (mpirun -np <nproc>)

Question 3: Command Line Argument

Specify the command line arguments that should be passed to your program when it is run. Arguments must be given in quotes and separated by commas. Leave this filed empty if you do not want to specify command line arguments.

Example: "1","int","arg=2" is interpreted as three arguments 1, int, and arg=2.