Sample solution
Content |
This works indeed as we can work with multiple blocks in this case where one block represents a row of a our matrix. This works only in cases where the elements of a row are stored consecutively in memory, i.e. where we have A.incCol() == 1:
MPI_Type_vector( /* count = */ A.numRows(), /* blocklength = */ A.numCols(), /* stride = */ A.incRow(), /* element type = */ get_type(A(0, 0)), /* newly created type = */ &datatype);