How to check if irecv got a message?

say I have:

t = tensor.torch(0)
req = dist.irecv(t, rank)

how can i check if i have messages from some rank (stored in buffer or something). From c++ examples ive seen there are probe commands:

MPI_Probe(0, 0, MPI_COMM_WORLD, &status);

to check message length.
One possible solution would be to check if tensor != 0 but that doesnt seem to be the right way to do it

1 Like

Do you get a better solution?

We probably should set the complete_ flag in the send/recv work object and expose that as a Python API. Similar issue exists in our Future API.

@Yanli_Zhao mentioned that this is also asked in https://github.com/pytorch/pytorch/issues/30723

added an issue to track: https://github.com/pytorch/pytorch/issues/41428