title: When is MPI_wait necessary with non-blocking calls?
body: <p>I'm a little bit confused about when I should call MPI_Wait (or other variants such as: MPI_Waitall, MPII_Waitsome, etc). Consider the following situations: (Note: pseudo code)</p>
  
  <p>Case (1)</p>
  
  <pre><code>MPI_Isend (send_buffer, send_req);    
  // Do local work
  MPI_Probe (recv_msg);
  MPI_Irecv (recv_buffer, recv_req);
  // wait for msgs to finish
  MPI_Wait (recv_req);   // &lt;--- Is this needed?
  MPI_Wait (send_req);   // &lt;--- How about this?
  </code></pre>
  
  <p>So my confusion stems from <code>MPI_Probe</code> in this case. Since this is a blocking call, wouldn't that essentially mean it blocks the caller until message is received? If this is the case, then I think MPI_Waits are unnecessary here.</p>
  
  <p>How about the following case?</p>
  
  <p>Case (2)</p>
  
  <pre><code>MPI_Isend (send_buffer, send_req);    
  // Do local work
  MPI_Probe (recv_msg);
  MPI_Recv (recv_buffer);
  // wait for msgs to finish
  MPI_Wait (send_req);   // &lt;--- Is this necessary?
  </code></pre>
  
  <p>Similar to the first case but <code>MPI_Irecv</code> is replaced with its blocking version. In this case, the message is definitely received by the time <code>MPI_Wait</code> is called which means <code>MPI_Isend</code> must have been finished ... </p>
  
  <p>Also as a separate question, what do we mean when we say <code>MPI_Probe</code> is blocking? Does it block until all of the message is received by the process or does it only block until "meta-data" (such as msg size, sender rank, etc) is received? In other words is <code>MPI_Probe</code> + <code>MPI_Irecv</code> any better than <code>MPI_Probe</code> + <code>MPI_Recv</code> ?</p>