Hi Hicham,
now I see your problem...
On Tue, Dec 7, 2010 at 9:41 AM, Hicham Mouline
During a sequence of communication, the slave processes don't know what type to get broadcast of, next. What should be the T in the call to broadcast.
1. the root sends a tag for the T to tell the receivers I will broadcast you this and this. This means 2 broadcast each time
Safe and easy option. Could be the slowest if you plan broadcasting a lot of messages and/or running on a large number of ranks.
2. the root sends directly a reference to a base class of anything sendable, then the receivers construct the derived classes on reception with broadcast. The T is then the base class type.
There's a risk of slicing here, i.e., if you pass a reference to a base class, only the base class data will be serialized and received. As far as I understand, Boost.Serialization (hence Boost.MPI) will do the correct thing if you use *pointers* instead: i.e., you send a pointer to a (derived) class and you receive it through a pointer to the base class. (Beware: I have not checked!)
3. I just thought of using boost::variant<> over all the possible types.
Should work, provided you #include