Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r64423 - in branches/release: boost/mpi boost/mpi/detail libs/mpi/src
From: troyer_at_[hidden]
Date: 2010-07-28 23:27:11


Author: troyer
Date: 2010-07-28 23:27:09 EDT (Wed, 28 Jul 2010)
New Revision: 64423
URL: http://svn.boost.org/trac/boost/changeset/64423

Log:
Changes required to make Boost.MPI work with Boost.Serialization after breaking changes for 1.44
Text files modified:
   branches/release/boost/mpi/datatype.hpp | 20 ++++++++++++++++++++
   branches/release/boost/mpi/datatype_fwd.hpp | 4 +++-
   branches/release/boost/mpi/detail/binary_buffer_iprimitive.hpp | 3 ++-
   branches/release/boost/mpi/detail/binary_buffer_oprimitive.hpp | 3 ++-
   branches/release/boost/mpi/detail/ignore_iprimitive.hpp | 7 -------
   branches/release/boost/mpi/detail/ignore_skeleton_oarchive.hpp | 3 +++
   branches/release/boost/mpi/detail/packed_iprimitive.hpp | 5 +++--
   branches/release/boost/mpi/detail/packed_oprimitive.hpp | 5 +++--
   branches/release/boost/mpi/intercommunicator.hpp | 4 ++--
   branches/release/boost/mpi/packed_iarchive.hpp | 23 ++++++++++++++++++-----
   branches/release/boost/mpi/packed_oarchive.hpp | 19 ++++++++++++++-----
   branches/release/libs/mpi/src/packed_iarchive.cpp | 4 ----
   branches/release/libs/mpi/src/packed_oarchive.cpp | 5 -----
   branches/release/libs/mpi/src/packed_skeleton_iarchive.cpp | 8 +-------
   branches/release/libs/mpi/src/packed_skeleton_oarchive.cpp | 6 ------
   branches/release/libs/mpi/src/text_skeleton_oarchive.cpp | 5 +----
   16 files changed, 72 insertions(+), 52 deletions(-)

Modified: branches/release/boost/mpi/datatype.hpp
==============================================================================
--- branches/release/boost/mpi/datatype.hpp (original)
+++ branches/release/boost/mpi/datatype.hpp 2010-07-28 23:27:09 EDT (Wed, 28 Jul 2010)
@@ -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()), integer);
+BOOST_MPI_DATATYPE(boost::serialization::item_version_type, get_mpi_datatype(uint_least8_t()), integer);
+
+#endif // Doxygen
+
+
 } } // end namespace boost::mpi
 
 // define a macro to make explicit designation of this more transparent

Modified: branches/release/boost/mpi/datatype_fwd.hpp
==============================================================================
--- branches/release/boost/mpi/datatype_fwd.hpp (original)
+++ branches/release/boost/mpi/datatype_fwd.hpp 2010-07-28 23:27:09 EDT (Wed, 28 Jul 2010)
@@ -25,7 +25,9 @@
 template<typename T> struct is_mpi_complex_datatype;
 template<typename T> struct is_mpi_byte_datatype;
 template<typename T> struct is_mpi_datatype;
-template<typename T> MPI_Datatype get_mpi_datatype(const T& x = T());
+template<typename T> MPI_Datatype get_mpi_datatype(const T& x);
+template<typename T> MPI_Datatype get_mpi_datatype()
+ { return get_mpi_datatype(T());}
 
 /// a dummy data type giving MPI_PACKED as its MPI_Datatype
 struct packed {};

Modified: branches/release/boost/mpi/detail/binary_buffer_iprimitive.hpp
==============================================================================
--- branches/release/boost/mpi/detail/binary_buffer_iprimitive.hpp (original)
+++ branches/release/boost/mpi/detail/binary_buffer_iprimitive.hpp 2010-07-28 23:27:09 EDT (Wed, 28 Jul 2010)
@@ -88,7 +88,8 @@
       load_impl(&t, sizeof(T));
     }
 
- void load( std::string & s)
+ template<class CharType>
+ void load(std::basic_string<CharType> & s)
     {
       unsigned int l;
       load(l);

Modified: branches/release/boost/mpi/detail/binary_buffer_oprimitive.hpp
==============================================================================
--- branches/release/boost/mpi/detail/binary_buffer_oprimitive.hpp (original)
+++ branches/release/boost/mpi/detail/binary_buffer_oprimitive.hpp 2010-07-28 23:27:09 EDT (Wed, 28 Jul 2010)
@@ -79,7 +79,8 @@
       save_impl(&t, sizeof(T));
     }
 
- void save(const std::string &s)
+ template<class CharType>
+ void save(const std::basic_string<CharType> &s)
     {
       unsigned int l = static_cast<unsigned int>(s.size());
       save(l);

Modified: branches/release/boost/mpi/detail/ignore_iprimitive.hpp
==============================================================================
--- branches/release/boost/mpi/detail/ignore_iprimitive.hpp (original)
+++ branches/release/boost/mpi/detail/ignore_iprimitive.hpp 2010-07-28 23:27:09 EDT (Wed, 28 Jul 2010)
@@ -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)

Modified: branches/release/boost/mpi/detail/ignore_skeleton_oarchive.hpp
==============================================================================
--- branches/release/boost/mpi/detail/ignore_skeleton_oarchive.hpp (original)
+++ branches/release/boost/mpi/detail/ignore_skeleton_oarchive.hpp 2010-07-28 23:27:09 EDT (Wed, 28 Jul 2010)
@@ -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)
     {

Modified: branches/release/boost/mpi/detail/packed_iprimitive.hpp
==============================================================================
--- branches/release/boost/mpi/detail/packed_iprimitive.hpp (original)
+++ branches/release/boost/mpi/detail/packed_iprimitive.hpp 2010-07-28 23:27:09 EDT (Wed, 28 Jul 2010)
@@ -86,7 +86,8 @@
         load_impl(&t, get_mpi_datatype(t), 1);
     }
 
- void load( std::string & s)
+ template<class CharType>
+ void load(std::basic_string<CharType> & s)
     {
        unsigned int l;
         load(l);
@@ -96,7 +97,7 @@
         #endif
         s.resize(l);
         // note breaking a rule here - could be a problem on some platform
- load_impl(const_cast<char *>(s.data()),MPI_CHAR,l);
+ load_impl(const_cast<char *>(s.data()),get_mpi_datatype(CharType()),l);
     }
 
 private:

Modified: branches/release/boost/mpi/detail/packed_oprimitive.hpp
==============================================================================
--- branches/release/boost/mpi/detail/packed_oprimitive.hpp (original)
+++ branches/release/boost/mpi/detail/packed_oprimitive.hpp 2010-07-28 23:27:09 EDT (Wed, 28 Jul 2010)
@@ -77,11 +77,12 @@
         save_impl(&t, get_mpi_datatype<T>(t), 1);
     }
 
- void save(const std::string &s)
+ template<class CharType>
+ void save(const std::basic_string<CharType> &s)
     {
       unsigned int l = static_cast<unsigned int>(s.size());
       save(l);
- save_impl(s.data(),MPI_CHAR,s.size());
+ save_impl(s.data(),get_mpi_datatype(CharType()),s.size());
     }
 
 private:

Modified: branches/release/boost/mpi/intercommunicator.hpp
==============================================================================
--- branches/release/boost/mpi/intercommunicator.hpp (original)
+++ branches/release/boost/mpi/intercommunicator.hpp 2010-07-28 23:27:09 EDT (Wed, 28 Jul 2010)
@@ -59,9 +59,9 @@
    * underlying MPI_Comm. This operation is used for "casting" from a
    * communicator to an intercommunicator.
    */
- explicit intercommunicator(const shared_ptr<MPI_Comm>& comm_ptr)
+ explicit intercommunicator(const shared_ptr<MPI_Comm>& cp)
   {
- this->comm_ptr = comm_ptr;
+ this->comm_ptr = cp;
   }
 
 public:

Modified: branches/release/boost/mpi/packed_iarchive.hpp
==============================================================================
--- branches/release/boost/mpi/packed_iarchive.hpp (original)
+++ branches/release/boost/mpi/packed_iarchive.hpp 2010-07-28 23:27:09 EDT (Wed, 28 Jul 2010)
@@ -20,10 +20,13 @@
 
 #include <boost/mpi/datatype.hpp>
 #include <boost/archive/detail/auto_link_archive.hpp>
-#include <boost/archive/basic_binary_iarchive.hpp>
+#include <boost/archive/detail/common_iarchive.hpp>
 #include <boost/archive/shared_ptr_helper.hpp>
 #include <boost/mpi/detail/packed_iprimitive.hpp>
 #include <boost/mpi/detail/binary_buffer_iprimitive.hpp>
+#include <boost/serialization/string.hpp>
+#include <boost/serialization/collection_size_type.hpp>
+#include <boost/serialization/item_version_type.hpp>
 #include <boost/assert.hpp>
 
 namespace boost { namespace mpi {
@@ -44,7 +47,7 @@
  */
 class BOOST_MPI_DECL packed_iarchive
   : public iprimitive
- , public archive::basic_binary_iarchive<packed_iarchive>
+ , public archive::detail::common_iarchive<packed_iarchive>
   , public archive::detail::shared_ptr_helper
 {
 public:
@@ -67,7 +70,7 @@
    */
   packed_iarchive(MPI_Comm const & comm, buffer_type & b, unsigned int flags = boost::archive::no_header, int position = 0)
         : iprimitive(b,comm,position),
- archive::basic_binary_iarchive<packed_iarchive>(flags)
+ archive::detail::common_iarchive<packed_iarchive>(flags)
         {}
 
   /**
@@ -87,7 +90,7 @@
           ( MPI_Comm const & comm , std::size_t s=0,
            unsigned int flags = boost::archive::no_header)
          : iprimitive(internal_buffer_,comm)
- , archive::basic_binary_iarchive<packed_iarchive>(flags)
+ , archive::detail::common_iarchive<packed_iarchive>(flags)
          , internal_buffer_(s)
         {}
 
@@ -95,7 +98,7 @@
   template<class T>
   void load_override(T& x, int version, mpl::false_)
   {
- archive::basic_binary_iarchive<packed_iarchive>::load_override(x,version);
+ archive::detail::common_iarchive<packed_iarchive>::load_override(x,version);
   }
 
   // Load it directly using the primnivites
@@ -115,6 +118,16 @@
     load_override(x, version, use_optimized());
   }
 
+ void load_override(archive::class_name_type & t, int)
+ {
+ std::string cn;
+ cn.reserve(BOOST_SERIALIZATION_MAX_KEY_SIZE);
+ * this->This() >> cn;
+ std::memcpy(t, cn.data(), cn.size());
+ // borland tweak
+ t.t[cn.size()] = '\0';
+ }
+
 private:
   /// An internal buffer to be used when the user does not supply his
   /// own buffer.

Modified: branches/release/boost/mpi/packed_oarchive.hpp
==============================================================================
--- branches/release/boost/mpi/packed_oarchive.hpp (original)
+++ branches/release/boost/mpi/packed_oarchive.hpp 2010-07-28 23:27:09 EDT (Wed, 28 Jul 2010)
@@ -20,9 +20,12 @@
 
 #include <boost/mpi/datatype.hpp>
 #include <boost/archive/detail/auto_link_archive.hpp>
-#include <boost/archive/basic_binary_oarchive.hpp>
+#include <boost/archive/detail/common_oarchive.hpp>
 #include <boost/mpi/detail/packed_oprimitive.hpp>
 #include <boost/mpi/detail/binary_buffer_oprimitive.hpp>
+#include <boost/serialization/string.hpp>
+#include <boost/serialization/collection_size_type.hpp>
+#include <boost/serialization/item_version_type.hpp>
 
 namespace boost { namespace mpi {
 
@@ -43,7 +46,7 @@
   
 class BOOST_MPI_DECL packed_oarchive
   : public oprimitive,
- public archive::basic_binary_oarchive<packed_oarchive>
+ public archive::detail::common_oarchive<packed_oarchive>
 {
 public:
   /**
@@ -62,7 +65,7 @@
    */
   packed_oarchive( MPI_Comm const & comm, buffer_type & b, unsigned int flags = boost::archive::no_header)
          : oprimitive(b,comm),
- archive::basic_binary_oarchive<packed_oarchive>(flags)
+ archive::detail::common_oarchive<packed_oarchive>(flags)
         {}
 
   /**
@@ -78,14 +81,14 @@
    */
   packed_oarchive ( MPI_Comm const & comm, unsigned int flags = boost::archive::no_header)
          : oprimitive(internal_buffer_,comm),
- archive::basic_binary_oarchive<packed_oarchive>(flags)
+ archive::detail::common_oarchive<packed_oarchive>(flags)
         {}
 
   // Save everything else in the usual way, forwarding on to the Base class
   template<class T>
   void save_override(T const& x, int version, mpl::false_)
   {
- archive::basic_binary_oarchive<packed_oarchive>::save_override(x,version);
+ archive::detail::common_oarchive<packed_oarchive>::save_override(x,version);
   }
 
   // Save it directly using the primnivites
@@ -103,6 +106,12 @@
     save_override(x, version, use_optimized());
   }
 
+ // explicitly convert to char * to avoid compile ambiguities
+ void save_override(const archive::class_name_type & t, int){
+ const std::string s(t);
+ * this->This() << s;
+ }
+
 private:
   /// An internal buffer to be used when the user does not supply his
   /// own buffer.

Modified: branches/release/libs/mpi/src/packed_iarchive.cpp
==============================================================================
--- branches/release/libs/mpi/src/packed_iarchive.cpp (original)
+++ branches/release/libs/mpi/src/packed_iarchive.cpp 2010-07-28 23:27:09 EDT (Wed, 28 Jul 2010)
@@ -11,15 +11,11 @@
 
 #include <boost/archive/detail/archive_serializer_map.hpp>
 #include <boost/archive/impl/archive_serializer_map.ipp>
-#include <boost/archive/binary_iarchive.hpp>
-#include <boost/archive/impl/basic_binary_iprimitive.ipp>
-#include <boost/archive/impl/basic_binary_iarchive.ipp>
 
 namespace boost { namespace archive {
 
 // explicitly instantiate all required templates
 
-template class basic_binary_iarchive<mpi::packed_iarchive> ;
 template class detail::archive_serializer_map<mpi::packed_iarchive> ;
 
 } } // end namespace boost::archive

Modified: branches/release/libs/mpi/src/packed_oarchive.cpp
==============================================================================
--- branches/release/libs/mpi/src/packed_oarchive.cpp (original)
+++ branches/release/libs/mpi/src/packed_oarchive.cpp 2010-07-28 23:27:09 EDT (Wed, 28 Jul 2010)
@@ -8,17 +8,12 @@
 
 #define BOOST_ARCHIVE_SOURCE
 #include <boost/mpi/packed_oarchive.hpp>
-
 #include <boost/archive/detail/archive_serializer_map.hpp>
 #include <boost/archive/impl/archive_serializer_map.ipp>
-#include <boost/archive/binary_oarchive.hpp>
-#include <boost/archive/impl/basic_binary_oprimitive.ipp>
-#include <boost/archive/impl/basic_binary_oarchive.ipp>
 
 namespace boost { namespace archive {
 // explicitly instantiate all required templates
 
 template class detail::archive_serializer_map<mpi::packed_oarchive> ;
-template class basic_binary_oarchive<mpi::packed_oarchive> ;
 
 } } // end namespace boost::archive

Modified: branches/release/libs/mpi/src/packed_skeleton_iarchive.cpp
==============================================================================
--- branches/release/libs/mpi/src/packed_skeleton_iarchive.cpp (original)
+++ branches/release/libs/mpi/src/packed_skeleton_iarchive.cpp 2010-07-28 23:27:09 EDT (Wed, 28 Jul 2010)
@@ -10,22 +10,16 @@
 
 #include <boost/archive/detail/archive_serializer_map.hpp>
 #include <boost/archive/impl/archive_serializer_map.ipp>
-
 #include <boost/mpi/skeleton_and_content.hpp>
 
-#include <boost/archive/binary_iarchive.hpp>
-#include <boost/archive/impl/basic_binary_iprimitive.ipp>
-#include <boost/archive/impl/basic_binary_iarchive.ipp>
-
 namespace boost { namespace archive {
 
 // explicitly instantiate all required templates
 
-template class basic_binary_iarchive<mpi::packed_skeleton_iarchive> ;
+// template class basic_binary_iarchive<mpi::packed_skeleton_iarchive> ;
 template class detail::archive_serializer_map<mpi::packed_skeleton_iarchive> ;
 template class detail::archive_serializer_map<
   mpi::detail::forward_skeleton_iarchive<
     boost::mpi::packed_skeleton_iarchive, boost::mpi::packed_iarchive> > ;
-//template class binary_iarchive_impl<packed_skeleton_iarchive> ;
 
 } } // end namespace boost::archive

Modified: branches/release/libs/mpi/src/packed_skeleton_oarchive.cpp
==============================================================================
--- branches/release/libs/mpi/src/packed_skeleton_oarchive.cpp (original)
+++ branches/release/libs/mpi/src/packed_skeleton_oarchive.cpp 2010-07-28 23:27:09 EDT (Wed, 28 Jul 2010)
@@ -8,12 +8,8 @@
 
 #define BOOST_ARCHIVE_SOURCE
 #include <boost/mpi/skeleton_and_content.hpp>
-
 #include <boost/archive/detail/archive_serializer_map.hpp>
 #include <boost/archive/impl/archive_serializer_map.ipp>
-#include <boost/archive/binary_oarchive.hpp>
-#include <boost/archive/impl/basic_binary_oprimitive.ipp>
-#include <boost/archive/impl/basic_binary_oarchive.ipp>
 
 namespace boost { namespace archive {
 // explicitly instantiate all required templates
@@ -22,7 +18,5 @@
 template class detail::archive_serializer_map<
   mpi::detail::forward_skeleton_oarchive<
     boost::mpi::packed_skeleton_oarchive, boost::mpi::packed_oarchive> > ;
-template class basic_binary_oarchive<mpi::packed_skeleton_oarchive> ;
-//template class binary_oarchive_impl<mpi_packed_oarchive> ;
 
 } } // end namespace boost::archive

Modified: branches/release/libs/mpi/src/text_skeleton_oarchive.cpp
==============================================================================
--- branches/release/libs/mpi/src/text_skeleton_oarchive.cpp (original)
+++ branches/release/libs/mpi/src/text_skeleton_oarchive.cpp 2010-07-28 23:27:09 EDT (Wed, 28 Jul 2010)
@@ -11,13 +11,10 @@
 
 #include <boost/archive/detail/archive_serializer_map.hpp>
 #include <boost/archive/impl/archive_serializer_map.ipp>
-#include <boost/archive/binary_oarchive.hpp>
-#include <boost/archive/impl/basic_binary_oprimitive.ipp>
-#include <boost/archive/impl/basic_binary_oarchive.ipp>
 
 namespace boost { namespace archive {
 // explicitly instantiate all required templates
 
-template class detail::archive_serializer_map<text_oarchive>;
+// template class detail::archive_serializer_map<text_oarchive>;
 
 } } // end namespace boost::archive


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk