Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: Re: [OMPI users] Passing data structure
From: Danesh Daroui (Danesh.D_at_[hidden])
Date: 2008-04-11 13:47:07


Hi Alessandro,

As far as I understood , you want to send a row of your two dimensional
array using MPI sending functions.
This is of course possible in a simple way. You can send/receive data
with any type and any size using MPI
but you should tell MPI the type your data using MPI_Datatype structure.
For example code below send 10
integers in an array of ints in C:

int temp[10];
.
.
.
MPI_Send(tmp, 10, MPI_INT, procID, mtag, THECOM);

Use this link to see a complete list of MPI data types:

http://users.cs.cf.ac.uk/David.W.Walker/mpitutorial/node50.html

Cheers,

Danesh

Alessandro Palandri skrev:
> Hello,
>
> I am a new user of MPI and I would like to have your opinion on the
> following issue.
> With 1 processor I keep the data in
>
> std::vector<std::vector<double> > X
>
> Then I call a function that takes various arguments, among which X[ i
> ] and X[ j ], i.e. two sub-vectors of X.
>
> With MPI I would have the same function execute on different
> processors for different values of i and j in X[ i ] and X[ j ].
>
> From my understanding since std::vector is not an MPI type it cannot
> be passed neither as a message nor an element of an MPI structure. I
> thought of using
>
> double X[200][4000]
>
> which MPI would pass but I don't see how to isolate a single row, i.e.
> X[99] would not make sense in this context.
>
> Any suggestion for an efficient and possibly simple solution?
>
> Thank you for your help,
>
> Alessandro
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> users mailing list
> users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/users