Lab 2
Lab 2
Lab 2
Broadcast
Broadcast
MPI has a primitive (MPI_Bcast) for performing a broadcast. All processes should call it at the same time to perform a broadcast.
- How can you specify which process is the sender ?
- Write an MPI code which performs a Broadcast from 0 to all other processes.
All-to-All
All-to-All
We consider p processes, each with an array tab of size p such that tab[rank]=rank et tab[i]=0 pour i!=rank.
- Write an MPI program using MPI_BCast so that all processes end up with the same array.
Matrix-vector
Matrix-vector
- Implement the matrix-vector product on a ring
- Consider a NxN matrix
- Every process will have a copy of the vector.
- The matrix is initially divided in blocks of size (N/P)
- Each node will compute the sub-result
- All intermediate results will be sent back to processus 0 to display the final result.