ENCCS / intermediate-mpi

Intermediate MPI lesson
https://enccs.github.io/intermediate-mpi/
Creative Commons Attribution 4.0 International
25 stars 11 forks source link

comment on datatypes #72

Open wikfeldt opened 3 years ago

wikfeldt commented 3 years ago

from Joachim:

[...] looking into the example 2 of the block Extents and sizes, you directly feed the result of MPI_Get_address into the displacements of MPI_Type_create_struct.

To my understanding MPI_Get_address, returns the address with respect to MPI_BOTTOM, however the displacement needs to be specified with respect to the beginning of the derived data type you want to sent. So you need to subtract a (typically large offset).

For my own MPI course my teaching examples, in which I subtract the offset, work against OpenMPI. Please have a look and I am happy to discuss this - or be corrected in case my reading of the standard is wrong.

robertodr commented 3 years ago

Joachim is correct and we did get questions about it in the course. It works here because it's such a silly example. In the other exercise the displacements are computed as differences with respect to a base address.