Semantics of MPI Cancel?

Lewins, Lloyd J (llewins@msmail4.hac.com)
7 Mar 1997 10:00:26 -0800

What is the correct behaviour of the following program?

Process 0 Process 1
------------- --------------
MPI_Init () MPI_Init ()
MPI_Isend (...,1,...)
MPI_Cancel ()
MPI_Wait ()
MPI_Test_cancelled ()
MPI_Barrier () MPI_Barrier ()
MPI_Probe ()

Must test cancelled return true? Must probe return false?

I believe test cancelled may return either true of false. If it returns true,
probe returns false. If it returns false, probe returns true.

Consider an implementation which uses an eager send protocol for short
messages. The Isend may be complete by the time the cancel call occurs. I
don't think the intention is that cancel is actually "unsend" in this case.

Rationale:

The standard says that cancel "marks for cancellation a PENDING, nonblocking
communication operation." (my emphasis). In the above (eager) case, the send
is no longer pending, it is complete (but not yet completed). The meat of the
definition of cancel is then to define that a subsequent wait is local, not
that a probe after the cancel is guaranteed to return false.

I would argue that if we wanted a way to "unsend", we would have this
functionality for blocking sends as well.

A related issue, consider:

Process 0 Process 1
------------- --------------
MPI_Init () MPI_Init ()
MPI_Isend (...,1,...)
MPI_Probe ()
MPI_Cancel ()
MPI_Wait ()
MPI_Test_cancelled ()
MPI_Barrier () MPI_Barrier ()
MPI_Recv ()

Assuming the probe returns true, should the cancel go ahead or not? If it
does, then the standard is violated with regards to the recv (a probe showed a
message exists, but the receive doesn't get it). If it doesn't,
the standard is violated with regards to the cancel (the wait is not
local). Catch 22.

I believe that the send should be canceled, and that we need to add clarifying
text to probe (the recv gets the message, assuming no other recv has grabbed
it AND the send was not successfully canceled).

Comments?

Lloyd Lewins
Hughes Aircraft Co.,
llewins@msmail4.hac.com