1
votes

I am trying to use MPI_Scatter to transmit a set of rows of matrix[5000][2000] across 16 processes (Trying to achieve a matrix multiplication). but 5000 is not divisible by 16. So if every process receives equal amount of rows, last few rows will be lost. ( 312 * 16 + 8 = 5000 )

Can anyone tell me how to scatter this [5000] rows properly among the processes using MPI_Scatter?

Thank you

1

1 Answers

1
votes

I found the answer I was looking for. MPI provides functions for this purpose. a version of gather and scatter.

MPI_Scatterv http://www.mpich.org/static/docs/v3.1/www3/MPI_Scatterv.html

MPI_Gatherv http://www.mpich.org/static/docs/v3.1/www3/MPI_Gatherv.html