Hi Pavan,
Ok, I got the point about unexpected messages. I can modify the program according to your note.
But things aren't clear enough for me yet.
You said:
You don’t need to know how many messages you will receive. You only need to make sure that whenever a message comes in, it knows which buffer it should go into. One way to fix that is to post N receives with ANY_SOURCE and ANY_TAG:
I understand that I will have to have N buffers, one for each posted MPI_Irecv. I will also have to TEST (using MPI_PROBE or MPI_WAITANY) until a message comes. The result of this test will identify which one of the posted MPI_Irecv has actually received the message and then process the right buffer. Is this correct?
Should I have to change anything at the sender's processes?
At the end, my receiver process receives a message identifying that it should exit this routine. What should I do with the already posted MPI_Irecv's? Can I cancel them?
Sorry for the newbie questions and thanks in advance for your attention.
Regards,
Luiz