Boost logo

Boost Users :

Subject: Re: [Boost-users] [MPI] lifetime of data sent through communicator::isend()
From: Belcourt, K. Noel (kbelco_at_[hidden])
Date: 2010-11-21 11:50:36


Hi Riccardo,

On Nov 21, 2010, at 2:18 AM, Riccardo Murri wrote:

> On Sun, Nov 21, 2010 at 9:27 AM, Heiko Bauke <heiko.bauke_at_[hidden]>
> wrote:
>> Riccardo Murri <riccardo.murri_at_[hidden]> wrote:
>>> I'm using mpi::communicator::isend where the payload data comes
>>> from a
>>> pointer (e.g., "req = comm_.isend(dest, tag. *data)").
>>> When am I free to "delete" the pointer? Immediately after isend()
>>> returns? Or should I wait until the request is completed?
>>
>> yes, you have to wait before you can free your memory. See
>> http://www.mpi-forum.org/docs/mpi22-report/node57.htm
>> and the following pages.
>>
>
> Thanks for the answers. However, I think I didn't make myself clear:
> I know what I should do with the C-level MPI_ISend() calls, I'm not
> sure what I can do after an Boost.MPI's communicator::isend().
>
> My reading of the docs is that Boost.MPI creates an instance of
> boost::mpi::packed_oarchive archive and sends *that* one with
> MPI_ISend(). So the question is: can I "delete data;" immediately
> after I do "communicator::isend(..., *data);", or does the Boost.MPI
> archive hold a reference to the "*data" buffer? In other words, does
> Boost.MPI *copy* data into the archive or does it just reference it
> somehow?

It seems you're asking what the Boost.MPI implementation does and, to
me, you shouldn't depend on an implementation detail of Boost.MPI for
the correct operation of your code. I'd stick to the documented
behavior and either use a blocking form of send so that you know
you're free to release the data once send returns, or use iSend and
correctly interrogate or wait on the returned request object.

-- Noel


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