title: Can MPI_Gather be used to receive data from threads that use MPI_Send?
body: <p>I have a master process and more slave processes. I want that every slave process to send back to the master one integer, so I guess I should gather them using MPI_Gather. But somehow it doesn't work and I started to think that MPI_Gather is incompatible with MPI_Send.</p>
  
  <p>The relevant lines of code look like this:</p>
  
  <pre><code>MPI_Init(&amp;argc, &amp;argv);
  MPI_Comm_rank(MPI_COMM_WORLD, &amp;process_id);
  MPI_Comm_size(MPI_COMM_WORLD, &amp;process_count);
  
  int full_word_count = 0;
  int* receiving_buffer = (int*)malloc(sizeof(int) * 100);
  
  if (process_id == 0)
  {
      // Some Master code here ...
  
      MPI_Gather(full_word_count, 1, MPI_INT, receiving_buffer, 1, MPI_INT, 0, MPI_COMM_WORLD);
  
      // ...
  }
  else
  {
      // Some Slave code here ...
  
      MPI_Send(full_word_count, 1, MPI_INT, 0, 0, MPI_COMM_WORLD);
  
      //...
  }
  
  MPI_Finalize();
  </code></pre>
  
  <p>I also know that I used "1" for MPI_Gather because I tried to run only for two processes, so process 1 would send, and process 0 would gather; of course, for more processes I should modify it using ranks. But my main question here is that I can use (and if yes, how) MPI_Gather combined with MPI_Send for a situation like this.</p>