Am 02.12.2010 um 18:00 schrieb Riccardo Murri:

Hi Philipp,

On Thu, Dec 2, 2010 at 4:12 PM, Philipp Kraus
<philipp.kraus@flashpixx.de> wrote:
There is only one problem at the time:  The CPU 0 does not catch every
message.
The main method:

MPI::Init_thread( argc, argv, MPI_THREAD_SERIALIZED );
mpi::communicator loMPICom;
tl::logger::getInstance()->startListener(loMPICom);
tl::logger::getInstance()->write(loMPICom, tl::logger::warn, "test all");
tl::logger::getInstance()->shutdownListener(loMPICom);
MPI::Finalize();


So every process shoudl create a message and the CPU 0 should catch them
all. The write method sends the data with isend (non-blocking).
The CPU 0 runs a thread in background with

while (m_listenerrunnging) {
       while (boost::optional<mpi::status> l_status =
p_mpi.iprobe(mpi::any_source, LOGGER_MPI_TAG)) {
                       std::string l_str;
               p_mpi.recv(  l_status->source(), l_status->tag(), l_str );
       }
       boost::this_thread::yield();
}


This code for the background thread will only probe for new messages
until m_listenerrunnging is true; as soon as it turns to false (in
logger::getInstance()->shutdownListener?), it will stop and receive no
more messages.

You probably want to make it run until all messages have arrived.  How
you do this depends on your application: if you know how many messages
will be coming, just count them; if you don't, make ranks !=1 send an
"end of transmission" message when they are done and only shutdown the
listener when all "end of transmission" messages have been received.
There might be other methods that are more suited to your application.

Okay, that answers my question: It is also my problem to solving the transmission. The MPI interface has no implementated code.

If I run the program some times, I receive at one run 1 message,
sometimes 4 or 5, but it's not deterministic.

MPI guarantees reliable delivery of messages but not within a specific
timeframe. IOW, messages will be received *if you wait long enough*.
If you shut down the receiver end too early, messages will be lost.

I think that is the main problem, so I must send a EO? for close all transmission.

Thanks

PHil