Newsgroups: comp.parallel.mpi
From: rdaoud@magnus.acs.ohio-state.edu (Raja B Daoud)
Subject: Re: Need to pass a structure containing dynamically created elements
Organization: Ohio Supercomputer Center
Date: 31 Jan 1995 07:33:50 GMT
Message-ID: <3gkp4u$g6p@charm.magnus.acs.ohio-state.edu>

Balakrishnan Kannikeswaran <bala@lucky-eddie.ece.uc.edu> wrote:
>I need to pass a structure which has a pointer to a string in it using MPI.

The derived datatypes have fixed count/lengths (once created).
For dynamically changing field sizes you can:

- Fix the field sizes to a max length value and create a datatype
  (works nicely if the sizes don't fluctuate widely).

- Use MPI_Pack() and MPI_Unpack().

Anytime you are sending arrays of fixed size elements, use derived datatypes.
Otherwise using pack/unpack.  Mix-n-match to simplify the code, each method
has pros and cons.

--Raja

-=-
Raja Daoud				raja@osc.edu
Ohio Supercomputer Center		http://www.osc.edu/lam.html

