The example 4.17 in the MPI 2.2 standard (page 114) is addressing exactly this 
type of datatypes. Once you define the suitable datatype, you can use it in any 
type of communications, including collectives.

  george.


On Aug 3, 2012, at 13:36 , Grzegorz Maj wrote:

> Hi,
> I would like my MPI processes to exchange some structural data. That
> data is represented by plain structures containing basic datatypes. I
> would like to use MPI derived datatypes, because of its portability
> and good performance.
> 
> I would like to be able to send/receive any of my structures in the
> same part of code. In the low-level network programming it is usually
> done by having each struct of this pattern:
> struct S1 {
>  int structType;
>  ...
> }
> And then you first read structType and know what bytes to expect next.
> 
> Is there a good way to do it using MPI derived datatypes?
> 
> I was thinking of having separate MPI_Request for each of my
> structures and calling multiple MPI_Irecv + MPI_Waitany. But then, how
> to do this for MPI_Bcast?
> 
> My second question is about having arbitrary size structures, i.e. the
> ones having 'char buf[0]' as the last field, where you allocate memory
> of size 'sizeof(S) + bufLen'. Is there a way to convert such a struct
> into MPI derived datatype?
> 
> Thanks for any help,
> Regards,
> Grzegorz Maj
> _______________________________________________
> users mailing list
> us...@open-mpi.org
> http://www.open-mpi.org/mailman/listinfo.cgi/users


Reply via email to