[mpich-discuss] Reading buffers during MPI call in multithreaded application

Balaji, Pavan balaji at anl.gov
Tue Aug 16 15:34:42 CDT 2016

> On Aug 16, 2016, at 3:12 PM, Mark Davis <markdavisinboston at gmail.com> wrote:
>> At the non-root processes, MPI_Bcast behaves like a MPI_Recv call, and thus
>> you cannot touch the buffer until the function returned.
> That part makes sense. I'm not allowing the buffer to be read or
> otherwise used on non-root threads. It makes sense to me that this
> acts as a MPI_Recv call.
> The thing that I'm confused by is on the root process, as it seems
> that the root process' buffer is also written to during the course of
> the MPI_Bcast; it should act like an MPI_Send. It seems like this is
> just an implementation detail, and as you pointed out, since the
> MPI_Bcast buffer is not marked const, anything could happen.

As of MPI-2.2, we allowed the root process to read from the buffer while communication is going on for point-to-point and collective operations.  In MPI-3.0, we removed that wording when we added "const" attributes, and might have accidentally removed the wording in collectives also even though we didn't add const in all cases.  I didn't get a chance to look through the MPI-3.1 standard, but if we missed that, we should fix it.

The intention is that MPI_Bcast allows the user to read from the buffer at the root process, but not write to it.  So, for example, you can do multiple MPI_Ibcasts from the same buffer.

  -- Pavan

discuss mailing list     discuss at mpich.org
To manage subscription options or unsubscribe:

More information about the discuss mailing list