title: Can I use MPI_Bcast to synchronize?
body: <p>I need to perform an operation that can be performed only by the master process. The slaves can't really do anything but wait for the master to finish. I therefore did the following (pseudocode, I wrap most routines, so I would have a hard time coming up with the actual MPI code. I hope the comments are clear enough in explaining what I am doing)</p>
  
  <pre><code>def routine():
  
      if not isMaster(): 
          # I am a slave. I just sit here, waiting for the master to finish.
          # wait for a string from the master explaining the state
          string = MPI_Bcast("whatever", 0) 
          return (string == "SUCCESS")
  
      &lt;master does its long running business&gt;
  
      string = MPI_Bcast("SUCCESS", 0) # tell the slaves it worked fine.
  
      return True
  </code></pre>
  
  <p>Does this work, or am I misusing the broadcast?</p>