LAM/MPI logo

LAM/MPI General User's Mailing List Archives

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

From: L WK (phase2phasel_at_[hidden])
Date: 2005-08-06 18:23:56


Hi there,
  Suppose I have 2 nodes take part in the parallel computing. Initially,
each node owns a full identical 2D array as follow

 _______________________
| 0 | 1 | 2 | 3 | 4 | 5 |
|---|---|----------------
| 6 | 7 | 8 | 9 | 10| 11|
 ------------------------

the array are divided into 12 parts

Assume that
 rank 0 will exchange data with rank 1:
 * rank 0 send part 1,2 to rank 1; rank 1 recv data and copy to part 0, 6
 * rank 1 send part 0,6 to rank 0; rank 0 recv data and copy to part 1, 2

In this case, if I don't know which node will send data first. Suppose rank
0 send data first, so rank 1 get data and copy them to the position of part
0, 6, then part 0,6 will get exactly the same data as part 1,2. So, in the
mean time, rank 1 sends part 0,6 (extactly identical to part 1,2) to rank
0. We know that the data being sent is not what rank 1 really want. What I
want to do is data exchange, someone suggest that I should setup an
additional buffer and have my code like

 rank 0:copy part 1, 2 to A; send A to rank 1; recv data from rank 1 and
copy to part 1,2
 rank 1:copy part 0,6 to B; send B to rank 0; recv data from rank 0 and
copy to part 0,6

it do work. However, I need an extra storage and time to perform the copy
operation( in this case, the cost maybe negligible, but in real case, the
cost is much larger). Is there is any better approach for my issue ?

Thanks in advance.

_________________________________________________________________
ÓëÁª»úµÄÅóÓѽøÐн»Á÷£¬ÇëʹÓà MSN Messenger: http://messenger.msn.com/cn