I need to create an MPI derived type to represent a class in my program. The class is fairly straight forward, but large (about 75 data members**). All the data members are
The easiest way to go is to just treat the whole object as a big buffer:
MPI_Datatype datatype;
MPI_Type_contiguous(sizeof(RestartData), MPI_BYTE, &datatype);
MPI_Type_commit(&datatype);
I don't see the benefit of telling MPI about the internal structure of your class.
Alternatively a 2D array is an array of 1D arrays. So (I imagine) you could use one call to MPI_Type_contiguous
per array dimension to build up the array datatype.