I have 41 computers that used MPI on the same local area network. MPI works good on these machines without any problem. I want to use one of them for sending a float number to the other 40 computers by selecting randomly. I mean that the main distributor computer will randomly select a host and send a float number to it. This process will be performed repeatedly.These 40 hosts will use these float numbers for their calculations. The random selection is needed for some “heuristic optimization” reasons. Thus, for sending a float number, some hosts may be selected frequently, some hosts may be selected rarely (may be never selected).
I tried to understand the blocking and nonblocking communication by reading the documents and using the examples. As a result, I saw that I cannot use MPI_Send and MPI_Recv for a randomly selection as I mentioned. Because, the receiver hosts have to wait for the sending process of distributor computer without doing any benefit calculation as a nature of their blocking model. MPI_ISend and MPI_IRecv may be useful but I could not find a way. Because the example programs which I found mostly used MPI_Wait. Eventually these programs also wait for the data from distributer computer without doing anything. My hosts must check for the message but if there is no message, it must continue its own calculations with initial float number values or the values which is previously received.
How can I do it? At least, which functions can be used for this purpose.
Thanks for reading
MPI_Testis what you’re looking for. It will poll a nonblocking receive initiated byMPI_Irecv, and return immediately even if the communication didn’t complete yet. You can check theMPI_Statusobjectflagparameter after the call to see whether a new message was received or not, and branch accordingly.