Re: Clarification of close semantics
Bill Nitzberg (nitzberg@nas.nasa.gov)
Fri, 28 Feb 1997 14:41:09 -0800
John May wrote
> The definition of MPI_Close says "The user is responsible
> for ensuring that all outstanding requests associated with
> fh have completed before calling MPI_CLOSE." (See p217,
> lines 1-2 of the Feb 7 draft.)
>
> This clearly applies to outstanding requests on the node
> that's calling close, but what about outstanding requests
> on the same open file on other nodes? In other words, is
> it legal for the user to allow this to happen:
>
>
> Node 0 Node 1
> MPI_Open( ... "myfile" ... &fh ) MPI_Open( ... "myfile" ... &fh )
> . .
> MPI_Iread( ... fh ... &req ); .
> . MPI_Close( fh ); /* legal? */
> MPI_Wait( req ... );
> MPI_Close( fh );
>
> Neither node has a local outstanding request when it calls
> MPI_Close, but Node 0 has an outstanding request when Node 1
> calls close on the same file. (The same problem comes up if
> Node 0 issues a blocking read has not completed by the time
> Node 1 calls MPI_Close.)
>
> Can we get a clarification of this case?
>
> John
My understanding is that this case is no different from the following
clearly legal case:
Process 0 Process 1
MPI_Send( node 1, ...)
MPI_Finalize()
MPI_Receive( node 0, ...)
MPI_Finalize()
The MPI implementation is responsible for ensuring that all requests
completed by the user are actually carried out by the system (except
when exceptional conditions prevent, e.g, memory overflow).
MPI does not require the user to synchronize, nor does it require the
implementation to synchronize, but it does require the implementation
to ensure that the user's unsynchronized code works.
Nick Maclaren wrote:
> But MPI_CLOSE is a collective routine. The way that I read it, the
> processes will call MPI_CLOSE and lock up, until the last has called
> in. At some time after that, they will be released. If I am right,
> is there still a problem?
Although an implementation is free to "lock up", it is not required
to do so. Clever implementations may not need to synchronize at close.
- bill