Re: Semantics of MPI Cancel?

Eric Salo (salo@mrjones.engr.sgi.com)
Sat, 8 Mar 1997 02:31:58 -0800

> What is the correct behaviour of the following program?

Good grief! Is this a real problem for a code, or are you just being evil???

> 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?

My belief is that if we go with a strict interpretation of the standard,
test_cancelled must return true and probe must return false. Meaning, that for
100% "correctness" an UNSEND message is needed here. Which is a big chunk of
why, after more than two years now, I still haven't bothered to implement
cancel for sends...

> 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.

Well, the standard says that either the cancel must succeed or the request must
be guaranteed to complete. But until a matching receive is posted, there is no
way to ensure that this completion will ever occur. I think you are using the
common (and more useful) defintion of "complete" rather than the official one.

> 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 ()

You are a twisted man. Please seek professional help before it's too late.

-- 
Eric Salo    Silicon Graphics Inc.    salo@sgi.com