ENCCS/intermediate-mpi

Datatypes episode

Opened this issue · 0 comments

To consider

  • Give less space to the communicators and groups episodes in favor of more in-depth treatment of datatypes.

To change

  • Clarify the meaning of displacements in the typemap
  • In the my_pair type-along, the addresses are relative to whatever MPI thinks is the first byte in memory. Make it so that they are relative to the first field in the data structure
  • Clarify why/when to use pack/unpack and why/when to define datatypes.
    • The former can incur overhead, e.g. calls to functions in a dynamically linked library (-lmpi) are slower than calls to functions in your executable.
    • The latter is essential if we want to perform reductions with a custom operation.

To add

  • Defining custom operations on custom datatypes. This could fit in the collective episode.
  • Short discussion of whether it is possible to automatically generate the MPI representation of custom datatypes.
    • Automatic serialization/deserialization libraries (like Cereal for C++) but using these is not exactly the same as defining datatypes, e.g. you can't do custom reductions.
    • Introspection. Possible in C++ with metaprogramming, but do you really want to go there? 😄
    • Code generation. Build is in two passes then: first generate the code (the generation of the code needs some tool to analyze the AST) then compile it.