LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: Jones, Donald E (donald.e.jones_at_[hidden])
Date: 2003-05-22 17:56:26


You may be able to use an MPI_Type_vector to pass the data. I have not played with that on 4D matrix, but if I have a simple 2D matrix:
   1 2 3 4
   5 6 7 8
   9 10 11 12
  13 14 15 16
I can define an MPI_Type_vector that will allow me to pass the original array as:
   1 3 5 7
   9 11 13 15

MPI_Type_vector allows you to specify a blocklength and stride to skip through the array. However, I have never tried that with a 4D matrix, only 2D.

Don Jones

-----Original Message-----
From: Roberto Pasianot [mailto:pasianot_at_[hidden]]
Sent: Thursday, May 22, 2003 3:34 PM
To: General LAM/MPI mailing list
Subject: Re: LAM: 4d Matrix problem

 Let me add to Brian's comment my $0.02 worth.
 If you could place index "c" in the slowest varying position
 ( 1st in C, 4th in Fortran ), and if the array is of homogeneous
 kind, then passing a pointer to the first element to be sent and the
 corresponding displacement is the easiest way to go.

 Ciao,
 Roberto

On Thu, 22 May 2003, Brian W. Barrett wrote:

> On Thu, 22 May 2003, Renzo Mischianti wrote:
>
> > I have a problem... I have a 4d Matrix (matrix(a,b,c,d)) and I want to send
> > a part of it to some processors, but I must to split it on c coordinate
> > (like matrix(a,b,c/n,d) n = number of processors to split it).
> >
> > - do I have to define a datatype and copy elements there?
> > or
> > - is there an instruction that make it automatically??
> >
> > and then to receive the result respecting the matrix structure?
> >
> > What's the best way??
>
> It might be possible to describe such a data structure using the MPI
> derived datatypes, but I'm not exactly sure how one would do so. There is
> definitely not an MPI function to do it for you :).
>
> Most likely, you will have to copy (or just lay it out correctly to begin
> with) such that your data is contigous (or at least easier to describe
> using the MPI derived datatypes).
>
> You might want to look at a book on MPI programming - it may be able to
> offer more advice on data layout and distribution.
>
> Hope this helps,
>
> Brian
>
> --
> Brian Barrett
> LAM/MPI developer and all around nice guy
> Have a LAM/MPI day: http://www.lam-mpi.org/
> _______________________________________________
> This list is archived at http://www.lam-mpi.org/MailArchives/lam/
>

_______________________________________________
This list is archived at http://www.lam-mpi.org/MailArchives/lam/