I want to send 2D array\'s columns, each to separate process. I have now one whole 2d array and I am stuck with MPI_Scatter. How to send whole columns as a field?
T
There's quite a few things wrong with that, but your main problem is memory layout. At the memory location denoted by a, there isn't a single float: there are only float*s that point to various arrays of float elsewhere in memory. Since these arrays are not necessarily contiguous, you can't use Scatter on them.
The easiest solution would be to store your matrix in a single array:
float a[100*101];
And fill it in column-major order. Then simply Scatter like so:
MPI_Scatter(a, 100*101, MPI_FLOAT, send, 10*101, MPI_FLOAT, 0, MPI_COMM_WORLD);
This is assuming that you Scatter between 10 processes and send is defined as a float[10*101] in each process. Note that in the code you posted, arguments 4-6 of Scatter are definitely flawed. If send is an array, then you don't need to pass &send (for the same reason you don't need to pass &a in the first argument), and you want to match the number and type of data items you receive to what you send.