While trying to simulate the behaviour of a network using OpenMPI, I am experiencing an issue which can be summed up as follows:
Rank 2 sends a message (message1) to rank 0;
Rank 2 sends a message (message2) to rank 1;
Rank 2 sends a message (message3) to rank 0;
At his own turn, rank 0 receives both messages from rank 2 and forwards them to rank 1 (in the correct order);
Rank 1 receives the messages in the following order: message1, message3 and message2.
This behaviour only occurs only once in a while running the program. Usually (6 times out of 7), following the same pattern, rank 1 appears to receive the messages in the expected order (i.e: message2, message1, message3)
I am only using the basic MPI_Recv and MPI_Send functions.