next up previous
Next: The all-gather operation Up: ninth.c in detail Previous: ninth.c in detail

Declaring a simple 4-slot MPI structure

 

Each particle is represented by a structure

typedef struct {
   double x, y, z;
   double mass;
} Particle;
Although this cannot be guaranteed, on most systems this structure will be stored simply as 4 double precision numbers. Hence our MPI type declaration:
MPI_Type_contiguous ( 4, MPI_DOUBLE, &particle_type );
MPI_Type_commit ( &particle_type );
The second call requests MPI to optimise handling of MPI_Datatype particle_type if possible.



Zdzislaw Meglicki
Tue Feb 28 15:07:51 EST 1995