Q:

Parallel Matrix Multiplication MPI (Element Wise Calculation)

I need to program for parallel block matrix calculation (Element by Element wise) using MPI. I programmed before row wise allocation to nodes for calculation. In current problem i need to divide tasks according to elements of resultant matrix. 
I keep trying how to distribute the data to nodes but have not reached the solution. Could you please help me in understanding the logic about how to do that?

A:

Let's work backwards through this.  My notation will come from A*B=C.  Each element of C is built from the corresponding row of A and column of B.  A(i,0:n)*B(0:n,j)=C(i,j).  So, for each element of C, you will need a row of A and a column of B.  If you want each rank to solve for a block of C, then you need all corresponding rows of A and all corresponding columns of B.  So, break C into blocks, get the ranges needed for each block.  C(i1:i2,j1:j2) would require A(i1:i2,0:n) and B(0:n,j1:j2).  To distribute this data, I'd recommend using MPI_Scatter and/or MPI_Scatterv (depends on the memory layout which you'll need to use).

