Skip to content

Commit

Permalink
Cleaning component modules
Browse files Browse the repository at this point in the history
  • Loading branch information
hkaiser committed Feb 4, 2024
1 parent 4981de5 commit 991215c
Show file tree
Hide file tree
Showing 95 changed files with 1,035 additions and 1,076 deletions.
12 changes: 5 additions & 7 deletions components/component_storage/src/component_module.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2015 Hartmut Kaiser
// Copyright (c) 2015-2024 Hartmut Kaiser
//
// SPDX-License-Identifier: BSL-1.0
// Distributed under the Boost Software License, Version 1.0. (See accompanying
Expand All @@ -17,11 +17,10 @@
// Add factory registration functionality.
HPX_REGISTER_COMPONENT_MODULE()

typedef hpx::components::server::component_storage component_storage_type;
using component_storage_type = hpx::components::server::component_storage;

HPX_REGISTER_COMPONENT(
hpx::components::component<component_storage_type>,
component_storage_factory, hpx::components::factory_enabled)
HPX_REGISTER_COMPONENT(hpx::components::component<component_storage_type>,
component_storage_factory, hpx::components::factory_state::enabled)
HPX_DEFINE_GET_COMPONENT_TYPE(component_storage_type)

///////////////////////////////////////////////////////////////////////////////
Expand All @@ -31,6 +30,5 @@ HPX_REGISTER_ACTION(
HPX_REGISTER_ACTION(
hpx::components::server::component_storage::migrate_from_here_action,
component_storage_migrate_component_from_here_action)
HPX_REGISTER_ACTION(
hpx::components::server::component_storage::size_action,
HPX_REGISTER_ACTION(hpx::components::server::component_storage::size_action,
component_storage_size_action)
28 changes: 12 additions & 16 deletions components/iostreams/src/component_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,36 +16,32 @@
#include <hpx/runtime_local/shutdown_function.hpp>
#include <hpx/runtime_local/startup_function.hpp>

#include <hpx/components/iostreams/server/output_stream.hpp>
#include <hpx/components/iostreams/ostream.hpp>
#include <hpx/components/iostreams/server/output_stream.hpp>
#include <hpx/components/iostreams/standard_streams.hpp>

///////////////////////////////////////////////////////////////////////////////
HPX_REGISTER_COMPONENT_MODULE()

typedef hpx::iostreams::server::output_stream ostream_type;

HPX_REGISTER_COMPONENT(
hpx::components::component<ostream_type>,
output_stream_factory, hpx::components::factory_enabled)
HPX_REGISTER_COMPONENT(hpx::components::component<ostream_type>,
output_stream_factory, hpx::components::factory_state::enabled)
HPX_DEFINE_GET_COMPONENT_TYPE(ostream_type)

///////////////////////////////////////////////////////////////////////////////
HPX_REGISTER_ACTION_ID(
ostream_type::write_async_action,
HPX_REGISTER_ACTION_ID(ostream_type::write_async_action,
output_stream_write_async_action,
hpx::actions::output_stream_write_async_action_id)

HPX_REGISTER_ACTION_ID(
ostream_type::write_sync_action,
HPX_REGISTER_ACTION_ID(ostream_type::write_sync_action,
output_stream_write_sync_action,
hpx::actions::output_stream_write_sync_action_id)

///////////////////////////////////////////////////////////////////////////////
// Register a startup function which will be called as a HPX-thread during
// runtime startup.
namespace hpx { namespace iostreams { namespace detail
{
namespace hpx { namespace iostreams { namespace detail {
///////////////////////////////////////////////////////////////////////////
void register_ostreams()
{
Expand All @@ -65,21 +61,21 @@ namespace hpx { namespace iostreams { namespace detail
bool get_startup(startup_function_type& startup_func, bool& pre_startup)
{
// return our startup-function
startup_func = register_ostreams; // function to run during startup
pre_startup = true; // run as pre-startup function
startup_func = register_ostreams; // function to run during startup
pre_startup = true; // run as pre-startup function
return true;
}

bool get_shutdown(shutdown_function_type& shutdown_func, bool& pre_shutdown)
{
// return our startup-function
shutdown_func = unregister_ostreams; // function to run during startup
pre_shutdown = false; // run as pre-startup function
shutdown_func =
unregister_ostreams; // function to run during startup
pre_shutdown = false; // run as pre-startup function
return true;
}
}}}
}}} // namespace hpx::iostreams::detail

// Note that this macro can be used not more than once in one module.
HPX_REGISTER_STARTUP_SHUTDOWN_MODULE(
hpx::iostreams::detail::get_startup, hpx::iostreams::detail::get_shutdown)

7 changes: 3 additions & 4 deletions components/process/src/process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ HPX_REGISTER_COMPONENT_MODULE()

typedef hpx::components::process::server::child child_type;

HPX_REGISTER_COMPONENT(
hpx::components::component<child_type>,
hpx_components_process_child_factory, hpx::components::factory_enabled)
HPX_REGISTER_COMPONENT(hpx::components::component<child_type>,
hpx_components_process_child_factory,
hpx::components::factory_state::enabled)
HPX_DEFINE_GET_COMPONENT_TYPE(child_type)

2 changes: 1 addition & 1 deletion examples/quickstart/data_actions.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2014-2017 Hartmut Kaiser
// Copyright (c) 2014-2024 Hartmut Kaiser
//
// SPDX-License-Identifier: BSL-1.0
// Distributed under the Boost Software License, Version 1.0. (See accompanying
Expand Down
14 changes: 9 additions & 5 deletions examples/sheneos/sheneos/server/partition3d.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2007-2017 Hartmut Kaiser
// Copyright (c) 2007-2024 Hartmut Kaiser
//
// SPDX-License-Identifier: BSL-1.0
// Distributed under the Boost Software License, Version 1.0. (See accompanying
Expand Down Expand Up @@ -393,13 +393,17 @@ namespace hpx { namespace serialization {
void serialize(
input_archive& ar, sheneos::sheneos_coord& coord, unsigned int const)
{
ar& coord.ye_& coord.temp_& coord.rho_;
// clang-format off
ar & coord.ye_ & coord.temp_ & coord.rho_;
// clang-format on
}

void serialize(
output_archive& ar, sheneos::sheneos_coord& coord, unsigned int const)
{
ar& coord.ye_& coord.temp_& coord.rho_;
// clang-format off
ar & coord.ye_ & coord.temp_ & coord.rho_;
// clang-format on
}
}} // namespace hpx::serialization

Expand Down Expand Up @@ -427,12 +431,12 @@ HPX_REGISTER_ACTION(hpx::lcos::base_lco_with_value<
set_value_action_vector_vector_double)
HPX_DEFINE_GET_COMPONENT_TYPE_STATIC(
hpx::lcos::base_lco_with_value<std::vector<std::vector<double>>>,
hpx::components::component_base_lco_with_value);
to_int(hpx::components::component_enum_type::base_lco_with_value));

HPX_REGISTER_ACTION(
hpx::lcos::base_lco_with_value<std::vector<double>>::set_value_action,
set_value_action_vector_double)
HPX_DEFINE_GET_COMPONENT_TYPE_STATIC(
hpx::lcos::base_lco_with_value<std::vector<double>>,
hpx::components::component_base_lco_with_value);
to_int(hpx::components::component_enum_type::base_lco_with_value));
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ namespace hpx::compute::host {
helper->operator()(p, page_ptr, pagesize, nodesets.size());
if (dom == numa_domain)
{
HPX_ASSERT((static_cast<std::size_t>(page_ptr) &
HPX_ASSERT((reinterpret_cast<std::size_t>(page_ptr) &
(threads::get_memory_page_size() - 1)) == 0);
// trigger a memory read and rewrite without changing contents
T volatile* vaddr = const_cast<T volatile*>(page_ptr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include <hpx/config.hpp>
#include <hpx/coroutines/thread_enums.hpp>
#include <hpx/threading_base/threading_base_fwd.hpp>

#include <string>
#include <vector>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ double benchmark_serialization(std::size_t data_size, std::size_t iterations,
{
hpx::id_type const here = hpx::find_here();
hpx::naming::address addr(hpx::get_locality(),
hpx::components::component_invalid, (void*) &test_function);
to_int(hpx::components::component_enum_type::invalid),
(void*) &test_function);

// compose archive flags
std::string endian_out = hpx::get_config_entry("hpx.parcel.endian_out",
Expand Down
18 changes: 12 additions & 6 deletions libs/full/actions/tests/unit/zero_copy_serialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ void test_normal_serialization(T& arg)
{
hpx::id_type const here = hpx::find_here();
hpx::naming::address addr(hpx::get_locality(),
hpx::components::component_invalid, (void*) &test_function1);
to_int(hpx::components::component_enum_type::invalid),
(void*) &test_function1);

// compose archive flags
auto out_archive_flags = static_cast<std::uint32_t>(
Expand Down Expand Up @@ -211,7 +212,8 @@ void test_normal_serialization(T1& arg1, T2& arg2)
{
hpx::id_type const here = hpx::find_here();
hpx::naming::address addr(hpx::get_locality(),
hpx::components::component_invalid, (void*) &test_function2);
to_int(hpx::components::component_enum_type::invalid),
(void*) &test_function2);

// compose archive flags
auto out_archive_flags = static_cast<std::uint32_t>(
Expand Down Expand Up @@ -245,7 +247,8 @@ void test_normal_serialization(
{
hpx::id_type const here = hpx::find_here();
hpx::naming::address addr(hpx::get_locality(),
hpx::components::component_invalid, (void*) &test_function2);
to_int(hpx::components::component_enum_type::invalid),
(void*) &test_function2);

// compose archive flags
auto out_archive_flags = static_cast<std::uint32_t>(
Expand Down Expand Up @@ -279,7 +282,8 @@ void test_zero_copy_serialization(T& arg)
{
hpx::id_type const here = hpx::find_here();
hpx::naming::address addr(hpx::get_locality(),
hpx::components::component_invalid, (void*) &test_function1);
to_int(hpx::components::component_enum_type::invalid),
(void*) &test_function1);

// compose archive flags
std::uint32_t out_archive_flags = 0U;
Expand Down Expand Up @@ -311,7 +315,8 @@ void test_zero_copy_serialization(T1& arg1, T2& arg2)
{
hpx::id_type const here = hpx::find_here();
hpx::naming::address addr(hpx::get_locality(),
hpx::components::component_invalid, (void*) &test_function2);
to_int(hpx::components::component_enum_type::invalid),
(void*) &test_function2);

// compose archive flags
std::uint32_t out_archive_flags = 0U;
Expand Down Expand Up @@ -344,7 +349,8 @@ void test_zero_copy_serialization(
{
hpx::id_type const here = hpx::find_here();
hpx::naming::address addr(hpx::get_locality(),
hpx::components::component_invalid, (void*) &test_function2);
to_int(hpx::components::component_enum_type::invalid),
(void*) &test_function2);

// compose archive flags
std::uint32_t out_archive_flags = 0U;
Expand Down
74 changes: 35 additions & 39 deletions libs/full/actions_base/include/hpx/actions_base/plain_action.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2007-2022 Hartmut Kaiser
// Copyright (c) 2007-2024 Hartmut Kaiser
// Copyright (c) 2011 Bryce Lelbach
//
// SPDX-License-Identifier: BSL-1.0
Expand All @@ -19,7 +19,6 @@
#include <hpx/preprocessor/cat.hpp>
#include <hpx/preprocessor/expand.hpp>
#include <hpx/preprocessor/nargs.hpp>
#include <hpx/preprocessor/strip_parens.hpp>

#include <cstdlib>
#include <stdexcept>
Expand Down Expand Up @@ -122,7 +121,7 @@ namespace hpx::traits {
HPX_ALWAYS_EXPORT inline components::component_type component_type_database<
hpx::actions::detail::plain_function>::get() noexcept
{
return hpx::components::component_plain_function;
return to_int(hpx::components::component_enum_type::plain_function);
}

// clang-format off
Expand Down Expand Up @@ -237,37 +236,36 @@ namespace hpx::traits {
/// \a func. It defines the action type \a name representing the given function.
/// This macro additionally registers the newly define action type with HPX.
///
/// The parameter \p func is a global or free (non-member) function which
/// should be encapsulated into a plain action. The parameter \p name is the
/// name of the action type defined by this macro.
/// The parameter \p func is a global or free (non-member) function which should
/// be encapsulated into a plain action. The parameter \p name is the name of
/// the action type defined by this macro.
///
/// \par Example:
///
/// \code
/// namespace app
/// {
/// void some_global_function(double d)
/// {
/// namespace app {
/// void some_global_function(double d) {
/// cout << d;
/// }
/// }
///
/// // This will define the action type 'some_global_action' which represents
/// // the function 'app::some_global_function'.
/// // This will define the action type 'some_global_action' which
/// // represents the function 'app::some_global_function'.
/// HPX_PLAIN_ACTION(app::some_global_function, some_global_action)
/// \endcode
///
/// \note The macro \a HPX_PLAIN_ACTION has to be used at global namespace even
/// if the wrapped function is located in some other namespace. The newly
/// defined action type is placed into the global namespace as well.
///
/// \note The macro \a HPX_PLAIN_ACTION_ID can be used with 1, 2, or 3 arguments.
/// The second and third arguments are optional. The default value for the
/// second argument (the typename of the defined action) is derived from the
/// name of the function (as passed as the first argument) by appending '_action'.
/// The second argument can be omitted only if the first argument with an
/// appended suffix '_action' resolves to a valid, unqualified C++ type name.
/// The default value for the third argument is \a hpx::components::factory_check.
/// \note The macro \a HPX_PLAIN_ACTION_ID can be used with 1, 2, or 3
/// arguments. The second and third arguments are optional. The default
/// value for the second argument (the typename of the defined action) is
/// derived from the name of the function (as passed as the first
/// argument) by appending '_action'. The second argument can be omitted
/// only if the first argument with an appended suffix '_action' resolves
/// to a valid, unqualified C++ type name. The default value for the third
/// argument is \a hpx::components::factory_state::check.
///
/// \note Only one of the forms of this macro \a HPX_PLAIN_ACTION or
/// \a HPX_PLAIN_ACTION_ID should be used for a particular action,
Expand All @@ -282,42 +280,40 @@ namespace hpx::traits {
/// \brief Defines a plain action type based on the given function \a func and
/// registers it with HPX.
///
/// The macro \a HPX_PLAIN_ACTION_ID can be used to define a plain action (e.g. an
/// action encapsulating a global or free function) based on the given function
/// \a func. It defines the action type \a actionname representing the given function.
/// The parameter \a actionid
/// The macro \a HPX_PLAIN_ACTION_ID can be used to define a plain action (e.g.
/// an action encapsulating a global or free function) based on the given
/// function \a func. It defines the action type \a actionname representing the
/// given function.
///
/// The parameter \a actionid specifies an unique integer value which will be
/// The parameter \a actionid specifies a unique integer value which will be
/// used to represent the action during serialization.
///
/// The parameter \p func is a global or free (non-member) function which
/// should be encapsulated into a plain action. The parameter \p name is the
/// name of the action type defined by this macro.
/// The parameter \p func is a global or free (non-member) function which should
/// be encapsulated into a plain action. The parameter \p name is the name of
/// the action type defined by this macro.
///
/// The second parameter has to be usable as a plain (non-qualified) C++
/// identifier, it should not contain special characters which cannot be part
/// of a C++ identifier, such as '<', '>', or ':'.
/// identifier, it should not contain special characters which cannot be part of
/// a C++ identifier, such as '<', '>', or ':'.
///
/// \par Example:
///
/// \code
/// namespace app
/// {
/// void some_global_function(double d)
/// {
/// namespace app {
/// void some_global_function(double d) {
/// cout << d;
/// }
/// }
///
/// // This will define the action type 'some_global_action' which represents
/// // the function 'app::some_global_function'.
/// // This will define the action type 'some_global_action' which
/// // represents the function 'app::some_global_function'.
/// HPX_PLAIN_ACTION_ID(app::some_global_function, some_global_action,
/// some_unique_id);
/// some_unique_id);
/// \endcode
///
/// \note The macro \a HPX_PLAIN_ACTION_ID has to be used at global namespace even
/// if the wrapped function is located in some other namespace. The newly
/// defined action type is placed into the global namespace as well.
/// \note The macro \a HPX_PLAIN_ACTION_ID has to be used at global namespace
/// even if the wrapped function is located in some other namespace. The
/// newly defined action type is placed into the global namespace as well.
///
/// \note Only one of the forms of this macro \a HPX_PLAIN_ACTION or
/// \a HPX_PLAIN_ACTION_ID should be used for a particular action,
Expand Down
Loading

0 comments on commit 991215c

Please sign in to comment.