drjrm3
drjrm3

Reputation: 4718

MPI functions to 'listen' for if a node is ready

I would like to have one 'parent' node which generates data and passes it to worker nodes who will do the computations necessary on the data.

I would like the parent node to sit around and 'listen' for when a worker node tells him he is ready to receive the data.

What is the best way to accomplish this? What functions should I use for this? if I use MPI_Send(...) then I have to know which node I am sending my data to ahead of time. If I use MPI_Recv(...) to receive a message from rank 'i' saying that he is ready, then won't the parent node be waiting around on a given rank to say he is ready when other nodes may be trying to send a 'ready' message as well?

I am looking for a function where my parent node can listen for any incoming messages or will somehow know when it is safe to send a message to a given worker node.

Upvotes: 2

Views: 993

Answers (1)

suszterpatt
suszterpatt

Reputation: 8273

You can use the special value MPI_ANY_SOURCE for the source parameter in MPI_Recv, and then examine the MPI_Status object for the rank of the process that you actually received from.

Upvotes: 3

Related Questions