|
Boost Users : |
Subject: Re: [Boost-users] mpi non-blocking communication
From: Philipp Kraus (philipp.kraus_at_[hidden])
Date: 2010-11-28 07:25:19
On 2010-11-28 13:02:33 +0100, Riccardo Murri said:
> 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);
> }
I understand the recv in this way, that it waits until a message is
send. I think if I have no messages, the receive blocks the loop, do it?
I would like to create the code in that way:
while (...) {
while mpi-message-is-there
do something
}
I have tested it with recv, but I can receive only one message of my
CPU's (> 0) It should be a kind of waiting queue. Every process sends
the message with non-blocking, and the CPU 0 get every message, but I
don't know, how many message are sended.
Thanks
Phil
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