Advertisement
Guest User

Untitled

a guest
Sep 4th, 2015
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. typedef struct point_struct { int x, y; }point;
  2.  
  3. int num_item =2;
  4. int blocklengths[2] = {1,1};
  5. MPI_Datatype types[2] = {MPI_INT, MPI_INT};
  6. MPI_Datatype mpi_point_type;
  7. MPI_Aint offsets[2];
  8. offsets[0] = offsetof(point, x);
  9. offsets[1] = offsetof(point, y);
  10. MPI_Type_create_struct(num_item, blocklengths, offsets, types, &mpi_point_type );
  11. MPI_Type_commit(&mpi_point_type);
  12.  
  13. point p_x[n];
  14.  
  15. point *p_x = (struct point_struct*)malloc(n*sizeof(struct point_struct));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement