Assume that i have a struct type as follows:
typedef struct {
float x, y, z;
float velocity;
int n, type;
} Particle;
I want to send it. I have to create an MPI_Type. I know 4 ways to do it. I listed them below. I want to know what are the differences, limits and benefits of them.
Using
MPI_Type_extent
Using
offsetof()
instddef.h
, it was explained in this answer: MPI Derived Type Send answerUsing
MPI_Get_address
, also an example in the same answer.Using
reinterpret_cast<const unsigned char*>
, i didn't try but there is an example here: MPI Create Custom Data