Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: Re: [OMPI users] Open MPI C++ class datatype
From: Cristobal Navarro (axischire_at_[hidden])
Date: 2010-08-04 10:13:06


If your class has too many complex atributes,
 it might be a good idea to send some sort of string or similar data
representing your class,
and then on the receiving node, you create the object based on that
information.

works on some type of problems problems.
best regards.
Cristobal

On Wed, Aug 4, 2010 at 3:53 AM, Riccardo Murri <riccardo.murri_at_[hidden]>wrote:

> Hi Jack,
>
> On Wed, Aug 4, 2010 at 6:25 AM, Jack Bryan <dtustudy68_at_[hidden]> wrote:
> > I need to transfer some data, which is C++ class with some vector<float>
> > member data.
> > I want to use MPI_Bcast(buffer, count, datatype, root, comm);
> > May I use MPI_Datatype to define customized data structure that contain
> C++
> > class ?
>
> No, unless you have access to the implementation details of the
> std::vector class (which would render your code dependent on one
> particular implementation of the STL, and thus non-portable).
>
> Boost.MPI provides support for std C++ datatypes; if you want to keep
> to "plain MPI" calls, then your only choice is to use C-style arrays.
>
> Regards,
> Riccardo
>
> _______________________________________________
> users mailing list
> users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/users