diff --git a/docs/sphinx/manual/writing_single_node_hpx_applications.rst b/docs/sphinx/manual/writing_single_node_hpx_applications.rst index b48b66a38a06..84bb6543b8fa 100644 --- a/docs/sphinx/manual/writing_single_node_hpx_applications.rst +++ b/docs/sphinx/manual/writing_single_node_hpx_applications.rst @@ -1202,7 +1202,7 @@ With ``executor_parameter_traits``, clients access all types of executor parameters uniformly, e.g.:: std::size_t chunk_size = - hpx::execution::get_chunk_size(my_parameter, my_executor, + hpx::execution::experimental::get_chunk_size(my_parameter, my_executor, num_cores, num_tasks); This call synchronously retrieves the size of a single chunk of loop iterations diff --git a/docs/sphinx/releases.rst b/docs/sphinx/releases.rst index 9118431c4ced..eba2fb10461e 100644 --- a/docs/sphinx/releases.rst +++ b/docs/sphinx/releases.rst @@ -1,5 +1,5 @@ .. - Copyright (C) 2018-2023 STE||AR Group + Copyright (C) 2018-2024 STE||AR Group SPDX-License-Identifier: BSL-1.0 Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -17,6 +17,7 @@ List of releases .. toctree:: :maxdepth: 1 + releases/whats_new_1_11_0 releases/whats_new_1_10_0 releases/whats_new_1_9_1 releases/whats_new_1_9_0 diff --git a/docs/sphinx/releases/whats_new_1_11_0.rst b/docs/sphinx/releases/whats_new_1_11_0.rst new file mode 100644 index 000000000000..d093d6e0c7a9 --- /dev/null +++ b/docs/sphinx/releases/whats_new_1_11_0.rst @@ -0,0 +1,31 @@ +.. + 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) + +.. _hpx_1_11_0: + +============================ +|hpx| V1.11.0 (TBA) +============================ + +General changes +=============== + +Breaking changes +================ + +- We have moved most of the APIs that were defined in the namespace + ``hpx::parallel::execution`` to the namespace ``hpx::execution::experimental``. + It was not possible to add compatibility facilities that will allow to continue + using the old APIs, applications will have to be changed in order to + continue functioning correctly. + +Closed issues +============= + +Closed pull requests +==================== + diff --git a/examples/async_io/async_io_action.cpp b/examples/async_io/async_io_action.cpp index bb5fd61c6ed2..9d05a296302d 100644 --- a/examples/async_io/async_io_action.cpp +++ b/examples/async_io/async_io_action.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2013 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 @@ -42,7 +42,7 @@ namespace detail { std::make_shared>(); // Get a reference to one of the IO specific HPX io_service objects ... - hpx::parallel::execution::io_pool_executor executor; + hpx::execution::experimental::io_pool_executor executor; // ... and schedule the handler to run on one of its OS-threads. hpx::post(executor, &do_async_io, string_to_write, p); diff --git a/examples/async_io/async_io_simple.cpp b/examples/async_io/async_io_simple.cpp index b03dee1f0eeb..f7bdd460acf3 100644 --- a/examples/async_io/async_io_simple.cpp +++ b/examples/async_io/async_io_simple.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2013 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 @@ -34,7 +34,7 @@ int async_io(char const* string_to_write) { // Get a reference to one of the IO specific HPX io_service objects ... - hpx::parallel::execution::io_pool_executor executor; + hpx::execution::experimental::io_pool_executor executor; // ... and schedule the handler to run on one of its OS-threads. hpx::async(executor, &do_async_io, string_to_write, std::ref(result)) diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/detail/set_operation.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/detail/set_operation.hpp index 6ad845a27d70..3a312fb1bb3c 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/detail/set_operation.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/detail/set_operation.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 @@ -114,9 +114,10 @@ namespace hpx::parallel::detail { using buffer_type = typename set_operations_buffer::type; - std::size_t cores = execution::processing_units_count( - policy.parameters(), policy.executor(), hpx::chrono::null_duration, - (std::min)(len1, len2)); + std::size_t cores = + hpx::execution::experimental::processing_units_count( + policy.parameters(), policy.executor(), + hpx::chrono::null_duration, (std::min)(len1, len2)); std::size_t const step = (len1 + cores - 1) / cores; diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/make_heap.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/make_heap.hpp index 82545c2b79ee..314a46bedcb4 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/make_heap.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/make_heap.hpp @@ -369,8 +369,9 @@ namespace hpx::parallel { }; std::size_t const cores = - execution::processing_units_count(policy.parameters(), - policy.executor(), hpx::chrono::null_duration, n); + hpx::execution::experimental::processing_units_count( + policy.parameters(), policy.executor(), + hpx::chrono::null_duration, n); // Take a standard chunk size (amount of work / cores), and only // take a quarter of that. If our chunk size is too large a LOT @@ -378,13 +379,15 @@ namespace hpx::parallel { // barrier of heap parallelism. 1/4 of the standard chunk size // is an estimate to lower the average number of levels done // sequentially - std::size_t chunk_size = execution::get_chunk_size( - policy.parameters(), policy.executor(), - hpx::chrono::null_duration, cores, n); + std::size_t chunk_size = + hpx::execution::experimental::get_chunk_size( + policy.parameters(), policy.executor(), + hpx::chrono::null_duration, cores, n); chunk_size /= 4; - std::size_t max_chunks = execution::maximal_number_of_chunks( - policy.parameters(), policy.executor(), cores, n); + std::size_t max_chunks = + hpx::execution::experimental::maximal_number_of_chunks( + policy.parameters(), policy.executor(), cores, n); util::detail::adjust_chunk_size_and_max_chunks( cores, n, chunk_size, max_chunks); diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/partial_sort.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/partial_sort.hpp index 939e54459c7d..e19710ba9102 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/partial_sort.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/partial_sort.hpp @@ -390,13 +390,15 @@ namespace hpx::parallel { { // figure out the chunk size to use std::size_t const cores = - execution::processing_units_count(policy.parameters(), - policy.executor(), hpx::chrono::null_duration, nelem); + hpx::execution::experimental::processing_units_count( + policy.parameters(), policy.executor(), + hpx::chrono::null_duration, nelem); // number of elements to sort - std::size_t chunk_size = execution::get_chunk_size( - policy.parameters(), policy.executor(), - hpx::chrono::null_duration, cores, nelem); + std::size_t chunk_size = + hpx::execution::experimental::get_chunk_size( + policy.parameters(), policy.executor(), + hpx::chrono::null_duration, cores, nelem); hpx::future left = execution::async_execute( policy.executor(), sort_thread_helper(), policy, first, diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/partition.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/partition.hpp index ba5d718e14b8..43c574eedd8e 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/partition.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/partition.hpp @@ -670,19 +670,19 @@ namespace hpx::parallel { } else { - std::size_t const cores = - execution::processing_units_count( - policy.parameters(), policy.executor(), - hpx::chrono::null_duration, size); + std::size_t const cores = hpx::execution::experimental:: + processing_units_count(policy.parameters(), + policy.executor(), hpx::chrono::null_duration, + size); - std::size_t chunk_size = execution::get_chunk_size( - policy.parameters(), policy.executor(), - hpx::chrono::null_duration, cores, size); + std::size_t chunk_size = + hpx::execution::experimental::get_chunk_size( + policy.parameters(), policy.executor(), + hpx::chrono::null_duration, cores, size); - std::size_t max_chunks = - execution::maximal_number_of_chunks( - policy.parameters(), policy.executor(), cores, - size); + std::size_t max_chunks = hpx::execution::experimental:: + maximal_number_of_chunks(policy.parameters(), + policy.executor(), cores, size); util::detail::adjust_chunk_size_and_max_chunks( cores, size, chunk_size, max_chunks); @@ -1341,9 +1341,10 @@ namespace hpx::parallel { if (first == last) return first; - std::size_t const cores = execution::processing_units_count( - policy.parameters(), policy.executor(), - hpx::chrono::null_duration, std::distance(first, last)); + std::size_t const cores = + hpx::execution::experimental::processing_units_count( + policy.parameters(), policy.executor(), + hpx::chrono::null_duration, std::distance(first, last)); // TODO: Find better block size. constexpr std::size_t block_size = diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/rotate.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/rotate.hpp index 6e3965057191..c5d93563355d 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/rotate.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/rotate.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2023 Hartmut Kaiser +// Copyright (c) 2007-2024 Hartmut Kaiser // Copyright (c) 2021-2022 Chuanqiu He // // SPDX-License-Identifier: BSL-1.0 @@ -225,9 +225,9 @@ namespace hpx::parallel { // get number of cores currently used std::size_t const cores = - parallel::execution::processing_units_count(policy.parameters(), - policy.executor(), hpx::chrono::null_duration, - size_left + size_right); + hpx::execution::experimental::processing_units_count( + policy.parameters(), policy.executor(), + hpx::chrono::null_duration, size_left + size_right); // get currently used first core std::size_t first_core = @@ -257,11 +257,13 @@ namespace hpx::parallel { auto p = policy(hpx::execution::task); auto left_policy = - execution::with_processing_units_count(p, cores_left); - auto right_policy = execution::with_processing_units_count( - hpx::execution::experimental::with_first_core( - p, cores == 1 ? first_core : first_core + cores_left), - cores_right); + hpx::execution::experimental::with_processing_units_count( + p, cores_left); + auto right_policy = + hpx::execution::experimental::with_processing_units_count( + hpx::execution::experimental::with_first_core( + p, cores == 1 ? first_core : first_core + cores_left), + cores_right); detail::reverse r; diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/sort.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/sort.hpp index 752fd6aa1f47..282787ca9129 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/sort.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/sort.hpp @@ -289,15 +289,18 @@ namespace hpx::parallel { // figure out the chunk size to use std::size_t const cores = - execution::processing_units_count(policy.parameters(), - policy.executor(), hpx::chrono::null_duration, count); - - std::size_t max_chunks = execution::maximal_number_of_chunks( - policy.parameters(), policy.executor(), cores, count); - - std::size_t chunk_size = execution::get_chunk_size( - policy.parameters(), policy.executor(), - hpx::chrono::null_duration, cores, count); + hpx::execution::experimental::processing_units_count( + policy.parameters(), policy.executor(), + hpx::chrono::null_duration, count); + + std::size_t max_chunks = + hpx::execution::experimental::maximal_number_of_chunks( + policy.parameters(), policy.executor(), cores, count); + + std::size_t chunk_size = + hpx::execution::experimental::get_chunk_size( + policy.parameters(), policy.executor(), + hpx::chrono::null_duration, cores, count); util::detail::adjust_chunk_size_and_max_chunks( cores, count, max_chunks, chunk_size); diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/stable_sort.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/stable_sort.hpp index 665feabd39e5..35f8cfa742af 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/stable_sort.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/stable_sort.hpp @@ -222,15 +222,18 @@ namespace hpx::parallel { // figure out the chunk size to use std::size_t cores = - execution::processing_units_count(policy.parameters(), - policy.executor(), hpx::chrono::null_duration, count); - - std::size_t max_chunks = execution::maximal_number_of_chunks( - policy.parameters(), policy.executor(), cores, count); - - std::size_t chunk_size = execution::get_chunk_size( - policy.parameters(), policy.executor(), - hpx::chrono::null_duration, cores, count); + hpx::execution::experimental::processing_units_count( + policy.parameters(), policy.executor(), + hpx::chrono::null_duration, count); + + std::size_t max_chunks = + hpx::execution::experimental::maximal_number_of_chunks( + policy.parameters(), policy.executor(), cores, count); + + std::size_t chunk_size = + hpx::execution::experimental::get_chunk_size( + policy.parameters(), policy.executor(), + hpx::chrono::null_duration, cores, count); util::detail::adjust_chunk_size_and_max_chunks( cores, count, max_chunks, chunk_size); diff --git a/libs/core/algorithms/include/hpx/parallel/util/detail/chunk_size.hpp b/libs/core/algorithms/include/hpx/parallel/util/detail/chunk_size.hpp index 691c399c5744..3754d4e512c2 100644 --- a/libs/core/algorithms/include/hpx/parallel/util/detail/chunk_size.hpp +++ b/libs/core/algorithms/include/hpx/parallel/util/detail/chunk_size.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2022 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 @@ -144,14 +144,17 @@ namespace hpx::parallel::util::detail { } std::size_t const cores = - execution::processing_units_count(policy.parameters(), - policy.executor(), hpx::chrono::null_duration, count); + hpx::execution::experimental::processing_units_count( + policy.parameters(), policy.executor(), + hpx::chrono::null_duration, count); - std::size_t max_chunks = execution::maximal_number_of_chunks( - policy.parameters(), policy.executor(), cores, count); + std::size_t max_chunks = + hpx::execution::experimental::maximal_number_of_chunks( + policy.parameters(), policy.executor(), cores, count); - std::size_t chunk_size = execution::get_chunk_size(policy.parameters(), - policy.executor(), hpx::chrono::null_duration, cores, count); + std::size_t chunk_size = + hpx::execution::experimental::get_chunk_size(policy.parameters(), + policy.executor(), hpx::chrono::null_duration, cores, count); // make sure, chunk size and max_chunks are consistent adjust_chunk_size_and_max_chunks(cores, count, max_chunks, chunk_size); @@ -170,7 +173,8 @@ namespace hpx::parallel::util::detail { // update executor with new values policy = hpx::experimental::prefer( - execution::with_processing_units_count, policy, cores); + hpx::execution::experimental::with_processing_units_count, policy, + cores); auto shape_begin = chunk_size_iterator(it_or_r, chunk_size, count); auto shape_end = chunk_size_iterator(last, chunk_size, count, count); @@ -221,17 +225,22 @@ namespace hpx::parallel::util::detail { }; // note: running the test function will modify 'count' - auto iteration_duration = execution::measure_iteration( - policy.parameters(), policy.executor(), test_function, count); + auto iteration_duration = + hpx::execution::experimental::measure_iteration( + policy.parameters(), policy.executor(), test_function, count); - std::size_t const cores = execution::processing_units_count( - policy.parameters(), policy.executor(), iteration_duration, count); + std::size_t const cores = + hpx::execution::experimental::processing_units_count( + policy.parameters(), policy.executor(), iteration_duration, + count); - std::size_t max_chunks = execution::maximal_number_of_chunks( - policy.parameters(), policy.executor(), cores, count); + std::size_t max_chunks = + hpx::execution::experimental::maximal_number_of_chunks( + policy.parameters(), policy.executor(), cores, count); - std::size_t chunk_size = execution::get_chunk_size(policy.parameters(), - policy.executor(), iteration_duration, cores, count); + std::size_t chunk_size = + hpx::execution::experimental::get_chunk_size(policy.parameters(), + policy.executor(), iteration_duration, cores, count); // make sure, chunk size and max_chunks are consistent adjust_chunk_size_and_max_chunks(cores, count, max_chunks, chunk_size); @@ -249,7 +258,8 @@ namespace hpx::parallel::util::detail { // update executor with new values policy = hpx::experimental::prefer( - execution::with_processing_units_count, policy, cores); + hpx::execution::experimental::with_processing_units_count, policy, + cores); auto shape_begin = chunk_size_iterator(it_or_r, chunk_size, count); auto shape_end = chunk_size_iterator(last, chunk_size, count, count); @@ -272,11 +282,13 @@ namespace hpx::parallel::util::detail { } std::size_t const cores = - execution::processing_units_count(policy.parameters(), - policy.executor(), hpx::chrono::null_duration, count); + hpx::execution::experimental::processing_units_count( + policy.parameters(), policy.executor(), + hpx::chrono::null_duration, count); - std::size_t max_chunks = execution::maximal_number_of_chunks( - policy.parameters(), policy.executor(), cores, count); + std::size_t max_chunks = + hpx::execution::experimental::maximal_number_of_chunks( + policy.parameters(), policy.executor(), cores, count); HPX_ASSERT(0 != max_chunks); Stride stride = parallel::detail::abs(s); @@ -292,9 +304,10 @@ namespace hpx::parallel::util::detail { while (count != 0) { - std::size_t chunk_size = execution::get_chunk_size( - policy.parameters(), policy.executor(), - hpx::chrono::null_duration, cores, count); + std::size_t chunk_size = + hpx::execution::experimental::get_chunk_size( + policy.parameters(), policy.executor(), + hpx::chrono::null_duration, cores, count); // make sure, chunk size and max_chunks are consistent adjust_chunk_size_and_max_chunks( @@ -320,7 +333,8 @@ namespace hpx::parallel::util::detail { // update executor with new values policy = hpx::experimental::prefer( - execution::with_processing_units_count, policy, cores); + hpx::execution::experimental::with_processing_units_count, policy, + cores); return shape; } @@ -387,17 +401,20 @@ namespace hpx::parallel::util::detail { } std::size_t const cores = - execution::processing_units_count(policy.parameters(), - policy.executor(), hpx::chrono::null_duration, count); + hpx::execution::experimental::processing_units_count( + policy.parameters(), policy.executor(), + hpx::chrono::null_duration, count); - std::size_t max_chunks = execution::maximal_number_of_chunks( - policy.parameters(), policy.executor(), cores, count); + std::size_t max_chunks = + hpx::execution::experimental::maximal_number_of_chunks( + policy.parameters(), policy.executor(), cores, count); FwdIter last = parallel::detail::next(begin, count); Stride stride = parallel::detail::abs(s); - std::size_t chunk_size = execution::get_chunk_size(policy.parameters(), - policy.executor(), hpx::chrono::null_duration, cores, count); + std::size_t chunk_size = + hpx::execution::experimental::get_chunk_size(policy.parameters(), + policy.executor(), hpx::chrono::null_duration, cores, count); // make sure, chunk size and max_chunks are consistent adjust_chunk_size_and_max_chunks(cores, count, max_chunks, chunk_size); @@ -413,7 +430,8 @@ namespace hpx::parallel::util::detail { // update executor with new values policy = hpx::experimental::prefer( - execution::with_processing_units_count, policy, cores); + hpx::execution::experimental::with_processing_units_count, policy, + cores); using iterator = parallel::util::detail::chunk_size_idx_iterator; @@ -470,19 +488,24 @@ namespace hpx::parallel::util::detail { }; // note: running the test function will modify 'count' - auto iteration_duration = execution::measure_iteration( - policy.parameters(), policy.executor(), test_function, count); + auto iteration_duration = + hpx::execution::experimental::measure_iteration( + policy.parameters(), policy.executor(), test_function, count); - std::size_t const cores = execution::processing_units_count( - policy.parameters(), policy.executor(), iteration_duration, count); + std::size_t const cores = + hpx::execution::experimental::processing_units_count( + policy.parameters(), policy.executor(), iteration_duration, + count); - std::size_t max_chunks = execution::maximal_number_of_chunks( - policy.parameters(), policy.executor(), cores, count); + std::size_t max_chunks = + hpx::execution::experimental::maximal_number_of_chunks( + policy.parameters(), policy.executor(), cores, count); FwdIter last = parallel::detail::next(begin, count); - std::size_t chunk_size = execution::get_chunk_size(policy.parameters(), - policy.executor(), iteration_duration, cores, count); + std::size_t chunk_size = + hpx::execution::experimental::get_chunk_size(policy.parameters(), + policy.executor(), iteration_duration, cores, count); // make sure, chunk size and max_chunks are consistent adjust_chunk_size_and_max_chunks(cores, count, max_chunks, chunk_size); @@ -498,7 +521,8 @@ namespace hpx::parallel::util::detail { // update executor with new values policy = hpx::experimental::prefer( - execution::with_processing_units_count, policy, cores); + hpx::execution::experimental::with_processing_units_count, policy, + cores); using iterator = parallel::util::detail::chunk_size_idx_iterator; @@ -524,11 +548,13 @@ namespace hpx::parallel::util::detail { } std::size_t const cores = - execution::processing_units_count(policy.parameters(), - policy.executor(), hpx::chrono::null_duration, count); + hpx::execution::experimental::processing_units_count( + policy.parameters(), policy.executor(), + hpx::chrono::null_duration, count); - std::size_t max_chunks = execution::maximal_number_of_chunks( - policy.parameters(), policy.executor(), cores, count); + std::size_t max_chunks = + hpx::execution::experimental::maximal_number_of_chunks( + policy.parameters(), policy.executor(), cores, count); Stride stride = parallel::detail::abs(s); @@ -544,9 +570,10 @@ namespace hpx::parallel::util::detail { std::size_t base_idx = 0; while (count != 0) { - std::size_t chunk_size = execution::get_chunk_size( - policy.parameters(), policy.executor(), - hpx::chrono::null_duration, cores, count); + std::size_t chunk_size = + hpx::execution::experimental::get_chunk_size( + policy.parameters(), policy.executor(), + hpx::chrono::null_duration, cores, count); // make sure, chunk size and max_chunks are consistent adjust_chunk_size_and_max_chunks( @@ -573,7 +600,8 @@ namespace hpx::parallel::util::detail { // update executor with new values policy = hpx::experimental::prefer( - execution::with_processing_units_count, policy, cores); + hpx::execution::experimental::with_processing_units_count, policy, + cores); return shape; } diff --git a/libs/core/algorithms/include/hpx/parallel/util/detail/scoped_executor_parameters.hpp b/libs/core/algorithms/include/hpx/parallel/util/detail/scoped_executor_parameters.hpp index 2655e347a270..510052d32de8 100644 --- a/libs/core/algorithms/include/hpx/parallel/util/detail/scoped_executor_parameters.hpp +++ b/libs/core/algorithms/include/hpx/parallel/util/detail/scoped_executor_parameters.hpp @@ -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 @@ -21,17 +21,18 @@ namespace hpx::parallel::util::detail { : params_(params) , exec_(exec) { - execution::mark_begin_execution(params_, exec_); + hpx::execution::experimental::mark_begin_execution(params_, exec_); } void mark_end_of_scheduling() const { - execution::mark_end_of_scheduling(params_, exec_); + hpx::execution::experimental::mark_end_of_scheduling( + params_, exec_); } ~scoped_executor_parameters() { - execution::mark_end_execution(params_, exec_); + hpx::execution::experimental::mark_end_execution(params_, exec_); } private: @@ -49,17 +50,18 @@ namespace hpx::parallel::util::detail { : params_(params) , exec_(exec) { - execution::mark_begin_execution(params_, exec_); + hpx::execution::experimental::mark_begin_execution(params_, exec_); } void mark_end_of_scheduling() const { - execution::mark_end_of_scheduling(params_, exec_); + hpx::execution::experimental::mark_end_of_scheduling( + params_, exec_); } ~scoped_executor_parameters_ref() { - execution::mark_end_execution(params_, exec_); + hpx::execution::experimental::mark_end_execution(params_, exec_); } private: diff --git a/libs/core/algorithms/include/hpx/parallel/util/foreach_partitioner.hpp b/libs/core/algorithms/include/hpx/parallel/util/foreach_partitioner.hpp index 28a8a800542d..933776cee10c 100644 --- a/libs/core/algorithms/include/hpx/parallel/util/foreach_partitioner.hpp +++ b/libs/core/algorithms/include/hpx/parallel/util/foreach_partitioner.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 @@ -41,11 +41,14 @@ namespace hpx::parallel::util::detail { { // estimate a chunk size based on number of cores used using parameters_type = - execution::extract_executor_parameters_t>; + hpx::execution::experimental::extract_executor_parameters_t< + std::decay_t>; constexpr bool has_variable_chunk_size = - execution::extract_has_variable_chunk_size_v; + hpx::execution::experimental::extract_has_variable_chunk_size_v< + parameters_type>; constexpr bool invokes_testing_function = - execution::extract_invokes_testing_function_v; + hpx::execution::experimental::extract_invokes_testing_function_v< + parameters_type>; if constexpr (has_variable_chunk_size) { diff --git a/libs/core/algorithms/include/hpx/parallel/util/partitioner.hpp b/libs/core/algorithms/include/hpx/parallel/util/partitioner.hpp index ac04f6e6995e..6f7bc3b775ef 100644 --- a/libs/core/algorithms/include/hpx/parallel/util/partitioner.hpp +++ b/libs/core/algorithms/include/hpx/parallel/util/partitioner.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 @@ -45,11 +45,14 @@ namespace hpx::parallel::util::detail { { // estimate a chunk size based on number of cores used using parameters_type = - execution::extract_executor_parameters_t>; + hpx::execution::experimental::extract_executor_parameters_t< + std::decay_t>; constexpr bool has_variable_chunk_size = - execution::extract_has_variable_chunk_size_v; + hpx::execution::experimental::extract_has_variable_chunk_size_v< + parameters_type>; constexpr bool invokes_testing_function = - execution::extract_invokes_testing_function_v; + hpx::execution::experimental::extract_invokes_testing_function_v< + parameters_type>; if constexpr (has_variable_chunk_size) { @@ -94,11 +97,14 @@ namespace hpx::parallel::util::detail { { // estimate a chunk size based on number of cores used using parameters_type = - execution::extract_executor_parameters_t>; + hpx::execution::experimental::extract_executor_parameters_t< + std::decay_t>; constexpr bool has_variable_chunk_size = - execution::extract_has_variable_chunk_size_v; + hpx::execution::experimental::extract_has_variable_chunk_size_v< + parameters_type>; constexpr bool invokes_testing_function = - execution::extract_invokes_testing_function_v; + hpx::execution::experimental::extract_invokes_testing_function_v< + parameters_type>; if constexpr (has_variable_chunk_size) { diff --git a/libs/core/algorithms/include/hpx/parallel/util/scan_partitioner.hpp b/libs/core/algorithms/include/hpx/parallel/util/scan_partitioner.hpp index 06dc0db2220b..4c9121d4ef3e 100644 --- a/libs/core/algorithms/include/hpx/parallel/util/scan_partitioner.hpp +++ b/libs/core/algorithms/include/hpx/parallel/util/scan_partitioner.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2023 Hartmut Kaiser +// Copyright (c) 2007-2024 Hartmut Kaiser // Copyright (c) 2015 Daniel Bourgeois // Copyright (c) 2017 Taeguk Kwon // Copyright (c) 2021 Akhil J Nair @@ -85,8 +85,8 @@ namespace hpx::parallel::util { std::size_t const count_ = count; // estimate a chunk size based on number of cores used - using has_variable_chunk_size = - typename execution::extract_has_variable_chunk_size< + using has_variable_chunk_size = typename hpx::execution:: + experimental::extract_has_variable_chunk_size< parameters_type>::type; auto shape = detail::get_bulk_iteration_shape( diff --git a/libs/core/algorithms/tests/performance/foreach_scaling_helpers.hpp b/libs/core/algorithms/tests/performance/foreach_scaling_helpers.hpp index fc2264b02712..88d852be1df9 100644 --- a/libs/core/algorithms/tests/performance/foreach_scaling_helpers.hpp +++ b/libs/core/algorithms/tests/performance/foreach_scaling_helpers.hpp @@ -1,5 +1,5 @@ // Copyright (c) 2014 Grant Mercer -// Copyright (c) 2021-2023 Hartmut Kaiser +// Copyright (c) 2021-2024 Hartmut Kaiser // // SPDX-License-Identifier: BSL-1.0 // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -38,7 +38,7 @@ struct disable_stealing_parameter { template friend void tag_override_invoke( - hpx::parallel::execution::mark_begin_execution_t, + hpx::execution::experimental::mark_begin_execution_t, disable_stealing_parameter, Executor&&) { hpx::threads::add_remove_scheduler_mode( @@ -48,7 +48,7 @@ struct disable_stealing_parameter template friend void tag_override_invoke( - hpx::parallel::execution::mark_end_of_scheduling_t, + hpx::execution::experimental::mark_end_of_scheduling_t, disable_stealing_parameter, Executor&&) { hpx::threads::remove_scheduler_mode( @@ -57,7 +57,7 @@ struct disable_stealing_parameter template friend void tag_override_invoke( - hpx::parallel::execution::mark_end_execution_t, + hpx::execution::experimental::mark_end_execution_t, disable_stealing_parameter, Executor&&) { hpx::threads::add_remove_scheduler_mode( @@ -67,7 +67,7 @@ struct disable_stealing_parameter }; template <> -struct hpx::parallel::execution::is_executor_parameters< +struct hpx::execution::experimental::is_executor_parameters< disable_stealing_parameter> : std::true_type { }; diff --git a/libs/core/algorithms/tests/regressions/num_cores.cpp b/libs/core/algorithms/tests/regressions/num_cores.cpp index de0287bd02cb..05bb9339ace9 100644 --- a/libs/core/algorithms/tests/regressions/num_cores.cpp +++ b/libs/core/algorithms/tests/regressions/num_cores.cpp @@ -17,14 +17,14 @@ int hpx_main() hpx::execution::experimental::num_cores nc(2); auto policy = hpx::execution::par.with(nc); - HPX_TEST_EQ( - hpx::parallel::execution::processing_units_count(policy.parameters(), - policy.executor(), hpx::chrono::null_duration, 0), + HPX_TEST_EQ(hpx::execution::experimental::processing_units_count( + policy.parameters(), policy.executor(), + hpx::chrono::null_duration, 0), static_cast(2)); auto policy2 = - hpx::parallel::execution::with_processing_units_count(policy, 2); - HPX_TEST_EQ(hpx::parallel::execution::processing_units_count( + hpx::execution::experimental::with_processing_units_count(policy, 2); + HPX_TEST_EQ(hpx::execution::experimental::processing_units_count( hpx::execution::par.parameters(), policy2.executor(), hpx::chrono::null_duration, 0), static_cast(2)); diff --git a/libs/core/async_cuda/include/hpx/async_cuda/cublas_executor.hpp b/libs/core/async_cuda/include/hpx/async_cuda/cublas_executor.hpp index 731746808648..737bc8df9204 100644 --- a/libs/core/async_cuda/include/hpx/async_cuda/cublas_executor.hpp +++ b/libs/core/async_cuda/include/hpx/async_cuda/cublas_executor.hpp @@ -1,5 +1,6 @@ // Copyright (c) 2020 John Biddiscombe // Copyright (c) 2020 Teodor Nikolov +// Copyright (c) 2024 Hartmut Kaiser // // SPDX-License-Identifier: BSL-1.0 // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -277,7 +278,8 @@ namespace hpx { namespace cuda { namespace experimental { }}} // namespace hpx::cuda::experimental -namespace hpx { namespace parallel { namespace execution { +namespace hpx::execution::experimental { + /// \cond NOINTERNAL template <> struct is_one_way_executor @@ -293,5 +295,5 @@ namespace hpx { namespace parallel { namespace execution { // we support returning a waitable/future }; /// \endcond -}}} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental #endif diff --git a/libs/core/async_cuda/include/hpx/async_cuda/cuda_executor.hpp b/libs/core/async_cuda/include/hpx/async_cuda/cuda_executor.hpp index 4cff6ed5e3ce..c2f9f9462bd7 100644 --- a/libs/core/async_cuda/include/hpx/async_cuda/cuda_executor.hpp +++ b/libs/core/async_cuda/include/hpx/async_cuda/cuda_executor.hpp @@ -1,5 +1,6 @@ // Copyright (c) 2020 John Biddiscombe // Copyright (c) 2020 Teodor Nikolov +// Copyright (c) 2024 Hartmut Kaiser // // SPDX-License-Identifier: BSL-1.0 // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -186,7 +187,7 @@ namespace hpx { namespace cuda { namespace experimental { }}} // namespace hpx::cuda::experimental -namespace hpx { namespace parallel { namespace execution { +namespace hpx::execution::experimental { /// \cond NOINTERNAL template <> @@ -203,4 +204,4 @@ namespace hpx { namespace parallel { namespace execution { // we support returning a waitable/future }; /// \endcond -}}} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental diff --git a/libs/core/async_sycl/include/hpx/async_sycl/sycl_executor.hpp b/libs/core/async_sycl/include/hpx/async_sycl/sycl_executor.hpp index f53c5a7c9e09..451ae8c46c72 100644 --- a/libs/core/async_sycl/include/hpx/async_sycl/sycl_executor.hpp +++ b/libs/core/async_sycl/include/hpx/async_sycl/sycl_executor.hpp @@ -1,4 +1,5 @@ -// Copyright (c) 2022 Gregor Daiß +// Copyright (c) 2022 Gregor Daiß +// Copyright (c) 2024 Hartmut Kaiser // // SPDX-License-Identifier: BSL-1.0 // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -25,7 +26,7 @@ #include #include -namespace hpx { namespace sycl { namespace experimental { +namespace hpx::sycl::experimental { struct sycl_executor { @@ -125,123 +126,117 @@ namespace hpx { namespace sycl { namespace experimental { //#if defined(__LIBSYCL_MAJOR_VERSION) && defined(__LIBSYCL_MINOR_VERSION) #if defined(__INTEL_LLVM_COMPILER) || \ (defined(__clang__) && defined(SYCL_IMPLEMENTATION_ONEAPI)) - // To find the correct overload (or any at all actually) we need to add - // the code_location argument which is the last argument in every queue - // member function in the intel oneapi sycl implementation. As far as - // I can tell it is usually invisible from the user-side since it is - // using a default argument (code_location::current()) + // To find the correct overload (or any at all actually) we need to add + // the code_location argument which is the last argument in every queue + // member function in the intel oneapi sycl implementation. As far as + // I can tell it is usually invisible from the user-side since it is + // using a default argument (code_location::current()) - /// sycl::queue::member_function type with code_location parameter - template - using queue_function_code_loc_ptr_t = cl::sycl::event ( - cl::sycl::queue::*)( - Param, cl::sycl::detail::code_location const&); - /// Invoke member function given queue and parameters. Default - /// code_location argument added automatically. - template - void post(queue_function_code_loc_ptr_t&& - queue_member_function, - Param&& args) - { - // for the intel version we need to actually pass the code - // location. Within the intel sycl api this is usually a default - // argument, but for invoke we need to pass it manually + /// sycl::queue::member_function type with code_location parameter + template + using queue_function_code_loc_ptr_t = cl::sycl::event ( + cl::sycl::queue::*)(Param, cl::sycl::detail::code_location const&); + /// Invoke member function given queue and parameters. Default + /// code_location argument added automatically. + template + void post(queue_function_code_loc_ptr_t&& queue_member_function, + Param&& args) + { + // for the intel version we need to actually pass the code + // location. Within the intel sycl api this is usually a default + // argument, but for invoke we need to pass it manually + cl::sycl::event e = + HPX_INVOKE(HPX_FORWARD(queue_function_code_loc_ptr_t, + queue_member_function), + command_queue, HPX_FORWARD(Param, args), + cl::sycl::detail::code_location::current()); + } + /// Invoke queue member function given queue and parameters. Default + /// code_location argument added automatically. / Returns hpx::future + /// tied to the sycl event returned by the asynchronous queue member + /// function call (two way) + template + hpx::future async_execute( + queue_function_code_loc_ptr_t&& queue_member_function, + Param&& args) + { + // launching a sycl member function may throw -- if it does put it + // into the future + return hpx::detail::try_catch_exception_ptr( + [&]() { cl::sycl::event e = HPX_INVOKE( HPX_FORWARD(queue_function_code_loc_ptr_t, queue_member_function), command_queue, HPX_FORWARD(Param, args), cl::sycl::detail::code_location::current()); - } - /// Invoke queue member function given queue and parameters. Default - /// code_location argument added automatically. / Returns hpx::future - /// tied to the sycl event returned by the asynchronous queue member - /// function call (two way) - template - hpx::future async_execute( - queue_function_code_loc_ptr_t&& - queue_member_function, - Param&& args) - { - // launching a sycl member function may throw -- if it does put it - // into the future - return hpx::detail::try_catch_exception_ptr( - [&]() { - cl::sycl::event e = HPX_INVOKE( - HPX_FORWARD( - queue_function_code_loc_ptr_t, - queue_member_function), - command_queue, HPX_FORWARD(Param, args), - cl::sycl::detail::code_location::current()); - return get_future(e); - }, - [&](std::exception_ptr&& ep) { - return hpx::make_exceptional_future( - HPX_MOVE(ep)); - }); - } + return get_future(e); + }, + [&](std::exception_ptr&& ep) { + return hpx::make_exceptional_future(HPX_MOVE(ep)); + }); + } #endif - // -------------------------------------------------------------------- - // OneWay Execution - template - friend decltype(auto) tag_invoke( - hpx::parallel::execution::post_t, sycl_executor& exec, - F&& f, Ts&&... ts) - { - return exec.post(HPX_FORWARD(F, f), HPX_FORWARD(Ts, ts)...); - } + // -------------------------------------------------------------------- + // OneWay Execution + template + friend decltype(auto) tag_invoke(hpx::parallel::execution::post_t, + sycl_executor& exec, F&& f, Ts&&... ts) + { + return exec.post(HPX_FORWARD(F, f), HPX_FORWARD(Ts, ts)...); + } - // -------------------------------------------------------------------- - // TwoWay Execution - template - friend decltype(auto) tag_invoke( - hpx::parallel::execution::async_execute_t, - sycl_executor& exec, F&& f, Ts&&... ts) - { - return exec.async_execute( - HPX_FORWARD(F, f), HPX_FORWARD(Ts, ts)...); - } + // -------------------------------------------------------------------- + // TwoWay Execution + template + friend decltype(auto) tag_invoke( + hpx::parallel::execution::async_execute_t, sycl_executor& exec, + F&& f, Ts&&... ts) + { + return exec.async_execute( + HPX_FORWARD(F, f), HPX_FORWARD(Ts, ts)...); + } - // Property interface: + // Property interface: - /// Return the device used by the underlying SYCL queue - HPX_FORCEINLINE cl::sycl::device get_device() const - { - return command_queue.get_device(); - } - /// Return the context used by the underlying SYCL queue - HPX_FORCEINLINE cl::sycl::context get_context() const - { - return command_queue.get_context(); - } + /// Return the device used by the underlying SYCL queue + HPX_FORCEINLINE cl::sycl::device get_device() const + { + return command_queue.get_device(); + } + /// Return the context used by the underlying SYCL queue + HPX_FORCEINLINE cl::sycl::context get_context() const + { + return command_queue.get_context(); + } - // TODO Future work: Check if we want to expose any other (non-event) - // queue methods - protected: - cl::sycl::queue command_queue; - }; + // TODO Future work: Check if we want to expose any other (non-event) + // queue methods + protected: + cl::sycl::queue command_queue; + }; +} // namespace hpx::sycl::experimental -}}} // namespace hpx::sycl::experimental +namespace hpx::execution::experimental { -namespace hpx { - namespace parallel { namespace execution { + /// \cond NOINTERNAL + template <> + struct is_one_way_executor + : std::true_type + { + // support for fire and forget without returning a waitable/future + }; - /// \cond NOINTERNAL - template <> - struct is_one_way_executor - : std::true_type - { - // support for fire and forget without returning a waitable/future - }; + template <> + struct is_two_way_executor + : std::true_type + { + // support for a waitable/future + }; + /// \endcond +} // namespace hpx::execution::experimental - template <> - struct is_two_way_executor - : std::true_type - { - // support for a waitable/future - }; - /// \endcond - }} // namespace parallel::execution +namespace hpx { // Add overloads for apply and async to help the compiler determine the // correct sycl queue member function/overload by passing it the types for diff --git a/libs/core/compute_local/include/hpx/compute_local/host/block_allocator.hpp b/libs/core/compute_local/include/hpx/compute_local/host/block_allocator.hpp index 1ccbd88dd699..93d2e880f32b 100644 --- a/libs/core/compute_local/include/hpx/compute_local/host/block_allocator.hpp +++ b/libs/core/compute_local/include/hpx/compute_local/host/block_allocator.hpp @@ -257,7 +257,7 @@ namespace hpx::compute::host { /// template + hpx::execution::experimental::restricted_thread_pool_executor> struct block_allocator : public detail::policy_allocator + hpx::execution::experimental::restricted_thread_pool_executor> struct block_executor { public: @@ -301,7 +301,7 @@ namespace hpx::compute::host { }; } // namespace hpx::compute::host -namespace hpx::parallel::execution { +namespace hpx::execution::experimental { template struct executor_execution_category> @@ -332,4 +332,4 @@ namespace hpx::parallel::execution { : std::true_type { }; -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental diff --git a/libs/core/compute_local/include/hpx/compute_local/host/block_fork_join_executor.hpp b/libs/core/compute_local/include/hpx/compute_local/host/block_fork_join_executor.hpp index c93e5ef8dee9..2c76620ecc15 100644 --- a/libs/core/compute_local/include/hpx/compute_local/host/block_fork_join_executor.hpp +++ b/libs/core/compute_local/include/hpx/compute_local/host/block_fork_join_executor.hpp @@ -386,21 +386,16 @@ namespace hpx::execution::experimental { fork_join_executor exec_; std::vector block_execs_; }; -} // namespace hpx::execution::experimental - -namespace hpx::parallel::execution { /// \cond NOINTERNAL template <> - struct is_bulk_one_way_executor< - hpx::execution::experimental::block_fork_join_executor> : std::true_type + struct is_bulk_one_way_executor : std::true_type { }; template <> - struct is_bulk_two_way_executor< - hpx::execution::experimental::block_fork_join_executor> : std::true_type + struct is_bulk_two_way_executor : std::true_type { }; /// \endcond -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental diff --git a/libs/core/compute_local/include/hpx/compute_local/host/numa_allocator.hpp b/libs/core/compute_local/include/hpx/compute_local/host/numa_allocator.hpp index 982bb8fe7eea..d9f95548c677 100644 --- a/libs/core/compute_local/include/hpx/compute_local/host/numa_allocator.hpp +++ b/libs/core/compute_local/include/hpx/compute_local/host/numa_allocator.hpp @@ -118,7 +118,7 @@ namespace hpx::parallel::util { std::size_t thread_num = hpx::get_worker_thread_num(); hpx::threads::mask_cref_type thread_mask = - hpx::parallel::execution::get_pu_mask( + hpx::execution::experimental::get_pu_mask( executors_[i], topo_, thread_num); HPX_ASSERT(threads::mask_size(mem_mask) == diff --git a/libs/core/compute_local/include/hpx/compute_local/host/numa_binding_allocator.hpp b/libs/core/compute_local/include/hpx/compute_local/host/numa_binding_allocator.hpp index 45f3bcf67e5c..4a86b26ae75f 100644 --- a/libs/core/compute_local/include/hpx/compute_local/host/numa_binding_allocator.hpp +++ b/libs/core/compute_local/include/hpx/compute_local/host/numa_binding_allocator.hpp @@ -51,7 +51,7 @@ namespace hpx { "NUM_B_A"); } -namespace hpx::parallel::execution { +namespace hpx::execution::experimental { struct numa_binding_allocator_tag { @@ -69,7 +69,7 @@ namespace hpx::parallel::execution { return domain; } }; -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental namespace hpx::compute::host { @@ -448,15 +448,18 @@ namespace hpx::compute::host { using namespace parallel::execution; using allocator_hint_type = - pool_numa_hint; + hpx::execution::experimental::pool_numa_hint< + hpx::execution::experimental::numa_binding_allocator_tag>; // Warning :low priority tasks are used here, because the scheduler // does not steal across numa domains for those tasks, so they are // sure to remain on the right queue and be executed on the right // domain. - guided_pool_executor numa_executor( - &hpx::resource::get_thread_pool(binding_helper_->pool_name()), - threads::thread_priority::bound); + hpx::execution::experimental::guided_pool_executor< + allocator_hint_type> + numa_executor(&hpx::resource::get_thread_pool( + binding_helper_->pool_name()), + threads::thread_priority::bound); nba_deb.debug("Launching First-Touch tasks"); // for each numa domain, we must launch a task to 'touch' the memory diff --git a/libs/core/config/include/hpx/config/deprecation.hpp b/libs/core/config/include/hpx/config/deprecation.hpp index b387b2b4bc5e..1bd202ea5193 100644 --- a/libs/core/config/include/hpx/config/deprecation.hpp +++ b/libs/core/config/include/hpx/config/deprecation.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2022 Hartmut Kaiser +// Copyright (c) 2020-2024 Hartmut Kaiser // // SPDX-License-Identifier: BSL-1.0 // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -69,6 +69,25 @@ #define HPX_DEPRECATED_V1_10(x) #endif +/////////////////////////////////////////////////////////////////////////////// +// Deprecate a given functionality starting HPX V1.11 +#if !defined(HPX_HAVE_DEPRECATION_WARNINGS_V1_11) +#define HPX_HAVE_DEPRECATION_WARNINGS_V1_11 1 +#endif + +#if (HPX_VERSION_FULL >= 0x011100) && (HPX_HAVE_DEPRECATION_WARNINGS_V1_11 != 0) +#define HPX_DEPRECATED_MSG_V1_11 \ + "This functionality is deprecated starting HPX V1.11 and will be removed " \ + "in the future. You can define HPX_HAVE_DEPRECATION_WARNINGS_V1_11=0 to " \ + "acknowledge that you have received this warning." +#define HPX_DEPRECATED_V1_11(x) \ + [[deprecated(x " (" HPX_PP_EXPAND(HPX_DEPRECATED_MSG_V1_11) ")")]] +#endif + +#if !defined(HPX_DEPRECATED_V1_11) +#define HPX_DEPRECATED_V1_11(x) +#endif + /////////////////////////////////////////////////////////////////////////////// // Deprecate a given functionality starting at the given version of HPX #define HPX_DEPRECATED_V(major, minor, x) \ diff --git a/libs/core/execution/include/hpx/execution/executors/adaptive_static_chunk_size.hpp b/libs/core/execution/include/hpx/execution/executors/adaptive_static_chunk_size.hpp index c3b630c99266..080d5de980e0 100644 --- a/libs/core/execution/include/hpx/execution/executors/adaptive_static_chunk_size.hpp +++ b/libs/core/execution/include/hpx/execution/executors/adaptive_static_chunk_size.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2023 Hartmut Kaiser +// Copyright (c) 2007-2024 Hartmut Kaiser // Copyright (c) 2022 Karame M.Shokooh // // SPDX-License-Identifier: BSL-1.0 @@ -55,14 +55,15 @@ namespace hpx::execution::experimental { /// \cond NOINTERNAL template friend std::size_t tag_override_invoke( - hpx::parallel::execution::get_chunk_size_t, + hpx::execution::experimental::get_chunk_size_t, adaptive_static_chunk_size const& this_, Executor& exec, hpx::chrono::steady_duration const&, std::size_t cores, std::size_t input_size) { // Make sure the internal round-robin counter of the executor is // reset - parallel::execution::reset_thread_distribution(this_, exec); + hpx::execution::experimental::reset_thread_distribution( + this_, exec); // use the given chunk size if given if (this_.chunk_size_ != 0) @@ -115,15 +116,16 @@ namespace hpx::execution::experimental { std::size_t chunk_size_ = 0; /// \endcond }; -} // namespace hpx::execution::experimental -/// \cond NOINTERNAL -template <> -struct hpx::parallel::execution::is_executor_parameters< - hpx::execution::experimental::adaptive_static_chunk_size> : std::true_type -{ -}; -/// \endcond + /// \cond NOINTERNAL + template <> + struct is_executor_parameters< + hpx::execution::experimental::adaptive_static_chunk_size> + : std::true_type + { + }; + /// \endcond +} // namespace hpx::execution::experimental namespace hpx::execution { diff --git a/libs/core/execution/include/hpx/execution/executors/auto_chunk_size.hpp b/libs/core/execution/include/hpx/execution/executors/auto_chunk_size.hpp index c742f600c00f..b8b3c24b5560 100644 --- a/libs/core/execution/include/hpx/execution/executors/auto_chunk_size.hpp +++ b/libs/core/execution/include/hpx/execution/executors/auto_chunk_size.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 @@ -74,7 +74,7 @@ namespace hpx::execution::experimental { // Estimate execution time for one iteration template friend auto tag_override_invoke( - hpx::parallel::execution::measure_iteration_t, + hpx::execution::experimental::measure_iteration_t, auto_chunk_size& this_, Executor&& exec, F&& f, std::size_t count) { // by default use 1% of the iterations @@ -112,7 +112,7 @@ namespace hpx::execution::experimental { // Estimate a chunk size based on number of cores used. template friend std::size_t tag_override_invoke( - hpx::parallel::execution::get_chunk_size_t, + hpx::execution::experimental::get_chunk_size_t, auto_chunk_size const& this_, Executor&&, hpx::chrono::steady_duration const& iteration_duration, std::size_t cores, std::size_t count) noexcept @@ -152,15 +152,15 @@ namespace hpx::execution::experimental { std::uint64_t num_iters_for_timing_; /// \endcond }; -} // namespace hpx::execution::experimental -/// \cond NOINTERNAL -template <> -struct hpx::parallel::execution::is_executor_parameters< - hpx::execution::experimental::auto_chunk_size> : std::true_type -{ -}; -/// \endcond + /// \cond NOINTERNAL + template <> + struct is_executor_parameters + : std::true_type + { + }; + /// \endcond +} // namespace hpx::execution::experimental namespace hpx::execution { diff --git a/libs/core/execution/include/hpx/execution/executors/default_parameters.hpp b/libs/core/execution/include/hpx/execution/executors/default_parameters.hpp index 2087ad664e9f..c09327fa79e1 100644 --- a/libs/core/execution/include/hpx/execution/executors/default_parameters.hpp +++ b/libs/core/execution/include/hpx/execution/executors/default_parameters.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 @@ -44,7 +44,7 @@ namespace hpx::execution::experimental { { // Make sure the internal round-robin counter of the executor is // reset - parallel::execution::reset_thread_distribution( + hpx::execution::experimental::reset_thread_distribution( *this, HPX_FORWARD(Executor, exec)); if (cores == 1) @@ -64,12 +64,12 @@ namespace hpx::execution::experimental { } /// \endcond }; -} // namespace hpx::execution::experimental -/// \cond NOINTERNAL -template <> -struct hpx::parallel::execution::is_executor_parameters< - hpx::execution::experimental::default_parameters> : std::true_type -{ -}; -/// \endcond + /// \cond NOINTERNAL + template <> + struct is_executor_parameters< + hpx::execution::experimental::default_parameters> : std::true_type + { + }; + /// \endcond +} // namespace hpx::execution::experimental diff --git a/libs/core/execution/include/hpx/execution/executors/dynamic_chunk_size.hpp b/libs/core/execution/include/hpx/execution/executors/dynamic_chunk_size.hpp index cc833aec3020..2d03f86d8902 100644 --- a/libs/core/execution/include/hpx/execution/executors/dynamic_chunk_size.hpp +++ b/libs/core/execution/include/hpx/execution/executors/dynamic_chunk_size.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 @@ -53,7 +53,7 @@ namespace hpx::execution::experimental { /// \cond NOINTERNAL template friend constexpr std::size_t tag_override_invoke( - hpx::parallel::execution::get_chunk_size_t, + hpx::execution::experimental::get_chunk_size_t, dynamic_chunk_size const& this_, Executor&&, hpx::chrono::steady_duration const&, std::size_t, std::size_t) noexcept @@ -80,15 +80,15 @@ namespace hpx::execution::experimental { std::size_t chunk_size_ = 1; /// \endcond }; -} // namespace hpx::execution::experimental -/// \cond NOINTERNAL -template <> -struct hpx::parallel::execution::is_executor_parameters< - hpx::execution::experimental::dynamic_chunk_size> : std::true_type -{ -}; -/// \endcond + /// \cond NOINTERNAL + template <> + struct is_executor_parameters< + hpx::execution::experimental::dynamic_chunk_size> : std::true_type + { + }; + /// \endcond +} // namespace hpx::execution::experimental namespace hpx::execution { diff --git a/libs/core/execution/include/hpx/execution/executors/execution_information.hpp b/libs/core/execution/include/hpx/execution/executors/execution_information.hpp index 2c5cb14abf88..eeb52a93d568 100644 --- a/libs/core/execution/include/hpx/execution/executors/execution_information.hpp +++ b/libs/core/execution/include/hpx/execution/executors/execution_information.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022 Hartmut Kaiser +// Copyright (c) 2017-2024 Hartmut Kaiser // Copyright (c) 2017 Google // // SPDX-License-Identifier: BSL-1.0 @@ -21,7 +21,7 @@ #include #include -namespace hpx::parallel::execution { +namespace hpx::execution::experimental { /////////////////////////////////////////////////////////////////////////// namespace detail { @@ -69,7 +69,7 @@ namespace hpx::parallel::execution { friend HPX_FORCEINLINE decltype(auto) tag_invoke( has_pending_closures_t, Executor&& exec) { - return exec.has_pending_closures(); + return HPX_FORWARD(Executor, exec).has_pending_closures(); } } has_pending_closures{}; @@ -102,7 +102,8 @@ namespace hpx::parallel::execution { Executor&& /*exec*/, threads::topology& topo, std::size_t thread_num) { - return detail::get_pu_mask(topo, thread_num); + return hpx::parallel::execution::detail::get_pu_mask( + topo, thread_num); } // clang-format off @@ -115,7 +116,7 @@ namespace hpx::parallel::execution { friend HPX_FORCEINLINE decltype(auto) tag_invoke(get_pu_mask_t, Executor&& exec, threads::topology& topo, std::size_t thread_num) { - return exec.get_pu_mask(topo, thread_num); + return HPX_FORWARD(Executor, exec).get_pu_mask(topo, thread_num); } } get_pu_mask{}; @@ -153,7 +154,7 @@ namespace hpx::parallel::execution { friend HPX_FORCEINLINE void tag_invoke( set_scheduler_mode_t, Executor&& exec, Mode const& mode) { - exec.set_scheduler_mode(mode); + HPX_FORWARD(Executor, exec).set_scheduler_mode(mode); } } set_scheduler_mode{}; -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental diff --git a/libs/core/execution/include/hpx/execution/executors/execution_parameters.hpp b/libs/core/execution/include/hpx/execution/executors/execution_parameters.hpp index 5a6a55bf6dff..746adc08d454 100644 --- a/libs/core/execution/include/hpx/execution/executors/execution_parameters.hpp +++ b/libs/core/execution/include/hpx/execution/executors/execution_parameters.hpp @@ -1,5 +1,5 @@ // Copyright (c) 2016 Marcin Copik -// Copyright (c) 2016-2023 Hartmut Kaiser +// Copyright (c) 2016-2024 Hartmut Kaiser // // SPDX-License-Identifier: BSL-1.0 // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -32,860 +32,839 @@ #include /////////////////////////////////////////////////////////////////////////////// -namespace hpx::parallel::execution { +namespace hpx::execution::experimental::detail { - namespace detail { - /// \cond NOINTERNAL + /// \cond NOINTERNAL - /////////////////////////////////////////////////////////////////////// - template class CheckForProperty> - struct get_parameters_property_t final - : hpx::functional::detail::tag_fallback< - get_parameters_property_t> - { - private: - using derived_property_t = - get_parameters_property_t; + /////////////////////////////////////////////////////////////////////// + template class CheckForProperty> + struct get_parameters_property_t final + : hpx::functional::detail::tag_fallback< + get_parameters_property_t> + { + private: + using derived_property_t = + get_parameters_property_t; - template - using check_for_property = CheckForProperty>; + template + using check_for_property = CheckForProperty>; - // clang-format off + // clang-format off template || !check_for_property::value )> - // clang-format on - friend HPX_FORCEINLINE constexpr decltype(auto) tag_fallback_invoke( - derived_property_t, Executor&& /*exec*/, - Parameters&& /*params*/, Property prop) noexcept - { - return std::make_pair(prop, prop); - } - - /////////////////////////////////////////////////////////////////// - // Parameters directly supports property - // clang-format off + // clang-format on + friend HPX_FORCEINLINE constexpr decltype(auto) tag_fallback_invoke( + derived_property_t, Executor&& /*exec*/, Parameters&& /*params*/, + Property prop) noexcept + { + return std::make_pair(prop, prop); + } + + /////////////////////////////////////////////////////////////////// + // Parameters directly supports property + // clang-format off template && check_for_property::value )> - // clang-format on - friend HPX_FORCEINLINE constexpr decltype(auto) tag_fallback_invoke( - derived_property_t, Executor&& exec, Parameters&& params, - Property /*prop*/) noexcept - { - return std::pair( - HPX_FORWARD(Parameters, params), - HPX_FORWARD(Executor, exec)); - } - - /////////////////////////////////////////////////////////////////// - // Executor directly supports property - // clang-format off + // clang-format on + friend HPX_FORCEINLINE constexpr decltype(auto) tag_fallback_invoke( + derived_property_t, Executor&& exec, Parameters&& params, + Property /*prop*/) noexcept + { + return std::pair( + HPX_FORWARD(Parameters, params), HPX_FORWARD(Executor, exec)); + } + + /////////////////////////////////////////////////////////////////// + // Executor directly supports property + // clang-format off template && check_for_property::value )> - // clang-format on - friend HPX_FORCEINLINE constexpr decltype(auto) tag_invoke( - derived_property_t, Executor&& exec, Parameters&& params, - Property /*prop*/) noexcept - { - return std::pair( - HPX_FORWARD(Executor, exec), - HPX_FORWARD(Parameters, params)); - } - }; - - /////////////////////////////////////////////////////////////////////// - // define member traits - HPX_HAS_MEMBER_XXX_TRAIT_DEF(get_chunk_size) - - /////////////////////////////////////////////////////////////////////// - // default property implementation allowing to handle get_chunk_size - struct get_chunk_size_property - { - // default implementation - template - HPX_FORCEINLINE static constexpr std::size_t get_chunk_size(Target, - hpx::chrono::steady_duration const&, std::size_t, - std::size_t) noexcept - { - // return zero for the chunk-size, which will tell the - // implementation to calculate the chunk size either based on a - // specified maximum number of chunks or based on some internal - // rule (if no maximum number of chunks was given) - return 0; - } - }; - - ////////////////////////////////////////////////////////////////////// - // Generate a type that is guaranteed to support get_chunk_size - using get_parameters_chunk_size_t = - get_parameters_property_t; - - inline constexpr get_parameters_chunk_size_t - get_parameters_chunk_size{}; - - ////////////////////////////////////////////////////////////////////// - // customization point for interface get_chunk_size() - template - struct get_chunk_size_fn_helper>> - { - template - HPX_FORCEINLINE static constexpr std::size_t call( - Parameters& params, Executor&& exec, - hpx::chrono::steady_duration const& iteration_duration, - std::size_t cores, std::size_t num_tasks) - { - auto get_prop = - get_parameters_chunk_size(HPX_FORWARD(Executor, exec), - params, get_chunk_size_property{}); - - return get_prop.first.get_chunk_size( - HPX_FORWARD(decltype(get_prop.second), get_prop.second), - iteration_duration, cores, num_tasks); - } - - template - HPX_FORCEINLINE static constexpr std::size_t call( - AnyParameters params, Executor&& exec, - hpx::chrono::steady_duration const& iteration_duration, - std::size_t cores, std::size_t num_tasks) - { - return call(static_cast(params), - HPX_FORWARD(Executor, exec), iteration_duration, cores, - num_tasks); - } - }; - - /////////////////////////////////////////////////////////////////////// - // define member traits - HPX_HAS_MEMBER_XXX_TRAIT_DEF(measure_iteration) - - /////////////////////////////////////////////////////////////////////// - // default property implementation allowing to handle measure_iteration - struct measure_iteration_property - { - // default implementation - template - HPX_FORCEINLINE static constexpr decltype(auto) measure_iteration( - Target, F&&, std::size_t) noexcept - { - // return zero for the iteration duration, which will tell the - // implementation to calculate the chunk size either based on a - // specified maximum number of chunks or based on some internal - // rule (if no maximum number of chunks was given) - return hpx::chrono::null_duration; - } - }; - - ////////////////////////////////////////////////////////////////////// - // Generate a type that is guaranteed to support measure_iteration - using measure_iteration_t = - get_parameters_property_t; - - inline constexpr measure_iteration_t get_parameters_measure_iteration{}; - - ////////////////////////////////////////////////////////////////////// - // customization point for interface measure_iteration() - template - struct measure_iteration_fn_helper>> - { - template - HPX_FORCEINLINE static constexpr decltype(auto) call( - Parameters& params, Executor&& exec, F&& f, - std::size_t num_tasks) - { - auto get_prop = get_parameters_measure_iteration( - HPX_FORWARD(Executor, exec), params, - measure_iteration_property{}); - - return get_prop.first.measure_iteration( - HPX_FORWARD(decltype(get_prop.second), get_prop.second), - HPX_FORWARD(F, f), num_tasks); - } - - template - HPX_FORCEINLINE static constexpr decltype(auto) call( - AnyParameters params, Executor&& exec, F&& f, - std::size_t num_tasks) - { - return call(static_cast(params), - HPX_FORWARD(Executor, exec), HPX_FORWARD(F, f), num_tasks); - } - }; - - /////////////////////////////////////////////////////////////////////// - // define member traits - HPX_HAS_MEMBER_XXX_TRAIT_DEF(maximal_number_of_chunks) - - /////////////////////////////////////////////////////////////////////// - // default property implementation allowing to handle - // maximal_number_of_chunks - struct maximal_number_of_chunks_property - { - // default implementation - - // different versions of clang-format disagree - // clang-format off + // clang-format on + friend HPX_FORCEINLINE constexpr decltype(auto) tag_invoke( + derived_property_t, Executor&& exec, Parameters&& params, + Property /*prop*/) noexcept + { + return std::pair( + HPX_FORWARD(Executor, exec), HPX_FORWARD(Parameters, params)); + } + }; + + /////////////////////////////////////////////////////////////////////// + // define member traits + HPX_HAS_MEMBER_XXX_TRAIT_DEF(get_chunk_size) + + /////////////////////////////////////////////////////////////////////// + // default property implementation allowing to handle get_chunk_size + struct get_chunk_size_property + { + // default implementation + template + HPX_FORCEINLINE static constexpr std::size_t get_chunk_size(Target, + hpx::chrono::steady_duration const&, std::size_t, + std::size_t) noexcept + { + // return zero for the chunk-size, which will tell the + // implementation to calculate the chunk size either based on a + // specified maximum number of chunks or based on some internal + // rule (if no maximum number of chunks was given) + return 0; + } + }; + + ////////////////////////////////////////////////////////////////////// + // Generate a type that is guaranteed to support get_chunk_size + using get_parameters_chunk_size_t = + get_parameters_property_t; + + inline constexpr get_parameters_chunk_size_t get_parameters_chunk_size{}; + + ////////////////////////////////////////////////////////////////////// + // customization point for interface get_chunk_size() + template + struct get_chunk_size_fn_helper>> + { + template + HPX_FORCEINLINE static constexpr std::size_t call(Parameters& params, + Executor&& exec, + hpx::chrono::steady_duration const& iteration_duration, + std::size_t cores, std::size_t num_tasks) + { + auto get_prop = get_parameters_chunk_size( + HPX_FORWARD(Executor, exec), params, get_chunk_size_property{}); + + return get_prop.first.get_chunk_size( + HPX_FORWARD(decltype(get_prop.second), get_prop.second), + iteration_duration, cores, num_tasks); + } + + template + HPX_FORCEINLINE static constexpr std::size_t call(AnyParameters params, + Executor&& exec, + hpx::chrono::steady_duration const& iteration_duration, + std::size_t cores, std::size_t num_tasks) + { + return call(static_cast(params), + HPX_FORWARD(Executor, exec), iteration_duration, cores, + num_tasks); + } + }; + + /////////////////////////////////////////////////////////////////////// + // define member traits + HPX_HAS_MEMBER_XXX_TRAIT_DEF(measure_iteration) + + /////////////////////////////////////////////////////////////////////// + // default property implementation allowing to handle measure_iteration + struct measure_iteration_property + { + // default implementation + template + HPX_FORCEINLINE static constexpr decltype(auto) measure_iteration( + Target, F&&, std::size_t) noexcept + { + // return zero for the iteration duration, which will tell the + // implementation to calculate the chunk size either based on a + // specified maximum number of chunks or based on some internal + // rule (if no maximum number of chunks was given) + return hpx::chrono::null_duration; + } + }; + + ////////////////////////////////////////////////////////////////////// + // Generate a type that is guaranteed to support measure_iteration + using measure_iteration_t = + get_parameters_property_t; + + inline constexpr measure_iteration_t get_parameters_measure_iteration{}; + + ////////////////////////////////////////////////////////////////////// + // customization point for interface measure_iteration() + template + struct measure_iteration_fn_helper>> + { + template + HPX_FORCEINLINE static constexpr decltype(auto) call( + Parameters& params, Executor&& exec, F&& f, std::size_t num_tasks) + { + auto get_prop = + get_parameters_measure_iteration(HPX_FORWARD(Executor, exec), + params, measure_iteration_property{}); + + return get_prop.first.measure_iteration( + HPX_FORWARD(decltype(get_prop.second), get_prop.second), + HPX_FORWARD(F, f), num_tasks); + } + + template + HPX_FORCEINLINE static constexpr decltype(auto) call( + AnyParameters params, Executor&& exec, F&& f, std::size_t num_tasks) + { + return call(static_cast(params), + HPX_FORWARD(Executor, exec), HPX_FORWARD(F, f), num_tasks); + } + }; + + /////////////////////////////////////////////////////////////////////// + // define member traits + HPX_HAS_MEMBER_XXX_TRAIT_DEF(maximal_number_of_chunks) + + /////////////////////////////////////////////////////////////////////// + // default property implementation allowing to handle + // maximal_number_of_chunks + struct maximal_number_of_chunks_property + { + // default implementation + + // different versions of clang-format disagree + // clang-format off template HPX_FORCEINLINE static constexpr std::size_t maximal_number_of_chunks(Target, std::size_t, std::size_t) noexcept - // clang-format on - { - // return zero chunks which will tell the implementation to - // calculate the number of chunks either based on a - // specified chunk size or based on some internal rule (if no - // chunk-size was given) - return 0; - } - }; - - ////////////////////////////////////////////////////////////////////// - // Generate a type that is guaranteed to support - // maximal_number_of_chunks - using get_maximal_number_of_chunks_t = - get_parameters_property_t; - - inline constexpr get_maximal_number_of_chunks_t - get_maximal_number_of_chunks{}; - - /////////////////////////////////////////////////////////////////////// - // customization point for interface maximal_number_of_chunks() - template - struct maximal_number_of_chunks_fn_helper>> - { - template - HPX_FORCEINLINE static constexpr std::size_t call( - Parameters& params, Executor&& exec, std::size_t cores, - std::size_t num_tasks) - { - auto get_prop = - get_maximal_number_of_chunks(HPX_FORWARD(Executor, exec), - params, maximal_number_of_chunks_property{}); - - return get_prop.first.maximal_number_of_chunks( - HPX_FORWARD(decltype(get_prop.second), get_prop.second), - cores, num_tasks); - } - - template - HPX_FORCEINLINE static constexpr std::size_t call( - AnyParameters params, Executor&& exec, std::size_t cores, - std::size_t num_tasks) - { - return call(static_cast(params), - HPX_FORWARD(Executor, exec), cores, num_tasks); - } - }; - - /////////////////////////////////////////////////////////////////////// - // define member traits - HPX_HAS_MEMBER_XXX_TRAIT_DEF(reset_thread_distribution) - - /////////////////////////////////////////////////////////////////////// - // default property implementation allowing to handle - // reset_thread_distribution - struct reset_thread_distribution_property - { - // default implementation - template - HPX_FORCEINLINE static constexpr void reset_thread_distribution( - Target) noexcept - { - } - }; - - ////////////////////////////////////////////////////////////////////// - // Generate a type that is guaranteed to support - // reset_thread_distribution - using get_reset_thread_distribution_t = - get_parameters_property_t; - - inline constexpr get_reset_thread_distribution_t - get_reset_thread_distribution{}; - - /////////////////////////////////////////////////////////////////////// - // customization point for interface reset_thread_distribution() - template - struct reset_thread_distribution_fn_helper>> - { - template - HPX_FORCEINLINE static constexpr void call( - Parameters& params, Executor&& exec) - { - auto get_prop = - get_reset_thread_distribution(HPX_FORWARD(Executor, exec), - params, reset_thread_distribution_property{}); - - get_prop.first.reset_thread_distribution( - HPX_FORWARD(decltype(get_prop.second), get_prop.second)); - } - - template - HPX_FORCEINLINE static constexpr void call( - AnyParameters params, Executor&& exec) - { - call(static_cast(params), - HPX_FORWARD(Executor, exec)); - } - }; - - /////////////////////////////////////////////////////////////////////// - // define member traits - HPX_HAS_MEMBER_XXX_TRAIT_DEF(processing_units_count) - - /////////////////////////////////////////////////////////////////////// - // default property implementation allowing to handle - // processing_units_count_property - struct processing_units_count_property - { - // default implementation - template - HPX_FORCEINLINE static std::size_t processing_units_count(Target&&, - hpx::chrono::steady_duration const& = - hpx::chrono::null_duration, - std::size_t = 0) - { - return get_os_thread_count(); - } - }; - - ////////////////////////////////////////////////////////////////////// - // Generate a type that is guaranteed to support - // processing_units_count_property - using get_processing_units_count_target_t = - get_parameters_property_t; - - inline constexpr get_processing_units_count_target_t - get_processing_units_count_target{}; - - /////////////////////////////////////////////////////////////////////// - // customization point for interface processing_units_count() - template - struct processing_units_count_fn_helper>> - { - template - HPX_FORCEINLINE static constexpr std::size_t call( - Parameters& params, Executor&& exec, - hpx::chrono::steady_duration const& iteration_duration, - std::size_t num_tasks) - { - auto get_prop = get_processing_units_count_target( - HPX_FORWARD(Executor, exec), params, - processing_units_count_property{}); - - return get_prop.first.processing_units_count( - HPX_FORWARD(decltype(get_prop.second), get_prop.second), - iteration_duration, num_tasks); - } - - template - HPX_FORCEINLINE static constexpr std::size_t call( - AnyParameters params, Executor&& exec, - hpx::chrono::steady_duration const& iteration_duration, - std::size_t num_tasks) - { - return call(static_cast(params), - HPX_FORWARD(Executor, exec), iteration_duration, num_tasks); - } - }; - - template - struct processing_units_count_fn_helper>> - { - template - HPX_FORCEINLINE static constexpr std::size_t call(Executor&& exec, - hpx::chrono::steady_duration const& iteration_duration, - std::size_t num_tasks) - { - return processing_units_count_property::processing_units_count( - HPX_FORWARD(Executor, exec), iteration_duration, num_tasks); - } - }; - - /////////////////////////////////////////////////////////////////////// - // define member traits - HPX_HAS_MEMBER_XXX_TRAIT_DEF(mark_begin_execution) - - /////////////////////////////////////////////////////////////////////// - // default property implementation allowing to handle - // mark_begin_execution - struct mark_begin_execution_property - { - // default implementation - template - HPX_FORCEINLINE static constexpr void mark_begin_execution( - Target) noexcept - { - } - }; - - ////////////////////////////////////////////////////////////////////// - // Generate a type that is guaranteed to support - // mark_begin_execution - using get_mark_begin_execution_t = - get_parameters_property_t; - - inline constexpr get_mark_begin_execution_t get_mark_begin_execution{}; - - /////////////////////////////////////////////////////////////////////// - // customization point for interface mark_begin_execution() - template - struct mark_begin_execution_fn_helper>> - { - template - HPX_FORCEINLINE static constexpr void call( - Parameters& params, Executor&& exec) - { - auto get_prop = - get_mark_begin_execution(HPX_FORWARD(Executor, exec), - params, mark_begin_execution_property{}); - - get_prop.first.mark_begin_execution( - HPX_FORWARD(decltype(get_prop.second), get_prop.second)); - } - - template - HPX_FORCEINLINE static constexpr void call( - AnyParameters params, Executor&& exec) - { - call(static_cast(params), - HPX_FORWARD(Executor, exec)); - } - }; - - /////////////////////////////////////////////////////////////////////// - // define member traits - HPX_HAS_MEMBER_XXX_TRAIT_DEF(mark_end_of_scheduling) - - /////////////////////////////////////////////////////////////////////// - // default property implementation allowing to handle - // mark_end_of_scheduling - struct mark_end_of_scheduling_property - { - // default implementation - template - HPX_FORCEINLINE static constexpr void mark_end_of_scheduling( - Target) noexcept - { - } - }; - - ////////////////////////////////////////////////////////////////////// - // Generate a type that is guaranteed to support - // mark_end_of_scheduling - using get_mark_end_of_scheduling_t = - get_parameters_property_t; - - inline constexpr get_mark_end_of_scheduling_t - get_mark_end_of_scheduling{}; - - /////////////////////////////////////////////////////////////////////// - // customization point for interface mark_end_of_scheduling() - template - struct mark_end_of_scheduling_fn_helper>> - { - template - HPX_FORCEINLINE static constexpr void call( - Parameters& params, Executor&& exec) - { - auto get_prop = - get_mark_end_of_scheduling(HPX_FORWARD(Executor, exec), - params, mark_end_of_scheduling_property{}); - - get_prop.first.mark_end_of_scheduling( - HPX_FORWARD(decltype(get_prop.second), get_prop.second)); - } - - template - HPX_FORCEINLINE static constexpr void call( - AnyParameters params, Executor&& exec) - { - call(static_cast(params), - HPX_FORWARD(Executor, exec)); - } - }; - - /////////////////////////////////////////////////////////////////////// - // define member traits - HPX_HAS_MEMBER_XXX_TRAIT_DEF(mark_end_execution) - - /////////////////////////////////////////////////////////////////////// - // default property implementation allowing to handle - // mark_end_execution - struct mark_end_execution_property - { - // default implementation - template - HPX_FORCEINLINE static constexpr void mark_end_execution( - Target) noexcept - { - } - }; - - ////////////////////////////////////////////////////////////////////// - // Generate a type that is guaranteed to support - // mark_end_execution - using get_mark_end_execution_t = - get_parameters_property_t; - - inline constexpr get_mark_end_execution_t get_mark_end_execution{}; - - /////////////////////////////////////////////////////////////////////// - // customization point for interface mark_end_execution() - template - struct mark_end_execution_fn_helper>> - { - template - HPX_FORCEINLINE static constexpr void call( - Parameters& params, Executor&& exec) - { - auto get_prop = - get_mark_end_execution(HPX_FORWARD(Executor, exec), params, - mark_end_execution_property{}); - - get_prop.first.mark_end_execution( - HPX_FORWARD(decltype(get_prop.second), get_prop.second)); - } - - template - HPX_FORCEINLINE static constexpr void call( - AnyParameters params, Executor&& exec) - { - call(static_cast(params), - HPX_FORWARD(Executor, exec)); - } - }; - /// \endcond - } // namespace detail + // clang-format on + { + // return zero chunks which will tell the implementation to + // calculate the number of chunks either based on a + // specified chunk size or based on some internal rule (if no + // chunk-size was given) + return 0; + } + }; - /////////////////////////////////////////////////////////////////////////// - namespace detail { + ////////////////////////////////////////////////////////////////////// + // Generate a type that is guaranteed to support + // maximal_number_of_chunks + using get_maximal_number_of_chunks_t = + get_parameters_property_t; + + inline constexpr get_maximal_number_of_chunks_t + get_maximal_number_of_chunks{}; + + /////////////////////////////////////////////////////////////////////// + // customization point for interface maximal_number_of_chunks() + template + struct maximal_number_of_chunks_fn_helper>> + { + template + HPX_FORCEINLINE static constexpr std::size_t call(Parameters& params, + Executor&& exec, std::size_t cores, std::size_t num_tasks) + { + auto get_prop = + get_maximal_number_of_chunks(HPX_FORWARD(Executor, exec), + params, maximal_number_of_chunks_property{}); + + return get_prop.first.maximal_number_of_chunks( + HPX_FORWARD(decltype(get_prop.second), get_prop.second), cores, + num_tasks); + } + + template + HPX_FORCEINLINE static constexpr std::size_t call(AnyParameters params, + Executor&& exec, std::size_t cores, std::size_t num_tasks) + { + return call(static_cast(params), + HPX_FORWARD(Executor, exec), cores, num_tasks); + } + }; - /// \cond NOINTERNAL - template - struct parameters_type_counter; + /////////////////////////////////////////////////////////////////////// + // define member traits + HPX_HAS_MEMBER_XXX_TRAIT_DEF(reset_thread_distribution) - template <> - struct parameters_type_counter<> + /////////////////////////////////////////////////////////////////////// + // default property implementation allowing to handle + // reset_thread_distribution + struct reset_thread_distribution_property + { + // default implementation + template + HPX_FORCEINLINE static constexpr void reset_thread_distribution( + Target) noexcept { - static constexpr int value = 0; - }; + } + }; - /// Return the number of parameters which are true - template - struct parameters_type_counter + ////////////////////////////////////////////////////////////////////// + // Generate a type that is guaranteed to support + // reset_thread_distribution + using get_reset_thread_distribution_t = + get_parameters_property_t; + + inline constexpr get_reset_thread_distribution_t + get_reset_thread_distribution{}; + + /////////////////////////////////////////////////////////////////////// + // customization point for interface reset_thread_distribution() + template + struct reset_thread_distribution_fn_helper>> + { + template + HPX_FORCEINLINE static constexpr void call( + Parameters& params, Executor&& exec) { - static constexpr int value = - Flag1 + parameters_type_counter::value; - }; + auto get_prop = + get_reset_thread_distribution(HPX_FORWARD(Executor, exec), + params, reset_thread_distribution_property{}); - /////////////////////////////////////////////////////////////////////// - template - struct unwrapper : T - { - // default constructor is needed for serialization purposes - template , Dependent>> - unwrapper() - : T() - { - } - - // generic poor-man's forwarding constructor - template , unwrapper>>> - unwrapper(U&& u) - : T(HPX_FORWARD(U, u)) - { - } - }; - - /////////////////////////////////////////////////////////////////////// - template - struct maximal_number_of_chunks_call_helper - { - }; - - template - struct maximal_number_of_chunks_call_helper>> - { - template - HPX_FORCEINLINE std::size_t maximal_number_of_chunks( - Executor&& exec, std::size_t cores, std::size_t num_tasks) const - { - auto& wrapped = - static_cast const*>(this)->member_.get(); - return wrapped.maximal_number_of_chunks( - HPX_FORWARD(Executor, exec), cores, num_tasks); - } - }; - - /////////////////////////////////////////////////////////////////////// - template - struct get_chunk_size_call_helper - { - }; - - template - struct get_chunk_size_call_helper>> - { - template - HPX_FORCEINLINE std::size_t get_chunk_size(Executor&& exec, - hpx::chrono::steady_duration const& iteration_duration, - std::size_t cores, std::size_t num_tasks) const - { - auto& wrapped = - static_cast const*>(this)->member_.get(); - return wrapped.get_chunk_size(HPX_FORWARD(Executor, exec), - iteration_duration, cores, num_tasks); - } - }; - - /////////////////////////////////////////////////////////////////////// - template - struct measure_iteration_call_helper - { - }; - - template - struct measure_iteration_call_helper>> - { - template - HPX_FORCEINLINE std::size_t measure_iteration(Executor&& exec, - F&& f, std::size_t cores, std::size_t num_tasks) const - { - auto& wrapped = - static_cast const*>(this)->member_.get(); - return wrapped.measure_iteration(HPX_FORWARD(Executor, exec), - HPX_FORWARD(F, f), cores, num_tasks); - } - }; - - /////////////////////////////////////////////////////////////////////// - template - struct mark_begin_execution_call_helper - { - }; - - template - struct mark_begin_execution_call_helper>> - { - template - HPX_FORCEINLINE void mark_begin_execution(Executor&& exec) - { - auto& wrapped = - static_cast*>(this)->member_.get(); - wrapped.mark_begin_execution(HPX_FORWARD(Executor, exec)); - } - }; - - /////////////////////////////////////////////////////////////////////// - template - struct mark_end_of_scheduling_call_helper - { - }; - - template - struct mark_end_of_scheduling_call_helper>> - { - template - HPX_FORCEINLINE void mark_end_of_scheduling(Executor&& exec) - { - auto& wrapped = - static_cast*>(this)->member_.get(); - wrapped.mark_end_of_scheduling(HPX_FORWARD(Executor, exec)); - } - }; - - /////////////////////////////////////////////////////////////////////// - template - struct mark_end_execution_call_helper - { - }; - - template - struct mark_end_execution_call_helper>> - { - template - HPX_FORCEINLINE void mark_end_execution(Executor&& exec) - { - auto& wrapped = - static_cast*>(this)->member_.get(); - wrapped.mark_end_execution(HPX_FORWARD(Executor, exec)); - } - }; - - /////////////////////////////////////////////////////////////////////// - template - struct processing_units_count_call_helper - { - }; - - template - struct processing_units_count_call_helper>> - { - template - HPX_FORCEINLINE std::size_t processing_units_count( - Executor&& exec) const - { - auto& wrapped = - static_cast const*>(this)->member_.get(); - return wrapped.processing_units_count( - HPX_FORWARD(Executor, exec)); - } - }; - - /////////////////////////////////////////////////////////////////////// - template - struct reset_thread_distribution_call_helper - { - }; - - template - struct reset_thread_distribution_call_helper>> - { - template - HPX_FORCEINLINE void reset_thread_distribution(Executor&& exec) - { - auto& wrapped = - static_cast*>(this)->member_.get(); - wrapped.reset_thread_distribution(HPX_FORWARD(Executor, exec)); - } - }; - - /////////////////////////////////////////////////////////////////////// - template - struct base_member_helper + get_prop.first.reset_thread_distribution( + HPX_FORWARD(decltype(get_prop.second), get_prop.second)); + } + + template + HPX_FORCEINLINE static constexpr void call( + AnyParameters params, Executor&& exec) { - explicit constexpr base_member_helper(T t) noexcept - : member_(HPX_MOVE(t)) - { - } + call(static_cast(params), HPX_FORWARD(Executor, exec)); + } + }; - T member_; - }; + /////////////////////////////////////////////////////////////////////// + // define member traits + HPX_HAS_MEMBER_XXX_TRAIT_DEF(processing_units_count) - /////////////////////////////////////////////////////////////////////// - template - struct unwrapper<::std::reference_wrapper> - : base_member_helper> - , maximal_number_of_chunks_call_helper> - , get_chunk_size_call_helper> - , measure_iteration_call_helper> - , mark_begin_execution_call_helper> - , mark_end_of_scheduling_call_helper> - , mark_end_execution_call_helper> - , processing_units_count_call_helper> - , reset_thread_distribution_call_helper> - { - using wrapper_type = std::reference_wrapper; - - constexpr explicit unwrapper(wrapper_type wrapped_param) noexcept - : base_member_helper(HPX_MOVE(wrapped_param)) - { - } - }; - - /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// + // default property implementation allowing to handle + // processing_units_count_property + struct processing_units_count_property + { + // default implementation + template + HPX_FORCEINLINE static std::size_t processing_units_count(Target&&, + hpx::chrono::steady_duration const& = hpx::chrono::null_duration, + std::size_t = 0) + { + return hpx::parallel::execution::detail::get_os_thread_count(); + } + }; + + ////////////////////////////////////////////////////////////////////// + // Generate a type that is guaranteed to support + // processing_units_count_property + using get_processing_units_count_target_t = + get_parameters_property_t; + + inline constexpr get_processing_units_count_target_t + get_processing_units_count_target{}; + + /////////////////////////////////////////////////////////////////////// + // customization point for interface processing_units_count() + template + struct processing_units_count_fn_helper>> + { + template + HPX_FORCEINLINE static constexpr std::size_t call(Parameters& params, + Executor&& exec, + hpx::chrono::steady_duration const& iteration_duration, + std::size_t num_tasks) + { + auto get_prop = + get_processing_units_count_target(HPX_FORWARD(Executor, exec), + params, processing_units_count_property{}); + + return get_prop.first.processing_units_count( + HPX_FORWARD(decltype(get_prop.second), get_prop.second), + iteration_duration, num_tasks); + } + + template + HPX_FORCEINLINE static constexpr std::size_t call(AnyParameters params, + Executor&& exec, + hpx::chrono::steady_duration const& iteration_duration, + std::size_t num_tasks) + { + return call(static_cast(params), + HPX_FORWARD(Executor, exec), iteration_duration, num_tasks); + } + }; + + template + struct processing_units_count_fn_helper>> + { + template + HPX_FORCEINLINE static constexpr std::size_t call(Executor&& exec, + hpx::chrono::steady_duration const& iteration_duration, + std::size_t num_tasks) + { + return processing_units_count_property::processing_units_count( + HPX_FORWARD(Executor, exec), iteration_duration, num_tasks); + } + }; + + /////////////////////////////////////////////////////////////////////// + // define member traits + HPX_HAS_MEMBER_XXX_TRAIT_DEF(mark_begin_execution) + + /////////////////////////////////////////////////////////////////////// + // default property implementation allowing to handle + // mark_begin_execution + struct mark_begin_execution_property + { + // default implementation + template + HPX_FORCEINLINE static constexpr void mark_begin_execution( + Target) noexcept + { + } + }; + + ////////////////////////////////////////////////////////////////////// + // Generate a type that is guaranteed to support + // mark_begin_execution + using get_mark_begin_execution_t = + get_parameters_property_t; + + inline constexpr get_mark_begin_execution_t get_mark_begin_execution{}; + + /////////////////////////////////////////////////////////////////////// + // customization point for interface mark_begin_execution() + template + struct mark_begin_execution_fn_helper>> + { + template + HPX_FORCEINLINE static constexpr void call( + Parameters& params, Executor&& exec) + { + auto get_prop = + get_mark_begin_execution(HPX_FORWARD(Executor, exec), params, + mark_begin_execution_property{}); + + get_prop.first.mark_begin_execution( + HPX_FORWARD(decltype(get_prop.second), get_prop.second)); + } + + template + HPX_FORCEINLINE static constexpr void call( + AnyParameters params, Executor&& exec) + { + call(static_cast(params), HPX_FORWARD(Executor, exec)); + } + }; + + /////////////////////////////////////////////////////////////////////// + // define member traits + HPX_HAS_MEMBER_XXX_TRAIT_DEF(mark_end_of_scheduling) + + /////////////////////////////////////////////////////////////////////// + // default property implementation allowing to handle + // mark_end_of_scheduling + struct mark_end_of_scheduling_property + { + // default implementation + template + HPX_FORCEINLINE static constexpr void mark_end_of_scheduling( + Target) noexcept + { + } + }; + + ////////////////////////////////////////////////////////////////////// + // Generate a type that is guaranteed to support + // mark_end_of_scheduling + using get_mark_end_of_scheduling_t = + get_parameters_property_t; + + inline constexpr get_mark_end_of_scheduling_t get_mark_end_of_scheduling{}; + + /////////////////////////////////////////////////////////////////////// + // customization point for interface mark_end_of_scheduling() + template + struct mark_end_of_scheduling_fn_helper>> + { + template + HPX_FORCEINLINE static constexpr void call( + Parameters& params, Executor&& exec) + { + auto get_prop = + get_mark_end_of_scheduling(HPX_FORWARD(Executor, exec), params, + mark_end_of_scheduling_property{}); + + get_prop.first.mark_end_of_scheduling( + HPX_FORWARD(decltype(get_prop.second), get_prop.second)); + } + + template + HPX_FORCEINLINE static constexpr void call( + AnyParameters params, Executor&& exec) + { + call(static_cast(params), HPX_FORWARD(Executor, exec)); + } + }; + + /////////////////////////////////////////////////////////////////////// + // define member traits + HPX_HAS_MEMBER_XXX_TRAIT_DEF(mark_end_execution) + + /////////////////////////////////////////////////////////////////////// + // default property implementation allowing to handle + // mark_end_execution + struct mark_end_execution_property + { + // default implementation + template + HPX_FORCEINLINE static constexpr void mark_end_execution( + Target) noexcept + { + } + }; + ////////////////////////////////////////////////////////////////////// + // Generate a type that is guaranteed to support + // mark_end_execution + using get_mark_end_execution_t = + get_parameters_property_t; + + inline constexpr get_mark_end_execution_t get_mark_end_execution{}; + + /////////////////////////////////////////////////////////////////////// + // customization point for interface mark_end_execution() + template + struct mark_end_execution_fn_helper>> + { + template + HPX_FORCEINLINE static constexpr void call( + Parameters& params, Executor&& exec) + { + auto get_prop = get_mark_end_execution(HPX_FORWARD(Executor, exec), + params, mark_end_execution_property{}); + + get_prop.first.mark_end_execution( + HPX_FORWARD(decltype(get_prop.second), get_prop.second)); + } + + template + HPX_FORCEINLINE static constexpr void call( + AnyParameters params, Executor&& exec) + { + call(static_cast(params), HPX_FORWARD(Executor, exec)); + } + }; + /// \endcond + + /// \cond NOINTERNAL + template + struct parameters_type_counter; + + template <> + struct parameters_type_counter<> + { + static constexpr int value = 0; + }; + + /// Return the number of parameters which are true + template + struct parameters_type_counter + { + static constexpr int value = + Flag1 + parameters_type_counter::value; + }; + + /////////////////////////////////////////////////////////////////////// + template + struct unwrapper : T + { + // default constructor is needed for serialization purposes + template , Dependent>> + unwrapper() + : T() + { + } + + // generic poor-man's forwarding constructor + template , unwrapper>>> + unwrapper(U&& u) + : T(HPX_FORWARD(U, u)) + { + } + }; + + /////////////////////////////////////////////////////////////////////// + template + struct maximal_number_of_chunks_call_helper + { + }; + + template + struct maximal_number_of_chunks_call_helper>> + { + template + HPX_FORCEINLINE std::size_t maximal_number_of_chunks( + Executor&& exec, std::size_t cores, std::size_t num_tasks) const + { + auto& wrapped = + static_cast const*>(this)->member_.get(); + return wrapped.maximal_number_of_chunks( + HPX_FORWARD(Executor, exec), cores, num_tasks); + } + }; + + /////////////////////////////////////////////////////////////////////// + template + struct get_chunk_size_call_helper + { + }; + + template + struct get_chunk_size_call_helper>> + { + template + HPX_FORCEINLINE std::size_t get_chunk_size(Executor&& exec, + hpx::chrono::steady_duration const& iteration_duration, + std::size_t cores, std::size_t num_tasks) const + { + auto& wrapped = + static_cast const*>(this)->member_.get(); + return wrapped.get_chunk_size(HPX_FORWARD(Executor, exec), + iteration_duration, cores, num_tasks); + } + }; + + /////////////////////////////////////////////////////////////////////// + template + struct measure_iteration_call_helper + { + }; + + template + struct measure_iteration_call_helper>> + { + template + HPX_FORCEINLINE std::size_t measure_iteration(Executor&& exec, F&& f, + std::size_t cores, std::size_t num_tasks) const + { + auto& wrapped = + static_cast const*>(this)->member_.get(); + return wrapped.measure_iteration(HPX_FORWARD(Executor, exec), + HPX_FORWARD(F, f), cores, num_tasks); + } + }; + + /////////////////////////////////////////////////////////////////////// + template + struct mark_begin_execution_call_helper + { + }; + + template + struct mark_begin_execution_call_helper>> + { + template + HPX_FORCEINLINE void mark_begin_execution(Executor&& exec) + { + auto& wrapped = + static_cast*>(this)->member_.get(); + wrapped.mark_begin_execution(HPX_FORWARD(Executor, exec)); + } + }; + + /////////////////////////////////////////////////////////////////////// + template + struct mark_end_of_scheduling_call_helper + { + }; + + template + struct mark_end_of_scheduling_call_helper>> + { + template + HPX_FORCEINLINE void mark_end_of_scheduling(Executor&& exec) + { + auto& wrapped = + static_cast*>(this)->member_.get(); + wrapped.mark_end_of_scheduling(HPX_FORWARD(Executor, exec)); + } + }; + + /////////////////////////////////////////////////////////////////////// + template + struct mark_end_execution_call_helper + { + }; + + template + struct mark_end_execution_call_helper>> + { + template + HPX_FORCEINLINE void mark_end_execution(Executor&& exec) + { + auto& wrapped = + static_cast*>(this)->member_.get(); + wrapped.mark_end_execution(HPX_FORWARD(Executor, exec)); + } + }; + + /////////////////////////////////////////////////////////////////////// + template + struct processing_units_count_call_helper + { + }; + + template + struct processing_units_count_call_helper>> + { + template + HPX_FORCEINLINE std::size_t processing_units_count( + Executor&& exec) const + { + auto& wrapped = + static_cast const*>(this)->member_.get(); + return wrapped.processing_units_count(HPX_FORWARD(Executor, exec)); + } + }; + + /////////////////////////////////////////////////////////////////////// + template + struct reset_thread_distribution_call_helper + { + }; + + template + struct reset_thread_distribution_call_helper>> + { + template + HPX_FORCEINLINE void reset_thread_distribution(Executor&& exec) + { + auto& wrapped = + static_cast*>(this)->member_.get(); + wrapped.reset_thread_distribution(HPX_FORWARD(Executor, exec)); + } + }; + + /////////////////////////////////////////////////////////////////////// + template + struct base_member_helper + { + explicit constexpr base_member_helper(T t) noexcept + : member_(HPX_MOVE(t)) + { + } + + T member_; + }; + + /////////////////////////////////////////////////////////////////////// + template + struct unwrapper<::std::reference_wrapper> + : base_member_helper> + , maximal_number_of_chunks_call_helper> + , get_chunk_size_call_helper> + , measure_iteration_call_helper> + , mark_begin_execution_call_helper> + , mark_end_of_scheduling_call_helper> + , mark_end_execution_call_helper> + , processing_units_count_call_helper> + , reset_thread_distribution_call_helper> + { + using wrapper_type = std::reference_wrapper; + + constexpr explicit unwrapper(wrapper_type wrapped_param) noexcept + : base_member_helper(HPX_MOVE(wrapped_param)) + { + } + }; + + /////////////////////////////////////////////////////////////////////// #define HPX_STATIC_ASSERT_ON_PARAMETERS_AMBIGUITY(func) \ static_assert( \ parameters_type_counter< \ - HPX_PP_CAT(hpx::parallel::execution::detail::has_, func) < \ + HPX_PP_CAT(hpx::execution::experimental::detail::has_, func) < \ hpx::util::decay_unwrap_t>::value... > ::value <= 1, \ "Passing more than one executor parameters type " \ "exposing " HPX_PP_STRINGIZE(func) " is not possible") /**/ - template - struct executor_parameters : public unwrapper... - { - static_assert( - hpx::util::all_of_v>...>, - "All passed parameters must be a proper executor parameters " - "objects"); - static_assert(sizeof...(Params) >= 2, - "This type is meant to be used with at least 2 parameters " - "objects"); - - HPX_STATIC_ASSERT_ON_PARAMETERS_AMBIGUITY(get_chunk_size); - HPX_STATIC_ASSERT_ON_PARAMETERS_AMBIGUITY(measure_iteration); - HPX_STATIC_ASSERT_ON_PARAMETERS_AMBIGUITY(mark_begin_execution); - HPX_STATIC_ASSERT_ON_PARAMETERS_AMBIGUITY(mark_end_of_scheduling); - HPX_STATIC_ASSERT_ON_PARAMETERS_AMBIGUITY(mark_end_execution); - HPX_STATIC_ASSERT_ON_PARAMETERS_AMBIGUITY(processing_units_count); - HPX_STATIC_ASSERT_ON_PARAMETERS_AMBIGUITY(maximal_number_of_chunks); - HPX_STATIC_ASSERT_ON_PARAMETERS_AMBIGUITY( - reset_thread_distribution); - - template ...>, - Dependent>> - constexpr executor_parameters() - : unwrapper()... - { - } - - template ::size == - hpx::util::pack::size>> - constexpr explicit executor_parameters(Params_&&... params) - : unwrapper(HPX_FORWARD(Params_, params))... - { - } - - private: - friend class hpx::serialization::access; - - template - void serialize(Archive& ar, unsigned int const /* version */) - { - (hpx::serialization::detail::serialize_one( - ar, serialization::base_object(*this)), - ...); - } - }; + template + struct executor_parameters : public unwrapper... + { + static_assert( + hpx::util::all_of_v< + hpx::traits::is_executor_parameters>...>, + "All passed parameters must be a proper executor parameters " + "objects"); + static_assert(sizeof...(Params) >= 2, + "This type is meant to be used with at least 2 parameters " + "objects"); + + HPX_STATIC_ASSERT_ON_PARAMETERS_AMBIGUITY(get_chunk_size); + HPX_STATIC_ASSERT_ON_PARAMETERS_AMBIGUITY(measure_iteration); + HPX_STATIC_ASSERT_ON_PARAMETERS_AMBIGUITY(mark_begin_execution); + HPX_STATIC_ASSERT_ON_PARAMETERS_AMBIGUITY(mark_end_of_scheduling); + HPX_STATIC_ASSERT_ON_PARAMETERS_AMBIGUITY(mark_end_execution); + HPX_STATIC_ASSERT_ON_PARAMETERS_AMBIGUITY(processing_units_count); + HPX_STATIC_ASSERT_ON_PARAMETERS_AMBIGUITY(maximal_number_of_chunks); + HPX_STATIC_ASSERT_ON_PARAMETERS_AMBIGUITY(reset_thread_distribution); + + template ...>, + Dependent>> + constexpr executor_parameters() + : unwrapper()... + { + } + + template ::size == + hpx::util::pack::size>> + constexpr explicit executor_parameters(Params_&&... params) + : unwrapper(HPX_FORWARD(Params_, params))... + { + } + + private: + friend class hpx::serialization::access; + + template + void serialize(Archive& ar, unsigned int const /* version */) + { + (hpx::serialization::detail::serialize_one( + ar, serialization::base_object(*this)), + ...); + } + }; #undef HPX_STATIC_ASSERT_ON_PARAMETERS_AMBIGUITY - /// \endcond - } // namespace detail + /// \endcond +} // namespace hpx::execution::experimental::detail + +namespace hpx::execution::experimental { /////////////////////////////////////////////////////////////////////////// // specialize trait for the type-combiner @@ -928,4 +907,4 @@ namespace hpx::parallel::execution { return HPX_FORWARD(Param, param); } -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental diff --git a/libs/core/execution/include/hpx/execution/executors/execution_parameters_fwd.hpp b/libs/core/execution/include/hpx/execution/executors/execution_parameters_fwd.hpp index b2b2f5af2fc8..f6a38bd4c517 100644 --- a/libs/core/execution/include/hpx/execution/executors/execution_parameters_fwd.hpp +++ b/libs/core/execution/include/hpx/execution/executors/execution_parameters_fwd.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2022 Hartmut Kaiser +// Copyright (c) 2016-2024 Hartmut Kaiser // // SPDX-License-Identifier: BSL-1.0 // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -21,7 +21,7 @@ #include #include -namespace hpx::parallel::execution { +namespace hpx::execution::experimental { /////////////////////////////////////////////////////////////////////////// // Executor information customization points @@ -320,9 +320,8 @@ namespace hpx::parallel::execution { processing_units_count_t tag, Executor&& exec, std::size_t num_tasks = 0) { - return tag(hpx::parallel::execution::null_parameters, - HPX_FORWARD(Executor, exec), hpx::chrono::null_duration, - num_tasks); + return tag(null_parameters, HPX_FORWARD(Executor, exec), + hpx::chrono::null_duration, num_tasks); } } processing_units_count{}; @@ -419,10 +418,10 @@ namespace hpx::parallel::execution { HPX_FORWARD(Executor, exec)); } } mark_end_execution{}; -} // namespace hpx::parallel::execution -template <> -struct hpx::execution::experimental::is_scheduling_property< - hpx::parallel::execution::with_processing_units_count_t> : std::true_type -{ -}; + template <> + struct is_scheduling_property + : std::true_type + { + }; +} // namespace hpx::execution::experimental diff --git a/libs/core/execution/include/hpx/execution/executors/guided_chunk_size.hpp b/libs/core/execution/include/hpx/execution/executors/guided_chunk_size.hpp index e0d025fd1e32..fe004a820c2e 100644 --- a/libs/core/execution/include/hpx/execution/executors/guided_chunk_size.hpp +++ b/libs/core/execution/include/hpx/execution/executors/guided_chunk_size.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 @@ -65,7 +65,7 @@ namespace hpx::execution::experimental { template friend constexpr std::size_t tag_override_invoke( - hpx::parallel::execution::get_chunk_size_t, + hpx::execution::experimental::get_chunk_size_t, guided_chunk_size const& this_, Executor&& /* exec */, hpx::chrono::steady_duration const&, std::size_t cores, std::size_t num_tasks) noexcept @@ -93,15 +93,15 @@ namespace hpx::execution::experimental { std::size_t min_chunk_size_ = 1; /// \endcond }; -} // namespace hpx::execution::experimental -/// \cond NOINTERNAL -template <> -struct hpx::parallel::execution::is_executor_parameters< - hpx::execution::experimental::guided_chunk_size> : std::true_type -{ -}; -/// \endcond + /// \cond NOINTERNAL + template <> + struct is_executor_parameters< + hpx::execution::experimental::guided_chunk_size> : std::true_type + { + }; + /// \endcond +} // namespace hpx::execution::experimental namespace hpx::execution { diff --git a/libs/core/execution/include/hpx/execution/executors/num_cores.hpp b/libs/core/execution/include/hpx/execution/executors/num_cores.hpp index dc00f888667b..2934bab419eb 100644 --- a/libs/core/execution/include/hpx/execution/executors/num_cores.hpp +++ b/libs/core/execution/include/hpx/execution/executors/num_cores.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2022-2023 Hartmut Kaiser +// Copyright (c) 2022-2024 Hartmut Kaiser // Copyright (c) 2022 Chuanqiu He // // SPDX-License-Identifier: BSL-1.0 @@ -42,14 +42,14 @@ namespace hpx::execution::experimental { // discover the number of cores to use for parallelization template friend std::size_t tag_override_invoke( - hpx::parallel::execution::processing_units_count_t, + hpx::execution::experimental::processing_units_count_t, num_cores const& this_, Executor&& exec, hpx::chrono::steady_duration const& duration = hpx::chrono::null_duration, std::size_t num_tasks = 0) noexcept { std::size_t const available_pus = - parallel::execution::processing_units_count( + hpx::execution::experimental::processing_units_count( exec, duration, num_tasks); return (std::min)(this_.num_cores_, available_pus); } @@ -73,15 +73,15 @@ namespace hpx::execution::experimental { std::size_t num_cores_; /// \endcond }; -} // namespace hpx::execution::experimental -/// \cond NOINTERNAL -template <> -struct hpx::parallel::execution::is_executor_parameters< - hpx::execution::experimental::num_cores> : std::true_type -{ -}; -/// \endcond + /// \cond NOINTERNAL + template <> + struct is_executor_parameters + : std::true_type + { + }; + /// \endcond +} // namespace hpx::execution::experimental namespace hpx::execution { diff --git a/libs/core/execution/include/hpx/execution/executors/persistent_auto_chunk_size.hpp b/libs/core/execution/include/hpx/execution/executors/persistent_auto_chunk_size.hpp index b0906c259f9a..c2c1b4666b1e 100644 --- a/libs/core/execution/include/hpx/execution/executors/persistent_auto_chunk_size.hpp +++ b/libs/core/execution/include/hpx/execution/executors/persistent_auto_chunk_size.hpp @@ -1,5 +1,5 @@ // Copyright (c) 2016 Zahra Khatami -// 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 @@ -96,7 +96,7 @@ namespace hpx::execution::experimental { // Estimate execution time for one iteration template friend auto tag_override_invoke( - hpx::parallel::execution::measure_iteration_t, + hpx::execution::experimental::measure_iteration_t, persistent_auto_chunk_size& this_, Executor&&, F&& f, std::size_t count) { @@ -141,7 +141,7 @@ namespace hpx::execution::experimental { // Estimate a chunk size based on number of cores used. template friend std::size_t tag_override_invoke( - hpx::parallel::execution::get_chunk_size_t, + hpx::execution::experimental::get_chunk_size_t, persistent_auto_chunk_size const& this_, Executor& /* exec */, hpx::chrono::steady_duration const& iteration_duration, std::size_t cores, std::size_t count) noexcept @@ -180,15 +180,16 @@ namespace hpx::execution::experimental { std::uint64_t num_iters_for_timing_; /// \endcond }; -} // namespace hpx::execution::experimental -/// \cond NOINTERNAL -template <> -struct hpx::parallel::execution::is_executor_parameters< - hpx::execution::experimental::persistent_auto_chunk_size> : std::true_type -{ -}; -/// \endcond + /// \cond NOINTERNAL + template <> + struct is_executor_parameters< + hpx::execution::experimental::persistent_auto_chunk_size> + : std::true_type + { + }; + /// \endcond +} // namespace hpx::execution::experimental namespace hpx::execution { diff --git a/libs/core/execution/include/hpx/execution/executors/polymorphic_executor.hpp b/libs/core/execution/include/hpx/execution/executors/polymorphic_executor.hpp index 672b951318de..8f2bac4ed991 100644 --- a/libs/core/execution/include/hpx/execution/executors/polymorphic_executor.hpp +++ b/libs/core/execution/include/hpx/execution/executors/polymorphic_executor.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022 Hartmut Kaiser +// Copyright (c) 2017-2024 Hartmut Kaiser // // SPDX-License-Identifier: BSL-1.0 // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -925,6 +925,9 @@ namespace hpx::parallel::execution { using base_type::storage; using base_type::vptr; }; +} // namespace hpx::parallel::execution + +namespace hpx::execution::experimental { /// \cond NOINTERNAL template @@ -957,4 +960,4 @@ namespace hpx::parallel::execution { { }; /// \endcond -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental diff --git a/libs/core/execution/include/hpx/execution/executors/rebind_executor.hpp b/libs/core/execution/include/hpx/execution/executors/rebind_executor.hpp index eaf8de020b53..da3be6f312c9 100644 --- a/libs/core/execution/include/hpx/execution/executors/rebind_executor.hpp +++ b/libs/core/execution/include/hpx/execution/executors/rebind_executor.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2022 Hartmut Kaiser +// Copyright (c) 2016-2024 Hartmut Kaiser // // SPDX-License-Identifier: BSL-1.0 // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -14,7 +14,7 @@ #include #include -namespace hpx::parallel::execution { +namespace hpx::execution::experimental { /////////////////////////////////////////////////////////////////////////// namespace detail { @@ -95,4 +95,4 @@ namespace hpx::parallel::execution { HPX_FORWARD(Parameters, parameters)); } } create_rebound_policy{}; -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental diff --git a/libs/core/execution/include/hpx/execution/executors/static_chunk_size.hpp b/libs/core/execution/include/hpx/execution/executors/static_chunk_size.hpp index 1d921a9d5a9e..e483c5c9dffe 100644 --- a/libs/core/execution/include/hpx/execution/executors/static_chunk_size.hpp +++ b/libs/core/execution/include/hpx/execution/executors/static_chunk_size.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 @@ -53,14 +53,15 @@ namespace hpx::execution::experimental { /// \cond NOINTERNAL template friend std::size_t tag_override_invoke( - hpx::parallel::execution::get_chunk_size_t, + hpx::execution::experimental::get_chunk_size_t, static_chunk_size& this_, Executor& exec, hpx::chrono::steady_duration const&, std::size_t cores, std::size_t num_tasks) { // Make sure the internal round-robin counter of the executor is // reset - parallel::execution::reset_thread_distribution(this_, exec); + hpx::execution::experimental::reset_thread_distribution( + this_, exec); // use the given chunk size if given if (this_.chunk_size_ != 0) @@ -107,7 +108,7 @@ namespace hpx::execution::experimental { /// \cond NOINTERNAL template <> -struct hpx::parallel::execution::is_executor_parameters< +struct hpx::execution::experimental::is_executor_parameters< hpx::execution::experimental::static_chunk_size> : std::true_type { }; diff --git a/libs/core/execution/include/hpx/execution/traits/executor_traits.hpp b/libs/core/execution/include/hpx/execution/traits/executor_traits.hpp index d73f73f8c36b..e79e212453bc 100644 --- a/libs/core/execution/include/hpx/execution/traits/executor_traits.hpp +++ b/libs/core/execution/include/hpx/execution/traits/executor_traits.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022 Hartmut Kaiser +// Copyright (c) 2017-2024 Hartmut Kaiser // // SPDX-License-Identifier: BSL-1.0 // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -45,7 +45,7 @@ namespace hpx::execution { struct unsequenced_execution_tag; } // namespace hpx::execution -namespace hpx::parallel::execution { +namespace hpx::execution::experimental { /////////////////////////////////////////////////////////////////////////// namespace detail { @@ -233,50 +233,53 @@ namespace hpx::parallel::execution { template using executor_future_t = typename executor_future::type; -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental namespace hpx::traits { /////////////////////////////////////////////////////////////////////////// template struct has_post_member - : parallel::execution::has_post_member> + : hpx::execution::experimental::has_post_member> { }; template struct has_sync_execute_member - : parallel::execution::has_sync_execute_member> + : hpx::execution::experimental::has_sync_execute_member> { }; template struct has_async_execute_member - : parallel::execution::has_async_execute_member> + : hpx::execution::experimental::has_async_execute_member> { }; template struct has_then_execute_member - : parallel::execution::has_then_execute_member> + : hpx::execution::experimental::has_then_execute_member> { }; template struct has_bulk_sync_execute_member - : parallel::execution::has_bulk_sync_execute_member> + : hpx::execution::experimental::has_bulk_sync_execute_member< + std::decay_t> { }; template struct has_bulk_async_execute_member - : parallel::execution::has_bulk_async_execute_member> + : hpx::execution::experimental::has_bulk_async_execute_member< + std::decay_t> { }; template struct has_bulk_then_execute_member - : parallel::execution::has_bulk_then_execute_member> + : hpx::execution::experimental::has_bulk_then_execute_member< + std::decay_t> { }; @@ -310,7 +313,7 @@ namespace hpx::traits { /////////////////////////////////////////////////////////////////////////// template struct executor_context - : parallel::execution::executor_context> + : hpx::execution::experimental::executor_context> { }; @@ -319,7 +322,8 @@ namespace hpx::traits { template struct executor_execution_category - : parallel::execution::executor_execution_category> + : hpx::execution::experimental::executor_execution_category< + std::decay_t> { }; @@ -329,7 +333,7 @@ namespace hpx::traits { template struct executor_shape - : parallel::execution::executor_shape> + : hpx::execution::experimental::executor_shape> { }; @@ -338,7 +342,7 @@ namespace hpx::traits { template struct executor_index - : parallel::execution::executor_index> + : hpx::execution::experimental::executor_index> { }; @@ -347,7 +351,7 @@ namespace hpx::traits { template struct executor_future - : parallel::execution::executor_future, T, + : hpx::execution::experimental::executor_future, T, std::decay_t...> { }; @@ -360,7 +364,8 @@ namespace hpx::traits { // extension template struct executor_parameters_type - : parallel::execution::executor_parameters_type> + : hpx::execution::experimental::executor_parameters_type< + std::decay_t> { }; diff --git a/libs/core/execution/src/execution_parameter_callbacks.cpp b/libs/core/execution/src/execution_parameter_callbacks.cpp index 86d5e327e13b..f6e9ce2f3c73 100644 --- a/libs/core/execution/src/execution_parameter_callbacks.cpp +++ b/libs/core/execution/src/execution_parameter_callbacks.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2020 ETH Zurich -// Copyright (c) 2017 Hartmut Kaiser +// Copyright (c) 2017-2-24 Hartmut Kaiser // Copyright (c) 2017 Google // // SPDX-License-Identifier: BSL-1.0 @@ -33,18 +33,15 @@ namespace hpx::parallel::execution::detail { { return get_get_os_thread_count()(); } - else - { - HPX_THROW_EXCEPTION(hpx::error::invalid_status, - "hpx::parallel::execution::detail::get_os_thread_count", - "No fallback handler for get_os_thread_count is installed. " - "Please start the runtime if you haven't done so. If you " - "intended to not use the runtime make sure you have " - "implemented get_os_thread_count for your executor or install " - "a fallback handler with " - "hpx::parallel::execution::detail::set_get_os_thread_count."); - return std::size_t(-1); - } + + HPX_THROW_EXCEPTION(hpx::error::invalid_status, + "hpx::parallel::execution::detail::get_os_thread_count", + "No fallback handler for get_os_thread_count is installed. " + "Please start the runtime if you haven't done so. If you " + "intended to not use the runtime make sure you have " + "implemented get_os_thread_count for your executor or install " + "a fallback handler with " + "hpx::parallel::execution::detail::set_get_os_thread_count."); } get_pu_mask_type& get_get_pu_mask() @@ -65,19 +62,14 @@ namespace hpx::parallel::execution::detail { { return get_get_pu_mask()(topo, thread_num); } - else - { - HPX_THROW_EXCEPTION(hpx::error::invalid_status, - "hpx::parallel::execution::detail::get_pu_mask", - "No fallback handler for get_pu_mask is installed. Please " - "start the runtime if you haven't done so. If you intended " - "to not use the runtime make sure you have implemented " - "get_pu_mask for your executor or install a fallback " - "handler with " - "hpx::parallel::execution::detail::set_get_pu_mask."); - static threads::mask_type mask{}; - return mask; - } + HPX_THROW_EXCEPTION(hpx::error::invalid_status, + "hpx::parallel::execution::detail::get_pu_mask", + "No fallback handler for get_pu_mask is installed. Please " + "start the runtime if you haven't done so. If you intended " + "to not use the runtime make sure you have implemented " + "get_pu_mask for your executor or install a fallback " + "handler with " + "hpx::parallel::execution::detail::set_get_pu_mask."); } } // namespace hpx::parallel::execution::detail diff --git a/libs/core/execution/tests/regressions/is_executor_1691.cpp b/libs/core/execution/tests/regressions/is_executor_1691.cpp index 33e4902cd9e3..ecdded1832d3 100644 --- a/libs/core/execution/tests/regressions/is_executor_1691.cpp +++ b/libs/core/execution/tests/regressions/is_executor_1691.cpp @@ -1,4 +1,5 @@ // Copyright (c) 2015 Daniel Bourgeois +// Copyright (c) 2024 Hartmut Kaiser // // SPDX-License-Identifier: BSL-1.0 // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -16,7 +17,7 @@ struct my_executor : hpx::execution::parallel_executor { }; -namespace hpx::parallel::execution { +namespace hpx::execution::experimental { template <> struct is_one_way_executor : std::true_type @@ -32,7 +33,7 @@ namespace hpx::parallel::execution { struct is_bulk_two_way_executor : std::true_type { }; -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental /////////////////////////////////////////////////////////////////////////////// int hpx_main() diff --git a/libs/core/execution/tests/unit/executor_parameters.cpp b/libs/core/execution/tests/unit/executor_parameters.cpp index 395b03291894..e922dc5f443c 100644 --- a/libs/core/execution/tests/unit/executor_parameters.cpp +++ b/libs/core/execution/tests/unit/executor_parameters.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2023 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 @@ -165,21 +165,21 @@ struct timer_hooks_parameters template friend void tag_override_invoke( - hpx::parallel::execution::mark_begin_execution_t, + hpx::execution::experimental::mark_begin_execution_t, timer_hooks_parameters const&, Executor&&) { } template friend void tag_override_invoke( - hpx::parallel::execution::mark_end_of_scheduling_t, + hpx::execution::experimental::mark_end_of_scheduling_t, timer_hooks_parameters const&, Executor&&) { } template friend void tag_override_invoke( - hpx::parallel::execution::mark_end_execution_t, + hpx::execution::experimental::mark_end_execution_t, timer_hooks_parameters const&, Executor&&) { } @@ -188,8 +188,8 @@ struct timer_hooks_parameters }; template <> -struct hpx::parallel::execution::is_executor_parameters - : std::true_type +struct hpx::execution::experimental::is_executor_parameters< + timer_hooks_parameters> : std::true_type { }; diff --git a/libs/core/execution/tests/unit/executor_parameters_dispatching.cpp b/libs/core/execution/tests/unit/executor_parameters_dispatching.cpp index b09ac2e35909..d97a4de0b677 100644 --- a/libs/core/execution/tests/unit/executor_parameters_dispatching.cpp +++ b/libs/core/execution/tests/unit/executor_parameters_dispatching.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2023 Hartmut Kaiser +// Copyright (c) 2020-2024 Hartmut Kaiser // // SPDX-License-Identifier: BSL-1.0 // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -30,10 +30,10 @@ struct test_executor_get_chunk_size : hpx::execution::parallel_executor test_executor_get_chunk_size() = default; template - friend std::size_t tag_invoke(hpx::parallel::execution::get_chunk_size_t, - Parameters&&, test_executor_get_chunk_size, - hpx::chrono::steady_duration const&, std::size_t cores, - std::size_t count) + friend std::size_t tag_invoke( + hpx::execution::experimental::get_chunk_size_t, Parameters&&, + test_executor_get_chunk_size, hpx::chrono::steady_duration const&, + std::size_t cores, std::size_t count) { ++exec_count; return (count + cores - 1) / cores; @@ -41,7 +41,7 @@ struct test_executor_get_chunk_size : hpx::execution::parallel_executor }; template <> -struct hpx::parallel::execution::is_two_way_executor< +struct hpx::execution::experimental::is_two_way_executor< test_executor_get_chunk_size> : std::true_type { }; @@ -50,8 +50,8 @@ struct test_chunk_size { template friend std::size_t tag_override_invoke( - hpx::parallel::execution::get_chunk_size_t, test_chunk_size, Executor&&, - hpx::chrono::steady_duration const&, std::size_t cores, + hpx::execution::experimental::get_chunk_size_t, test_chunk_size, + Executor&&, hpx::chrono::steady_duration const&, std::size_t cores, std::size_t count) { ++params_count; @@ -60,7 +60,7 @@ struct test_chunk_size }; template <> -struct hpx::parallel::execution::is_executor_parameters +struct hpx::execution::experimental::is_executor_parameters : std::true_type { }; @@ -72,7 +72,7 @@ void test_get_chunk_size() params_count = 0; exec_count = 0; - hpx::parallel::execution::get_chunk_size( + hpx::execution::experimental::get_chunk_size( test_chunk_size{}, hpx::execution::par.executor(), 1, 1); HPX_TEST_EQ(params_count, static_cast(1)); @@ -83,7 +83,7 @@ void test_get_chunk_size() params_count = 0; exec_count = 0; - hpx::parallel::execution::get_chunk_size(test_chunk_size{}, + hpx::execution::experimental::get_chunk_size(test_chunk_size{}, hpx::execution::par.executor(), hpx::chrono::null_duration, 1, 1); HPX_TEST_EQ(params_count, static_cast(1)); @@ -94,7 +94,7 @@ void test_get_chunk_size() params_count = 0; exec_count = 0; - hpx::parallel::execution::get_chunk_size( + hpx::execution::experimental::get_chunk_size( test_chunk_size{}, test_executor_get_chunk_size{}, 1, 1); HPX_TEST_EQ(params_count, static_cast(1)); @@ -105,7 +105,7 @@ void test_get_chunk_size() params_count = 0; exec_count = 0; - hpx::parallel::execution::get_chunk_size( + hpx::execution::experimental::get_chunk_size( hpx::execution::par.parameters(), test_executor_get_chunk_size{}, hpx::chrono::null_duration, 1, 1); @@ -117,7 +117,7 @@ void test_get_chunk_size() params_count = 0; exec_count = 0; - hpx::parallel::execution::get_chunk_size( + hpx::execution::experimental::get_chunk_size( hpx::execution::par.parameters(), test_executor_get_chunk_size{}, 1, 1); @@ -134,7 +134,7 @@ struct test_executor_measure_iteration : hpx::execution::parallel_executor test_executor_measure_iteration() = default; template - friend auto tag_invoke(hpx::parallel::execution::measure_iteration_t, + friend auto tag_invoke(hpx::execution::experimental::measure_iteration_t, Parameters&&, test_executor_measure_iteration, F&&, std::size_t) { ++exec_count; @@ -143,7 +143,7 @@ struct test_executor_measure_iteration : hpx::execution::parallel_executor }; template <> -struct hpx::parallel::execution::is_two_way_executor< +struct hpx::execution::experimental::is_two_way_executor< test_executor_measure_iteration> : std::true_type { }; @@ -152,8 +152,8 @@ struct test_measure_iteration { template friend auto tag_override_invoke( - hpx::parallel::execution::measure_iteration_t, test_measure_iteration, - Executor&&, F&&, std::size_t) + hpx::execution::experimental::measure_iteration_t, + test_measure_iteration, Executor&&, F&&, std::size_t) { ++params_count; return hpx::chrono::null_duration; @@ -161,8 +161,8 @@ struct test_measure_iteration }; template <> -struct hpx::parallel::execution::is_executor_parameters - : std::true_type +struct hpx::execution::experimental::is_executor_parameters< + test_measure_iteration> : std::true_type { }; @@ -173,7 +173,7 @@ void test_get_measure_iteration() params_count = 0; exec_count = 0; - hpx::parallel::execution::measure_iteration( + hpx::execution::experimental::measure_iteration( test_measure_iteration{}, hpx::execution::par.executor(), [](std::size_t) { return 0; }, 1); @@ -185,7 +185,7 @@ void test_get_measure_iteration() params_count = 0; exec_count = 0; - hpx::parallel::execution::measure_iteration( + hpx::execution::experimental::measure_iteration( hpx::execution::par.parameters(), test_executor_measure_iteration{}, [](std::size_t) { return 0; }, 1); @@ -197,7 +197,7 @@ void test_get_measure_iteration() params_count = 0; exec_count = 0; - hpx::parallel::execution::measure_iteration( + hpx::execution::experimental::measure_iteration( test_measure_iteration{}, test_executor_measure_iteration{}, [](std::size_t) { return 0; }, 1); @@ -216,7 +216,7 @@ struct test_executor_maximal_number_of_chunks template friend std::size_t tag_invoke( - hpx::parallel::execution::maximal_number_of_chunks_t, Parameters&&, + hpx::execution::experimental::maximal_number_of_chunks_t, Parameters&&, test_executor_maximal_number_of_chunks, std::size_t, std::size_t num_tasks) { @@ -226,7 +226,7 @@ struct test_executor_maximal_number_of_chunks }; template <> -struct hpx::parallel::execution::is_two_way_executor< +struct hpx::execution::experimental::is_two_way_executor< test_executor_maximal_number_of_chunks> : std::true_type { }; @@ -235,7 +235,7 @@ struct test_number_of_chunks { template friend std::size_t tag_override_invoke( - hpx::parallel::execution::maximal_number_of_chunks_t, + hpx::execution::experimental::maximal_number_of_chunks_t, test_number_of_chunks, Executor&&, std::size_t, std::size_t num_tasks) { ++params_count; @@ -244,8 +244,8 @@ struct test_number_of_chunks }; template <> -struct hpx::parallel::execution::is_executor_parameters - : std::true_type +struct hpx::execution::experimental::is_executor_parameters< + test_number_of_chunks> : std::true_type { }; @@ -256,7 +256,7 @@ void test_maximal_number_of_chunks() params_count = 0; exec_count = 0; - hpx::parallel::execution::maximal_number_of_chunks( + hpx::execution::experimental::maximal_number_of_chunks( test_number_of_chunks{}, hpx::execution::par.executor(), 1, 1); HPX_TEST_EQ(params_count, static_cast(1)); @@ -267,7 +267,7 @@ void test_maximal_number_of_chunks() params_count = 0; exec_count = 0; - hpx::parallel::execution::maximal_number_of_chunks( + hpx::execution::experimental::maximal_number_of_chunks( hpx::execution::par.parameters(), test_executor_maximal_number_of_chunks{}, 1, 1); @@ -279,7 +279,7 @@ void test_maximal_number_of_chunks() params_count = 0; exec_count = 0; - hpx::parallel::execution::maximal_number_of_chunks( + hpx::execution::experimental::maximal_number_of_chunks( test_number_of_chunks{}, test_executor_maximal_number_of_chunks{}, 1, 1); @@ -298,7 +298,7 @@ struct test_executor_reset_thread_distribution template friend void tag_invoke( - hpx::parallel::execution::reset_thread_distribution_t, Parameters&&, + hpx::execution::experimental::reset_thread_distribution_t, Parameters&&, test_executor_reset_thread_distribution) { ++exec_count; @@ -306,7 +306,7 @@ struct test_executor_reset_thread_distribution }; template <> -struct hpx::parallel::execution::is_two_way_executor< +struct hpx::execution::experimental::is_two_way_executor< test_executor_reset_thread_distribution> : std::true_type { }; @@ -315,7 +315,7 @@ struct test_thread_distribution { template friend void tag_override_invoke( - hpx::parallel::execution::reset_thread_distribution_t, + hpx::execution::experimental::reset_thread_distribution_t, test_thread_distribution, Executor&&) { ++params_count; @@ -323,7 +323,7 @@ struct test_thread_distribution }; template <> -struct hpx::parallel::execution::is_executor_parameters< +struct hpx::execution::experimental::is_executor_parameters< test_thread_distribution> : std::true_type { }; @@ -335,7 +335,7 @@ void test_reset_thread_distribution() params_count = 0; exec_count = 0; - hpx::parallel::execution::reset_thread_distribution( + hpx::execution::experimental::reset_thread_distribution( test_thread_distribution{}, hpx::execution::par.executor()); HPX_TEST_EQ(params_count, static_cast(1)); @@ -346,7 +346,7 @@ void test_reset_thread_distribution() params_count = 0; exec_count = 0; - hpx::parallel::execution::reset_thread_distribution( + hpx::execution::experimental::reset_thread_distribution( hpx::execution::par.parameters(), test_executor_reset_thread_distribution{}); @@ -358,7 +358,7 @@ void test_reset_thread_distribution() params_count = 0; exec_count = 0; - hpx::parallel::execution::reset_thread_distribution( + hpx::execution::experimental::reset_thread_distribution( test_thread_distribution{}, test_executor_reset_thread_distribution{}); @@ -376,7 +376,7 @@ struct test_executor_processing_units_count : hpx::execution::parallel_executor template friend std::size_t tag_invoke( - hpx::parallel::execution::processing_units_count_t, Parameters&&, + hpx::execution::experimental::processing_units_count_t, Parameters&&, test_executor_processing_units_count, hpx::chrono::steady_duration const&, std::size_t) { @@ -386,7 +386,7 @@ struct test_executor_processing_units_count : hpx::execution::parallel_executor }; template <> -struct hpx::parallel::execution::is_two_way_executor< +struct hpx::execution::experimental::is_two_way_executor< test_executor_processing_units_count> : std::true_type { }; @@ -395,7 +395,7 @@ struct test_processing_units { template friend std::size_t tag_override_invoke( - hpx::parallel::execution::processing_units_count_t, + hpx::execution::experimental::processing_units_count_t, test_processing_units, Executor&&, hpx::chrono::steady_duration const& = hpx::chrono::null_duration, std::size_t = 0) @@ -406,8 +406,8 @@ struct test_processing_units }; template <> -struct hpx::parallel::execution::is_executor_parameters - : std::true_type +struct hpx::execution::experimental::is_executor_parameters< + test_processing_units> : std::true_type { }; @@ -417,7 +417,7 @@ void test_processing_units_count() { params_count = 0; - hpx::parallel::execution::processing_units_count( + hpx::execution::experimental::processing_units_count( test_processing_units{}, hpx::execution::parallel_executor()); HPX_TEST_EQ(params_count, static_cast(1)); @@ -427,7 +427,7 @@ void test_processing_units_count() params_count = 0; exec_count = 0; - hpx::parallel::execution::processing_units_count( + hpx::execution::experimental::processing_units_count( test_processing_units{}, test_executor_processing_units_count{}, hpx::chrono::null_duration, 0); @@ -438,11 +438,11 @@ void test_processing_units_count() { params_count = 0; - auto p = hpx::parallel::execution::with_processing_units_count( + auto p = hpx::execution::experimental::with_processing_units_count( hpx::execution::par, 2); std::size_t const num_cores = - hpx::parallel::execution::processing_units_count( + hpx::execution::experimental::processing_units_count( test_processing_units{}, p.executor()); HPX_TEST_EQ(num_cores, static_cast(1)); @@ -451,23 +451,23 @@ void test_processing_units_count() { hpx::execution::experimental::num_cores nc(2); - auto p = hpx::parallel::execution::with_processing_units_count( + auto p = hpx::execution::experimental::with_processing_units_count( hpx::execution::par, nc); std::size_t const num_cores = - hpx::parallel::execution::processing_units_count( - hpx::parallel::execution::null_parameters, p.executor(), + hpx::execution::experimental::processing_units_count( + hpx::execution::experimental::null_parameters, p.executor(), hpx::chrono::null_duration, 0); HPX_TEST_EQ(num_cores, static_cast(2)); } { - auto p = hpx::parallel::execution::with_processing_units_count( + auto p = hpx::execution::experimental::with_processing_units_count( hpx::execution::par, 2); std::size_t const num_cores = - hpx::parallel::execution::processing_units_count(p); + hpx::execution::experimental::processing_units_count(p); HPX_TEST_EQ(num_cores, static_cast(2)); } @@ -481,21 +481,22 @@ struct test_executor_begin_end : hpx::execution::parallel_executor test_executor_begin_end() = default; template - friend void tag_invoke(hpx::parallel::execution::mark_begin_execution_t, + friend void tag_invoke(hpx::execution::experimental::mark_begin_execution_t, Parameters&&, test_executor_begin_end) { ++exec_count; } template - friend void tag_invoke(hpx::parallel::execution::mark_end_of_scheduling_t, - Parameters&&, test_executor_begin_end) + friend void tag_invoke( + hpx::execution::experimental::mark_end_of_scheduling_t, Parameters&&, + test_executor_begin_end) { ++exec_count; } template - friend void tag_invoke(hpx::parallel::execution::mark_end_execution_t, + friend void tag_invoke(hpx::execution::experimental::mark_end_execution_t, Parameters&&, test_executor_begin_end) { ++exec_count; @@ -503,8 +504,8 @@ struct test_executor_begin_end : hpx::execution::parallel_executor }; template <> -struct hpx::parallel::execution::is_two_way_executor - : std::true_type +struct hpx::execution::experimental::is_two_way_executor< + test_executor_begin_end> : std::true_type { }; @@ -512,7 +513,7 @@ struct test_begin_end { template friend void tag_override_invoke( - hpx::parallel::execution::mark_begin_execution_t, test_begin_end, + hpx::execution::experimental::mark_begin_execution_t, test_begin_end, Executor&&) { ++params_count; @@ -520,7 +521,7 @@ struct test_begin_end template friend void tag_override_invoke( - hpx::parallel::execution::mark_end_of_scheduling_t, test_begin_end, + hpx::execution::experimental::mark_end_of_scheduling_t, test_begin_end, Executor&&) { ++params_count; @@ -528,7 +529,7 @@ struct test_begin_end template friend void tag_override_invoke( - hpx::parallel::execution::mark_end_execution_t, test_begin_end, + hpx::execution::experimental::mark_end_execution_t, test_begin_end, Executor&&) { ++params_count; @@ -536,7 +537,7 @@ struct test_begin_end }; template <> -struct hpx::parallel::execution::is_executor_parameters +struct hpx::execution::experimental::is_executor_parameters : std::true_type { }; @@ -548,7 +549,7 @@ void test_mark_begin_execution() params_count = 0; exec_count = 0; - hpx::parallel::execution::mark_begin_execution( + hpx::execution::experimental::mark_begin_execution( test_begin_end{}, hpx::execution::par.executor()); HPX_TEST_EQ(params_count, static_cast(1)); @@ -559,7 +560,7 @@ void test_mark_begin_execution() params_count = 0; exec_count = 0; - hpx::parallel::execution::mark_begin_execution( + hpx::execution::experimental::mark_begin_execution( hpx::execution::par.parameters(), test_executor_begin_end{}); HPX_TEST_EQ(params_count, static_cast(0)); @@ -570,7 +571,7 @@ void test_mark_begin_execution() params_count = 0; exec_count = 0; - hpx::parallel::execution::mark_begin_execution( + hpx::execution::experimental::mark_begin_execution( test_begin_end{}, test_executor_begin_end{}); HPX_TEST_EQ(params_count, static_cast(1)); @@ -584,7 +585,7 @@ void test_mark_end_of_scheduling() params_count = 0; exec_count = 0; - hpx::parallel::execution::mark_end_of_scheduling( + hpx::execution::experimental::mark_end_of_scheduling( test_begin_end{}, hpx::execution::par.executor()); HPX_TEST_EQ(params_count, static_cast(1)); @@ -595,7 +596,7 @@ void test_mark_end_of_scheduling() params_count = 0; exec_count = 0; - hpx::parallel::execution::mark_end_of_scheduling( + hpx::execution::experimental::mark_end_of_scheduling( hpx::execution::par.parameters(), test_executor_begin_end{}); HPX_TEST_EQ(params_count, static_cast(0)); @@ -606,7 +607,7 @@ void test_mark_end_of_scheduling() params_count = 0; exec_count = 0; - hpx::parallel::execution::mark_end_of_scheduling( + hpx::execution::experimental::mark_end_of_scheduling( test_begin_end{}, test_executor_begin_end{}); HPX_TEST_EQ(params_count, static_cast(1)); @@ -620,7 +621,7 @@ void test_mark_end_execution() params_count = 0; exec_count = 0; - hpx::parallel::execution::mark_end_execution( + hpx::execution::experimental::mark_end_execution( test_begin_end{}, hpx::execution::par.executor()); HPX_TEST_EQ(params_count, static_cast(1)); @@ -631,7 +632,7 @@ void test_mark_end_execution() params_count = 0; exec_count = 0; - hpx::parallel::execution::mark_end_execution( + hpx::execution::experimental::mark_end_execution( hpx::execution::par.parameters(), test_executor_begin_end{}); HPX_TEST_EQ(params_count, static_cast(0)); @@ -642,7 +643,7 @@ void test_mark_end_execution() params_count = 0; exec_count = 0; - hpx::parallel::execution::mark_end_execution( + hpx::execution::experimental::mark_end_execution( test_begin_end{}, test_executor_begin_end{}); HPX_TEST_EQ(params_count, static_cast(1)); diff --git a/libs/core/execution/tests/unit/executor_parameters_timer_hooks.cpp b/libs/core/execution/tests/unit/executor_parameters_timer_hooks.cpp index 3cab25103c60..30357cfe9635 100644 --- a/libs/core/execution/tests/unit/executor_parameters_timer_hooks.cpp +++ b/libs/core/execution/tests/unit/executor_parameters_timer_hooks.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2023 Hartmut Kaiser +// Copyright (c) 2016-2024 Hartmut Kaiser // // SPDX-License-Identifier: BSL-1.0 // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -67,7 +67,7 @@ struct timer_hooks_parameters template friend void tag_override_invoke( - hpx::parallel::execution::mark_begin_execution_t, + hpx::execution::experimental::mark_begin_execution_t, timer_hooks_parameters& this_, Executor&&) { ++this_.count_; @@ -76,14 +76,14 @@ struct timer_hooks_parameters template friend void tag_override_invoke( - hpx::parallel::execution::mark_end_of_scheduling_t, + hpx::execution::experimental::mark_end_of_scheduling_t, timer_hooks_parameters const&, Executor&&) { } template friend void tag_override_invoke( - hpx::parallel::execution::mark_end_execution_t, + hpx::execution::experimental::mark_end_execution_t, timer_hooks_parameters& this_, Executor&&) { this_.time_ = hpx::chrono::high_resolution_clock::now() - this_.time_; @@ -95,13 +95,13 @@ struct timer_hooks_parameters std::atomic count_; }; -namespace hpx::parallel::execution { +namespace hpx::execution::experimental { template <> struct is_executor_parameters : std::true_type { }; -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental void test_timer_hooks() { diff --git a/libs/core/execution/tests/unit/minimal_sync_executor.cpp b/libs/core/execution/tests/unit/minimal_sync_executor.cpp index d910a8725a7f..6cc29e74b112 100644 --- a/libs/core/execution/tests/unit/minimal_sync_executor.cpp +++ b/libs/core/execution/tests/unit/minimal_sync_executor.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2022 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 @@ -252,12 +252,12 @@ struct test_sync_executor1 } }; -namespace hpx::parallel::execution { +namespace hpx::execution::experimental { template <> struct is_one_way_executor : std::true_type { }; -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental struct test_sync_executor2 : test_sync_executor1 { @@ -292,7 +292,7 @@ struct test_sync_executor2 : test_sync_executor1 } }; -namespace hpx::parallel::execution { +namespace hpx::execution::experimental { template <> struct is_one_way_executor : std::true_type { @@ -302,7 +302,7 @@ namespace hpx::parallel::execution { struct is_bulk_one_way_executor : std::true_type { }; -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental /////////////////////////////////////////////////////////////////////////////// int hpx_main() diff --git a/libs/core/execution_base/include/hpx/execution_base/traits/is_executor.hpp b/libs/core/execution_base/include/hpx/execution_base/traits/is_executor.hpp index 2621ecb9279b..4d1f226d4f13 100644 --- a/libs/core/execution_base/include/hpx/execution_base/traits/is_executor.hpp +++ b/libs/core/execution_base/include/hpx/execution_base/traits/is_executor.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022 Hartmut Kaiser +// Copyright (c) 2017-2024 Hartmut Kaiser // // SPDX-License-Identifier: BSL-1.0 // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -7,11 +7,12 @@ #pragma once #include +#include #include #include -namespace hpx::parallel::execution { +namespace hpx::execution::experimental { namespace detail { @@ -94,14 +95,14 @@ namespace hpx::parallel::execution { : detail::is_scheduler_executor> { }; -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental namespace hpx::traits { // Concurrency TS V2: executor framework template struct is_one_way_executor - : parallel::execution::is_one_way_executor> + : execution::experimental::is_one_way_executor> { }; @@ -110,7 +111,8 @@ namespace hpx::traits { template struct is_never_blocking_one_way_executor - : parallel::execution::is_never_blocking_one_way_executor> + : execution::experimental::is_never_blocking_one_way_executor< + std::decay_t> { }; @@ -120,7 +122,7 @@ namespace hpx::traits { template struct is_bulk_one_way_executor - : parallel::execution::is_bulk_one_way_executor> + : execution::experimental::is_bulk_one_way_executor> { }; @@ -130,7 +132,7 @@ namespace hpx::traits { template struct is_two_way_executor - : parallel::execution::is_two_way_executor> + : execution::experimental::is_two_way_executor> { }; @@ -139,7 +141,7 @@ namespace hpx::traits { template struct is_bulk_two_way_executor - : parallel::execution::is_bulk_two_way_executor> + : execution::experimental::is_bulk_two_way_executor> { }; @@ -163,7 +165,8 @@ namespace hpx::traits { // is_scheduler_executor evaluates to true for executors that return senders // from their scheduling functions template - struct is_scheduler_executor : parallel::execution::is_scheduler_executor + struct is_scheduler_executor + : execution::experimental::is_scheduler_executor { }; @@ -171,3 +174,23 @@ namespace hpx::traits { inline constexpr bool is_scheduler_executor_v = is_scheduler_executor::value; } // namespace hpx::traits + +// backwards compatibility layer +namespace hpx::parallel::execution { + +#define HPX_IS_EXECUTOR_DEPRECATED(name) \ + template \ + using name HPX_DEPRECATED_V(1, 11, \ + "hpx::parallel::execution::" HPX_PP_STRINGIZE( \ + name) " is deprecated, use " \ + "hpx::execution::experimental::" HPX_PP_STRINGIZE( \ + name) " instead") = \ + hpx::execution::experimental::name /**/ + + HPX_IS_EXECUTOR_DEPRECATED(is_one_way_executor); + HPX_IS_EXECUTOR_DEPRECATED(is_never_blocking_one_way_executor); + HPX_IS_EXECUTOR_DEPRECATED(is_bulk_one_way_executor); + HPX_IS_EXECUTOR_DEPRECATED(is_two_way_executor); + HPX_IS_EXECUTOR_DEPRECATED(is_bulk_two_way_executor); + HPX_IS_EXECUTOR_DEPRECATED(is_scheduler_executor); +} // namespace hpx::parallel::execution diff --git a/libs/core/execution_base/include/hpx/execution_base/traits/is_executor_parameters.hpp b/libs/core/execution_base/include/hpx/execution_base/traits/is_executor_parameters.hpp index 87ff1af7891f..6fa903ed4a91 100644 --- a/libs/core/execution_base/include/hpx/execution_base/traits/is_executor_parameters.hpp +++ b/libs/core/execution_base/include/hpx/execution_base/traits/is_executor_parameters.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2023 Hartmut Kaiser +// Copyright (c) 2014-2024 Hartmut Kaiser // Copyright (c) 2016 Marcin Copik // // SPDX-License-Identifier: BSL-1.0 @@ -19,7 +19,7 @@ namespace hpx::traits { struct is_executor_parameters; } // namespace hpx::traits -namespace hpx::parallel::execution { +namespace hpx::execution::experimental { /////////////////////////////////////////////////////////////////////////// // Default sequential executor parameters @@ -137,14 +137,15 @@ namespace hpx::parallel::execution { template inline constexpr bool is_executor_parameters_v = is_executor_parameters::value; -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental namespace hpx::traits { // new executor framework template struct is_executor_parameters - : parallel::execution::is_executor_parameters> + : hpx::execution::experimental::is_executor_parameters< + std::decay_t> { }; diff --git a/libs/core/executors/examples/disable_thread_stealing_executor.cpp b/libs/core/executors/examples/disable_thread_stealing_executor.cpp index 721b1064ec64..a09325319901 100644 --- a/libs/core/executors/examples/disable_thread_stealing_executor.cpp +++ b/libs/core/executors/examples/disable_thread_stealing_executor.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2022 Hartmut Kaiser +// Copyright (c) 2020-2024 Hartmut Kaiser // // SPDX-License-Identifier: BSL-1.0 // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -108,7 +108,7 @@ namespace executor_example { /////////////////////////////////////////////////////////////////////////////// // simple forwarding implementations of executor traits -namespace hpx::parallel::execution { +namespace hpx::execution::experimental { template struct is_one_way_executor< @@ -144,7 +144,7 @@ namespace hpx::parallel::execution { : is_bulk_two_way_executor> { }; -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental int hpx_main() { diff --git a/libs/core/executors/examples/executor_with_thread_hooks.cpp b/libs/core/executors/examples/executor_with_thread_hooks.cpp index 9aa62b00b435..a597360b767c 100644 --- a/libs/core/executors/examples/executor_with_thread_hooks.cpp +++ b/libs/core/executors/examples/executor_with_thread_hooks.cpp @@ -170,14 +170,16 @@ namespace executor_example { thread_hook on_stop_; }; + // clang-format off template executor_with_thread_hooks(Executor&&, OnStart&&, OnStop&&) -> executor_with_thread_hooks>; + // clang-format on } // namespace executor_example /////////////////////////////////////////////////////////////////////////////// // simple forwarding implementations of executor traits -namespace hpx::parallel::execution { +namespace hpx::execution::experimental { template struct is_one_way_executor< @@ -213,7 +215,7 @@ namespace hpx::parallel::execution { : is_bulk_two_way_executor> { }; -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental int hpx_main() { diff --git a/libs/core/executors/include/hpx/executors/annotating_executor.hpp b/libs/core/executors/include/hpx/executors/annotating_executor.hpp index 6f9a750fa6d2..5f640b81bc3a 100644 --- a/libs/core/executors/include/hpx/executors/annotating_executor.hpp +++ b/libs/core/executors/include/hpx/executors/annotating_executor.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2021-2023 Hartmut Kaiser +// Copyright (c) 2021-2024 Hartmut Kaiser // // SPDX-License-Identifier: BSL-1.0 // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -24,7 +24,7 @@ namespace hpx::execution::experimental { /////////////////////////////////////////////////////////////////////////// - /// A \a annotating_executor wraps any other executor and adds the + /// An \a annotating_executor wraps any other executor and adds the /// capability to add annotations to the launched threads. template struct annotating_executor @@ -249,7 +249,7 @@ namespace hpx::execution::experimental { /////////////////////////////////////////////////////////////////////////// // if the given executor does not support annotations, wrap it into - // a annotating_executor + // an annotating_executor // // The functions below are used for executors that do not directly support // annotations. Those are wrapped into an annotating_executor if passed @@ -282,7 +282,7 @@ namespace hpx::execution::experimental { } } // namespace hpx::execution::experimental -namespace hpx::parallel::execution { +namespace hpx::execution::experimental { // The annotating executor exposes the same executor categories as its // underlying (wrapped) executor. @@ -330,4 +330,4 @@ namespace hpx::parallel::execution { { }; /// \endcond -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental diff --git a/libs/core/executors/include/hpx/executors/async.hpp b/libs/core/executors/include/hpx/executors/async.hpp index 9eaea4c94329..946d5d98d9ca 100644 --- a/libs/core/executors/include/hpx/executors/async.hpp +++ b/libs/core/executors/include/hpx/executors/async.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 diff --git a/libs/core/executors/include/hpx/executors/execution_policy.hpp b/libs/core/executors/include/hpx/executors/execution_policy.hpp index dcae07c4c57b..938eac6777c1 100644 --- a/libs/core/executors/include/hpx/executors/execution_policy.hpp +++ b/libs/core/executors/include/hpx/executors/execution_policy.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2023 Hartmut Kaiser +// Copyright (c) 2007-2024 Hartmut Kaiser // Copyright (c) 2016 Marcin Copik // // SPDX-License-Identifier: BSL-1.0 @@ -185,7 +185,7 @@ namespace hpx::execution { hpx::traits::is_executor_any_v>, "hpx::traits::is_executor_any_v"); - return hpx::parallel::execution::create_rebound_policy( + return hpx::execution::experimental::create_rebound_policy( derived(), HPX_FORWARD(Executor_, exec), parameters()); } @@ -206,9 +206,9 @@ namespace hpx::execution { template constexpr decltype(auto) with(Parameters_&&... params) const { - return hpx::parallel::execution::create_rebound_policy( + return hpx::execution::experimental::create_rebound_policy( derived(), executor(), - parallel::execution::join_executor_parameters( + hpx::execution::experimental::join_executor_parameters( HPX_FORWARD(Parameters_, params)...)); } @@ -239,7 +239,7 @@ namespace hpx::execution { } private: - friend struct hpx::parallel::execution::create_rebound_policy_t; + friend struct hpx::execution::experimental::create_rebound_policy_t; friend class hpx::serialization::access; template @@ -258,7 +258,7 @@ namespace hpx::execution { /////////////////////////////////////////////////////////////////////// // Extension: The class sequenced_task_policy_shim is an execution // policy type used as a unique type to disambiguate parallel algorithm - // overloading based on combining a underlying \a sequenced_task_policy + // overloading based on combining an underlying \a sequenced_task_policy // and an executor and indicate that a parallel algorithm's execution // may not be parallelized (has to run sequentially). // @@ -395,7 +395,7 @@ namespace hpx::execution { /////////////////////////////////////////////////////////////////////// // Extension: The class parallel_task_policy_shim is an execution policy // type used as a unique type to disambiguate parallel algorithm - // overloading based on combining a underlying \a parallel_task_policy + // overloading based on combining an underlying \a parallel_task_policy // and an executor and indicate that a parallel algorithm's execution // may be parallelized. template @@ -664,7 +664,7 @@ namespace hpx::execution { // Extension: The class unsequenced_task_policy_shim is an execution // policy type used as a unique type to disambiguate parallel algorithm - // overloading based on combining a underlying \a + // overloading based on combining an underlying \a // unsequenced_task_policy and an executor and indicate that a parallel // algorithm's execution may be vectorized. // diff --git a/libs/core/executors/include/hpx/executors/execution_policy_annotation.hpp b/libs/core/executors/include/hpx/executors/execution_policy_annotation.hpp index b9aa683c97da..7612da0823fd 100644 --- a/libs/core/executors/include/hpx/executors/execution_policy_annotation.hpp +++ b/libs/core/executors/include/hpx/executors/execution_policy_annotation.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2021-2022 Hartmut Kaiser +// Copyright (c) 2021-2024 Hartmut Kaiser // // SPDX-License-Identifier: BSL-1.0 // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -43,7 +43,7 @@ namespace hpx::execution::experimental { auto exec = hpx::execution::experimental::with_annotation( policy.executor(), annotation); - return hpx::parallel::execution::create_rebound_policy( + return hpx::execution::experimental::create_rebound_policy( policy, HPX_MOVE(exec), policy.parameters()); } @@ -63,7 +63,7 @@ namespace hpx::execution::experimental { auto exec = hpx::execution::experimental::with_annotation( policy.executor(), HPX_MOVE(annotation)); - return hpx::parallel::execution::create_rebound_policy( + return hpx::execution::experimental::create_rebound_policy( policy, HPX_MOVE(exec), policy.parameters()); } diff --git a/libs/core/executors/include/hpx/executors/execution_policy_parameters.hpp b/libs/core/executors/include/hpx/executors/execution_policy_parameters.hpp index 817c079d07ee..180d091d7eaa 100644 --- a/libs/core/executors/include/hpx/executors/execution_policy_parameters.hpp +++ b/libs/core/executors/include/hpx/executors/execution_policy_parameters.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2022 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 @@ -20,7 +20,7 @@ #include #include -namespace hpx::parallel::execution { +namespace hpx::execution::experimental { // with_processing_units_count property implementation for execution // policies that simply forwards to the embedded executor (if that supports @@ -102,4 +102,4 @@ namespace hpx::parallel::execution { { return prop(policy.executor(), HPX_FORWARD(Ts, ts)...); } -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental diff --git a/libs/core/executors/include/hpx/executors/execution_policy_scheduling_property.hpp b/libs/core/executors/include/hpx/executors/execution_policy_scheduling_property.hpp index 5119f66d53f6..6120a1dc93d8 100644 --- a/libs/core/executors/include/hpx/executors/execution_policy_scheduling_property.hpp +++ b/libs/core/executors/include/hpx/executors/execution_policy_scheduling_property.hpp @@ -34,7 +34,7 @@ namespace hpx::execution::experimental { constexpr decltype(auto) tag_invoke( Tag tag, ExPolicy&& policy, Property prop) { - return hpx::parallel::execution::create_rebound_policy( + return hpx::execution::experimental::create_rebound_policy( policy, tag(policy.executor(), prop), policy.parameters()); } diff --git a/libs/core/executors/include/hpx/executors/explicit_scheduler_executor.hpp b/libs/core/executors/include/hpx/executors/explicit_scheduler_executor.hpp index 0d4311ef27c7..9192cf84fd6b 100644 --- a/libs/core/executors/include/hpx/executors/explicit_scheduler_executor.hpp +++ b/libs/core/executors/include/hpx/executors/explicit_scheduler_executor.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2021-2023 Hartmut Kaiser +// Copyright (c) 2021-2024 Hartmut Kaiser // // SPDX-License-Identifier: BSL-1.0 // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -103,12 +103,12 @@ namespace hpx::execution::experimental { )> // clang-format on friend auto tag_invoke( - hpx::parallel::execution::processing_units_count_t tag, + hpx::execution::experimental::processing_units_count_t tag, Parameters&& params, explicit_scheduler_executor const& exec, hpx::chrono::steady_duration const& = hpx::chrono::null_duration, std::size_t = 0) -> decltype(std::declval< - hpx::parallel::execution::processing_units_count_t>()( + hpx::execution::experimental::processing_units_count_t>()( std::declval(), std::declval(), std::declval(), 0)) { @@ -330,7 +330,7 @@ namespace hpx::execution::experimental { } } // namespace hpx::execution::experimental -namespace hpx::parallel::execution { +namespace hpx::execution::experimental { /// \cond NOINTERNAL template @@ -369,4 +369,4 @@ namespace hpx::parallel::execution { { }; /// \endcond -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental diff --git a/libs/core/executors/include/hpx/executors/fork_join_executor.hpp b/libs/core/executors/include/hpx/executors/fork_join_executor.hpp index 95c5ac181367..b519d1658b12 100644 --- a/libs/core/executors/include/hpx/executors/fork_join_executor.hpp +++ b/libs/core/executors/include/hpx/executors/fork_join_executor.hpp @@ -1167,21 +1167,16 @@ namespace hpx::execution::experimental { HPX_CORE_EXPORT std::ostream& operator<<( std::ostream& os, fork_join_executor::loop_schedule schedule); -} // namespace hpx::execution::experimental - -namespace hpx::parallel::execution { /// \cond NOINTERNAL template <> - struct is_bulk_one_way_executor< - hpx::execution::experimental::fork_join_executor> : std::true_type + struct is_bulk_one_way_executor : std::true_type { }; template <> - struct is_bulk_two_way_executor< - hpx::execution::experimental::fork_join_executor> : std::true_type + struct is_bulk_two_way_executor : std::true_type { }; /// \endcond -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental diff --git a/libs/core/executors/include/hpx/executors/guided_pool_executor.hpp b/libs/core/executors/include/hpx/executors/guided_pool_executor.hpp index 924a18bcb1e3..3338094e4465 100644 --- a/libs/core/executors/include/hpx/executors/guided_pool_executor.hpp +++ b/libs/core/executors/include/hpx/executors/guided_pool_executor.hpp @@ -40,7 +40,7 @@ namespace hpx { // -------------------------------------------------------------------- // pool_numa_hint // -------------------------------------------------------------------- -namespace hpx::parallel::execution { +namespace hpx::execution::experimental { namespace detail { // -------------------------------------------------------------------- @@ -661,6 +661,6 @@ namespace hpx::parallel::execution { struct is_two_way_executor> : std::true_type { }; -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental #include diff --git a/libs/core/executors/include/hpx/executors/limiting_executor.hpp b/libs/core/executors/include/hpx/executors/limiting_executor.hpp index 0a880d101e19..7c8b85ecd50f 100644 --- a/libs/core/executors/include/hpx/executors/limiting_executor.hpp +++ b/libs/core/executors/include/hpx/executors/limiting_executor.hpp @@ -1,4 +1,5 @@ // Copyright (c) 2017-2018 John Biddiscombe +// Copyright (c) 2020-2024 Hartmut Kaiser // // SPDX-License-Identifier: BSL-1.0 // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -312,7 +313,7 @@ namespace hpx::execution::experimental { }; } // namespace hpx::execution::experimental -namespace hpx::parallel::execution { +namespace hpx::execution::experimental { // -------------------------------------------------------------------- // simple forwarding implementations of executor traits @@ -358,6 +359,6 @@ namespace hpx::parallel::execution { : is_scheduler_executor> { }; -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental #include diff --git a/libs/core/executors/include/hpx/executors/parallel_executor.hpp b/libs/core/executors/include/hpx/executors/parallel_executor.hpp index 915551b7c579..8a4ba024a760 100644 --- a/libs/core/executors/include/hpx/executors/parallel_executor.hpp +++ b/libs/core/executors/include/hpx/executors/parallel_executor.hpp @@ -227,7 +227,7 @@ namespace hpx::execution { )> // clang-format on friend constexpr auto tag_invoke( - hpx::parallel::execution::with_processing_units_count_t, + hpx::execution::experimental::with_processing_units_count_t, Executor_ const& exec, std::size_t num_cores) noexcept { auto exec_with_num_cores = exec; @@ -242,8 +242,8 @@ namespace hpx::execution { )> // clang-format on friend constexpr std::size_t tag_invoke( - hpx::parallel::execution::processing_units_count_t, Parameters&&, - parallel_policy_executor const& exec, + hpx::execution::experimental::processing_units_count_t, + Parameters&&, parallel_policy_executor const& exec, hpx::chrono::steady_duration const& = hpx::chrono::null_duration, std::size_t = 0) { @@ -610,7 +610,7 @@ namespace hpx::execution { using parallel_executor = parallel_policy_executor; } // namespace hpx::execution -namespace hpx::parallel::execution { +namespace hpx::execution::experimental { /// \cond NOINTERNAL template @@ -637,4 +637,4 @@ namespace hpx::parallel::execution { { }; /// \endcond -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental diff --git a/libs/core/executors/include/hpx/executors/restricted_thread_pool_executor.hpp b/libs/core/executors/include/hpx/executors/restricted_thread_pool_executor.hpp index e4929a69f55c..73c603f02518 100644 --- a/libs/core/executors/include/hpx/executors/restricted_thread_pool_executor.hpp +++ b/libs/core/executors/include/hpx/executors/restricted_thread_pool_executor.hpp @@ -1,5 +1,5 @@ // Copyright (c) 2020 Mikael Simberg -// Copyright (c) 2007-2022 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 @@ -23,7 +23,7 @@ #include #include -namespace hpx::parallel::execution { +namespace hpx::execution::experimental { template class restricted_policy_executor @@ -60,7 +60,7 @@ namespace hpx::parallel::execution { hierarchical_threshold) { // set initial number of cores - exec_ = hpx::parallel::execution::with_processing_units_count( + exec_ = hpx::execution::experimental::with_processing_units_count( exec_, num_threads); } @@ -102,7 +102,8 @@ namespace hpx::parallel::execution { { return static_cast(first_thread_ + (os_thread_++ % - hpx::parallel::execution::processing_units_count(exec_))); + hpx::execution::experimental::processing_units_count( + exec_))); } std::int16_t get_current_thread_num() const @@ -158,7 +159,7 @@ namespace hpx::parallel::execution { )> // clang-format on friend constexpr std::size_t tag_invoke( - hpx::parallel::execution::processing_units_count_t tag, + hpx::execution::experimental::processing_units_count_t tag, Parameters&& params, restricted_policy_executor const& exec, hpx::chrono::steady_duration const& duration = hpx::chrono::null_duration, @@ -255,6 +256,9 @@ namespace hpx::parallel::execution { using restricted_thread_pool_executor = restricted_policy_executor; +} // namespace hpx::execution::experimental + +namespace hpx::execution::experimental { /////////////////////////////////////////////////////////////////////////// /// \cond NOINTERNAL @@ -298,4 +302,4 @@ namespace hpx::parallel::execution { { }; /// \endcond -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental diff --git a/libs/core/executors/include/hpx/executors/scheduler_executor.hpp b/libs/core/executors/include/hpx/executors/scheduler_executor.hpp index e2373d807910..9fc6fba63137 100644 --- a/libs/core/executors/include/hpx/executors/scheduler_executor.hpp +++ b/libs/core/executors/include/hpx/executors/scheduler_executor.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2021-2023 Hartmut Kaiser +// Copyright (c) 2021-2024 Hartmut Kaiser // // SPDX-License-Identifier: BSL-1.0 // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -137,13 +137,13 @@ namespace hpx::execution::experimental { )> // clang-format on friend auto tag_invoke( - hpx::parallel::execution::processing_units_count_t tag, + hpx::execution::experimental::processing_units_count_t tag, Parameters&& params, scheduler_executor const& exec, hpx::chrono::steady_duration const& duration = hpx::chrono::null_duration, std::size_t num_cores = 0) -> decltype(std::declval< - hpx::parallel::execution::processing_units_count_t>()( + hpx::execution::experimental::processing_units_count_t>()( std::declval(), std::declval(), std::declval(), 0)) { @@ -355,9 +355,6 @@ namespace hpx::execution::experimental { { return tag(exec.sched()); } -} // namespace hpx::execution::experimental - -namespace hpx::parallel::execution { /// \cond NOINTERNAL template @@ -395,4 +392,4 @@ namespace hpx::parallel::execution { { }; /// \endcond -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental diff --git a/libs/core/executors/include/hpx/executors/sequenced_executor.hpp b/libs/core/executors/include/hpx/executors/sequenced_executor.hpp index 53162b7966ba..2903973bcd34 100644 --- a/libs/core/executors/include/hpx/executors/sequenced_executor.hpp +++ b/libs/core/executors/include/hpx/executors/sequenced_executor.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 @@ -230,8 +230,8 @@ namespace hpx::execution { )> // clang-format on friend constexpr std::size_t tag_invoke( - hpx::parallel::execution::processing_units_count_t, Parameters&&, - sequenced_executor const&, + hpx::execution::experimental::processing_units_count_t, + Parameters&&, sequenced_executor const&, hpx::chrono::steady_duration const& = hpx::chrono::null_duration, std::size_t = 0) { @@ -279,7 +279,7 @@ namespace hpx::execution { }; } // namespace hpx::execution -namespace hpx::parallel::execution { +namespace hpx::execution::experimental { /// \cond NOINTERNAL template <> @@ -312,4 +312,4 @@ namespace hpx::parallel::execution { { }; /// \endcond -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental diff --git a/libs/core/executors/include/hpx/executors/thread_pool_scheduler.hpp b/libs/core/executors/include/hpx/executors/thread_pool_scheduler.hpp index 2841c0970c08..c86d48df9e14 100644 --- a/libs/core/executors/include/hpx/executors/thread_pool_scheduler.hpp +++ b/libs/core/executors/include/hpx/executors/thread_pool_scheduler.hpp @@ -1,5 +1,5 @@ // Copyright (c) 2020 ETH Zurich -// 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 @@ -107,7 +107,7 @@ namespace hpx::execution::experimental { )> // clang-format on friend constexpr auto tag_invoke( - hpx::parallel::execution::with_processing_units_count_t, + hpx::execution::experimental::with_processing_units_count_t, Executor_ const& scheduler, std::size_t num_cores) noexcept { auto scheduler_with_num_cores = scheduler; @@ -122,8 +122,8 @@ namespace hpx::execution::experimental { )> // clang-format on friend constexpr std::size_t tag_invoke( - hpx::parallel::execution::processing_units_count_t, Parameters&&, - thread_pool_policy_scheduler const& scheduler, + hpx::execution::experimental::processing_units_count_t, + Parameters&&, thread_pool_policy_scheduler const& scheduler, hpx::chrono::steady_duration const& = hpx::chrono::null_duration, std::size_t = 0) { diff --git a/libs/core/executors/include/hpx/executors/thread_pool_scheduler_bulk.hpp b/libs/core/executors/include/hpx/executors/thread_pool_scheduler_bulk.hpp index 42fc38b08108..66aecce58f5e 100644 --- a/libs/core/executors/include/hpx/executors/thread_pool_scheduler_bulk.hpp +++ b/libs/core/executors/include/hpx/executors/thread_pool_scheduler_bulk.hpp @@ -1,5 +1,5 @@ // Copyright (c) 2021 ETH Zurich -// 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 @@ -651,8 +651,8 @@ namespace hpx::execution::experimental::detail { , f(HPX_FORWARD(F_, f)) , pu_mask(detail::full_mask( hpx::execution::experimental::get_first_core(scheduler), - hpx::parallel::execution::processing_units_count( - hpx::parallel::execution::null_parameters, scheduler, + hpx::execution::experimental::processing_units_count( + hpx::execution::experimental::null_parameters, scheduler, hpx::chrono::null_duration, 0))) { } @@ -805,9 +805,9 @@ namespace hpx::execution::experimental::detail { , first_thread( hpx::execution::experimental::get_first_core(scheduler)) , num_worker_threads( - hpx::parallel::execution::processing_units_count( - hpx::parallel::execution::null_parameters, scheduler, - hpx::chrono::null_duration, 0)) + hpx::execution::experimental::processing_units_count( + hpx::execution::experimental::null_parameters, + scheduler, hpx::chrono::null_duration, 0)) , pu_mask(HPX_MOVE(pumask)) , queues(num_worker_threads) , shape(HPX_FORWARD(Shape_, shape)) diff --git a/libs/core/executors/tests/regressions/pu_count_6184.cpp b/libs/core/executors/tests/regressions/pu_count_6184.cpp index 59a2dfb4fa85..44db1498b3b4 100644 --- a/libs/core/executors/tests/regressions/pu_count_6184.cpp +++ b/libs/core/executors/tests/regressions/pu_count_6184.cpp @@ -14,8 +14,9 @@ int hpx_main() { - hpx::parallel::execution::restricted_thread_pool_executor executor{0, 3}; - HPX_TEST_EQ(hpx::parallel::execution::processing_units_count(executor), + hpx::execution::experimental::restricted_thread_pool_executor executor{ + 0, 3}; + HPX_TEST_EQ(hpx::execution::experimental::processing_units_count(executor), static_cast(3)); return hpx::local::finalize(); } diff --git a/libs/core/executors/tests/regressions/wrapping_executor.cpp b/libs/core/executors/tests/regressions/wrapping_executor.cpp index c5ae72964cf7..2d224d6abf90 100644 --- a/libs/core/executors/tests/regressions/wrapping_executor.cpp +++ b/libs/core/executors/tests/regressions/wrapping_executor.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2022 Hartmut Kaiser +// Copyright (c) 2020-2024 Hartmut Kaiser // // SPDX-License-Identifier: BSL-1.0 // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -130,14 +130,16 @@ namespace test { BaseExecutor exec_; }; + // clang-format off template wrapping_executor(BaseExecutor&& exec) -> wrapping_executor>; + // clang-format on } // namespace test /////////////////////////////////////////////////////////////////////////////// // simple forwarding implementations of executor traits -namespace hpx::parallel::execution { +namespace hpx::execution::experimental { template struct is_one_way_executor> @@ -169,7 +171,7 @@ namespace hpx::parallel::execution { : is_bulk_two_way_executor> { }; -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental int hpx_main() { diff --git a/libs/core/executors/tests/unit/parallel_executor.cpp b/libs/core/executors/tests/unit/parallel_executor.cpp index 5912b9ee154f..9416180e20ce 100644 --- a/libs/core/executors/tests/unit/parallel_executor.cpp +++ b/libs/core/executors/tests/unit/parallel_executor.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2022 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 diff --git a/libs/core/executors/tests/unit/parallel_executor_parameters.cpp b/libs/core/executors/tests/unit/parallel_executor_parameters.cpp index 7822d93193a0..5382c9879061 100644 --- a/libs/core/executors/tests/unit/parallel_executor_parameters.cpp +++ b/libs/core/executors/tests/unit/parallel_executor_parameters.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2022 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 @@ -41,7 +41,7 @@ void test_stacksize() HPX_TEST( hpx::execution::experimental::get_stacksize(newexec) == stacksize); HPX_TEST( - hpx::parallel::execution::async_execute(newexec, &get_stacksize) + hpx::execution::experimental::async_execute(newexec, &get_stacksize) .get() == stacksize); } } @@ -71,8 +71,9 @@ void test_priority() hpx::threads::thread_priority::default_); HPX_TEST( hpx::execution::experimental::get_priority(newexec) == priority); - HPX_TEST(hpx::parallel::execution::async_execute(newexec, &get_priority) - .get() == priority); + HPX_TEST( + hpx::execution::experimental::async_execute(newexec, &get_priority) + .get() == priority); } } @@ -126,9 +127,9 @@ void test_annotation() auto newexec = hpx::experimental::prefer( hpx::execution::experimental::with_annotation, exec, desc); - auto newdesc = - hpx::parallel::execution::async_execute(newexec, &get_annotation) - .get(); + auto newdesc = hpx::execution::experimental::async_execute( + newexec, &get_annotation) + .get(); HPX_TEST_EQ(newdesc, desc); HPX_TEST_EQ(newdesc, @@ -139,9 +140,9 @@ void test_annotation() auto newexec = hpx::execution::experimental::with_annotation(exec, desc); - auto newdesc = - hpx::parallel::execution::async_execute(newexec, &get_annotation) - .get(); + auto newdesc = hpx::execution::experimental::async_execute( + newexec, &get_annotation) + .get(); HPX_TEST_EQ(newdesc, desc); HPX_TEST_EQ(newdesc, @@ -155,15 +156,15 @@ void test_num_cores() using executor = hpx::execution::parallel_executor; executor exec; - auto num_cores = hpx::parallel::execution::processing_units_count(exec); + auto num_cores = hpx::execution::experimental::processing_units_count(exec); auto newexec = - hpx::parallel::execution::with_processing_units_count(exec, 2); + hpx::execution::experimental::with_processing_units_count(exec, 2); - HPX_TEST( - num_cores == hpx::parallel::execution::processing_units_count(exec)); + HPX_TEST(num_cores == + hpx::execution::experimental::processing_units_count(exec)); HPX_TEST(std::size_t(2) == - hpx::parallel::execution::processing_units_count(newexec)); + hpx::execution::experimental::processing_units_count(newexec)); } /////////////////////////////////////////////////////////////////////////////// diff --git a/libs/core/executors/tests/unit/service_executors.cpp b/libs/core/executors/tests/unit/service_executors.cpp index 0b267df79833..bc42ea624c6d 100644 --- a/libs/core/executors/tests/unit/service_executors.cpp +++ b/libs/core/executors/tests/unit/service_executors.cpp @@ -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 @@ -149,26 +149,27 @@ void test_service_executor(Executor& exec) int hpx_main() { - using namespace hpx::parallel; - using hpx::parallel::execution::service_executor_type; + using hpx::execution::experimental::service_executor_type; #if defined(HPX_HAVE_IO_POOL) { - execution::service_executor exec(service_executor_type::io_thread_pool); + hpx::execution::experimental::service_executor exec( + service_executor_type::io_thread_pool); test_service_executor(exec); } #endif #if defined(HPX_HAVE_TIMER_POOL) { - execution::service_executor exec( + hpx::execution::experimental::service_executor exec( service_executor_type::timer_thread_pool); test_service_executor(exec); } #endif { - execution::service_executor exec(service_executor_type::main_thread); + hpx::execution::experimental::service_executor exec( + service_executor_type::main_thread); test_service_executor(exec); } diff --git a/libs/core/lcos_local/tests/unit/local_dataflow_executor_additional_arguments.cpp b/libs/core/lcos_local/tests/unit/local_dataflow_executor_additional_arguments.cpp index df85939852b1..e66a6aa6daf2 100644 --- a/libs/core/lcos_local/tests/unit/local_dataflow_executor_additional_arguments.cpp +++ b/libs/core/lcos_local/tests/unit/local_dataflow_executor_additional_arguments.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2020 ETH Zurich -// Copyright (c) 2015-2022 Hartmut Kaiser +// Copyright (c) 2015-2024 Hartmut Kaiser // Copyright (c) 2013 Thomas Heller // // SPDX-License-Identifier: BSL-1.0 @@ -67,7 +67,7 @@ struct additional_argument_executor } }; -namespace hpx::parallel::execution { +namespace hpx::execution::experimental { template <> struct is_one_way_executor : std::true_type { @@ -77,7 +77,7 @@ namespace hpx::parallel::execution { struct is_two_way_executor : std::true_type { }; -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental std::atomic void_f_count; std::atomic int_f_count; diff --git a/libs/core/resiliency/include/hpx/resiliency/async_replay_executor.hpp b/libs/core/resiliency/include/hpx/resiliency/async_replay_executor.hpp index c5cef2457edd..a253a032978a 100644 --- a/libs/core/resiliency/include/hpx/resiliency/async_replay_executor.hpp +++ b/libs/core/resiliency/include/hpx/resiliency/async_replay_executor.hpp @@ -58,14 +58,14 @@ namespace hpx::resiliency::experimental { } template - hpx::parallel::execution::executor_future_t call( - Executor&& exec, std::size_t n) + hpx::execution::experimental::executor_future_t + call(Executor&& exec, std::size_t n) { // launch given function asynchronously using pack_type = hpx::util::make_index_pack>; using result_type = - hpx::parallel::execution::executor_future_t; result_type f = invoke(exec, pack_type{}); @@ -148,14 +148,15 @@ namespace hpx::resiliency::experimental { } template - hpx::parallel::execution::executor_future_t call( - Executor&& exec, std::size_t n) + hpx::execution::experimental::executor_future_t + call(Executor&& exec, std::size_t n) { // launch given function asynchronously using pack_type = hpx::util::make_index_pack>; using result_type = - hpx::parallel::execution::executor_future_t; + hpx::execution::experimental::executor_future_t; result_type f = invoke(exec, pack_type{}); diff --git a/libs/core/resiliency/include/hpx/resiliency/replay_executor.hpp b/libs/core/resiliency/include/hpx/resiliency/replay_executor.hpp index db883072ea93..8abc9621ad55 100644 --- a/libs/core/resiliency/include/hpx/resiliency/replay_executor.hpp +++ b/libs/core/resiliency/include/hpx/resiliency/replay_executor.hpp @@ -226,7 +226,7 @@ namespace hpx::resiliency::experimental { } } // namespace hpx::resiliency::experimental -namespace hpx::parallel::execution { +namespace hpx::execution::experimental { template struct is_two_way_executor< @@ -241,4 +241,4 @@ namespace hpx::parallel::execution { : std::true_type { }; -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental diff --git a/libs/core/resiliency/include/hpx/resiliency/replicate_executor.hpp b/libs/core/resiliency/include/hpx/resiliency/replicate_executor.hpp index 2fee3fe6eb2e..30daabd69458 100644 --- a/libs/core/resiliency/include/hpx/resiliency/replicate_executor.hpp +++ b/libs/core/resiliency/include/hpx/resiliency/replicate_executor.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2023 Hartmut Kaiser +// Copyright (c) 2020-2024 Hartmut Kaiser // // SPDX-License-Identifier: BSL-1.0 // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -253,7 +253,7 @@ namespace hpx::resiliency::experimental { } } // namespace hpx::resiliency::experimental -namespace hpx::parallel::execution { +namespace hpx::execution::experimental { template struct is_two_way_executor> : std::true_type { }; -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental diff --git a/libs/core/resource_partitioner/examples/async_customization.cpp b/libs/core/resource_partitioner/examples/async_customization.cpp index f407b95f0605..ee4444676a9d 100644 --- a/libs/core/resource_partitioner/examples/async_customization.cpp +++ b/libs/core/resource_partitioner/examples/async_customization.cpp @@ -1,4 +1,5 @@ // Copyright (c) 2017-2018 John Biddiscombe +// Copyright (c) 2024 Hartmut Kaiser // // SPDX-License-Identifier: BSL-1.0 // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -137,6 +138,7 @@ struct test_async_executor // .then() execute specialized for a when_all dispatch for any future types // future< tuple< is_future::type, is_future::type, ...> > // -------------------------------------------------------------------- + // clang-format off template class OuterFuture, typename... InnerFutures, typename... Ts, typename = std::enable_if_t>&& predecessor, Ts&&... ts) - -> future>, Ts...>> + -> future>, Ts...>> + // clang-format on { using result_type = util::detail::invoke_deferred_result_t>, Ts...>; @@ -235,12 +238,13 @@ struct test_async_executor // -------------------------------------------------------------------- // set traits for executor to say it is an async executor // -------------------------------------------------------------------- -namespace hpx::parallel::execution { +namespace hpx::execution::experimental { + template <> struct is_two_way_executor : std::true_type { }; -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental template T dummy_task(T val) @@ -426,7 +430,8 @@ struct dummy_tag { }; -namespace hpx::parallel::execution { +namespace hpx::execution::experimental { + template <> struct pool_numa_hint { @@ -468,7 +473,7 @@ namespace hpx::parallel::execution { return 4; } }; -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental int hpx_main() { @@ -482,10 +487,10 @@ int hpx_main() std::cout << "Exception " << e.what() << std::endl; } - typedef hpx::parallel::execution::pool_numa_hint dummy_hint; + typedef hpx::execution::experimental::pool_numa_hint dummy_hint; try { - hpx::parallel::execution::guided_pool_executor exec2( + hpx::execution::experimental::guided_pool_executor exec2( &hpx::resource::get_thread_pool("default")); test("Testing guided_pool_executor", exec2); } @@ -496,8 +501,8 @@ int hpx_main() try { - hpx::parallel::execution::guided_pool_executor_shim exec3( - true, &hpx::resource::get_thread_pool("default")); + hpx::execution::experimental::guided_pool_executor_shim + exec3(true, &hpx::resource::get_thread_pool("default")); test("Testing guided_pool_executor_shim", exec3); } catch (std::exception& e) diff --git a/libs/core/resource_partitioner/examples/guided_pool_test.cpp b/libs/core/resource_partitioner/examples/guided_pool_test.cpp index 62dbdb66ff03..04ea92d48541 100644 --- a/libs/core/resource_partitioner/examples/guided_pool_test.cpp +++ b/libs/core/resource_partitioner/examples/guided_pool_test.cpp @@ -1,4 +1,5 @@ // Copyright (c) 2017-2018 John Biddiscombe +// Copyright (c) 2024 Hartmut Kaiser // // SPDX-License-Identifier: BSL-1.0 // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -74,7 +75,7 @@ std::string a_function(hpx::future&& df) return "The number 2"; } -namespace hpx::parallel::execution { +namespace hpx::execution::experimental { struct guided_test_tag { @@ -121,9 +122,9 @@ namespace hpx::parallel::execution { return 56; } }; -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental -using namespace hpx::parallel::execution; +using namespace hpx::execution::experimental; // this is called on an hpx thread after the runtime starts up int hpx_main() @@ -141,7 +142,7 @@ int hpx_main() // we must specialize the numa callback hint for the function type we are invoking using hint_type1 = pool_numa_hint; // create an executor using that hint type - hpx::parallel::execution::guided_pool_executor guided_exec( + hpx::execution::experimental::guided_pool_executor guided_exec( &hpx::resource::get_thread_pool(CUSTOM_POOL_NAME)); // invoke an async function using our numa hint executor hpx::future gf1 = hpx::async(guided_exec, &async_guided, @@ -159,7 +160,7 @@ int hpx_main() // the args of the async lambda must match the args of the hint type using hint_type2 = pool_numa_hint; // create an executor using the numa hint type - hpx::parallel::execution::guided_pool_executor + hpx::execution::experimental::guided_pool_executor guided_lambda_exec(&hpx::resource::get_thread_pool(CUSTOM_POOL_NAME)); // invoke a lambda asynchronously and use the numa executor hpx::future gf2 = hpx::async( @@ -184,8 +185,8 @@ int hpx_main() // the args of the async lambda must match the args of the hint type using hint_type3 = pool_numa_hint; // create an executor using the numa hint type - hpx::parallel::execution::guided_pool_executor guided_cont_exec( - &hpx::resource::get_thread_pool(CUSTOM_POOL_NAME)); + hpx::execution::experimental::guided_pool_executor + guided_cont_exec(&hpx::resource::get_thread_pool(CUSTOM_POOL_NAME)); // invoke the lambda asynchronously and use the numa executor auto new_future = hpx::async([]() -> double { return 2 * 3.1415; diff --git a/libs/core/runtime_local/include/hpx/runtime_local/run_as_os_thread.hpp b/libs/core/runtime_local/include/hpx/runtime_local/run_as_os_thread.hpp index cb9a18e4db6a..3b64f17e972e 100644 --- a/libs/core/runtime_local/include/hpx/runtime_local/run_as_os_thread.hpp +++ b/libs/core/runtime_local/include/hpx/runtime_local/run_as_os_thread.hpp @@ -24,7 +24,7 @@ namespace hpx { { HPX_ASSERT(threads::get_self_ptr() != nullptr); - parallel::execution::io_pool_executor executor; + hpx::execution::experimental::io_pool_executor executor; return parallel::execution::async_execute( executor, HPX_FORWARD(F, f), HPX_FORWARD(Ts, vs)...); } diff --git a/libs/core/runtime_local/include/hpx/runtime_local/service_executors.hpp b/libs/core/runtime_local/include/hpx/runtime_local/service_executors.hpp index da6fca6b240d..5c98817e697b 100644 --- a/libs/core/runtime_local/include/hpx/runtime_local/service_executors.hpp +++ b/libs/core/runtime_local/include/hpx/runtime_local/service_executors.hpp @@ -15,7 +15,7 @@ #include #include -namespace hpx::parallel::execution { +namespace hpx::execution::experimental { enum class service_executor_type : std::uint8_t { @@ -35,45 +35,49 @@ namespace hpx::parallel::execution { service_executor_type t, char const* name_suffix = ""); } // namespace detail - struct HPX_CORE_EXPORT service_executor : public detail::service_executor + struct HPX_CORE_EXPORT service_executor + : public parallel::execution::detail::service_executor { explicit service_executor( service_executor_type t, char const* name_suffix = ""); }; - struct HPX_CORE_EXPORT io_pool_executor : detail::service_executor + struct HPX_CORE_EXPORT io_pool_executor : service_executor { io_pool_executor(); }; - struct HPX_CORE_EXPORT parcel_pool_executor : detail::service_executor + struct HPX_CORE_EXPORT parcel_pool_executor : service_executor { explicit parcel_pool_executor(char const* name_suffix = "-tcp"); }; - struct HPX_CORE_EXPORT timer_pool_executor : detail::service_executor + struct HPX_CORE_EXPORT timer_pool_executor : service_executor { timer_pool_executor(); }; - struct HPX_CORE_EXPORT main_pool_executor : detail::service_executor + struct HPX_CORE_EXPORT main_pool_executor : service_executor { main_pool_executor(); }; /// \cond NOINTERNAL template <> - struct is_one_way_executor : std::true_type + struct is_one_way_executor + : std::true_type { }; template <> - struct is_two_way_executor : std::true_type + struct is_two_way_executor + : std::true_type { }; template <> - struct is_bulk_two_way_executor : std::true_type + struct is_bulk_two_way_executor< + parallel::execution::detail::service_executor> : std::true_type { }; @@ -152,4 +156,4 @@ namespace hpx::parallel::execution { { }; /// \endcond -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental diff --git a/libs/core/runtime_local/src/service_executors.cpp b/libs/core/runtime_local/src/service_executors.cpp index 2664f38a8f2c..3a7c69bced9d 100644 --- a/libs/core/runtime_local/src/service_executors.cpp +++ b/libs/core/runtime_local/src/service_executors.cpp @@ -10,7 +10,7 @@ #include #include -namespace hpx::parallel::execution { +namespace hpx::execution::experimental { namespace detail { @@ -47,31 +47,28 @@ namespace hpx::parallel::execution { service_executor::service_executor( service_executor_type t, char const* name_suffix) - : detail::service_executor(detail::get_service_pool(t, name_suffix)) + : hpx::parallel::execution::detail::service_executor( + detail::get_service_pool(t, name_suffix)) { } io_pool_executor::io_pool_executor() - : detail::service_executor( - detail::get_service_pool(service_executor_type::io_thread_pool)) + : service_executor(service_executor_type::io_thread_pool) { } parcel_pool_executor::parcel_pool_executor(char const* name_suffix) - : detail::service_executor(detail::get_service_pool( - service_executor_type::parcel_thread_pool, name_suffix)) + : service_executor(service_executor_type::parcel_thread_pool, name_suffix) { } timer_pool_executor::timer_pool_executor() - : detail::service_executor( - detail::get_service_pool(service_executor_type::timer_thread_pool)) + : service_executor(service_executor_type::timer_thread_pool) { } main_pool_executor::main_pool_executor() - : detail::service_executor( - detail::get_service_pool(service_executor_type::main_thread)) + : service_executor(service_executor_type::main_thread) { } -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental diff --git a/libs/core/timed_execution/include/hpx/timed_execution/timed_executors.hpp b/libs/core/timed_execution/include/hpx/timed_execution/timed_executors.hpp index 0764ea8edd3e..c7fbee1726e8 100644 --- a/libs/core/timed_execution/include/hpx/timed_execution/timed_executors.hpp +++ b/libs/core/timed_execution/include/hpx/timed_execution/timed_executors.hpp @@ -109,6 +109,7 @@ namespace hpx::parallel::execution { HPX_FORWARD(Ts, ts)...); } + // clang-format off template decltype(exec.sync_execute_at(abs_time, - HPX_FORWARD(F, f), HPX_FORWARD(Ts, ts)...)) + HPX_FORWARD(F, f), HPX_FORWARD(Ts, ts)...)) + // clang-format on { return exec.sync_execute_at( abs_time, HPX_FORWARD(F, f), HPX_FORWARD(Ts, ts)...); @@ -159,6 +161,7 @@ namespace hpx::parallel::execution { HPX_FORWARD(Ts, ts)...); } + // clang-format off template decltype(exec.sync_execute_at(abs_time, - HPX_FORWARD(F, f), HPX_FORWARD(Ts, ts)...)) + HPX_FORWARD(F, f), HPX_FORWARD(Ts, ts)...)) + // clang-format on { return exec.sync_execute_at( abs_time, HPX_FORWARD(F, f), HPX_FORWARD(Ts, ts)...); @@ -242,6 +246,7 @@ namespace hpx::parallel::execution { HPX_FORWARD(Ts, ts)...); } + // clang-format off template decltype(exec.async_execute_at(abs_time, - HPX_FORWARD(F, f), HPX_FORWARD(Ts, ts)...)) + HPX_FORWARD(F, f), HPX_FORWARD(Ts, ts)...)) + // clang-format on { return exec.async_execute_at( abs_time, HPX_FORWARD(F, f), HPX_FORWARD(Ts, ts)...); @@ -298,6 +304,7 @@ namespace hpx::parallel::execution { HPX_FORWARD(Ts, ts)...); } + // clang-format off template decltype(exec.async_execute_at(abs_time, - HPX_FORWARD(F, f), HPX_FORWARD(Ts, ts)...)) + HPX_FORWARD(F, f), HPX_FORWARD(Ts, ts)...)) + // clang-format on { return exec.async_execute_at( abs_time, HPX_FORWARD(F, f), HPX_FORWARD(Ts, ts)...); @@ -373,6 +381,7 @@ namespace hpx::parallel::execution { HPX_FORWARD(Ts, ts)...); } + // clang-format off template decltype(exec.post_at(abs_time, - HPX_FORWARD(F, f), HPX_FORWARD(Ts, ts)...)) + HPX_FORWARD(F, f), HPX_FORWARD(Ts, ts)...)) + // clang-format on { return exec.post_at( abs_time, HPX_FORWARD(F, f), HPX_FORWARD(Ts, ts)...); @@ -420,6 +430,7 @@ namespace hpx::parallel::execution { abs_time, HPX_FORWARD(F, f), HPX_FORWARD(Ts, ts)...); } + // clang-format off template decltype(exec.post_at(abs_time, - HPX_FORWARD(F, f), HPX_FORWARD(Ts, ts)...)) + HPX_FORWARD(F, f), HPX_FORWARD(Ts, ts)...)) + // clang-format on { return exec.post_at( abs_time, HPX_FORWARD(F, f), HPX_FORWARD(Ts, ts)...); @@ -581,7 +593,7 @@ namespace hpx::parallel::execution { timed_executor; } // namespace hpx::parallel::execution -namespace hpx::parallel::execution { +namespace hpx::execution::experimental { /// \cond NOINTERNAL /////////////////////////////////////////////////////////////////////////// @@ -619,4 +631,4 @@ namespace hpx::parallel::execution { { }; /// \endcond -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental diff --git a/libs/core/timed_execution/tests/unit/minimal_timed_sync_executor.cpp b/libs/core/timed_execution/tests/unit/minimal_timed_sync_executor.cpp index d3f42cc0087a..1680dcfbbc6b 100644 --- a/libs/core/timed_execution/tests/unit/minimal_timed_sync_executor.cpp +++ b/libs/core/timed_execution/tests/unit/minimal_timed_sync_executor.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2022 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 @@ -175,7 +175,7 @@ struct test_timed_sync_executor1 : test_sync_executor1 } }; -namespace hpx::parallel::execution { +namespace hpx::execution::experimental { template <> struct is_one_way_executor : std::true_type { @@ -185,7 +185,7 @@ namespace hpx::parallel::execution { struct is_one_way_executor : std::true_type { }; -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental struct test_sync_executor2 : test_sync_executor1 { @@ -213,7 +213,7 @@ struct test_timed_sync_executor2 : test_sync_executor2 } }; -namespace hpx::parallel::execution { +namespace hpx::execution::experimental { template <> struct is_one_way_executor : std::true_type { @@ -223,7 +223,7 @@ namespace hpx::parallel::execution { struct is_one_way_executor : std::true_type { }; -} // namespace hpx::parallel::execution +} // namespace hpx::execution::experimental /////////////////////////////////////////////////////////////////////////////// int hpx_main() diff --git a/libs/full/init_runtime/tests/unit/parcel_pool.cpp b/libs/full/init_runtime/tests/unit/parcel_pool.cpp index 8af55dfb0d47..ed7b6e18150b 100644 --- a/libs/full/init_runtime/tests/unit/parcel_pool.cpp +++ b/libs/full/init_runtime/tests/unit/parcel_pool.cpp @@ -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 @@ -149,13 +149,12 @@ void test_service_executor(Executor& exec) int hpx_main() { - using namespace hpx::parallel; - using hpx::parallel::execution::service_executor_type; + using hpx::execution::experimental::service_executor_type; #if defined(HPX_HAVE_NETWORKING) if (hpx::is_networking_enabled()) { - execution::service_executor exec( + hpx::execution::experimental::service_executor exec( service_executor_type::parcel_thread_pool); test_service_executor(exec); } diff --git a/tests/performance/local/future_overhead.cpp b/tests/performance/local/future_overhead.cpp index 26d417b8a3aa..d310115979e9 100644 --- a/tests/performance/local/future_overhead.cpp +++ b/tests/performance/local/future_overhead.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2018-2020 Mikael Simberg // Copyright (c) 2018-2019 John Biddiscombe // Copyright (c) 2011 Bryce Adelstein-Lelbach +// Copyright (c) 2024 Hartmut Kaiser // // SPDX-License-Identifier: BSL-1.0 // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -279,7 +280,7 @@ struct unlimited_number_of_chunks { template friend std::size_t tag_override_invoke( - hpx::parallel::execution::maximal_number_of_chunks_t, + hpx::execution::experimental::maximal_number_of_chunks_t, unlimited_number_of_chunks, Executor&&, std::size_t, std::size_t num_tasks) { @@ -288,7 +289,7 @@ struct unlimited_number_of_chunks }; template <> -struct hpx::parallel::execution::is_executor_parameters< +struct hpx::execution::experimental::is_executor_parameters< unlimited_number_of_chunks> : std::true_type { };