I am working on MPI on C. I have this custom struct that I want to serialize and send to other nodes using MPI Collective communication (Gather, Scatter, Broadcast)
The struct is as following
typedef struct {
double x[2]; /* Old and new X-axis coordinates */
double y[2]; /* Old and new Y-axis coordinates */
double xf; /* force along X-axis */
double yf; /* force along Y-axis */
double xv; /* velocity along X-axis */
double yv; /* velocity along Y-axis */
double mass; /* Mass of the body */
double radius; /* width (derived from mass) */
} bodyType;
I have tried to understand serialization of custom structs on MPI but could not really understand the process. If some one can help me out here it would be great
Thank You
MPI_Type_struct
is your friend! – simpel01MPI_Type_struct
was deprecated in MPI-2 and no longer exists in MPI-3. One should useMPI_Type_create_struct
instead. – Hristo Iliev