title: openmpi: how to receive and send data between the root thread and a random (the fastest) other thread?
body: <p>my basic problem is having multiple threads doing stuff and some of them need much more time (20 times as much and more) as others, the time they need depends only on a starting value but it is not predictable from the starting value alone how much time they need. To reduce the idling time for the faster threads i want to balance the workload by designating a single thread (the root thread) that distributes the workload for the others (i want it to send a new starting value if a thread has finished his work and asks for a new one).</p>
  
  <p>Ideally there would have been a MPI function that can just send a value (the next starting value) to whoever thread that grabs it at first (because i am not interested which thread has calculated which starting values). But i could not find such a function, is there one?</p>
  
  <p>Then i thought i could combine the basic MPI_Recv and MPI_Send functions, my idea was to have the root waiting on a MPI_Recv and the other threads calling a MPI_Send (with the destination: root) sending their ID as soon as they have finished with their work.
  After the root receives the ID of the other thread it calls a MPI_Send (destination is the calling thread) to send them the new starting value. At the same time the other thread has called a MPI_Recv to receive the new starting value. Then the root thread gets looped back to the MPI_Recv and waits for the next finished thread.
  But then i noticed that MPI_Recv also needs an explicit source value! So the root cannot just wait on a MPI_Recv without knowing which thread will finish next! </p>
  
  <p>What can i do, is there a way to have the root thread communicate with the first thread that reaches a designated point in the program (some MPI function)?</p>
  
  <p>Thank you.</p>