Boost logo

Boost :

Subject: Re: [boost] [mpi] Boost.MPI broken
From: Matthias Troyer (troyer_at_[hidden])
Date: 2010-07-02 20:24:48


Hi,

The attached patch fixes the compilation problem on MacOS X - could someone please check whether this also works on other platforms?

The fundamental problem is the definition of the set of "primitive" types that any archive class needs to support to be compatible with Boost.Serialization. In the past those had been the fundamental builtin types and std::string. This has now changed to include a list of 10 additional types that were previously serialized using their serialize() function.

This change in the list of primitive types that every archive needs to support has been a serious breaking change and will most likely also impact other archives.

Robert, it would be good if you could add an explicit list of all primitive types that every archive needs to support to the documentation and archive concept, and announce any upcoming changes?

Ideally though it would be great if those types could get their serialize() function back so that they do not need to be treated ad primitive types.

Matthias

Index: boost/mpi/datatype.hpp
===================================================================
--- boost/mpi/datatype.hpp (revision 63522)
+++ boost/mpi/datatype.hpp (working copy)
@@ -26,6 +26,8 @@
 #include <boost/mpl/and.hpp>
 #include <boost/mpi/detail/mpi_datatype_cache.hpp>
 #include <boost/mpl/assert.hpp>
+#include <boost/archive/basic_archive.hpp>
+#include <boost/serialization/item_version_type.hpp>
 #include <utility> // for std::pair
 
 namespace boost { namespace mpi {
@@ -298,6 +300,7 @@
 BOOST_MPI_DATATYPE(signed char, MPI_SIGNED_CHAR, builtin);
 #endif
 
+
 #endif // Doxygen
 
 namespace detail {
@@ -325,6 +328,23 @@
   : boost::mpl::bool_<true>
 {};
 
+
+#ifndef BOOST_MPI_DOXYGEN
+// direct support for special primitive data types of the serialization library
+BOOST_MPI_DATATYPE(boost::archive::library_version_type, get_mpi_datatype(uint_least16_t()), integer);
+BOOST_MPI_DATATYPE(boost::archive::version_type, get_mpi_datatype(uint_least8_t()), integer);
+BOOST_MPI_DATATYPE(boost::archive::class_id_type, get_mpi_datatype(int_least16_t()), integer);
+BOOST_MPI_DATATYPE(boost::archive::class_id_reference_type, get_mpi_datatype(int_least16_t()), integer);
+BOOST_MPI_DATATYPE(boost::archive::class_id_optional_type, get_mpi_datatype(int_least16_t()), integer);
+BOOST_MPI_DATATYPE(boost::archive::object_id_type, get_mpi_datatype(uint_least32_t()), integer);
+BOOST_MPI_DATATYPE(boost::archive::object_reference_type, get_mpi_datatype(uint_least32_t()), integer);
+BOOST_MPI_DATATYPE(boost::archive::tracking_type, get_mpi_datatype(bool()), builtin);
+BOOST_MPI_DATATYPE(boost::serialization::collection_size_type, get_mpi_datatype(std::size_t()), builtin);
+BOOST_MPI_DATATYPE(boost::serialization::item_version_type, get_mpi_datatype(uint_least8_t()), builtin);
+
+#endif // Doxygen
+
+
 } } // end namespace boost::mpi
 
 // define a macro to make explicit designation of this more transparent
Index: boost/mpi/detail/ignore_skeleton_oarchive.hpp
===================================================================
--- boost/mpi/detail/ignore_skeleton_oarchive.hpp (revision 63522)
+++ boost/mpi/detail/ignore_skeleton_oarchive.hpp (working copy)
@@ -17,6 +17,7 @@
 #include <boost/archive/detail/oserializer.hpp>
 #include <boost/serialization/collection_size_type.hpp>
 #include <boost/serialization/array.hpp>
+#include <boost/serialization/item_version_type.hpp>
 
 namespace boost { namespace mpi { namespace detail {
 
@@ -53,6 +54,7 @@
 
 BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(archive::class_id_optional_type)
 BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(archive::version_type)
+BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(archive::library_version_type)
 BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(archive::class_id_type)
 BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(archive::class_id_reference_type)
 BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(archive::object_id_type)
@@ -60,6 +62,7 @@
 BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(archive::tracking_type)
 BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(archive::class_name_type)
 BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(serialization::collection_size_type)
+BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(serialization::item_version_type)
 
     void save_override(std::string const & s, int)
     {
Index: boost/mpi/detail/ignore_iprimitive.hpp
===================================================================
--- boost/mpi/detail/ignore_iprimitive.hpp (revision 63522)
+++ boost/mpi/detail/ignore_iprimitive.hpp (working copy)
@@ -42,13 +42,6 @@
 
     typedef is_mpi_datatype<mpl::_1> use_array_optimization;
 
-#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
- friend class archive::load_access;
-protected:
-#else
-public:
-#endif
-
         /// don't do anything when loading primitive types
     template<class T>
     void load(T & t)


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk