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-07-22 05:16:10


Hi all,
  I would like to learn more about communcation mode and wonder if
there are any codes for demonstrating the differences between each mode.
Thinking about the following case, a all-to-all communication performed
in a loop

  for (t=0; t<NC; t++) // NC computers in the parallel network
  {
    if (t!=myrank) // don't send the message to myself
    {
      if (t<myrank) // avoid deadlock
      {
         // N stands for the size of buffer to be sent or received, N>100
          MPI_Send(send_buf, N, MPI_INT, to, stag, MPI_COMM_WORLD);
          MPI_Recv(recv_buf, N, MPI_INT, from, rtag, MPI_COMM_WORLD,
MPI_STATUS_IGNORE);
      }
      else
      {
          MPI_Recv(recv_buf, N, MPI_INT, from, rtag, MPI_COMM_WORLD,
MPI_STATUS_IGNORE);
          MPI_Send(send_buf, N, MPI_INT, to, stag, MPI_COMM_WORLD);
      }
    }
  }

In the above code, blocking send/receive in stand mode have been used.
I have few questions about the send/recive process.

1) Because the send/recive procedure are run in a loop, for blocking
methods, will the loop pause until the current send/receive procedure
are finished?

2) If nonblocking send/recv are imposed, will the loop go on without
waiting the send/recv's finish? If so, how can I make sure the
each node receive the correct data (i.e. each send-receive procedure go
without any problem)?

3) Will the answer of 1) 2) change in other communcation mode?

Thanks in advance.

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