Using MPI_Allgather to collect parts of matrix-vector product from their respective processes to all processes
This exercise presents a simple program to demonstrate the use of MPI_Allgather. In this exercise, an 8x8 matrix has been divided into 4 2x8 submatrices. Each submatrix is stored in the local memory of each process. A local matrix-vector product is performed at each process. Then using MPI_Allgather, the results are assembled from each process onto all processes so that at the end, each process has the complete matrix-vector product. A bug has been delibrately introduced into the given program. Based on our discussion of MPI_Allgather, can you find the bug and correct it?