On Mon, 08 Feb 2010 13:54:10 -0500, Prentice Bisbal <prent...@ias.edu> wrote: > but I don't have that book handy
The standard has lots of examples. http://www.mpi-forum.org/docs/docs.html You can do this, but for small structures, you're better off just packing buffers. For large structures containing variable-size fields, I think it is clearer to use MPI_BOTTOM instead of offsets from an arbitrary (instance-dependent) address. [...] > if (rank == 0) { > a_point.index = 1; > a_point.coords = malloc(3 * sizeof(int)); > a_point.coords[0] = 3; > a_point.coords[1] = 6; > a_point.coords[2] = 9; > } > > block_lengths[0] = 1; > block_lengths[1] = 3; > > type_list[0] = MPI_INT; > type_list[1] = MPI_INT; > > displacements[0] = 0; > MPI_Address(&a_point.index, &start_address); > MPI_Address(a_point.coords, &address); ^^^^^^^^^^^^^^ Rank 1 has not allocated this yet. Jed