So I'm writing a program to bounce a "virtual ball" between processes. The root process i.e. the task with rank 0 initializes the game and then sends it to a random process which is determined by rand() % size
(with the random number generated seeded by the initial rank).
I've tried doing:
int rnk= rand() % size;
MPI_Send(&ball,1, MPI_INT, rnk, MPI_COMM_WORLD);
This sends the ball to the next random process but upon running this the code is held up by the blocking MPI_Send. I've just begun parallel programming so I don't have enough grasp of this. How do I send to a random process and then they further send it to any random process?
Any pointers, tips, books and tutorials are welcome.