MPI_SCATTER Fortran Matrices by Rows
Posted
by Fortran
on Stack Overflow
See other posts from Stack Overflow
or by Fortran
Published on 2010-03-22T21:14:20Z
Indexed on
2010/03/22
21:21 UTC
Read the original article
Hit count: 610
What is the best way to scatter a Fortran 90 matrix by its rows rather than columns? That is, let's say I have a matrix a(4,50) and I want to MPI_SCATTER it onto two processes where each part is alocal(2,50), where rank 0 has rows 1 and 2, and rank 1 has 3 and 4. Now, in C, this is simple since arrays are row-major, but in Fortran 90 they are column-major.
I'm trying to avoid using TRANSPOSE to flip a before scattering (i.e, doubling the memory use), and I figure there must be a way in MPI to do this. Would it be MPI_TYPE_VECTOR? MPI_TYPE_CREATE_SUBARRAY?
Likewise, what if I have a 3d array b(4,50,3) and I want two scattered matrices of blocal(2,50,3) distributed as above?
© Stack Overflow or respective owner