diff --git a/libs/core/affinity/CMakeLists.txt b/libs/core/affinity/CMakeLists.txt index 4c590c944080..51c636eb7a83 100644 --- a/libs/core/affinity/CMakeLists.txt +++ b/libs/core/affinity/CMakeLists.txt @@ -8,6 +8,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") set(affinity_headers hpx/affinity/affinity_data.hpp hpx/affinity/detail/partlit.hpp + hpx/affinity/detail/parse_mappings.hpp hpx/affinity/parse_affinity_options.hpp ) diff --git a/libs/core/affinity/include/hpx/affinity/detail/parse_mappings.hpp b/libs/core/affinity/include/hpx/affinity/detail/parse_mappings.hpp new file mode 100644 index 000000000000..4637b26cbfca --- /dev/null +++ b/libs/core/affinity/include/hpx/affinity/detail/parse_mappings.hpp @@ -0,0 +1,104 @@ +// Copyright (c) 2007-2024 Hartmut Kaiser +// Copyright (c) 2008-2009 Chirag Dekate, Anshul Tandon +// Copyright (c) 2012-2013 Thomas Heller +// +// SPDX-License-Identifier: BSL-1.0 +// 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) + +#pragma once + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +namespace hpx::threads::detail { + + using bounds_type = std::vector; + + enum class distribution_type : std::int8_t + { + compact = 0x01, + scatter = 0x02, + balanced = 0x04, + numa_balanced = 0x08 + }; + + struct spec_type + { + enum class type : std::int8_t + { + unknown, + thread, + socket, + numanode, + core, + pu + }; + + HPX_CORE_EXPORT static char const* type_name(type t) noexcept; + + static constexpr std::int64_t all_entities() noexcept + { + return (std::numeric_limits::min)(); + } + + spec_type() noexcept + : type_(type::unknown) + { + } + + explicit spec_type(type t, std::int64_t min = all_entities(), + std::int64_t max = all_entities()) + : type_(t) + { + if (t != type::unknown) + { + if (max == 0 || max == all_entities()) + { + // one or all entities + index_bounds_.push_back(min); + } + else if (min != all_entities()) + { + // all entities between min and -max, or just min,max + HPX_ASSERT(min >= 0); + index_bounds_.push_back(min); + index_bounds_.push_back(max); + } + } + } + + constexpr bool operator==(spec_type const& rhs) const noexcept + { + return type_ == rhs.type_ && index_bounds_ == rhs.index_bounds_; + } + constexpr bool operator!=(spec_type const& rhs) const noexcept + { + return !(*this == rhs); + } + + type type_; + bounds_type index_bounds_; + }; + + using mapping_type = std::vector; + using full_mapping_type = std::pair; + using mappings_spec_type = std::vector; + using mappings_type = boost::variant; + + HPX_CORE_EXPORT bounds_type extract_bounds( + spec_type const& m, std::size_t default_last, error_code& ec); + + HPX_CORE_EXPORT void parse_mappings(std::string const& spec, + mappings_type& mappings, error_code& ec = throws); +} // namespace hpx::threads::detail diff --git a/libs/core/affinity/include/hpx/affinity/parse_affinity_options.hpp b/libs/core/affinity/include/hpx/affinity/parse_affinity_options.hpp index 9983144d5905..6d65dd6791db 100644 --- a/libs/core/affinity/include/hpx/affinity/parse_affinity_options.hpp +++ b/libs/core/affinity/include/hpx/affinity/parse_affinity_options.hpp @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////// -// Copyright (c) 2007-2023 Hartmut Kaiser +// Copyright (c) 2007-2024 Hartmut Kaiser // Copyright (c) 2008-2009 Chirag Dekate, Anshul Tandon // Copyright (c) 2012-2013 Thomas Heller // @@ -11,104 +11,15 @@ #pragma once #include -#include #include #include -#include - #include -#include -#include #include -#include #include namespace hpx::threads { - namespace detail { - - using bounds_type = std::vector; - - enum class distribution_type : std::int8_t - { - compact = 0x01, - scatter = 0x02, - balanced = 0x04, - numa_balanced = 0x08 - }; - - struct spec_type - { - enum class type : std::int8_t - { - unknown, - thread, - socket, - numanode, - core, - pu - }; - - HPX_CORE_EXPORT static char const* type_name(type t) noexcept; - - static constexpr std::int64_t all_entities() noexcept - { - return (std::numeric_limits::min)(); - } - - spec_type() noexcept - : type_(type::unknown) - { - } - - explicit spec_type(type t, std::int64_t min = all_entities(), - std::int64_t max = all_entities()) - : type_(t) - { - if (t != type::unknown) - { - if (max == 0 || max == all_entities()) - { - // one or all entities - index_bounds_.push_back(min); - } - else if (min != all_entities()) - { - // all entities between min and -max, or just min,max - HPX_ASSERT(min >= 0); - index_bounds_.push_back(min); - index_bounds_.push_back(max); - } - } - } - - constexpr bool operator==(spec_type const& rhs) const noexcept - { - return type_ == rhs.type_ && index_bounds_ == rhs.index_bounds_; - } - constexpr bool operator!=(spec_type const& rhs) const noexcept - { - return !(*this == rhs); - } - - type type_; - bounds_type index_bounds_; - }; - - using mapping_type = std::vector; - using full_mapping_type = std::pair; - using mappings_spec_type = std::vector; - using mappings_type = - boost::variant; - - HPX_CORE_EXPORT bounds_type extract_bounds( - spec_type const& m, std::size_t default_last, error_code& ec); - - HPX_CORE_EXPORT void parse_mappings(std::string const& spec, - mappings_type& mappings, error_code& ec = throws); - } // namespace detail - HPX_CORE_EXPORT void parse_affinity_options(std::string const& spec, std::vector& affinities, std::size_t used_cores, std::size_t max_cores, std::size_t num_threads, diff --git a/libs/core/affinity/src/parse_affinity_options.cpp b/libs/core/affinity/src/parse_affinity_options.cpp index 5b60b061f6d1..d2bb3a48cf08 100644 --- a/libs/core/affinity/src/parse_affinity_options.cpp +++ b/libs/core/affinity/src/parse_affinity_options.cpp @@ -1,9 +1,10 @@ -// 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 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +#include #include #include #include diff --git a/libs/core/affinity/tests/unit/parse_affinity_options.cpp b/libs/core/affinity/tests/unit/parse_affinity_options.cpp index 3265afe00482..f93ebb889da7 100644 --- a/libs/core/affinity/tests/unit/parse_affinity_options.cpp +++ b/libs/core/affinity/tests/unit/parse_affinity_options.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2016 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 @@ -8,6 +8,8 @@ #include #include +#include + #include #include #include diff --git a/libs/core/execution/include/hpx/execution/algorithms/run_loop.hpp b/libs/core/execution/include/hpx/execution/algorithms/run_loop.hpp index bd3265374b1e..bfdbbaad9e25 100644 --- a/libs/core/execution/include/hpx/execution/algorithms/run_loop.hpp +++ b/libs/core/execution/include/hpx/execution/algorithms/run_loop.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2022-2023 Hartmut Kaiser +// Copyright (c) 2022-2024 Hartmut Kaiser // // SPDX-License-Identifier: BSL-1.0 // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include diff --git a/libs/core/futures/include/hpx/futures/futures_factory.hpp b/libs/core/futures/include/hpx/futures/futures_factory.hpp index b65ac89abfa3..6ab780cdaa60 100644 --- a/libs/core/futures/include/hpx/futures/futures_factory.hpp +++ b/libs/core/futures/include/hpx/futures/futures_factory.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2023 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 @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include diff --git a/libs/core/futures/include/hpx/futures/packaged_continuation.hpp b/libs/core/futures/include/hpx/futures/packaged_continuation.hpp index 707fd7991264..c7c38d936d43 100644 --- a/libs/core/futures/include/hpx/futures/packaged_continuation.hpp +++ b/libs/core/futures/include/hpx/futures/packaged_continuation.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2023 Hartmut Kaiser +// Copyright (c) 2007-2024 Hartmut Kaiser // Copyright (c) 2014-2015 Agustin Berge // // SPDX-License-Identifier: BSL-1.0 @@ -21,6 +21,7 @@ #include #include #include +#include #include #include diff --git a/libs/core/serialization/CMakeLists.txt b/libs/core/serialization/CMakeLists.txt index d3b0a4c09a2c..d4aa672e78e0 100644 --- a/libs/core/serialization/CMakeLists.txt +++ b/libs/core/serialization/CMakeLists.txt @@ -201,8 +201,7 @@ set(serialization_compat_headers # cmake-format: on if(HPX_SERIALIZATION_WITH_BOOST_TYPES) - set(serialization_headers - ${serialization_headers} + set(boost_serialization_headers hpx/serialization/boost_array.hpp hpx/serialization/boost_intrusive_ptr.hpp hpx/serialization/boost_multi_array.hpp @@ -210,6 +209,10 @@ if(HPX_SERIALIZATION_WITH_BOOST_TYPES) hpx/serialization/boost_variant.hpp ) + set(serialization_headers ${serialization_headers} + ${boost_serialization_headers} + ) + # cmake-format: off set(serialization_compat_headers ${serialization_compat_headers} hpx/serialization/multi_array.hpp => hpx/serialization/boost_multi_array.hpp @@ -246,5 +249,6 @@ add_hpx_module( hpx_type_support DEPENDENCIES ${serialization_optional_dependencies} ADD_TO_GLOBAL_HEADER hpx/serialization/detail/allow_zero_copy_receive.hpp + EXCLUDE_FROM_GLOBAL_HEADER ${boost_serialization_headers} CMAKE_SUBDIRS examples tests ) diff --git a/libs/core/serialization/include/hpx/serialization/array.hpp b/libs/core/serialization/include/hpx/serialization/array.hpp index 2a6d36a92da8..7c5e34b75858 100644 --- a/libs/core/serialization/include/hpx/serialization/array.hpp +++ b/libs/core/serialization/include/hpx/serialization/array.hpp @@ -18,10 +18,6 @@ #include #include -#if defined(HPX_SERIALIZATION_HAVE_BOOST_TYPES) -#include // for backwards compatibility -#endif - #include #include #include diff --git a/libs/core/serialization/include/hpx/serialization/detail/polymorphic_id_factory.hpp b/libs/core/serialization/include/hpx/serialization/detail/polymorphic_id_factory.hpp index f776c39f5dc1..4c1983904886 100644 --- a/libs/core/serialization/include/hpx/serialization/detail/polymorphic_id_factory.hpp +++ b/libs/core/serialization/include/hpx/serialization/detail/polymorphic_id_factory.hpp @@ -17,7 +17,6 @@ #include #include #include -#include #include #include diff --git a/libs/core/serialization/include/hpx/serialization/detail/polymorphic_intrusive_factory.hpp b/libs/core/serialization/include/hpx/serialization/detail/polymorphic_intrusive_factory.hpp index b1191f42be08..98a12ddd22ea 100644 --- a/libs/core/serialization/include/hpx/serialization/detail/polymorphic_intrusive_factory.hpp +++ b/libs/core/serialization/include/hpx/serialization/detail/polymorphic_intrusive_factory.hpp @@ -9,7 +9,7 @@ #pragma once #include -#include +#include #include #include #include diff --git a/libs/core/serialization/include/hpx/serialization/detail/polymorphic_nonintrusive_factory.hpp b/libs/core/serialization/include/hpx/serialization/detail/polymorphic_nonintrusive_factory.hpp index 1a45b40760f0..492d0d012b13 100644 --- a/libs/core/serialization/include/hpx/serialization/detail/polymorphic_nonintrusive_factory.hpp +++ b/libs/core/serialization/include/hpx/serialization/detail/polymorphic_nonintrusive_factory.hpp @@ -1,7 +1,7 @@ // Copyright (c) 2014 Thomas Heller // Copyright (c) 2015 Anton Bikineev // Copyright (c) 2015 Andreas Schaefer -// Copyright (c) 2022-2023 Hartmut Kaiser +// Copyright (c) 2022-2024 Hartmut Kaiser // // SPDX-License-Identifier: BSL-1.0 // Distributed under the Boost Software License, Version 1.0. @@ -12,7 +12,7 @@ #include #include -#include +#include #include #include #include diff --git a/libs/core/serialization/include/hpx/serialization/shared_ptr.hpp b/libs/core/serialization/include/hpx/serialization/shared_ptr.hpp index 147adc3b11c4..831e72b6d0bf 100644 --- a/libs/core/serialization/include/hpx/serialization/shared_ptr.hpp +++ b/libs/core/serialization/include/hpx/serialization/shared_ptr.hpp @@ -13,10 +13,6 @@ #include #include -#if defined(HPX_SERIALIZATION_HAVE_BOOST_TYPES) -#include // for backwards compatibility -#endif - #include namespace hpx::serialization { diff --git a/libs/core/serialization/include/hpx/serialization/variant.hpp b/libs/core/serialization/include/hpx/serialization/variant.hpp index 8efce39db845..2711e77c10d5 100644 --- a/libs/core/serialization/include/hpx/serialization/variant.hpp +++ b/libs/core/serialization/include/hpx/serialization/variant.hpp @@ -15,10 +15,6 @@ #include #include -#if defined(HPX_SERIALIZATION_HAVE_BOOST_TYPES) -#include // for backwards compatibility -#endif - #include #include #include diff --git a/libs/core/serialization/tests/unit/serialization_boost_variant.cpp b/libs/core/serialization/tests/unit/serialization_boost_variant.cpp index b29837060c25..41486c58de5c 100644 --- a/libs/core/serialization/tests/unit/serialization_boost_variant.cpp +++ b/libs/core/serialization/tests/unit/serialization_boost_variant.cpp @@ -8,6 +8,7 @@ #if defined(HPX_SERIALIZATION_HAVE_BOOST_TYPES) +#include #include #include #include @@ -52,7 +53,7 @@ struct A template void serialize(Archive& ar, unsigned) { - ar& t_; + ar & t_; } }; diff --git a/libs/core/synchronization/include/hpx/synchronization/mutex.hpp b/libs/core/synchronization/include/hpx/synchronization/mutex.hpp index 5a9291bdcdbe..2429acd06ff5 100644 --- a/libs/core/synchronization/include/hpx/synchronization/mutex.hpp +++ b/libs/core/synchronization/include/hpx/synchronization/mutex.hpp @@ -1,5 +1,5 @@ // Copyright (c) 2022 Bhumit Attarde -// Copyright (c) 2007-2022 Hartmut Kaiser +// Copyright (c) 2007-2024 Hartmut Kaiser // Copyright (c) 2013-2015 Agustin Berge // // SPDX-License-Identifier: BSL-1.0 @@ -15,9 +15,9 @@ #include #include #include -#include #include #include +#include #include namespace hpx::threads { diff --git a/libs/core/synchronization/include/hpx/synchronization/stop_token.hpp b/libs/core/synchronization/include/hpx/synchronization/stop_token.hpp index 2e3d5c436dd5..74ac1d56b7d3 100644 --- a/libs/core/synchronization/include/hpx/synchronization/stop_token.hpp +++ b/libs/core/synchronization/include/hpx/synchronization/stop_token.hpp @@ -12,10 +12,8 @@ #include #include -#include #include #include -#include #include #include diff --git a/libs/core/threading_base/include/hpx/threading_base/detail/reset_backtrace.hpp b/libs/core/threading_base/include/hpx/threading_base/detail/reset_backtrace.hpp index 71f81e5ab504..468c656def8a 100644 --- a/libs/core/threading_base/include/hpx/threading_base/detail/reset_backtrace.hpp +++ b/libs/core/threading_base/include/hpx/threading_base/detail/reset_backtrace.hpp @@ -10,7 +10,7 @@ #ifdef HPX_HAVE_THREAD_BACKTRACE_ON_SUSPENSION -#include +#include #include #include diff --git a/libs/core/threading_base/include/hpx/threading_base/thread_helpers.hpp b/libs/core/threading_base/include/hpx/threading_base/thread_helpers.hpp index 131369ccdc6c..6891294e0dfd 100644 --- a/libs/core/threading_base/include/hpx/threading_base/thread_helpers.hpp +++ b/libs/core/threading_base/include/hpx/threading_base/thread_helpers.hpp @@ -18,7 +18,7 @@ #include #include #if !defined(HPX_HAVE_THREAD_FULLBACKTRACE_ON_SUSPENSION) -#include +#include #endif #include diff --git a/libs/full/async_distributed/include/hpx/async_distributed/put_parcel.hpp b/libs/full/async_distributed/include/hpx/async_distributed/put_parcel.hpp index 449979cd5fb3..ac2b2d65c9c6 100644 --- a/libs/full/async_distributed/include/hpx/async_distributed/put_parcel.hpp +++ b/libs/full/async_distributed/include/hpx/async_distributed/put_parcel.hpp @@ -11,9 +11,7 @@ #if defined(HPX_HAVE_NETWORKING) #include -#include #include -#include #include #include diff --git a/libs/full/parcelset_base/include/hpx/parcelset_base/parcelport.hpp b/libs/full/parcelset_base/include/hpx/parcelset_base/parcelport.hpp index be80944071fb..446a21000283 100644 --- a/libs/full/parcelset_base/include/hpx/parcelset_base/parcelport.hpp +++ b/libs/full/parcelset_base/include/hpx/parcelset_base/parcelport.hpp @@ -13,9 +13,9 @@ #include #if defined(HPX_HAVE_NETWORKING) +#include #include #include -#include #include #include