Using MPI_Alltoall to perform matrix transpose

 

Using MPI_Alltoall to perform matrix transpose

 

This exercise presents a simple program to demonstrate the use of MPI_Alltoall. In this exercise, a 4x4 matrix has been divided into 4 1x4 submatrices. Each submatrix is stored in the local memory of each process. Using MPI_Alltoall, each element j of submtarix in process iis replaced by element i of submatrix in process j. A few bugs have been delibrately introduced into the given program. Based on our discussion of MPI_Alltoall, can you find the bugs and correct them?