Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |  

This web mail archive is frozen.

This page is part of a frozen web archive of this mailing list.

You can still navigate around this archive, but know that no new mails have been added to it since July of 2016.

Click here to be taken to the new web archives of this list; it includes all the mails that are in this frozen archive plus all new mails that have been sent to the list since it was migrated to the new archives.

Subject: Re: [OMPI users] Using MPI derived datatypes
From: George Bosilca (bosilca_at_[hidden])
Date: 2012-08-08 05:00:22


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
> users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/users