In MPI I can see if there are any messages waiting for a given process with MPI_Probe
. That will tell me who sent me the message, its tag, and importantly how big it is. If for some reason a sender tries to send me a message that is too large (I don't have enough memory to process it), I want to ignore that message forever. "nope, that's too big. you weren't supposed to do that"
One way we came up with was to do a zero-byte receive of the message. We would then have to set an MPI error handler for just this one case to ignore "message truncated".
Another way would be to call MPI_Iprobe
and skip over the message we do not want. The offending message is still there in the message queue, though, getting in the way (and maybe consuming resources we'd like spent elsewhere).
It feels like there should be a "zap this message" routine in MPI, but given how difficult it is to implement "cancel send" from the sender process, I can only imagine the difficulty when the receiver asks the sender to "cancel send"