Boost logo

Boost Users :

Subject: Re: [Boost-users] mpi non-blocking communication
From: Riccardo Murri (riccardo.murri_at_[hidden])
Date: 2010-11-28 07:02:33


Hi,

On Sun, Nov 28, 2010 at 12:54 PM, Kraus Philipp
<philipp.kraus_at_[hidden]> wrote:
> The CPU 0 (rank 0) creates a loop with this:
> while (true) {
>      std::string l_str;
>      p_com.irecv( mpi::any_source, LOGGER_MPI_TAG, l_str );
> }
> p_com is the commuicator object. All other CPUs (!= 0) can send a message to
> CPU 0, which should be received. The CPUs (!=0) can send a message, but they
> need not, so I would create this with non-blocking communication. At this
> time my l_str is alway empty, so it seems that the message, that are send,
> not transmittet, received or not inserted into l_str.

`irecv` means "start receving" (sort of); the message is actually
fully received (and available in `l_str`) when the corresponding
request is completed (use mpi::test_* or mpi::wait_* on the return
value of the irecv call).

If you want the message data to be available as soon as the receive
function returns, use `recv` instead of `irecv`::

  while(...) {
    std::string l_str;
    p_com.recv(mpi::any_source, LOGGER_MPI_TAG, l_str);
  }

Best regards,
Riccardo


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net