[dune-pdelab] Sending bytes in communication breaks portability

Christian Engwer christian.engwer at uni-muenster.de
Fri Jun 27 17:09:39 CEST 2014


On Fri, Jun 27, 2014 at 04:32:08PM +0200, Markus Blatt wrote:
> On Fri, Jun 27, 2014 at 12:32:45PM +0200, Christian Engwer wrote:
> 
> > The template MPI data wrappers in common do exactly the same, they
> > fold everything into a char array and send this. 
> 
> Are you sure? I tink I wrote them, and they correctly use the
> corresponding MPI_Datatypes. For all others (that I knew were used by
> some part) a correct new MPI_Datatype is constructed. This approach
> can also be used by users for their own custom datatypes. Only for
> unknown datatypes the default might be to use bytes. IMHO, that should
> probably be deactivated and an error should be thrown.

That was what I expected until I checked the implementation. For basic
data types and some special constructs (e.g. std::pair) it works, but
for all other types is computes the size and uses MPI_BYTE:
        MPI_Type_contiguous(sizeof(T),MPI_BYTE,&datatype);

Christian

PS: I also don't know of a better solution, but it is the same problem
as in pdelab. In pdelab it might make sense to construct the data type
using the MPI_Traits. This will allow to benetif from a future fix ;-)




More information about the dune-pdelab mailing list