In the MPI documentation I read that the difference between MPI_Type_vector
and MPI_Type_contiguos
is that the first allows to specify a stride gap between the elements of the array.
Why one should be interested in doing that instead of using simply a MPI_Type_contiguous
?
You can see
MPI_Type_contiguous()
as a special case ofMPI_Type_vector()
with no stride.For example, in Fortran, arrays are column major. so if you consider the following array
The derived datatype for a column can be obtained with
or
or
But the only way to describe a row is via
MPI_Type_vector()
Note that if you want to send/receive several rows at once, you will need to resize the datatype, so the full sequence would be