Boost logo

Boost Users :

Subject: Re: [Boost-users] mpi/serialization: broadcast function and the value argument
From: Hicham Mouline (hicham_at_[hidden])
Date: 2010-12-14 19:43:45


> -----Original Message-----
> From: Matthias Troyer [mailto:troyer_at_[hidden]]
> Sent: 14 December 2010 17:57
> <snip>
> >
> >>> mpi::broadcast() appears to be incapable of sending the argument
> "value" in a polymorphic way, ie:
> >>>
> >>> sender-------------------
> >>> Base* base;
> >>> If I call boost::mpi::broadcast(..., base, ...)
> >>>
> >>>
> >>> receiver-----------------
> >>> Base* base;
> >>> boost::mpi::broadcast(..., base, ...)
> >>> This does not construct the most derived type of base on the heap
> and make base point there, as serialization would do.
> >
> >> Did you register the most derived type?
> > Yes I have all types.
> >
> >> Did you test whether pointer deserialization works with other
> serialization archives?
> >> Matthias
> >
> > I will test.
>
> This will be crucial. If it does not work with, e.g. text or binary
> archives then it will not work with serialization either.
>
> Matthias

The attached works with serialization. I've also tested with the classes in
my real case.
However, looking at the implementation of mpi::broadcast, the receiver uses
the "value" passed to it to store what it received. If value is a Base*
that is not initialized, value[0], in particular, is used and that will
never work, see mpi/collectives/broadcast.hpp line 48
             ia >> values[i]

Am i interpreting this incorrectly?

Regards,


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net