Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove leftovers of traits::type_size #1650

Merged
merged 3 commits into from Jul 20, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 0 additions & 4 deletions hpx/runtime/actions/action_support.hpp
Expand Up @@ -227,10 +227,6 @@ namespace hpx { namespace actions
/// Return the thread stacksize this action has to be executed with
virtual threads::thread_stacksize get_thread_stacksize() const = 0;

/// Return the size of action arguments in bytes
/// flags should contain serialization options which affect the space required
virtual std::size_t get_type_size(int flags) const = 0;

/// Return whether the embedded action is part of termination detection
virtual bool does_termination_detection() const = 0;

Expand Down
8 changes: 0 additions & 8 deletions hpx/runtime/actions/transfer_action.hpp
Expand Up @@ -30,7 +30,6 @@
#include <hpx/traits/action_schedule_thread.hpp>
#include <hpx/traits/action_serialization_filter.hpp>
#include <hpx/traits/action_stacksize.hpp>
#include <hpx/traits/type_size.hpp>
#include <hpx/traits/serialize_as_future.hpp>
#include <hpx/util/move.hpp>
#include <hpx/util/serialize_exception.hpp>
Expand Down Expand Up @@ -255,13 +254,6 @@ namespace hpx { namespace actions
return stacksize_;
}

/// Return the size of action arguments in bytes
/// flags should contain serialization options which affect the space required
std::size_t get_type_size(int flags) const
{
return traits::type_size<arguments_type>::call(arguments_, flags);
}

/// Wait for embedded futures to become ready
void wait_for_futures()
{
Expand Down
32 changes: 0 additions & 32 deletions hpx/runtime/parcelset/parcel.hpp
Expand Up @@ -19,7 +19,6 @@
#include <hpx/runtime/serialization/binary_filter.hpp>
#include <hpx/runtime/serialization/serialize.hpp>
#include <hpx/util/assert.hpp>
#include <hpx/traits/type_size.hpp>
#include <hpx/traits/serialize_as_future.hpp>

#include <boost/intrusive_ptr.hpp>
Expand Down Expand Up @@ -96,8 +95,6 @@ namespace hpx { namespace parcelset
virtual naming::gid_type get_parcel_id() const = 0;
virtual void set_parcel_id(naming::gid_type const& id) = 0;

virtual std::size_t get_type_size(int flags) const = 0;

virtual bool does_termination_detection() const = 0;

virtual void wait_for_futures() = 0;
Expand Down Expand Up @@ -316,11 +313,6 @@ namespace hpx { namespace parcelset
data_.parcel_id_ = id;
}

std::size_t get_type_size(int flags) const
{
return sizeof(parcel_buffer) + this->get_action()->get_type_size(flags);
}

bool does_termination_detection() const
{
return this->get_action()->does_termination_detection();
Expand Down Expand Up @@ -501,14 +493,6 @@ namespace hpx { namespace parcelset
data_.parcel_id_ = id;
}

std::size_t get_type_size(int flags) const
{
return sizeof(parcel_buffer) +
traits::type_size<std::vector<naming::id_type> >::call(dests_, flags) +
traits::type_size<std::vector<naming::address> >::call(addrs_, flags) +
this->get_action()->get_type_size(flags); // action
}

void save(serialization::output_archive& ar) const;

void load(serialization::input_archive& ar);
Expand Down Expand Up @@ -709,11 +693,6 @@ namespace hpx { namespace parcelset
return data_->get_message_handler(ph, loc, *this);
}

std::size_t get_type_size(int flags) const
{
return data_->get_type_size(flags);
}

bool does_termination_detection() const
{
return data_->does_termination_detection();
Expand Down Expand Up @@ -750,15 +729,6 @@ namespace hpx { namespace parcelset

namespace hpx { namespace traits
{
template <>
struct type_size<hpx::parcelset::parcel>
{
static std::size_t call(hpx::parcelset::parcel const& p, int flags)
{
return sizeof(hpx::parcelset::parcel) + p.get_type_size(flags);
}
};

template <>
struct serialize_as_future<hpx::parcelset::parcel>
: boost::mpl::true_
Expand Down Expand Up @@ -792,8 +762,6 @@ namespace hpx { namespace traits
#endif
}}

#include <hpx/traits/type_size.hpp>

#include <hpx/config/warnings_suffix.hpp>

#endif
17 changes: 0 additions & 17 deletions hpx/runtime/serialization/serialize_buffer.hpp
Expand Up @@ -457,23 +457,6 @@ namespace hpx { namespace traits
struct supports_streaming_with_any<serialization::serialize_buffer<T, Allocator> >
: boost::mpl::false_
{};

///////////////////////////////////////////////////////////////////////////
// Calculate the required amount of raw memory for serialization.
template <typename T, typename Allocator>
struct type_size<serialization::serialize_buffer<T, Allocator> >
{
static std::size_t call(serialization::serialize_buffer<T, Allocator> const& b, int flags)
{
if (flags & hpx::serialization::disable_data_chunking) {
return b.size() * sizeof(T) + sizeof(std::size_t) + sizeof(Allocator); //-V119
}
else {
// size required to specify a new pointer chunk is coming (needs checking)
return 8;
}
}
};
}}

#endif
4 changes: 0 additions & 4 deletions hpx/traits.hpp
Expand Up @@ -94,10 +94,6 @@ namespace hpx { namespace traits
struct action_schedule_thread;

///////////////////////////////////////////////////////////////////////////
// Customization point for type_size
template <typename T, typename Enable = void>
struct type_size;

template <typename A, typename Enable = void>
struct is_chunk_allocator;

Expand Down
164 changes: 0 additions & 164 deletions hpx/traits/type_size.hpp

This file was deleted.

22 changes: 17 additions & 5 deletions tests/performance/local/serialization_overhead.cpp
Expand Up @@ -3,16 +3,16 @@
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#include <algorithm>
#include <iterator>
#include <fstream>

#include <hpx/hpx_init.hpp>
#include <hpx/include/actions.hpp>
#include <hpx/include/iostreams.hpp>
#include <hpx/include/serialization.hpp>
#include <hpx/util/high_resolution_timer.hpp>

#include <algorithm>
#include <iterator>
#include <fstream>

#include <boost/format.hpp>

// This function will never be called
Expand All @@ -22,6 +22,18 @@ int test_function(hpx::serialization::serialize_buffer<double> const& b)
}
HPX_PLAIN_ACTION(test_function, test_action)

std::size_t get_archive_size(hpx::parcelset::parcel const& p,
boost::uint32_t flags,
std::vector<hpx::serialization::serialization_chunk>* chunks)
{
// gather the required size for the archive
hpx::serialization::detail::size_gatherer_container gather_size;
hpx::serialization::output_archive archive(
gather_size, flags, 0, chunks);
archive << p;
return gather_size.size();
}

///////////////////////////////////////////////////////////////////////////////
double benchmark_serialization(std::size_t data_size, std::size_t iterations,
bool continuation, bool zerocopy)
Expand Down Expand Up @@ -100,7 +112,7 @@ double benchmark_serialization(std::size_t data_size, std::size_t iterations,

for (std::size_t i = 0; i != iterations; ++i)
{
std::size_t arg_size = hpx::traits::get_type_size(outp, out_archive_flags);
std::size_t arg_size = get_archive_size(outp, out_archive_flags, chunks);
std::vector<char> out_buffer;

out_buffer.resize(arg_size + HPX_PARCEL_SERIALIZATION_OVERHEAD);
Expand Down