title: Receive multiple send commands using mpi4py
body: <p>How can I modify the following code (adapted from <a href="http://materials.jeremybejarano.com/MPIwithPython/pointToPoint.html" rel="nofollow">http://materials.jeremybejarano.com/MPIwithPython/pointToPoint.html</a>) so that every <code>comm.Send</code> instance is received by <code>root = 0</code> and the output printed. At the moment, only the first send command is received.</p>
  
  <pre><code>#passRandomDraw.py
  import numpy
  from mpi4py import MPI
  from mpi4py.MPI import ANY_SOURCE
  import numpy as np
  
  comm = MPI.COMM_WORLD
  rank = comm.Get_rank()
  
  if rank == 0:
      randNum = numpy.zeros(1)
      print "Process before receiving random numbers"
  
  
  else:
      for i in range(0,np.random.randint(1,10),1):
          randNum = numpy.zeros(1)
          randNum = numpy.random.random_sample(1)
          print "Process", rank, "iteration", i, "drew the number", randNum[0]
          comm.Send(randNum, dest=0)
  
  
  if rank == 0:
     comm.Recv(randNum, ANY_SOURCE)
     print "Process", rank, "received the number", randNum[0]
  </code></pre>