On Mon, 08 Feb 2010 14:42:15 -0500, Prentice Bisbal <prent...@ias.edu> wrote: > I'll give that a try, too. IMHO, MPI_Pack/Unpack looks easier and less > error prone, but Pacheco advocates using derived types over > MPI_Pack/Unpack.
I would recommend using derived types for big structures, or perhaps for long-lived medium-sized structures. If your structure is static (i.e. doesn't contain pointers), then derived types definitely make sense and allow you to use that type in collectives. > In my situation, rank 0 is reading in a file containing all the coords. > So even if other ranks don't have the data, I still need to create the > structure on all the nodes, even if I don't populate it with data? You're populating it by receiving data. MPI can't allocate the space for you, so you have to it up. > To clarify: I thought adding a similar structure, b_point in rank 1 > would be adequate to receive the data from rank 0 You have allocated memory by the time you call MPI_Recv, but you were passing an undefined value to MPI_Address, and you certainly can't base derived_type an a_point and use it to receive into b_point. It would be fine to receive into a_point on rank 1, but whatever you do, derived_type has to be created correctly on each process. Jed