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

Moving coalescing registration to TUs #2076

Merged
merged 1 commit into from Apr 8, 2016
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
5 changes: 3 additions & 2 deletions hpx/components/iostreams/write_functions.hpp
Expand Up @@ -12,11 +12,12 @@
#include <hpx/util/bind.hpp>
#include <hpx/util/function.hpp>

#include <ostream>
#include <iterator>
#include <algorithm>
#include <deque>
#include <iterator>
#include <ostream>
#include <type_traits>
#include <vector>

namespace hpx { namespace iostreams
{
Expand Down
12 changes: 0 additions & 12 deletions hpx/lcos/base_lco.hpp
Expand Up @@ -14,10 +14,6 @@
#include <hpx/runtime/actions/component_action.hpp>
#include <hpx/util/ini.hpp>

#include <hpx/plugins/parcel/coalescing_message_handler_registration.hpp>

#include <boost/mpl/bool.hpp>

namespace hpx { namespace lcos
{
/// The \a base_lco class is the common base class for all LCO's
Expand Down Expand Up @@ -124,12 +120,4 @@ HPX_REGISTER_ACTION_DECLARATION(
HPX_REGISTER_ACTION_DECLARATION(
hpx::lcos::base_lco::disconnect_action, base_disconnect_action)

///////////////////////////////////////////////////////////////////////////////
HPX_ACTION_USES_MESSAGE_COALESCING_NOTHROW(
hpx::lcos::base_lco::set_event_action, "lco_set_value_action",
std::size_t(-1), std::size_t(-1))
HPX_ACTION_USES_MESSAGE_COALESCING_NOTHROW(
hpx::lcos::base_lco::set_exception_action, "lco_set_value_action",
std::size_t(-1), std::size_t(-1))

#endif
17 changes: 9 additions & 8 deletions hpx/lcos/base_lco_with_value.hpp
Expand Up @@ -18,10 +18,11 @@
#include <hpx/util/unused.hpp>
#include <hpx/util/void_guard.hpp>

#include <boost/mpl/bool.hpp>
#include <boost/mpl/if.hpp>
#include <hpx/plugins/parcel/coalescing_message_handler_registration.hpp>

#include <boost/preprocessor/cat.hpp>
#include <boost/type_traits/is_same.hpp>

#include <type_traits>

namespace hpx { namespace lcos
{
Expand All @@ -35,8 +36,8 @@ namespace hpx { namespace lcos
template <typename Result, typename RemoteResult>
class base_lco_with_value : public base_lco
{
typedef typename boost::mpl::if_<
boost::is_same<void, Result>, util::unused_type, Result
typedef typename std::conditional<
std::is_void<Result>::value, util::unused_type, Result
>::type result_type;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use std::is_void<Result>::value instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I will change that.


protected:
Expand Down Expand Up @@ -162,9 +163,6 @@ namespace hpx { namespace traits
HPX_REGISTER_TYPED_CONTINUATION_DECLARATION( \
Value \
, BOOST_PP_CAT(typed_continuation_, Name)) \
HPX_ACTION_USES_MESSAGE_COALESCING_NOTHROW( \
hpx::lcos::base_lco_with_value<Value>::set_value_action, \
"lco_set_value_action", std::size_t(-1), std::size_t(-1)) \
/**/

#define HPX_REGISTER_BASE_LCO_WITH_VALUE(Value, Name) \
Expand All @@ -177,6 +175,9 @@ namespace hpx { namespace traits
HPX_REGISTER_TYPED_CONTINUATION( \
Value \
, BOOST_PP_CAT(typed_continuation_, Name)) \
HPX_ACTION_USES_MESSAGE_COALESCING_NOTHROW( \
hpx::lcos::base_lco_with_value<Value>::set_value_action, \
"lco_set_value_action", std::size_t(-1), std::size_t(-1)) \
/**/

#define HPX_REGISTER_BASE_LCO_WITH_VALUE_ID( \
Expand Down
1 change: 1 addition & 0 deletions hpx/parallel/segmented_algorithms/count.hpp
Expand Up @@ -19,6 +19,7 @@

#include <algorithm>
#include <iterator>
#include <numeric>
#include <type_traits>
#include <list>

Expand Down
Expand Up @@ -47,8 +47,8 @@ namespace hpx { namespace parcelset
#define HPX_REGISTER_COALESCING_COUNTERS(Action, coalescing_name) \
namespace hpx { namespace parcelset \
{ \
template<> \
inline char const* get_action_coalescing_name<Action>() \
template<> HPX_ALWAYS_EXPORT \
char const* get_action_coalescing_name<Action>() \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's your rationale for this change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rationale is that we don't really have to have the get_action_coalescing_name definition in each translation unit. We have the same already for get_action_name.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition, this change silenced the memory leak report I got.

{ \
return coalescing_name; \
} \
Expand Down
7 changes: 4 additions & 3 deletions hpx/util/ini.hpp
Expand Up @@ -8,13 +8,14 @@
#if !defined(HPX_UTIL_SECTION_SEP_17_2008_022PM)
#define HPX_UTIL_SECTION_SEP_17_2008_022PM

#include <map>
#include <iostream>

#include <hpx/runtime/serialization/serialization_fwd.hpp>

#include <boost/lexical_cast.hpp>

#include <iostream>
#include <map>
#include <vector>

// suppress warnings about dependent classes not being exported from the dll
#if defined(HPX_MSVC)
#pragma warning(push)
Expand Down
12 changes: 11 additions & 1 deletion src/lcos/base_lco.cpp
Expand Up @@ -4,7 +4,7 @@
// 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 <hpx/hpx_fwd.hpp>
#include <hpx/config.hpp>
#include <hpx/runtime/applier/applier.hpp>
#include <hpx/runtime/components/component_factory.hpp>
#include <hpx/runtime/components/derived_component_factory.hpp>
Expand All @@ -13,6 +13,8 @@
#include <hpx/util/ini.hpp>
#include <hpx/util/serialize_exception.hpp>

#include <hpx/plugins/parcel/coalescing_message_handler_registration.hpp>

namespace hpx { namespace lcos
{
void base_lco::set_exception(boost::exception_ptr const& e)
Expand Down Expand Up @@ -73,6 +75,14 @@ HPX_REGISTER_ACTION_ID(hpx::lcos::base_lco::connect_action,
HPX_REGISTER_ACTION_ID(hpx::lcos::base_lco::disconnect_action,
base_disconnect_action, hpx::actions::base_disconnect_action_id)

///////////////////////////////////////////////////////////////////////////////
HPX_ACTION_USES_MESSAGE_COALESCING_NOTHROW(
hpx::lcos::base_lco::set_event_action, "lco_set_value_action",
std::size_t(-1), std::size_t(-1))
HPX_ACTION_USES_MESSAGE_COALESCING_NOTHROW(
hpx::lcos::base_lco::set_exception_action, "lco_set_value_action",
std::size_t(-1), std::size_t(-1))

///////////////////////////////////////////////////////////////////////////////
HPX_DEFINE_GET_COMPONENT_TYPE_STATIC(
hpx::lcos::base_lco, hpx::components::component_base_lco)
Expand Down
3 changes: 2 additions & 1 deletion src/runtime/parcelset/parcelhandler.cpp
Expand Up @@ -6,7 +6,7 @@
// 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 <hpx/hpx_fwd.hpp>
#include <hpx/config.hpp>
#include <hpx/state.hpp>
#include <hpx/exception.hpp>
#include <hpx/config/asio.hpp>
Expand All @@ -18,6 +18,7 @@
#include <hpx/runtime/naming/resolver_client.hpp>
#include <hpx/runtime/parcelset/parcelhandler.hpp>
#include <hpx/runtime/parcelset/static_parcelports.hpp>
#include <hpx/runtime/parcelset/policies/message_handler.hpp>
#include <hpx/runtime/threads/threadmanager.hpp>
#include <hpx/runtime/actions/continuation.hpp>
#include <hpx/runtime/applier/applier.hpp>
Expand Down
1 change: 1 addition & 0 deletions tests/unit/parcelset/put_parcels_with_coalescing.cpp
Expand Up @@ -5,6 +5,7 @@

#include <hpx/hpx.hpp>
#include <hpx/hpx_init.hpp>
#include <hpx/include/actions.hpp>
#include <hpx/include/performance_counters.hpp>
#include <hpx/include/iostreams.hpp>
#include <hpx/util/lightweight_test.hpp>
Expand Down
1 change: 1 addition & 0 deletions tests/unit/serialization/serialize_buffer.cpp
Expand Up @@ -6,6 +6,7 @@

#include <hpx/hpx_init.hpp>
#include <hpx/hpx.hpp>
#include <hpx/include/actions.hpp>
#include <hpx/util/lightweight_test.hpp>
#include <hpx/runtime/serialization/serialize_buffer.hpp>

Expand Down