title: MPI_Probe Using MPI_ANY_TAG, Always Returns status.MPI_TAG = 0
body: <p>I am trying to create a message handler that blocking-probes for a message with any tag:</p>
  
  <pre><code>MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &amp;probe_status);
  </code></pre>
  
  <p>And then act accordingly depending on the tag:</p>
  
  <pre><code>int tag = probe_status.MPI_TAG;
  if (tag == 0){
      // The message is of type a
  }
  else if (tag == 1){
      // The message is of type b
  }
  </code></pre>
  
  <p>However, <code>probe_status.MPI_TAG</code> is always evaluating to 0, even though I've isolated the senders and only have a single <code>MPI_Isend</code> using tag 1.</p>
  
  <p>EDIT:
  In fact, even </p>
  
  <pre><code>MPI_Probe(0, 1, MPI_COMM_WORLD, &amp;probe_status);
  
  cout &lt;&lt; rank &lt;&lt; ": a message has been found with the probe, with tag " 
       &lt;&lt; probe_status.MPI_TAG &lt;&lt; ", source " &lt;&lt; probe_status.MPI_SOURCE &lt;&lt; " 
       and size " &lt;&lt; probe_status.count &lt;&lt; endl;
  </code></pre>
  
  <p>Gives: Tag 0, source 12 and size 0. There are only 2 nodes running and the probe blocks if the sender is removed so it is finding the 'correct' message being sent from node 0.</p>
  
  <p>EDIT2:
  The sender is this:</p>
  
  <pre><code>unsigned int rank = MPI::COMM_WORLD.Get_rank();
  unsigned int nodes = MPI::COMM_WORLD.Get_size();
  
  for(unsigned int i=0; i&lt;nodes; i++){
  // Send the release to all nodes except the current
      if(i != rank){
          int taskid[5];
          convert_task_to_id(task_name,taskid);
  
      Message* message = get_available_message();
      memcpy(message-&gt;taskobject_id,taskid, sizeof(taskid));
  
      message-&gt;available = false;
      MPI_Isend(&amp;(message-&gt;taskobject_id), 3, MPI_INT, i, 1, MPI_COMM_WORLD, &amp;(message-&gt;request));
  }
  }
  </code></pre>
  
  <p>Where <code>Message</code> is a <code>struct</code> holding <code>MPI_Request</code> and a <code>bool</code> available (so that I can re-use <code>MPI_Request</code>s as they are finished with). In this example, only node 0 sends, and only node 1 will find a message. Using MPICH 3.0.4. </p>
  
  <p>Thanks for any help.</p>