From 2651fc2561239ab7d09e5943277ae0f2b566e2b7 Mon Sep 17 00:00:00 2001 From: Hartmut Kaiser Date: Sun, 21 Jan 2018 13:46:42 -0600 Subject: [PATCH] This patch disables default executor compatibility with V1 executors - this is in preparation with the V1.1. release at which point the V1 executors should be disabled by default - this also sets the default for HPX_HAVE_TRANSFORM_REDUCE_COMPATIBILITY to OFF --- CMakeLists.txt | 12 +-- docs/hpx.idx | 2 +- .../quickstart/component_with_executor.cpp | 4 +- .../oversubscribing_resource_partitioner.cpp | 2 +- .../simple_resource_partitioner.cpp | 2 +- hpx/compute/host/block_executor.hpp | 20 ++--- hpx/lcos/local/spmd_block.hpp | 58 ++++++------ hpx/lcos/spmd_block.hpp | 18 ++-- hpx/parallel/algorithms/inclusive_scan.hpp | 8 +- hpx/parallel/algorithms/inner_product.hpp | 6 +- .../algorithms/transform_exclusive_scan.hpp | 8 +- .../algorithms/transform_inclusive_scan.hpp | 8 +- hpx/parallel/algorithms/transform_reduce.hpp | 2 +- .../executors/execution_information.hpp | 53 +++++++++-- hpx/parallel/executors/rebind_executor.hpp | 88 +++++++++++-------- hpx/parallel/executors/timed_executors.hpp | 4 +- hpx/parallel/spmd_block.hpp | 12 ++- hpx/traits/is_timed_executor.hpp | 2 - .../local/transform_reduce_scaling.cpp | 17 ++-- .../parallel/executors/is_executor_1691.cpp | 21 +++-- .../parallel/scan_different_inits.cpp | 28 +++--- .../partitioned_vector_transform_scan.cpp | 8 +- tests/unit/parallel/spmd_block.cpp | 61 +++++++------ tests/unit/parallel/task_block_executor.cpp | 4 +- tests/unit/resource/named_pool_executor.cpp | 10 ++- tests/unit/threads/resource_manager.cpp | 33 ++++--- 26 files changed, 279 insertions(+), 212 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cb84f85c544a..4ce84b5c121f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -940,24 +940,24 @@ endif() # HPX_WITH_EXECUTOR_COMPATIBILITY: introduced in V1.0.0 hpx_option(HPX_WITH_EXECUTOR_COMPATIBILITY BOOL - "Enable old (pre-concurrency TS) executor API (default: ON)" - ON ADVANCED) + "Enable old (pre-concurrency TS) executor API (default: OFF)" + OFF ADVANCED) if(HPX_WITH_EXECUTOR_COMPATIBILITY) hpx_add_config_define(HPX_HAVE_EXECUTOR_COMPATIBILITY) endif() # HPX_WITH_EXECUTION_POLICY_COMPATIBILITY: introduced in V1.0.0 hpx_option(HPX_WITH_EXECUTION_POLICY_COMPATIBILITY BOOL - "Enable old execution policy names in API (default: ON)" - ON ADVANCED) + "Enable old execution policy names in API (default: OFF)" + OFF ADVANCED) if(HPX_WITH_EXECUTION_POLICY_COMPATIBILITY) hpx_add_config_define(HPX_HAVE_EXECUTION_POLICY_COMPATIBILITY) endif() # HPX_WITH_TRANSFORM_REDUCE_COMPATIBILITY: introduced in V1.0.0 hpx_option(HPX_WITH_TRANSFORM_REDUCE_COMPATIBILITY BOOL - "Enable old overloads for transform_reduce and inner_product (default: ON)" - ON ADVANCED) + "Enable old overloads for transform_reduce and inner_product (default: OFF)" + OFF ADVANCED) if(HPX_WITH_TRANSFORM_REDUCE_COMPATIBILITY) hpx_add_config_define(HPX_HAVE_TRANSFORM_REDUCE_COMPATIBILITY) endif() diff --git a/docs/hpx.idx b/docs/hpx.idx index 0ec52ecb691f..cd9ac146b435 100644 --- a/docs/hpx.idx +++ b/docs/hpx.idx @@ -114,7 +114,7 @@ parallel::is_executor "is_executor" "hpx\ parallel::execution::sequenced_execution_tag "sequenced_execution_tag" "hpx\.parallel\.execution\.sequenced_execution_tag.*" parallel::execution::parallel_execution_tag "parallel_execution_tag" "hpx\.parallel\.execution\.parallel_execution_tag.*" -parallel::execution::vector_execution_tag "vector_execution_tag" "hpx\.parallel\.execution\.vector_execution_tag.*" +parallel::execution::unsequenced_execution_tag "unsequenced_execution_tag" "hpx\.parallel\.execution\.unsequenced_execution_tag.*" # hpx/parallel/executors/sequential_executor.hpp parallel::execution::sequenced_executor "sequenced_executor" "hpx\.parallel\.execution\.sequenced_executor.*" diff --git a/examples/quickstart/component_with_executor.cpp b/examples/quickstart/component_with_executor.cpp index 3363ed0d0562..09d317c0453e 100644 --- a/examples/quickstart/component_with_executor.cpp +++ b/examples/quickstart/component_with_executor.cpp @@ -15,10 +15,10 @@ // Define a base component which exposes the required interface struct hello_world_server : hpx::components::executor_component< - hpx::parallel::local_priority_queue_executor, + hpx::parallel::execution::local_priority_queue_executor, hpx::components::component_base > { - typedef hpx::parallel::local_priority_queue_executor executor_type; + typedef hpx::parallel::execution::local_priority_queue_executor executor_type; typedef hpx::components::executor_component< executor_type, hpx::components::component_base > base_type; diff --git a/examples/resource_partitioner/oversubscribing_resource_partitioner.cpp b/examples/resource_partitioner/oversubscribing_resource_partitioner.cpp index 600861e0a6d1..d4d246377cfc 100644 --- a/examples/resource_partitioner/oversubscribing_resource_partitioner.cpp +++ b/examples/resource_partitioner/oversubscribing_resource_partitioner.cpp @@ -151,7 +151,7 @@ int hpx_main(boost::program_options::variables_map& vm) std::set thread_set; // test a parallel algorithm on custom pool with high priority - hpx::parallel::static_chunk_size fixed(1); + hpx::parallel::execution::static_chunk_size fixed(1); hpx::parallel::for_loop_strided( hpx::parallel::execution::par.with(fixed).on(high_priority_executor), 0, loop_count, 1, [&](std::size_t i) { diff --git a/examples/resource_partitioner/simple_resource_partitioner.cpp b/examples/resource_partitioner/simple_resource_partitioner.cpp index 220f38848e3e..430b57ba0912 100644 --- a/examples/resource_partitioner/simple_resource_partitioner.cpp +++ b/examples/resource_partitioner/simple_resource_partitioner.cpp @@ -153,7 +153,7 @@ int hpx_main(boost::program_options::variables_map& vm) std::set thread_set; // test a parallel algorithm on custom pool with high priority - hpx::parallel::static_chunk_size fixed(1); + hpx::parallel::execution::static_chunk_size fixed(1); hpx::parallel::for_loop_strided( hpx::parallel::execution::par.with(fixed).on(high_priority_executor), 0, loop_count, 1, [&](std::size_t i) { diff --git a/hpx/compute/host/block_executor.hpp b/hpx/compute/host/block_executor.hpp index b42c66d8aa53..27c3ec674774 100644 --- a/hpx/compute/host/block_executor.hpp +++ b/hpx/compute/host/block_executor.hpp @@ -137,16 +137,16 @@ namespace hpx { namespace compute { namespace host template std::vector::type> - > + >::type + > > bulk_async_execute(F && f, Shape const& shape, Ts &&... ts) { std::vector::type + typename parallel::execution::detail::bulk_function_result< + F, Shape, Ts... + >::type > > results; std::size_t cnt = util::size(shape); std::size_t part_size = cnt / executors_.size(); @@ -181,13 +181,13 @@ namespace hpx { namespace compute { namespace host } } - template - typename hpx::parallel::v3::detail::bulk_execute_result< + template + typename parallel::execution::detail::bulk_execute_result< F, Shape, Ts... >::type - bulk_sync_execute(F && f, Shape const& shape, Ts &&... ts) + bulk_sync_execute(F&& f, Shape const& shape, Ts&&... ts) { - typename hpx::parallel::v3::detail::bulk_execute_result< + typename parallel::execution::detail::bulk_execute_result< F, Shape, Ts... >::type results; std::size_t cnt = util::size(shape); diff --git a/hpx/lcos/local/spmd_block.hpp b/hpx/lcos/local/spmd_block.hpp index 7c65738c1f59..6873352fc14a 100644 --- a/hpx/lcos/local/spmd_block.hpp +++ b/hpx/lcos/local/spmd_block.hpp @@ -170,15 +170,17 @@ namespace hpx { namespace lcos { namespace local // Asynchronous version template ::value>::type - > + hpx::parallel::execution::is_async_execution_policy< + ExPolicy + >::value + >::type> std::vector> - define_spmd_block(ExPolicy && policy, - std::size_t num_images, F && f, Args && ... args) + define_spmd_block(ExPolicy && policy, std::size_t num_images, F && f, + Args && ... args) { static_assert( - parallel::execution::is_execution_policy::value, - "parallel::execution::is_execution_policy::value"); + parallel::execution::is_async_execution_policy::value, + "parallel::execution::is_async_execution_policy::value"); using ftype = typename std::decay::type; using first_type = @@ -202,26 +204,24 @@ namespace hpx { namespace lcos { namespace local std::shared_ptr mtx = std::make_shared(); - return - hpx::parallel::executor_traits< - typename std::decay::type - >::bulk_async_execute( - policy.executor(), - detail::spmd_block_helper{ - barrier,barriers,mtx,std::forward(f),num_images - }, - boost::irange(std::size_t(0), num_images), - std::forward(args)...); + return hpx::parallel::execution::bulk_async_execute( + policy.executor(), + detail::spmd_block_helper{ + barrier,barriers,mtx,std::forward(f), num_images + }, + boost::irange(std::size_t(0), num_images), + std::forward(args)...); } // Synchronous version template ::value>::type - > - void - define_spmd_block(ExPolicy && policy, - std::size_t num_images, F && f, Args && ... args) + !hpx::parallel::execution::is_async_execution_policy< + ExPolicy + >::value + >::type> + void define_spmd_block(ExPolicy && policy, std::size_t num_images, + F && f, Args && ... args) { static_assert( parallel::execution::is_execution_policy::value, @@ -249,15 +249,13 @@ namespace hpx { namespace lcos { namespace local std::shared_ptr mtx = std::make_shared(); - hpx::parallel::executor_traits< - typename std::decay::type - >::bulk_execute( - policy.executor(), - detail::spmd_block_helper{ - barrier,barriers,mtx,std::forward(f),num_images - }, - boost::irange(std::size_t(0), num_images), - std::forward(args)...); + hpx::parallel::execution::bulk_sync_execute( + policy.executor(), + detail::spmd_block_helper{ + barrier,barriers,mtx,std::forward(f), num_images + }, + boost::irange(std::size_t(0), num_images), + std::forward(args)...); } template diff --git a/hpx/lcos/spmd_block.hpp b/hpx/lcos/spmd_block.hpp index e190cad66b8b..efd04c5713a8 100644 --- a/hpx/lcos/spmd_block.hpp +++ b/hpx/lcos/spmd_block.hpp @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include @@ -289,15 +289,13 @@ namespace hpx { namespace lcos std::size_t offset = hpx::get_locality_id(); offset *= images_per_locality; - hpx::parallel::executor_traits< - executor_type - >::bulk_execute( - exec, - detail::spmd_block_helper{ - name,images_per_locality, num_images}, - boost::irange( - offset, offset + images_per_locality), - args...); + hpx::parallel::execution::bulk_sync_execute( + exec, + detail::spmd_block_helper{ + name,images_per_locality, num_images}, + boost::irange( + offset, offset + images_per_locality), + args...); } }; } diff --git a/hpx/parallel/algorithms/inclusive_scan.hpp b/hpx/parallel/algorithms/inclusive_scan.hpp index dd0c00ab00f6..bc419100e7d0 100644 --- a/hpx/parallel/algorithms/inclusive_scan.hpp +++ b/hpx/parallel/algorithms/inclusive_scan.hpp @@ -289,7 +289,7 @@ namespace hpx { namespace parallel { inline namespace v1 template ::value && + execution::is_execution_policy::value && hpx::traits::is_iterator::value && hpx::traits::is_iterator::value && hpx::traits::is_invocable::value && + execution::is_execution_policy::value && hpx::traits::is_iterator::value && hpx::traits::is_iterator::value && hpx::traits::is_invocable::value && + execution::is_execution_policy::value && hpx::traits::is_iterator::value && hpx::traits::is_iterator::value && !hpx::traits::is_invocable::value && + execution::is_execution_policy::value && hpx::traits::is_iterator::value && hpx::traits::is_iterator::value && hpx::traits::is_invocable + HPX_DEPRECATED(HPX_DEPRECATED_MSG) inline typename std::enable_if< - is_execution_policy::value, + execution::is_execution_policy::value, typename util::detail::algorithm_result::type >::type inner_product(ExPolicy&& policy, FwdIter1 first1, FwdIter1 last1, @@ -166,8 +167,9 @@ namespace hpx { namespace parallel { inline namespace v1 /// template + HPX_DEPRECATED(HPX_DEPRECATED_MSG) inline typename std::enable_if< - is_execution_policy::value, + execution::is_execution_policy::value, typename util::detail::algorithm_result::type >::type inner_product(ExPolicy&& policy, FwdIter1 first1, FwdIter1 last1, diff --git a/hpx/parallel/algorithms/transform_exclusive_scan.hpp b/hpx/parallel/algorithms/transform_exclusive_scan.hpp index 4c7fec70e399..a128e676a458 100644 --- a/hpx/parallel/algorithms/transform_exclusive_scan.hpp +++ b/hpx/parallel/algorithms/transform_exclusive_scan.hpp @@ -186,7 +186,7 @@ namespace hpx { namespace parallel { inline namespace v1 "Requires at least output iterator."); typedef std::integral_constant::value || + execution::is_sequenced_execution_policy::value || !hpx::traits::is_forward_iterator::value || !hpx::traits::is_forward_iterator::value > is_seq; @@ -198,7 +198,7 @@ namespace hpx { namespace parallel { inline namespace v1 (hpx::traits::is_forward_iterator::value), "Requires at least forward iterator."); - typedef is_sequenced_execution_policy is_seq; + typedef execution::is_sequenced_execution_policy is_seq; #endif return detail::transform_exclusive_scan().call( @@ -315,7 +315,7 @@ namespace hpx { namespace parallel { inline namespace v1 template ::value && + execution::is_execution_policy::value && hpx::traits::is_iterator::value && hpx::traits::is_iterator::value && hpx::traits::is_invocable::value && + execution::is_execution_policy::value && hpx::traits::is_iterator::value && hpx::traits::is_iterator::value && hpx::traits::is_invocable::value || + execution::is_sequenced_execution_policy::value || !hpx::traits::is_forward_iterator::value || !hpx::traits::is_forward_iterator::value > is_seq; @@ -197,7 +197,7 @@ namespace hpx { namespace parallel { inline namespace v1 (hpx::traits::is_forward_iterator::value), "Requires at least forward iterator."); - typedef is_sequenced_execution_policy is_seq; + typedef execution::is_sequenced_execution_policy is_seq; #endif return detail::transform_inclusive_scan().call( std::forward(policy), is_seq(), @@ -374,7 +374,7 @@ namespace hpx { namespace parallel { inline namespace v1 template ::value && + execution::is_execution_policy::value && hpx::traits::is_iterator::value && hpx::traits::is_iterator::value && hpx::traits::is_invocable::value && + execution::is_execution_policy::value && hpx::traits::is_iterator::value && hpx::traits::is_iterator::value && hpx::traits::is_invocable::value && + execution::is_execution_policy::value && hpx::traits::is_iterator::value && hpx::traits::is_invocable::value_type diff --git a/hpx/parallel/executors/execution_information.hpp b/hpx/parallel/executors/execution_information.hpp index 7f7891b9f88b..93b9e0c64d05 100644 --- a/hpx/parallel/executors/execution_information.hpp +++ b/hpx/parallel/executors/execution_information.hpp @@ -46,6 +46,49 @@ namespace hpx { namespace parallel { namespace execution /////////////////////////////////////////////////////////////////////// // customization point for interface processing_units_count() + template + struct processing_units_count_parameter_helper + { + template + static std::size_t call(hpx::traits::detail::wrap_int, + Parameters && params, Executor && exec) + { + return hpx::get_os_thread_count(); + } + + template + static auto call(int, Parameters && params, Executor && exec) + -> decltype(params.processing_units_count( + std::forward(exec))) + { + return params.processing_units_count( + std::forward(exec)); + } + + template + static std::size_t call(Parameters_& params, Executor && exec) + { + return call(0, params, std::forward(exec)); + } + + template + static std::size_t call(Parameters params, Executor && exec) + { + return call(static_cast(params), + std::forward(exec)); + } + }; + + template + std::size_t call_processing_units_parameter_count(Parameters && params, + Executor && exec) + { + return processing_units_count_parameter_helper< + typename hpx::util::decay_unwrap::type + >::call(std::forward(params), + std::forward(exec)); + } + template struct processing_units_count_fn_helper decltype(parallel::v3::detail:: - call_processing_units_parameter_count(params, - std::forward(exec))) + -> decltype(call_processing_units_parameter_count(params, + std::forward(exec))) { - return parallel::v3::detail:: - call_processing_units_parameter_count(params, - std::forward(exec)); + return call_processing_units_parameter_count( + params, std::forward(exec)); } template diff --git a/hpx/parallel/executors/rebind_executor.hpp b/hpx/parallel/executors/rebind_executor.hpp index 6cf122222006..21b786853cfc 100644 --- a/hpx/parallel/executors/rebind_executor.hpp +++ b/hpx/parallel/executors/rebind_executor.hpp @@ -7,43 +7,13 @@ #define HPX_PARALLEL_REBIND_EXECUTOR_SEP_07_2016_0658AM #include +#include #include #include - -#if defined(HPX_HAVE_EXECUTOR_COMPATIBILITY) -#include -#include #include -#include - -namespace hpx { namespace parallel { inline namespace v1 +namespace hpx { namespace parallel { namespace execution { - /////////////////////////////////////////////////////////////////////////// - /// Function invocations executed by a group of sequential execution agents - /// execute in sequential order. - using sequential_execution_tag = - parallel::execution::sequenced_execution_tag; - - /// Function invocations executed by a group of parallel execution agents - /// execute in unordered fashion. Any such invocations executing in the - /// same thread are indeterminately sequenced with respect to each other. - /// - /// \note \a parallel_execution_tag is weaker than - /// \a sequential_execution_tag. - using parallel_execution_tag = - parallel::execution::parallel_execution_tag; - - /// Function invocations executed by a group of vector execution agents are - /// permitted to execute in unordered fashion when executed in different - /// threads, and un-sequenced with respect to one another when executed in - /// the same thread. - /// - /// \note \a vector_execution_tag is weaker than - /// \a parallel_execution_tag. - using vector_execution_tag = - parallel::execution::unsequenced_execution_tag; - /////////////////////////////////////////////////////////////////////////// namespace detail { @@ -59,17 +29,17 @@ namespace hpx { namespace parallel { inline namespace v1 {}; template <> - struct is_not_weaker + struct is_not_weaker : std::true_type {}; template <> - struct is_not_weaker + struct is_not_weaker : std::true_type {}; template <> - struct is_not_weaker + struct is_not_weaker : std::true_type {}; /// \endcond @@ -81,8 +51,8 @@ namespace hpx { namespace parallel { inline namespace v1 struct rebind_executor { /// \cond NOINTERNAL - typedef typename hpx::util::decay::type executor_type; - typedef typename hpx::util::decay::type parameters_type; + typedef typename std::decay::type executor_type; + typedef typename std::decay::type parameters_type; typedef typename ExecutionPolicy::execution_category category1; typedef typename hpx::traits::executor_execution_category< @@ -90,8 +60,8 @@ namespace hpx { namespace parallel { inline namespace v1 >::type category2; static_assert( - (parallel::v1::detail::is_not_weaker::value), - "parallel::v1::detail::is_not_weaker::value" + detail::is_not_weaker::value, + "detail::is_not_weaker::value" ); /// \endcond @@ -101,6 +71,46 @@ namespace hpx { namespace parallel { inline namespace v1 >::type type; }; }}} + +#if defined(HPX_HAVE_EXECUTOR_COMPATIBILITY) +#include + +#include + +namespace hpx { namespace parallel { inline namespace v1 +{ + /////////////////////////////////////////////////////////////////////////// + /// Function invocations executed by a group of sequential execution agents + /// execute in sequential order. + using sequential_execution_tag = + parallel::execution::sequenced_execution_tag; + + /// Function invocations executed by a group of parallel execution agents + /// execute in unordered fashion. Any such invocations executing in the + /// same thread are indeterminately sequenced with respect to each other. + /// + /// \note \a parallel_execution_tag is weaker than + /// \a sequential_execution_tag. + using parallel_execution_tag = + parallel::execution::parallel_execution_tag; + + /// Function invocations executed by a group of vector execution agents are + /// permitted to execute in unordered fashion when executed in different + /// threads, and un-sequenced with respect to one another when executed in + /// the same thread. + /// + /// \note \a vector_execution_tag is weaker than + /// \a parallel_execution_tag. + using vector_execution_tag = + parallel::execution::unsequenced_execution_tag; + + /////////////////////////////////////////////////////////////////////////// + // Rebind the type of executor used by an execution policy. The execution + // category of Executor shall not be weaker than that of ExecutionPolicy. + template + using rebind_executor = parallel::execution:: + rebind_executor; +}}} #endif #endif diff --git a/hpx/parallel/executors/timed_executors.hpp b/hpx/parallel/executors/timed_executors.hpp index f26fc71c9264..0004d31250b7 100644 --- a/hpx/parallel/executors/timed_executors.hpp +++ b/hpx/parallel/executors/timed_executors.hpp @@ -196,7 +196,7 @@ namespace hpx { namespace parallel { namespace execution }; template <> - struct async_execute_at_helper + struct async_execute_at_helper { template static auto @@ -294,7 +294,7 @@ namespace hpx { namespace parallel { namespace execution }; template <> - struct post_at_helper + struct post_at_helper { template static void diff --git a/hpx/parallel/spmd_block.hpp b/hpx/parallel/spmd_block.hpp index 9be21bff6e16..796201f03a22 100644 --- a/hpx/parallel/spmd_block.hpp +++ b/hpx/parallel/spmd_block.hpp @@ -31,8 +31,10 @@ namespace hpx { namespace parallel { inline namespace v2 // Asynchronous version template ::value>::type - > + hpx::parallel::execution::is_async_execution_policy< + ExPolicy + >::value + >::type> std::vector> define_spmd_block(ExPolicy && policy, std::size_t num_images, F && f, Args && ... args) @@ -45,8 +47,10 @@ namespace hpx { namespace parallel { inline namespace v2 // Synchronous version template ::value>::type - > + !hpx::parallel::execution::is_async_execution_policy< + ExPolicy + >::value + >::type> void define_spmd_block(ExPolicy && policy, std::size_t num_images, F && f, Args && ... args) { diff --git a/hpx/traits/is_timed_executor.hpp b/hpx/traits/is_timed_executor.hpp index 46a9084c9532..77abf9be96a4 100644 --- a/hpx/traits/is_timed_executor.hpp +++ b/hpx/traits/is_timed_executor.hpp @@ -15,8 +15,6 @@ namespace hpx { namespace parallel { namespace execution { /////////////////////////////////////////////////////////////////////////// - struct timed_executor_tag : executor_tag {}; - namespace detail { /// \cond NOINTERNAL diff --git a/tests/performance/local/transform_reduce_scaling.cpp b/tests/performance/local/transform_reduce_scaling.cpp index 6d7ec4146418..7d4285ed7fb2 100644 --- a/tests/performance/local/transform_reduce_scaling.cpp +++ b/tests/performance/local/transform_reduce_scaling.cpp @@ -34,15 +34,14 @@ void measure_transform_reduce(std::size_t size) // invoke transform_reduce double result = hpx::parallel::transform_reduce(hpx::parallel::execution::par, - std::begin(data_representation), - std::end(data_representation), - 0.0, - [](Point r) - { - return r.x * r.y; - }, - std::plus() - ); + std::begin(data_representation), + std::end(data_representation), + 0.0, + std::plus(), + [](Point r) + { + return r.x * r.y; + }); HPX_UNUSED(result); } diff --git a/tests/regressions/parallel/executors/is_executor_1691.cpp b/tests/regressions/parallel/executors/is_executor_1691.cpp index 6cf6c4cc4bc1..e19aeb52abbf 100644 --- a/tests/regressions/parallel/executors/is_executor_1691.cpp +++ b/tests/regressions/parallel/executors/is_executor_1691.cpp @@ -13,15 +13,25 @@ #include /////////////////////////////////////////////////////////////////////////////// -struct my_executor : hpx::parallel::parallel_executor {}; +struct my_executor : hpx::parallel::execution::parallel_executor {}; -namespace hpx { namespace parallel { inline namespace v3 { namespace detail +namespace hpx { namespace parallel { namespace execution { template <> - struct is_executor + struct is_one_way_executor : std::true_type {}; -}}}} + + template <> + struct is_two_way_executor + : std::true_type + {}; + + template <> + struct is_bulk_two_way_executor + : std::true_type + {}; +}}} /////////////////////////////////////////////////////////////////////////////// int hpx_main(int argc, char* argv[]) @@ -33,8 +43,7 @@ int hpx_main(int argc, char* argv[]) std::vector v(100); - for_each(par.on(exec), - v.begin(), v.end(), [](int x){ }); + for_each(par.on(exec), v.begin(), v.end(), [](int x) {}); return hpx::finalize(); } diff --git a/tests/regressions/parallel/scan_different_inits.cpp b/tests/regressions/parallel/scan_different_inits.cpp index 09fef3081ea4..8eb2db2efd79 100644 --- a/tests/regressions/parallel/scan_different_inits.cpp +++ b/tests/regressions/parallel/scan_different_inits.cpp @@ -38,14 +38,14 @@ void test_zero() [](int bar, int baz){ return bar*baz; }); Iter i_transform_inc = transform_inclusive_scan(execution::par, a.begin(), a.end(), f.begin(), - 10, - [](int bar, int baz){ return 2*bar+2*baz; }, - [](int foo){ return foo - 3; }); + [](int bar, int baz){ return 2*bar+2*baz; }, + [](int foo){ return foo - 3; }, + 10); Iter i_transform_exc = transform_exclusive_scan(execution::par, a.begin(), a.end(), g.begin(), - 10, - [](int bar, int baz){ return 2*bar+2*baz; }, - [](int foo){ return foo - 3; }); + 10, + [](int bar, int baz){ return 2*bar+2*baz; }, + [](int foo){ return foo - 3; }); HPX_TEST(i_inc_add == b.begin()); HPX_TEST(i_inc_mult == c.begin()); @@ -79,13 +79,13 @@ void test_async_zero() a.begin(), a.end(), e.begin(), 10, [](int bar, int baz){ return bar*baz; }); Fut_Iter f_transform_inc = - transform_inclusive_scan(par(execution::task), + transform_inclusive_scan(execution::par(execution::task), a.begin(), a.end(), f.begin(), - 10, [](int bar, int baz){ return 2*bar+2*baz; }, - [](int foo){ return foo - 3; }); + [](int foo){ return foo - 3; }, + 10); Fut_Iter f_transform_exc = - transform_exclusive_scan(par(execution::task), + transform_exclusive_scan(execution::par(execution::task), a.begin(), a.end(), g.begin(), 10, [](int bar, int baz){ return 2*bar+2*baz; }, @@ -123,7 +123,7 @@ void test_one(std::vector a) exclusive_scan(execution::par, a.begin(), a.end(), e.begin(), 10, fun_mult); Iter f_transform_inc = transform_inclusive_scan(execution::par, a.begin(), a.end(), f.begin(), - 10, fun_add, fun_conv); + fun_add, fun_conv, 10); Iter f_transform_exc = transform_exclusive_scan(execution::par, a.begin(), a.end(), g.begin(), 10, fun_add, fun_conv); @@ -184,11 +184,11 @@ void test_async_one(std::vector a) exclusive_scan(execution::par(execution::task), a.begin(), a.end(), e.begin(), 10, fun_mult); Fut_Iter f_transform_inc = - transform_inclusive_scan(par(execution::task), + transform_inclusive_scan(execution::par(execution::task), a.begin(), a.end(), f.begin(), - 10, fun_add, fun_conv); + fun_add, fun_conv, 10); Fut_Iter f_transform_exc = - transform_exclusive_scan(par(execution::task), + transform_exclusive_scan(execution::par(execution::task), a.begin(), a.end(), g.begin(), 10, fun_add, fun_conv); diff --git a/tests/unit/parallel/segmented_algorithms/partitioned_vector_transform_scan.cpp b/tests/unit/parallel/segmented_algorithms/partitioned_vector_transform_scan.cpp index d2ce8668888f..f65a72a20bf9 100644 --- a/tests/unit/parallel/segmented_algorithms/partitioned_vector_transform_scan.cpp +++ b/tests/unit/parallel/segmented_algorithms/partitioned_vector_transform_scan.cpp @@ -40,7 +40,7 @@ void test_transform_inclusive_scan(ExPolicy && policy, hpx::partitioned_vector & xvalues, hpx::partitioned_vector & out) { hpx::parallel::transform_inclusive_scan(policy, xvalues.begin(), - xvalues.end(), out.begin(), conv(), T(0), op()); + xvalues.end(), out.begin(), op(), conv(), T(0)); } template @@ -50,7 +50,7 @@ test_transform_inclusive_scan_async(ExPolicy && policy, { hpx::parallel::transform_inclusive_scan(policy, xvalues.begin(), xvalues.end(), out.begin(), - conv(), T(0), op()).get(); + op(), conv(), T(0)).get(); } template @@ -58,7 +58,7 @@ void test_transform_exclusive_scan(ExPolicy && policy, hpx::partitioned_vector & xvalues, hpx::partitioned_vector & out) { hpx::parallel::transform_exclusive_scan(policy, xvalues.begin(), - xvalues.end(), out.begin(), conv(), T(0), op()); + xvalues.end(), out.begin(), T(0), op(), conv()); } template @@ -68,7 +68,7 @@ test_transform_exclusive_scan_async(ExPolicy && policy, { hpx::parallel::transform_exclusive_scan(policy, xvalues.begin(), xvalues.end(), out.begin(), - conv(), T(0), op()).get(); + T(0), op(), conv()).get(); } template diff --git a/tests/unit/parallel/spmd_block.cpp b/tests/unit/parallel/spmd_block.cpp index 26800e1c233a..02fda4c54f6d 100644 --- a/tests/unit/parallel/spmd_block.cpp +++ b/tests/unit/parallel/spmd_block.cpp @@ -20,16 +20,15 @@ std::size_t num_images = 10; std::size_t iterations = 20; -void bulk_test_function(hpx::parallel::v2::spmd_block block, - std::atomic * c) +void bulk_test_function(hpx::parallel::spmd_block block, + std::atomic* c) { HPX_TEST_EQ(block.get_num_images(), num_images); HPX_TEST_EQ(block.this_image() < num_images, true); // Test sync_all() - for(std::size_t i=0, test_count = num_images; - i vec_images = {5,6,7,8}; + std::vector vec_images = {5, 6, 7, 8}; - if((image_id == 5) || (image_id == 6) || (image_id == 7) || (image_id == 8)) + if ((image_id == 5) || (image_id == 6) || (image_id == 7) || + (image_id == 8)) { ++c[3]; } block.sync_images(vec_images); - if((image_id == 5) || (image_id == 6) || (image_id == 7) || (image_id == 8)) + if ((image_id == 5) || (image_id == 6) || (image_id == 7) || + (image_id == 8)) { - HPX_TEST_EQ(c[3],(std::size_t)4); + HPX_TEST_EQ(c[3], (std::size_t) 4); } block.sync_images(vec_images); - if((image_id == 5) || (image_id == 6) || (image_id == 7) || (image_id == 8)) + if ((image_id == 5) || (image_id == 6) || (image_id == 7) || + (image_id == 8)) { ++c[3]; } - block.sync_images(vec_images.begin(),vec_images.end()); - if((image_id == 5) || (image_id == 6) || (image_id == 7) || (image_id == 8)) + block.sync_images(vec_images.begin(), vec_images.end()); + if ((image_id == 5) || (image_id == 6) || (image_id == 7) || + (image_id == 8)) { - HPX_TEST_EQ(c[3],(std::size_t)8); + HPX_TEST_EQ(c[3], (std::size_t) 8); } } @@ -90,30 +93,26 @@ int main() using hpx::parallel::execution::task; auto bulk_test = - [](hpx::parallel::v2::spmd_block block, std::atomic * c) + [](hpx::parallel::spmd_block block, std::atomic * c) { bulk_test_function(std::move(block),c); }; std::array,4> c1, c2, c3; - for(std::size_t i =0; i<4; i++) + for (std::size_t i =0; i<4; i++) { c1[i] = c2[i] = c3[i] = (std::size_t)0; } - hpx::parallel::v2::define_spmd_block( - num_images, bulk_test, c1.data() ); + hpx::parallel::define_spmd_block(num_images, bulk_test, c1.data()); - std::vector> join = - hpx::parallel::v2::define_spmd_block( - par(task), - num_images, bulk_test, c2.data() ); + std::vector> join = hpx::parallel::define_spmd_block( + par(task), num_images, bulk_test, c2.data()); hpx::wait_all(join); - hpx::parallel::v2::define_spmd_block( - num_images, bulk_test_function, c3.data() ); + hpx::parallel::define_spmd_block(num_images, bulk_test_function, c3.data()); return 0; } diff --git a/tests/unit/parallel/task_block_executor.cpp b/tests/unit/parallel/task_block_executor.cpp index ccc7f3cbffec..6fa412909453 100644 --- a/tests/unit/parallel/task_block_executor.cpp +++ b/tests/unit/parallel/task_block_executor.cpp @@ -411,12 +411,12 @@ void test_executor_task_block(Executor& exec) int hpx_main() { { - hpx::parallel::sequential_executor exec; + hpx::parallel::execution::sequenced_executor exec; test_executor_task_block(exec); } { - hpx::parallel::parallel_executor exec; + hpx::parallel::execution::parallel_executor exec; test_executor_task_block(exec); define_task_block_exceptions_test3(exec); diff --git a/tests/unit/resource/named_pool_executor.cpp b/tests/unit/resource/named_pool_executor.cpp index 491dbe9004c7..1f598ffadd93 100644 --- a/tests/unit/resource/named_pool_executor.cpp +++ b/tests/unit/resource/named_pool_executor.cpp @@ -7,10 +7,12 @@ // pool and executor #include -#include + +#include #include -#include +#include #include +#include #include #include @@ -48,11 +50,11 @@ int hpx_main(int argc, char* argv[]) // the test to fail hpx::threads::scheduled_executor exec_0_hp = hpx::threads::executors::pool_executor("default", - hpx::threads::thread_priority_high); + hpx::threads::thread_priority_high); hpx::threads::scheduled_executor exec_0 = hpx::threads::executors::pool_executor("default", - hpx::threads::thread_priority_default); + hpx::threads::thread_priority_default); std::vector> lotsa_futures; diff --git a/tests/unit/threads/resource_manager.cpp b/tests/unit/threads/resource_manager.cpp index 13352bce0455..be1471819bc5 100644 --- a/tests/unit/threads/resource_manager.cpp +++ b/tests/unit/threads/resource_manager.cpp @@ -59,8 +59,6 @@ void test_executors(std::size_t processing_units, std::size_t num_pus) std::atomic count_invocations(0); std::size_t const num_tasks = 100; - typedef hpx::parallel::executor_information_traits infotraits; - std::size_t num_execs = processing_units / num_pus; { @@ -77,7 +75,9 @@ void test_executors(std::size_t processing_units, std::size_t num_pus) for(Executor& exec : execs) { - HPX_TEST_EQ(infotraits::processing_units_count(exec, test::dummy), + HPX_TEST_EQ( + hpx::parallel::execution::processing_units_count( + exec, test::dummy), num_pus); } @@ -97,7 +97,9 @@ void test_executors(std::size_t processing_units, std::size_t num_pus) // test again for(Executor& exec : execs) { - HPX_TEST_EQ(infotraits::processing_units_count(exec, test::dummy), + HPX_TEST_EQ( + hpx::parallel::execution::processing_units_count( + exec, test::dummy), num_pus); } } @@ -107,7 +109,7 @@ void test_executors(std::size_t processing_units, std::size_t num_pus) void test_executors(std::size_t num_pus) { - using namespace hpx::parallel; + using namespace hpx::parallel::execution; std::size_t processing_units = hpx::get_os_thread_count(); processing_units = (processing_units / num_pus) * num_pus; @@ -131,8 +133,6 @@ void test_executors_shrink(std::size_t processing_units, std::size_t num_pus) std::atomic count_invocations(0); std::size_t const num_tasks = 100; - typedef hpx::parallel::executor_information_traits infotraits; - // create one executor which can give back processing units Executor shrink_exec(processing_units); @@ -140,7 +140,8 @@ void test_executors_shrink(std::size_t processing_units, std::size_t num_pus) hpx::this_thread::yield(); HPX_TEST_EQ( - infotraits::processing_units_count(shrink_exec, test::dummy), + hpx::parallel::execution::processing_units_count( + shrink_exec, test::dummy), processing_units); std::size_t num_execs = (processing_units-1) / num_pus; @@ -157,13 +158,16 @@ void test_executors_shrink(std::size_t processing_units, std::size_t num_pus) for(Executor& exec : execs) { - HPX_TEST_EQ(infotraits::processing_units_count(exec, test::dummy), + HPX_TEST_EQ( + hpx::parallel::execution::processing_units_count( + exec, test::dummy), num_pus); } // the main executor should run on a reduced amount of cores HPX_TEST_EQ( - infotraits::processing_units_count(shrink_exec, test::dummy), + hpx::parallel::execution::processing_units_count( + shrink_exec, test::dummy), processing_units - num_execs * num_pus); // schedule a couple of tasks on each of the executors @@ -182,13 +186,16 @@ void test_executors_shrink(std::size_t processing_units, std::size_t num_pus) // test again for(Executor& exec : execs) { - HPX_TEST_EQ(infotraits::processing_units_count(exec, test::dummy), + HPX_TEST_EQ( + hpx::parallel::execution::processing_units_count( + exec, test::dummy), num_pus); } // the main executor should run on a reduced amount of cores HPX_TEST_EQ( - infotraits::processing_units_count(shrink_exec, test::dummy), + hpx::parallel::execution::processing_units_count( + shrink_exec, test::dummy), processing_units - num_execs * num_pus); } @@ -197,7 +204,7 @@ void test_executors_shrink(std::size_t processing_units, std::size_t num_pus) void test_executors_shrink(std::size_t num_pus) { - using namespace hpx::parallel; + using namespace hpx::parallel::execution; std::size_t processing_units = hpx::get_os_thread_count(); processing_units = (processing_units / num_pus) * num_pus;