Skip to content

Commit

Permalink
Fixing bit-wise (zero-copy) serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
hkaiser committed Feb 21, 2017
1 parent 274e58a commit 0991de0
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 15 deletions.
8 changes: 6 additions & 2 deletions hpx/compute/serialization/vector.hpp
Expand Up @@ -82,7 +82,9 @@ namespace hpx { namespace serialization
{
typedef std::integral_constant<bool,
hpx::traits::is_bitwise_serializable<
typename compute::vector<T, Allocator>::value_type
typename std::remove_const<
typename compute::vector<T, Allocator>::value_type
>::type
>::value> use_optimized;

v.clear();
Expand Down Expand Up @@ -129,7 +131,9 @@ namespace hpx { namespace serialization
{
typedef std::integral_constant<bool,
hpx::traits::is_bitwise_serializable<
typename compute::vector<T, Allocator>::value_type
typename std::remove_const<
typename compute::vector<T, Allocator>::value_type
>::type
>::value> use_optimized;

ar << v.size(); //-V128
Expand Down
4 changes: 3 additions & 1 deletion hpx/runtime/serialization/array.hpp
Expand Up @@ -66,7 +66,9 @@ namespace hpx { namespace serialization
void serialize(Archive& ar, unsigned int v)
{
typedef std::integral_constant<bool,
hpx::traits::is_bitwise_serializable<T>::value> use_optimized;
hpx::traits::is_bitwise_serializable<
typename std::remove_const<T>::type
>::value> use_optimized;

#ifdef BOOST_BIG_ENDIAN
bool archive_endianess_differs = ar.endian_little();
Expand Down
3 changes: 2 additions & 1 deletion hpx/runtime/serialization/complex.hpp
Expand Up @@ -10,6 +10,7 @@
#include <hpx/traits/is_bitwise_serializable.hpp>

#include <complex>
#include <type_traits>

namespace hpx { namespace serialization
{
Expand All @@ -33,7 +34,7 @@ namespace hpx { namespace traits
{
template <typename T>
struct is_bitwise_serializable<std::complex<T> >
: is_bitwise_serializable<T>
: is_bitwise_serializable<typename std::remove_const<T>::type>
{};
}}

Expand Down
3 changes: 2 additions & 1 deletion hpx/runtime/serialization/detail/boost_simd.hpp
Expand Up @@ -14,6 +14,7 @@
#include <hpx/traits/is_bitwise_serializable.hpp>

#include <cstddef>
#include <type_traits>

#include <boost/simd.hpp>

Expand All @@ -39,7 +40,7 @@ namespace hpx { namespace traits
{
template <typename T, std::size_t N, typename Abi>
struct is_bitwise_serializable<boost::simd::pack<T, N, Abi> >
: is_bitwise_serializable<T>
: is_bitwise_serializable<typename std::remove_const<T>::type>
{};
}}

Expand Down
3 changes: 2 additions & 1 deletion hpx/runtime/serialization/detail/libflatarray.hpp
Expand Up @@ -15,6 +15,7 @@

#include <array>
#include <cstddef>
#include <type_traits>

#include <libflatarray/flat_array.hpp>

Expand Down Expand Up @@ -45,7 +46,7 @@ namespace hpx { namespace traits
{
template <typename T, std::size_t N>
struct is_bitwise_serializable<LibFlatArray::short_vec<T, N> >
: is_bitwise_serializable<T>
: is_bitwise_serializable<typename std::remove_const<T>::type>
{};
}}
#endif
Expand Down
7 changes: 4 additions & 3 deletions hpx/runtime/serialization/detail/vc.hpp
Expand Up @@ -14,6 +14,7 @@
#include <hpx/traits/is_bitwise_serializable.hpp>

#include <cstddef>
#include <type_traits>

#include <Vc/Vc>

Expand Down Expand Up @@ -91,17 +92,17 @@ namespace hpx { namespace traits
{
template <typename T, typename Abi>
struct is_bitwise_serializable<Vc::Vector<T, Abi> >
: is_bitwise_serializable<T>
: is_bitwise_serializable<typename std::remove_const<T>::type>
{};

template <typename T>
struct is_bitwise_serializable<Vc::Scalar::Vector<T> >
: is_bitwise_serializable<T>
: is_bitwise_serializable<typename std::remove_const<T>::type>
{};

template <typename T, std::size_t N, typename V, std::size_t W>
struct is_bitwise_serializable<Vc::SimdArray<T, N, V, W> >
: is_bitwise_serializable<T>
: is_bitwise_serializable<typename std::remove_const<T>::type>
{};
}}

Expand Down
4 changes: 2 additions & 2 deletions hpx/runtime/serialization/map.hpp
Expand Up @@ -23,8 +23,8 @@ namespace hpx
struct is_bitwise_serializable<std::pair<Key, Value> >
: std::integral_constant<
bool,
is_bitwise_serializable<Key>::value
&& is_bitwise_serializable<Value>::value
is_bitwise_serializable<typename std::remove_const<Key>::type>::value
&& is_bitwise_serializable<typename std::remove_const<Value>::type>::value
>
{};
}
Expand Down
8 changes: 6 additions & 2 deletions hpx/runtime/serialization/vector.hpp
Expand Up @@ -83,7 +83,9 @@ namespace hpx { namespace serialization
{
typedef std::integral_constant<bool,
hpx::traits::is_bitwise_serializable<
typename std::vector<T, Allocator>::value_type
typename std::remove_const<
typename std::vector<T, Allocator>::value_type
>::type
>::value> use_optimized;

v.clear();
Expand Down Expand Up @@ -142,7 +144,9 @@ namespace hpx { namespace serialization
{
typedef std::integral_constant<bool,
hpx::traits::is_bitwise_serializable<
typename std::vector<T, Allocator>::value_type
typename std::remove_const<
typename std::vector<T, Allocator>::value_type
>::type
>::value> use_optimized;

ar << v.size(); //-V128
Expand Down
4 changes: 3 additions & 1 deletion hpx/util/tuple.hpp
Expand Up @@ -1012,7 +1012,9 @@ namespace hpx { namespace traits
struct is_bitwise_serializable<
::hpx::util::detail::tuple_impl<Is, Ts...>
> : ::hpx::util::detail::all_of<
hpx::traits::is_bitwise_serializable<Ts>...
hpx::traits::is_bitwise_serializable<
typename std::remove_const<Ts>::type
>...
>
{};
}}
Expand Down
1 change: 0 additions & 1 deletion src/runtime/naming/address.cpp
Expand Up @@ -8,7 +8,6 @@
#include <hpx/throw_exception.hpp>
#include <hpx/runtime/components/component_type.hpp>
#include <hpx/runtime/serialization/serialize.hpp>
#include <hpx/traits/is_bitwise_serializable.hpp>

#include <boost/io/ios_state.hpp>

Expand Down

0 comments on commit 0991de0

Please sign in to comment.