Re: Clarification of close semantics

W. Saphir (wcs@nersc.gov)
Fri, 28 Feb 1997 15:42:14 -0800

On Feb 28, 3:08pm, Linda Stanberry wrote:
> I think this is different from your example in that MPI_Close is a
> collective call and (if I got this right) MPI_Finalize is not? I'm
> still learning MPI-1 semantics, obviously, but if I understand them
> correctly, it is erroneous for a collective call to be issued
> without synchronizing (making sure no other op is pending).

No. It might be helpful to know what you read that gave
you this impression, so we can fix it if possible.
The requirement for a collective call is that all processes
call it. They do not need to synchronize before. A collective
call may or may not synchronize - this is left to the implementation
and sometimes depends on the semantics of the call (e.g.,
no process can return from MPI_Barrier until all have called
it, but this is not true of MPI_Bcast. )
An implementation is allowed to synchronize on any collective
call, so if your MPI-IO implementation can't work unless
you do some synchronization inside of MPI_CLOSE, go ahead
and do the synchronization there.
See, for example, the advice to impelmentors on page 223
of MPI: The Complete Reference, under the description of
MPI_COMM_FREE.

> The wording
> for MPI_CLOSE is a little blurry about whether it is erroneous to call
> MPI_CLOSE without synchronizing (1) just on all threads on this node or
> (2) on all threads on all nodes to guarantee that there are no outstanding
> requests on the given file handle.

I see what you're asking.
The language says "The user is responsible for ensuring that
all outstanding requests have completed." According to the
usual MPI understanding, this means only *local* requests,
not requests on other processes. Perhaps this should be
clarified somewhere in the text.

There has been some debate recently (in the context of MPI_Finalize)
about whether
MPI_Isome_function_that_creates_a_request(..., &request)
MPI_Request_free(&request)
MPI_Finalize()

is correct.
But there is no debate that Wait and Test (if successful)
complete a request. Note that "complete" in MPI is
usually defined at the user level. An operation is
complete if MPI_Wait() returns, although the implementation
may still be moving the data under the covers. (e.g.,
for a non-blocking Send).

Bill

Bill