c - Sending to and receiving from different processes in MPI -


so i'm writing program bounce "virtual ball" between processes. root process i.e. task rank 0 initializes game , sends random process determined rand() % size (with random number generated seeded initial rank).

i've tried doing:

int rnk= rand() % size; mpi_send(&ball,1, mpi_int, rnk, mpi_comm_world);

this sends ball next random process upon running code held blocking mpi_send. i've begun parallel programming don't have enough grasp of this. how send random process , further send random process?

any pointers, tips, books , tutorials welcome.

there issue here if root tries send (which can happen since rand()%size zero).

  • if post receive first on root block never send call (as pointed out @gregor above);
  • however, if post send first on root there no guarantee ever progress receive call mpi_send() not guaranteed asynchronous (i.e. implemented synchronous send wait forever matching receive).

you need either ensure sender never sends itself, or use non-blocking sends (or non-blocking receives) avoid potential deadlock.


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -