The MPI standard defines the upper bound and the upper bound for similar problems. However, even with all the functions in the MPI standard we cannot describe all types of data. There is always a solution, but sometimes one has to ask if the performance gain is worth the complexity introduced.

As I said there is always a solution. In fact there are 2 solution, one somehow optimal the other ... as bad as you can imagine.

The bad approach:
1. Use an MPI_Type_struct to create exactly what you want, element by element (i.e single pair). This can work in all cases. 2. If the sizeof(int) == sizeof(double) then the displacement inside each tuple (double_i, int_i) is constant. Therefore, you can start by creating one "single element" type and then use for each send the correct displacement in the array (added to the send buffer, respectively to the receive one).

  george.

On Oct 31, 2007, at 1:40 PM, Oleg Morajko wrote:

Hello,

I have the following problem. There areI two arrays somewere in the program:

double weights [MAX_SIZE];
...
int       values [MAX_SIZE];
...

I need to be able to send a single pair { weights [i], values [i] } with a single MPI_Send call Or receive it directly into both arrays at at given index i. How can I define a datatype that spans this pair over both arrays?

The only additional constraint it the fact that the memory location of both arrays is fixed and cannot be changed and I should avoid extra copies.

Is it possible?

Any help welcome,
Oleg Morajko


_______________________________________________
users mailing list
us...@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/users

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to