title: What should be the 'count' paramerter of MPI_reduce when using derived types created with MPI_Type_struct()?
body: <p>I'm not sure I understand correctly the difference between the 'count' parameter in :</p>
  
  <pre><code>    int MPI_Reduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, 
             MPI_Op op, int root, MPI_Comm comm);
  </code></pre>
  
  <p>and the 'blocklens' parameter of : </p>
  
  <pre><code>int MPI_Type_struct(int count,
                 int blocklens[],
                 MPI_Aint indices[],
                 MPI_Datatype old_types[],
                 MPI_Datatype *newtype);
  </code></pre>
  
  <p>Say I want to perform a reduction of my own type :</p>
  
  <pre><code>typedef struct buffers_s
  {
     double *buf1, *buf2;
  } Buffers;
  </code></pre>
  
  <p>where buf1 and buf2 are both allocated to N elements.</p>
  
  <p>Then when calling MPI_Type_struct() to create a new mpi type 'Custom_MPI_Type' based on 'Buffers', I would set 'count' to 2, blocklens[0] to N and blocklens[1] to N too.</p>
  
  <p>Then when the MPI type is created, assuming I have also created a reduction operator 'MyOp', I would call MPI_Reduce() with 'datatype' set to 'Custom_MPI_Type'. What then should be the value of the 'count' parameter ?</p>
  
  <p>From my experience setting it to N works, however I don't really understand the meaning of that, considering I've already specified that the MPI type I've just created was made of 2 blocks of length N. </p>
  
  <p>Said differently, when using MPI_Reduce() with arrays of basic types such as MPI_FLOAT, the 'count' parameter specifies the number of elements of type MPI_FLOAT starting at the address given as a first argument of MPI_Reduce()... so logically I would have expected, when using a custom Datatype, to set count to 1 element of type Custom_MPI_Type, provided that MPI already knows this type consists of 2 blocks of N elements of a given basic MPI_Datatype such as MPI_DOUBLE.</p>
  
  <p>Could someone explain all that ?</p>