[Dune] A question on CollectiveCommunication

Steffen Müthing steffen.muething at iwr.uni-heidelberg.de
Mon Jan 19 12:36:23 CET 2015


Hi Aleksejs,

Am 19.01.2015 um 11:51 schrieb Aleksejs Fomins <aleksejs.fomins at lspr.ch>:

> Signierter PGP Teil
> Dear Dune,
> 
> I am trying to understand the paradigm of the communication used in Dune
> 
> The question concerns the following
> Dune::CommDataHandleIF< DataHandleImp, DataTypeImp >
> 
> and
> 
> int Dune::CollectiveCommunication< C >::gather( T * in, T * out, int
> len, int root) const
> 
> In both cases we define a template parameter which defines the data
> type to be communicated. As I understood from discussions with Marcus
> and Peter, internally the communication is performed using MPI_BYTE
> communication, i.e. sending size_of(T) data from a given address to a
> given address.
> 
> It looks to me that this should not work for T = some stl object, because:
> 1) If T has variable size, and we are passing a pointer to the array
> of T's in gather, then gather has no information on the length of each
> individual T
> 2) If I would like to communicate T = std::vector<int>, would not the
> internal implementation of vector contain a pointer to an array for
> the current processor?
> 
> That said, the question is as follows:
> 
> Is dune communication interface intended to handle standard stl types?
> If no, which DataTypes are expected/allowed to be communicated?

as you have correctly figured out, all internal communication happens by means
of a char buffer, so the only kind of data you can safely communicate are POD types.
YaspGrid was bitten by this some time ago because it tried to send objects of a
class with virtual functions. MPI then happily copied the vtable pointer to the target
machine. That machine then crashed as soon as it tried to dereference the pointer
for a function call.

TL;DR: only communicate POD data.

Steffen

> 
> Regards,
> Aleksejs
> 
> 
> _______________________________________________
> Dune mailing list
> Dune at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20150119/96f51ab5/attachment.sig>


More information about the Dune mailing list