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

Removing hpx::util::polymorphic_factory #1470

Merged
merged 22 commits into from Apr 27, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
cf73d36
Fixing problems with polymorphic serialization
sithhell Apr 17, 2015
db00271
Ported action serialization to use the new polymorphic factory
sithhell Apr 17, 2015
eb93bb0
Simplyifing plain action registration
sithhell Apr 19, 2015
8f75dfa
Silence warning
sithhell Apr 19, 2015
48cb976
Fixing decorated functions with plain actions
sithhell Apr 20, 2015
8bcac71
Converting action continuations to new serialization
sithhell Apr 20, 2015
8846488
Converting function serialization to new scheme. deleting old polymor…
sithhell Apr 20, 2015
55d42bc
Merge remote-tracking branch 'origin/master' into new_action_serializ…
sithhell Apr 20, 2015
884efb4
Fixing one left over of old polymorphic_factory
sithhell Apr 20, 2015
4e08f3e
Fixing compilation problems
sithhell Apr 20, 2015
5164a28
Fixing polymorphic non intrusive serialization
sithhell Apr 21, 2015
262a598
Fine tuning of polymorphic serialization
sithhell Apr 21, 2015
3a24621
Fixing line length and other minor adaptions
sithhell Apr 24, 2015
b0e3c64
Merge branch 'master' into new_action_serialization
sithhell Apr 24, 2015
c077c17
More cosmetics
sithhell Apr 24, 2015
b74b2ce
Touching up documentation
sithhell Apr 24, 2015
d4d983e
added HPX_TRAITS_NONINTRUSIVE_POLYMORPHIC_TEMPLATE
AntonBikineev Apr 24, 2015
3196f67
Merge branch 'new_action_serialization' of https://github.com/STEllAR…
AntonBikineev Apr 24, 2015
a254882
Merge branch 'master' into new_action_serialization
sithhell Apr 27, 2015
532c1bf
Fixing merge conflict (fixed component ids had incorrect numbers)
sithhell Apr 27, 2015
1b38cc4
Fixing up component types and corresponding names for fixed components
sithhell Apr 27, 2015
4174af4
Fixing typo in component name comment
sithhell Apr 27, 2015
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
2 changes: 0 additions & 2 deletions docs/hpx.idx
Expand Up @@ -412,8 +412,6 @@ HPX_DEFINE_COMPONENT_ACTION "" "HPX_DEFINE_COMPONENT_ACTION"
HPX_DEFINE_COMPONENT_CONST_ACTION "" "HPX_DEFINE_COMPONENT_CONST_ACTION"

# hpx/runtime/actions/plain_action.hpp
HPX_REGISTER_PLAIN_ACTION "" "HPX_REGISTER_PLAIN_ACTION"
HPX_DEFINE_PLAIN_ACTION "" "HPX_DEFINE_PLAIN_ACTION"
HPX_PLAIN_ACTION "" "HPX_PLAIN_ACTION"

# hpx/runtime/components/component_factory.hpp
Expand Down
6 changes: 3 additions & 3 deletions docs/manual/applying_actions.qbk
Expand Up @@ -37,7 +37,7 @@ the action type. Here is an example demonstrating this:
If the action type should be defined somewhere not in global namespace, the
action type definition has to be split into two macro invocations
([macroref HPX_DEFINE_PLAIN_ACTION `HPX_DEFINE_PLAIN_ACTION`] and
[macroref HPX_REGISTER_PLAIN_ACTION `HPX_REGISTER_PLAIN_ACTION`]) as shown in
[macroref HPX_REGISTER_ACTION `HPX_REGISTER_ACTION`]) as shown in
the next example:

namespace app
Expand All @@ -61,7 +61,7 @@ the next example:
// The following macro expands to a series of definitions of global objects
// which are needed for proper serialization and initialization support
// enabling the remote invocation of the function `some_global_function`.
``[macroref HPX_REGISTER_PLAIN_ACTION `HPX_REGISTER_PLAIN_ACTION`]``(app::some_global_action, app_some_global_action);
``[macroref HPX_REGISTER_ACTION `HPX_REGISTER_ACTION`]``(app::some_global_action, app_some_global_action);

The shown code defines an action type `some_global_action` inside the namespace
`app`.
Expand All @@ -70,7 +70,7 @@ The shown code defines an action type `some_global_action` inside the namespace
above, the name of the action type to create has to be the same for
both macro invocations (here `some_global_action`).]

[important The second argument passed to [macroref HPX_REGISTER_PLAIN_ACTION `HPX_REGISTER_PLAIN_ACTION`]
[important The second argument passed to [macroref HPX_REGISTER_ACTION `HPX_REGISTER_ACTION`]
(`app_some_global_action`) has to comprise a globally unique C++
identifier representing the action. This is used for serialization
purposes.]
Expand Down
1 change: 0 additions & 1 deletion examples/1d_hydro/1d_hydro_upwind.cpp
Expand Up @@ -13,7 +13,6 @@
// INCLUDES
#include <hpx/hpx_init.hpp>
#include <hpx/runtime/actions/plain_action.hpp>
#include <hpx/runtime/components/plain_component_factory.hpp>
#include <hpx/include/async.hpp>
#include <hpx/include/iostreams.hpp>
#include <hpx/lcos/future_wait.hpp>
Expand Down
3 changes: 1 addition & 2 deletions examples/heartbeat/heartbeat.cpp
Expand Up @@ -8,10 +8,9 @@

#include <hpx/hpx_init.hpp>
#include <hpx/exception.hpp>
#include <hpx/runtime/applier/applier.hpp>
#include <hpx/include/performance_counters.hpp>
#include <hpx/include/lcos.hpp>
#include <hpx/runtime/actions/plain_action.hpp>
#include <hpx/runtime/components/plain_component_factory.hpp>
#include <hpx/runtime/threads/thread_helpers.hpp>
#include <hpx/lcos/future.hpp>
#include <hpx/state.hpp>
Expand Down
1 change: 0 additions & 1 deletion examples/quickstart/1d_wave_equation.cpp
Expand Up @@ -22,7 +22,6 @@
// Include statements.
#include <hpx/hpx_init.hpp>
#include <hpx/runtime/actions/plain_action.hpp>
#include <hpx/runtime/components/plain_component_factory.hpp>
#include <hpx/include/async.hpp>
#include <hpx/lcos/future_wait.hpp>
#include <hpx/include/iostreams.hpp>
Expand Down
1 change: 1 addition & 0 deletions examples/quickstart/fibonacci.cpp
Expand Up @@ -9,6 +9,7 @@

#include <hpx/hpx_init.hpp>
#include <hpx/include/actions.hpp>
#include <hpx/include/async.hpp>
#include <hpx/include/util.hpp>

#include <iostream>
Expand Down
1 change: 1 addition & 0 deletions examples/quickstart/fibonacci_one.cpp
Expand Up @@ -11,6 +11,7 @@

#include <hpx/hpx_init.hpp>
#include <hpx/include/actions.hpp>
#include <hpx/include/async.hpp>
#include <hpx/include/util.hpp>

#include <iostream>
Expand Down
5 changes: 1 addition & 4 deletions examples/quickstart/non_atomic_rma.cpp
Expand Up @@ -17,7 +17,6 @@
#include <hpx/hpx.hpp>
#include <hpx/hpx_init.hpp>
#include <hpx/runtime/actions/plain_action.hpp>
#include <hpx/runtime/components/plain_component_factory.hpp>
#include <hpx/runtime/serialization/serialize.hpp>
#include <hpx/runtime/serialization/vector.hpp>

Expand Down Expand Up @@ -80,10 +79,8 @@ int hpx_main(po::variables_map &vm)
int result = 0;
double elapsed = 0.0;

components::component_type type =
components::get_component_type<components::server::plain_function<set_initialdata_action> >();
std::vector<naming::id_type> localities =
hpx::find_remote_localities(type);
hpx::find_remote_localities();

Copy link
Member

Choose a reason for hiding this comment

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

Is there still a way to identify plain actions for selecting localities supporting them?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, since all plain actions have the same component type, this is not possible with those changes. Is this something we really need?

naming::id_type this_prefix = hpx::find_here();

Expand Down
16 changes: 7 additions & 9 deletions examples/quickstart/print_to_console.cpp
Expand Up @@ -4,15 +4,16 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

///////////////////////////////////////////////////////////////////////////////
// This is not demonstrating the recommended way of printing things to the
// console - this can be done easily using hpx::cout instead. The purpose of
// this example is to demonstrate how to use templated plain actions.
// This is not demonstrating the recommended way of printing things to the
// console - this can be done easily using hpx::cout instead. The purpose of
// this example is to demonstrate how to use templated plain actions.

#include <hpx/hpx_main.hpp>
#include <hpx/include/actions.hpp>
#include <hpx/include/async.hpp>

///////////////////////////////////////////////////////////////////////////////
template <typename T>
template <typename T>
void print(T const& t)
{
std::cout << t << "\n";
Expand All @@ -24,17 +25,14 @@ struct print_action
: hpx::actions::make_action<void (*)(T const&), &print<T>, print_action<T> >
{};

HPX_REGISTER_PLAIN_ACTION_TEMPLATE((template <typename T>), (print_action<T>));

// define a direct action which is semantically equivalent to the plain action
// above
template <typename T>
struct print_direct_action
: hpx::actions::make_direct_action<void (*)(T const&), &print<T>, print_direct_action<T> >
: hpx::actions::make_direct_action<
void (*)(T const&), &print<T>, print_direct_action<T> >
{};
Copy link
Member

Choose a reason for hiding this comment

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

Please try to limit line length to approx. 80 characters.

Copy link
Member

Choose a reason for hiding this comment

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

There should be no need for accessing the nested ::type here. If the code is otherwise failing then it's a bug that needs fixing.

Copy link
Member

Choose a reason for hiding this comment

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

That's true in other places as well (see changes to parallel/segmented_algorithms/detail/dispatch.hpp)

Copy link
Member

Choose a reason for hiding this comment

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

For the record, I don't mind the change (in fact I slightly prefer it due to compiler internals and other unimportant details). However, this pattern is used all over the place and is even documented for users to leverage, so I just want to make sure that it isn't broken now. Secondarily, I'd like both a rationale for the change, and it being applied consistently.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's not really necessary. I needed to do that change during development and forgot to revert. Action access with nested ::type is not a problem.


HPX_REGISTER_PLAIN_ACTION_TEMPLATE((template <typename T>), (print_direct_action<T>));

///////////////////////////////////////////////////////////////////////////////
int main()
{
Expand Down
1 change: 0 additions & 1 deletion examples/quickstart/quicksort.cpp
Expand Up @@ -7,7 +7,6 @@
#include <hpx/hpx.hpp>
#include <hpx/hpx_init.hpp>
#include <hpx/runtime/actions/plain_action.hpp>
#include <hpx/runtime/components/plain_component_factory.hpp>
#include <hpx/util/high_resolution_timer.hpp>
#include <hpx/include/async.hpp>

Expand Down
Expand Up @@ -176,10 +176,6 @@ namespace hpx { namespace components { namespace server
{};
}}}

HPX_REGISTER_PLAIN_ACTION_TEMPLATE(
(template <typename Component>),
(hpx::components::server::trigger_migrate_from_storage_here_action<Component>))

#endif


Expand Up @@ -208,14 +208,6 @@ namespace hpx { namespace components { namespace server
{};
}}}

HPX_REGISTER_PLAIN_ACTION_TEMPLATE(
(template <typename Component>),
(hpx::components::server::migrate_to_storage_here_action<Component>))

HPX_REGISTER_PLAIN_ACTION_TEMPLATE(
(template <typename Component>),
(hpx::components::server::trigger_migrate_to_storage_here_action<Component>))

#endif


33 changes: 18 additions & 15 deletions hpx/hpx_fwd.hpp
Expand Up @@ -548,43 +548,46 @@ namespace hpx
// component creation, etc). One per locality.
component_runtime_support = 0,

// Pseudo-component to be used for plain actions
component_plain_function = 1,

// Pseudo-component for direct access to local virtual memory.
component_memory = 1,
component_memory = 2,

// Generic memory blocks.
component_memory_block = 2,
component_memory_block = 3,

// Base component for LCOs that do not produce a value.
component_base_lco = 3,
component_base_lco = 4,

// Base component for LCOs that do produce values.
component_base_lco_with_value = 4,
component_base_lco_with_value = 5,

// Synchronization latch, barrier, and flex_barrier LCOs.
component_latch = ((5 << 16) | component_base_lco_with_value),
component_barrier = ((6 << 16) | component_base_lco),
component_flex_barrier = ((7 << 16) | component_base_lco),
component_latch = ((6 << 16) | component_base_lco_with_value),
component_barrier = ((7 << 16) | component_base_lco),
component_flex_barrier = ((8 << 16) | component_base_lco),

// An LCO representing a value which may not have been computed yet.
component_promise = ((8 << 16) | component_base_lco_with_value),
component_promise = ((9 << 16) | component_base_lco_with_value),

// AGAS locality services.
component_agas_locality_namespace = 9,
component_agas_locality_namespace = 10,

// AGAS primary address resolution services.
component_agas_primary_namespace = 10,
component_agas_primary_namespace = 11,

// AGAS global type system.
component_agas_component_namespace = 11,
component_agas_component_namespace = 12,

// AGAS symbolic naming services.
component_agas_symbol_namespace = 12,
component_agas_symbol_namespace = 13,

#if defined(HPX_HAVE_SODIUM)
// root CA, subordinate CA
signed_certificate_promise = ((13 << 16) | component_base_lco_with_value),
component_root_certificate_authority = 14,
component_subordinate_certificate_authority = 15,
signed_certificate_promise = ((14 << 16) | component_base_lco_with_value),
component_root_certificate_authority = 15,
component_subordinate_certificate_authority = 16,
#endif

component_last,
Expand Down
2 changes: 0 additions & 2 deletions hpx/include/actions.hpp
Expand Up @@ -13,8 +13,6 @@
#include <hpx/runtime/actions/manage_object_action.hpp>
#include <hpx/runtime/actions/continuation.hpp>
#include <hpx/runtime/actions/action_invoke_no_more_than.hpp>
#include <hpx/runtime/components/plain_component_factory.hpp>
#include <hpx/runtime/components/component_factory.hpp>

#endif

1 change: 0 additions & 1 deletion hpx/include/components.hpp
Expand Up @@ -12,7 +12,6 @@

#include <hpx/runtime/components/component_factory.hpp>
#include <hpx/runtime/components/derived_component_factory.hpp>
#include <hpx/runtime/components/plain_component_factory.hpp>

#include <hpx/runtime/components/component_startup_shutdown.hpp>
#include <hpx/runtime/components/component_commandline.hpp>
Expand Down
1 change: 0 additions & 1 deletion hpx/include/plain_actions.hpp
Expand Up @@ -9,7 +9,6 @@
#include <hpx/hpx_fwd.hpp>
#include <hpx/runtime/actions/plain_action.hpp>
#include <hpx/runtime/actions/continuation.hpp>
#include <hpx/runtime/components/plain_component_factory.hpp>

#endif

8 changes: 4 additions & 4 deletions hpx/lcos/broadcast.hpp
Expand Up @@ -955,7 +955,7 @@ namespace hpx { namespace lcos
HPX_REGISTER_BROADCAST_APPLY_ACTION_2(Action, Action) \
/**/
#define HPX_REGISTER_BROADCAST_APPLY_ACTION_2(Action, Name) \
HPX_REGISTER_PLAIN_ACTION( \
HPX_REGISTER_ACTION( \
::hpx::lcos::detail::make_broadcast_apply_action<Action>::type \
, BOOST_PP_CAT(broadcast_apply_, Name) \
) \
Expand Down Expand Up @@ -1011,7 +1011,7 @@ namespace hpx { namespace lcos
HPX_REGISTER_BROADCAST_APPLY_WITH_INDEX_ACTION_2(Action, Action) \
/**/
#define HPX_REGISTER_BROADCAST_APPLY_WITH_INDEX_ACTION_2(Action, Name) \
HPX_REGISTER_PLAIN_ACTION( \
HPX_REGISTER_ACTION( \
::hpx::lcos::detail::make_broadcast_apply_action< \
::hpx::lcos::detail::broadcast_with_index<Action> \
>::type \
Expand Down Expand Up @@ -1064,7 +1064,7 @@ namespace hpx { namespace lcos
HPX_REGISTER_BROADCAST_ACTION_2(Action, Action) \
/**/
#define HPX_REGISTER_BROADCAST_ACTION_2(Action, Name) \
HPX_REGISTER_PLAIN_ACTION( \
HPX_REGISTER_ACTION( \
::hpx::lcos::detail::make_broadcast_action<Action>::type \
, BOOST_PP_CAT(broadcast_, Name) \
) \
Expand Down Expand Up @@ -1118,7 +1118,7 @@ namespace hpx { namespace lcos
HPX_REGISTER_BROADCAST_WITH_INDEX_ACTION_2(Action, Action) \
/**/
#define HPX_REGISTER_BROADCAST_WITH_INDEX_ACTION_2(Action, Name) \
HPX_REGISTER_PLAIN_ACTION( \
HPX_REGISTER_ACTION( \
::hpx::lcos::detail::make_broadcast_action< \
::hpx::lcos::detail::broadcast_with_index<Action> \
>::type \
Expand Down
8 changes: 4 additions & 4 deletions hpx/lcos/fold.hpp
Expand Up @@ -719,14 +719,14 @@ namespace hpx { namespace lcos
/**/

#define HPX_REGISTER_FOLD_ACTION_2(Action, FoldOp) \
HPX_REGISTER_PLAIN_ACTION( \
HPX_REGISTER_ACTION( \
::hpx::lcos::detail::make_fold_action<Action>:: \
fold_invoker<FoldOp>::type \
, BOOST_PP_CAT(BOOST_PP_CAT(fold_, Action), FoldOp) \
) \
/**/
#define HPX_REGISTER_FOLD_ACTION_3(Action, FoldOp, Name) \
HPX_REGISTER_PLAIN_ACTION( \
HPX_REGISTER_ACTION( \
::hpx::lcos::detail::make_fold_action<Action>:: \
fold_invoker<FoldOp>::type \
, BOOST_PP_CAT(fold_, Name) \
Expand Down Expand Up @@ -772,15 +772,15 @@ namespace hpx { namespace lcos
/**/

#define HPX_REGISTER_FOLD_WITH_INDEX_ACTION_2(Action, FoldOp) \
HPX_REGISTER_PLAIN_ACTION( \
HPX_REGISTER_ACTION( \
::hpx::lcos::detail::make_fold_action< \
::hpx::lcos::detail::fold_with_index<Action> \
>::fold_invoker<FoldOp>::type \
, BOOST_PP_CAT(BOOST_PP_CAT(fold_, Action), FoldOp) \
) \
/**/
#define HPX_REGISTER_FOLD_WITH_INDEX_ACTION_3(Action, FoldOp, Name) \
HPX_REGISTER_PLAIN_ACTION( \
HPX_REGISTER_ACTION( \
::hpx::lcos::detail::make_fold_action< \
::hpx::lcos::detail::fold_with_index<Action> \
>::fold_invoker<FoldOp>::type \
Expand Down