Concurrent receiveing/sending from/to one sender/receiver
I wonder if it is possible to concurrent receive the message from one sender, and other way round to concurrent sent to one receiver. And if yes how it will behave?
To make the question more clarified let imagine we have 4 threads, each of them is listening on message from the same source
MPI_Recv(buf, count, type, THE_SAME_SOURCE, tag, status)
All those thre开发者_JAVA技巧ads are within the same MPI process, so all they have the same MPI rank. And from other MPI process or the same but from different thread, someone called MPI_Send. Does each of the receivers receive the same message, or just one of them, or some exception is thrown (error occured)?
And other way round, what if 4 threads (within the same MPI process or not) send message to the one receiver which may also be in the same MPI process or not. Does it receive all the messages?
I do not have big experience with MPI, and answer for above question may help me a lot.
Thanks
Receives are processed in the order they are registered. There is never an "at the same time" situation, since they are synchronised.
Description of Point-To-Point Communication Semantics
So, in your first circumstance, this means that the one send that happens when four threads are waiting to receive will be sent to the first thread to have registered for receive, and the others will continue to wait for subsequent messages.
In your second circumstance, again there is no "at the same time". The first thread to send the message will be the one that is received by the receive thread. Other sends will not have receivers registered.
精彩评论