Boost C++ Libraries: Ticket #10977: Add functions for obtaining full MPI transfer info of variable https://svn.boost.org/trac10/ticket/10977 <p> I have a couple of MPI projects which duplicate functionality, so that neither depends on the other, for which boost::mpi would seem like a good place. </p> <p> In order to transfer something using MPI 3 pieces of info are required: 1) the starting address of data, 2) number of items (contiguous in memory) to send and 3) the (MPI) type of each item. As far as I can tell functions in boost::mpi only return the type but not the count nor the address of variables. I'd like to see this functionality in boost or add it myself if that's ok. For basic types the function would be e.g.: </p> <p> std::tuple&lt; </p> <blockquote> <p> void*, int, MPI_Datatype </p> <blockquote class="citation"> <p> get_mpi_transfer_info(const char&amp; variable) { </p> </blockquote> <p> return std::make_tuple( </p> <blockquote> <p> (void*) &amp;variable, 1, MPI_CHAR </p> </blockquote> <p> ); </p> </blockquote> <p> } </p> <p> For std types in contiguous containers only the count would differ (omitting error checking): </p> <p> std::tuple&lt; </p> <blockquote> <p> void*, int, MPI_Datatype </p> <blockquote class="citation"> <p> get_mpi_transfer_info(const std::vector&lt;char&gt;&amp; variable) { </p> </blockquote> <p> return std::make_tuple( </p> <blockquote> <p> (void*) variable.data(), variable.size(), MPI_CHAR </p> </blockquote> <p> ); </p> </blockquote> <p> } </p> <p> For non-standard types the function would try to use the types' get_mpi_transfer_info() member function. Here's one of my current implementations for this functionality (add missing h to beginning of link): ttps://github.com/nasailja/gensimcell/blob/master/source/get_var_mpi_datatype.hpp It can probably be shortened with better use of overloads, templates, etc. but should give a good idea of what I'm after. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10977 Trac 1.4.3