Boost logo

Boost Users :

Subject: Re: [Boost-users] mpi isend to group
From: Andreas Schäfer (gentryx_at_[hidden])
Date: 2012-12-31 06:58:09


On 00:23 Mon 31 Dec , Philipp Kraus wrote:
> The algorithm has got a "initialization", so the core 0 must send an
> identifier to all other cores and each core can initialize all data for the
> algorithm locally and independend from the other cores. So I need only the
> exchange of the ID. After all cores have finished their local initialization the cores
> must be "synchronized". So I named this initialization "preexecution".
> For the algorithm the time length of this preexecutation is irrelevant, so I
> need only that each core gets the ID from core 0 and after initialization the core
> must be switched into a "synchronized communication".

Ah, I get it. Thanks!

> >> I do it at the moment with:
> >>
> >> while (thread_is_running) {
> >>
> >> if (!l_mpicom.rank())
> >> for(std::size_t i=1; i < l_mpicom.size(); ++i)
> >> l_mpicom.isend(i, 666, l_task.getID());
> >> else
> >> if (boost::optional<mpi::status> l_status = l_mpicom.iprobe(0, 666))
> >> {
> >> std::size_t l_taskid = 0;
> >> l_mpicom.recv( l_status->source(), l_status->tag(), l_taskid );
> >> }
> >> }
> >
> > You could rebuild the binary tree communication scheme I've
> > illustrated using Boost MPI (I'm too lazy). I'm pretty sure calling
> > isend() without ever waiting for completion is illegal according to
> > the MPI standard and will result in a memory leak (plus the code won't
> > scale thanks to the for loop).
>
> I don't see a problem !? While loop checks on each iteration if there is
> a message in the MPI queue, if not I can do other things. If a message
> in the queue, I read them, and store it in my local variable and work with
> the value later (not shown here in the example).

The problem is that you never seem to call MPI_Wait() for the requests
generated by MPI_Isend (or Boost MPI's isend(), which is in fact
"just" a convenient wrapper). Let me quote the the man page:

  "Nonblocking calls allocate a communication request object"
  
These requests are only freed after calling MPI_Wait for them. Hence
the memory leak.

> Thanks for the great discussion

You're welcome. :-)

Cheers
-Andreas

-- 
==========================================================
Andreas Schäfer
HPC and Grid Computing
Chair of Computer Science 3
Friedrich-Alexander-Universität Erlangen-Nürnberg, Germany
+49 9131 85-27910
PGP/GPG key via keyserver
http://www.libgeodecomp.org
==========================================================
(\___/)
(+'.'+)
(")_(")
This is Bunny. Copy and paste Bunny into your 
signature to help him gain world domination!



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