Episode 1: derived datatypes
Closed this issue · 4 comments
- Data representation in MPI with typemaps.
- Type constructors and life cycle of user-defined types.
- User-defined packing and unpacking.
- Exercise: ?
In GROMACS we frequently pass around XYZ triples of either float or double. One could express that as an array of structs, and now a derived datatype is nice for MPI on it.
One could also express it as an array of the underlying type that is manually managed to be 3 times as large. That makes it clean to use MPI with MPI_FLOAT/MPI_DOUBLE and that same size. This runs faster because it is a built-in datatype. So there's useful tradeoffs to discuss with the students.
One could also have a struct with three separate arrays for X, Y, and Z and now you can make a different derived datatype for that.
The graphic for MPI_Pack is much improved. I further suggest that the *position
indicators on it are changed to be outbuf+*position
so it is more consistent with the words. (Position isn't a pointer, it's an offset from the outbuf
pointer`)
Likewise for the MPI_Unpack
graphic