How to send a message without a specific recipient in MPI?

I want to send a message to one of the ranks receiving a message with a specific tag. If there is any rank, the received message and the message is consumed. In MPI_Recv (), we can receive a message using MPI_ANY_SOURCE / MPI_ANY_TAG, but MPI_Send () cannot do this. How to send a message with an unknown address? MPI_Bcast () cannot do this, because after receiving I have to respond to the original process. Thank.

+5
source share
3 answers

What I would do is that the workflow signals the owner that he is ready to receive. The wizard will keep track of which ranks are ready, select one (first lowest rank, random, round robin, as you like), send it and clear its β€œready” flag.

+4
source

Do you want to just send a message to a random rank?

 MPI_Comm_size(MPI_COMM_WORLD, &size);
 sendto = rand() % size;
 MPI_Send(buffer, count, MPI_CHAR, sendto, 0, MPI_COMM_WORLD);
+1
source

: MPI.

: , , . , - . Suszterpatt, "" , , , - ( .. 1000 , , ).

+1

All Articles