You can actually do it either day (using the language's native ordering
one way or MPI datatypes the other day).
C's native ordering is row-major; Fortran's native ordering is
column-major.
It looks like you want to gather rows of a Fortran array, so you'll need
to make an MPI datatype that contains a row (i.e., a(1,1-3)), and then
you'll allgather 1 of those (since every MPI process will be contributing
1 row to the collective).
On Sun, 21 Sep 2003 seberino_at_[hidden] wrote:
> Jeff
>
> I hope you are right that you can do mpi_allgatherv's
> just as easily with 2d arrays as with 1d arrays.
>
> I'm confused however why you don't see a gotcha regarding
> order of indices...
>
> "3 elements from node0" means different things for different
> orderings of indices don't you agree?....
>
> It may mean {a(1,1),a(2,1),a(3,1)} or {a(1,1),a(1,2),a(1,3)}.
> You'll "gather" different guys from same nodes!!!!
>
> Do you see what I mean?
>
> chris
>
> On Mon, Aug 04, 2003 at 05:20:46PM -0400, Jeff Squyres wrote:
> > On Sat, 2 Aug 2003 seberino_at_[hidden] wrote:
> >
> > > Is an allgather possible to give every node a complete copy of this 2D
> > > array that is spread out over all the nodes???
> > >
> > > Node Number What part of array "a" it has
> > > =================================================
> > >
> > > 0 a(1,1), a(1,2), a(1,3) (i.e. a(1,1-3))
> > > 1 a(2,1), a(2,2), a(2,3) (i.e. a(2,1-3))
> > > 2 a(3,1), a(3,2), a(3,3) (i.e. a(3,1-3))
> > > 3 a(4,1), a(4,2), a(4,3) (i.e. a(4,1-3))
> > >
> > > 4 a(1,4), a(1,5), a(1,6) (i.e. a(1,4-6))
> > > 5 a(2,4), a(2,5), a(2,6) (i.e. a(2,4-6))
> > > 6 a(3,4), a(3,5), a(3,6) (i.e. a(3,4-6))
> > > 7 a(4,4), a(4,5), a(4,6) (i.e. a(4,4-6))
> >
> > Yes, it sounds like an Allgather is what you want to do. Check out Figure
> > 4.1 in the MPI-1 spec (p92) for a handy diagram of what each of the data
> > movement collectives do in MPI.
> >
> > > I've heard about column-major order and row-major order but always
> > > forget which one is C and which one Fortran90 uses.
--
{+} Jeff Squyres
{+} jsquyres_at_[hidden]
{+} http://www.lam-mpi.org/
|