Skip to content

Commit

Permalink
This patch disables default executor compatibility with V1 executors
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
hkaiser committed Jan 26, 2018
1 parent 2639df1 commit 2651fc2
Show file tree
Hide file tree
Showing 26 changed files with 279 additions and 212 deletions.
12 changes: 6 additions & 6 deletions CMakeLists.txt
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion docs/hpx.idx
Expand Up @@ -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.*"
Expand Down
4 changes: 2 additions & 2 deletions examples/quickstart/component_with_executor.cpp
Expand Up @@ -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<hello_world_server> >
{
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<hello_world_server>
> base_type;
Expand Down
Expand Up @@ -151,7 +151,7 @@ int hpx_main(boost::program_options::variables_map& vm)
std::set<std::thread::id> 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) {
Expand Down
Expand Up @@ -153,7 +153,7 @@ int hpx_main(boost::program_options::variables_map& vm)
std::set<std::thread::id> 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) {
Expand Down
20 changes: 10 additions & 10 deletions hpx/compute/host/block_executor.hpp
Expand Up @@ -137,16 +137,16 @@ namespace hpx { namespace compute { namespace host

template <typename F, typename Shape, typename ... Ts>
std::vector<hpx::future<
typename hpx::parallel::v3::detail::bulk_async_execute_result<
typename parallel::execution::detail::bulk_function_result<
F, Shape, Ts...
>::type>
>
>::type
> >
bulk_async_execute(F && f, Shape const& shape, Ts &&... ts)
{
std::vector<hpx::future<
typename hpx::parallel::v3::detail::bulk_async_execute_result<
F, Shape, Ts...
>::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();
Expand Down Expand Up @@ -181,13 +181,13 @@ namespace hpx { namespace compute { namespace host
}
}

template <typename F, typename Shape, typename ... Ts>
typename hpx::parallel::v3::detail::bulk_execute_result<
template <typename F, typename Shape, typename... Ts>
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);
Expand Down
58 changes: 28 additions & 30 deletions hpx/lcos/local/spmd_block.hpp
Expand Up @@ -170,15 +170,17 @@ namespace hpx { namespace lcos { namespace local
// Asynchronous version
template <typename ExPolicy, typename F, typename ... Args,
typename = typename std::enable_if<
hpx::parallel::v1::is_async_execution_policy<ExPolicy>::value>::type
>
hpx::parallel::execution::is_async_execution_policy<
ExPolicy
>::value
>::type>
std::vector<hpx::future<void>>
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<ExPolicy>::value,
"parallel::execution::is_execution_policy<ExPolicy>::value");
parallel::execution::is_async_execution_policy<ExPolicy>::value,
"parallel::execution::is_async_execution_policy<ExPolicy>::value");

using ftype = typename std::decay<F>::type;
using first_type =
Expand All @@ -202,26 +204,24 @@ namespace hpx { namespace lcos { namespace local
std::shared_ptr<mutex_type> mtx
= std::make_shared<mutex_type>();

return
hpx::parallel::executor_traits<
typename std::decay<executor_type>::type
>::bulk_async_execute(
policy.executor(),
detail::spmd_block_helper<F>{
barrier,barriers,mtx,std::forward<F>(f),num_images
},
boost::irange(std::size_t(0), num_images),
std::forward<Args>(args)...);
return hpx::parallel::execution::bulk_async_execute(
policy.executor(),
detail::spmd_block_helper<F>{
barrier,barriers,mtx,std::forward<F>(f), num_images
},
boost::irange(std::size_t(0), num_images),
std::forward<Args>(args)...);
}

// Synchronous version
template <typename ExPolicy, typename F, typename ... Args,
typename = typename std::enable_if<
!hpx::parallel::v1::is_async_execution_policy<ExPolicy>::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<ExPolicy>::value,
Expand Down Expand Up @@ -249,15 +249,13 @@ namespace hpx { namespace lcos { namespace local
std::shared_ptr<mutex_type> mtx
= std::make_shared<mutex_type>();

hpx::parallel::executor_traits<
typename std::decay<executor_type>::type
>::bulk_execute(
policy.executor(),
detail::spmd_block_helper<F>{
barrier,barriers,mtx,std::forward<F>(f),num_images
},
boost::irange(std::size_t(0), num_images),
std::forward<Args>(args)...);
hpx::parallel::execution::bulk_sync_execute(
policy.executor(),
detail::spmd_block_helper<F>{
barrier,barriers,mtx,std::forward<F>(f), num_images
},
boost::irange(std::size_t(0), num_images),
std::forward<Args>(args)...);
}

template <typename F, typename ... Args>
Expand Down
18 changes: 8 additions & 10 deletions hpx/lcos/spmd_block.hpp
Expand Up @@ -10,7 +10,7 @@
#include <hpx/lcos/future.hpp>
#include <hpx/lcos/barrier.hpp>
#include <hpx/lcos/broadcast.hpp>
#include <hpx/parallel/execution_policy.hpp>
#include <hpx/parallel/execution.hpp>
#include <hpx/runtime/get_locality_id.hpp>
#include <hpx/runtime/launch_policy.hpp>
#include <hpx/runtime/serialization/serialize.hpp>
Expand Down Expand Up @@ -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<F>{
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<F>{
name,images_per_locality, num_images},
boost::irange(
offset, offset + images_per_locality),
args...);
}
};
}
Expand Down
8 changes: 4 additions & 4 deletions hpx/parallel/algorithms/inclusive_scan.hpp
Expand Up @@ -289,7 +289,7 @@ namespace hpx { namespace parallel { inline namespace v1
template <typename ExPolicy, typename FwdIter1, typename FwdIter2, typename Op,
typename T,
HPX_CONCEPT_REQUIRES_(
is_execution_policy<ExPolicy>::value &&
execution::is_execution_policy<ExPolicy>::value &&
hpx::traits::is_iterator<FwdIter1>::value &&
hpx::traits::is_iterator<FwdIter2>::value &&
hpx::traits::is_invocable<Op,
Expand Down Expand Up @@ -330,7 +330,7 @@ namespace hpx { namespace parallel { inline namespace v1
template <typename ExPolicy, typename FwdIter1, typename FwdIter2, typename T,
typename Op,
HPX_CONCEPT_REQUIRES_(
is_execution_policy<ExPolicy>::value &&
execution::is_execution_policy<ExPolicy>::value &&
hpx::traits::is_iterator<FwdIter1>::value &&
hpx::traits::is_iterator<FwdIter2>::value &&
hpx::traits::is_invocable<Op,
Expand Down Expand Up @@ -429,7 +429,7 @@ namespace hpx { namespace parallel { inline namespace v1
///
template <typename ExPolicy, typename FwdIter1, typename FwdIter2, typename T,
HPX_CONCEPT_REQUIRES_(
is_execution_policy<ExPolicy>::value &&
execution::is_execution_policy<ExPolicy>::value &&
hpx::traits::is_iterator<FwdIter1>::value &&
hpx::traits::is_iterator<FwdIter2>::value &&
!hpx::traits::is_invocable<T,
Expand Down Expand Up @@ -542,7 +542,7 @@ namespace hpx { namespace parallel { inline namespace v1
///
template <typename ExPolicy, typename FwdIter1, typename FwdIter2, typename Op,
HPX_CONCEPT_REQUIRES_(
is_execution_policy<ExPolicy>::value &&
execution::is_execution_policy<ExPolicy>::value &&
hpx::traits::is_iterator<FwdIter1>::value &&
hpx::traits::is_iterator<FwdIter2>::value &&
hpx::traits::is_invocable<Op,
Expand Down
6 changes: 4 additions & 2 deletions hpx/parallel/algorithms/inner_product.hpp
Expand Up @@ -71,8 +71,9 @@ namespace hpx { namespace parallel { inline namespace v1
/// of \a transform_reduce.
///
template <typename ExPolicy, typename FwdIter1, typename FwdIter2, typename T>
HPX_DEPRECATED(HPX_DEPRECATED_MSG)
inline typename std::enable_if<
is_execution_policy<ExPolicy>::value,
execution::is_execution_policy<ExPolicy>::value,
typename util::detail::algorithm_result<ExPolicy, T>::type
>::type
inner_product(ExPolicy&& policy, FwdIter1 first1, FwdIter1 last1,
Expand Down Expand Up @@ -166,8 +167,9 @@ namespace hpx { namespace parallel { inline namespace v1
///
template <typename ExPolicy, typename FwdIter1, typename FwdIter2, typename T,
typename Op1, typename Op2>
HPX_DEPRECATED(HPX_DEPRECATED_MSG)
inline typename std::enable_if<
is_execution_policy<ExPolicy>::value,
execution::is_execution_policy<ExPolicy>::value,
typename util::detail::algorithm_result<ExPolicy, T>::type
>::type
inner_product(ExPolicy&& policy, FwdIter1 first1, FwdIter1 last1,
Expand Down
8 changes: 4 additions & 4 deletions hpx/parallel/algorithms/transform_exclusive_scan.hpp
Expand Up @@ -186,7 +186,7 @@ namespace hpx { namespace parallel { inline namespace v1
"Requires at least output iterator.");

typedef std::integral_constant<bool,
is_sequenced_execution_policy<ExPolicy>::value ||
execution::is_sequenced_execution_policy<ExPolicy>::value ||
!hpx::traits::is_forward_iterator<FwdIter1>::value ||
!hpx::traits::is_forward_iterator<FwdIter2>::value
> is_seq;
Expand All @@ -198,7 +198,7 @@ namespace hpx { namespace parallel { inline namespace v1
(hpx::traits::is_forward_iterator<FwdIter2>::value),
"Requires at least forward iterator.");

typedef is_sequenced_execution_policy<ExPolicy> is_seq;
typedef execution::is_sequenced_execution_policy<ExPolicy> is_seq;
#endif

return detail::transform_exclusive_scan<FwdIter2>().call(
Expand Down Expand Up @@ -315,7 +315,7 @@ namespace hpx { namespace parallel { inline namespace v1
template <typename ExPolicy, typename FwdIter1, typename FwdIter2,
typename T, typename Op, typename Conv,
HPX_CONCEPT_REQUIRES_(
is_execution_policy<ExPolicy>::value &&
execution::is_execution_policy<ExPolicy>::value &&
hpx::traits::is_iterator<FwdIter1>::value &&
hpx::traits::is_iterator<FwdIter2>::value &&
hpx::traits::is_invocable<Conv,
Expand Down Expand Up @@ -344,7 +344,7 @@ namespace hpx { namespace parallel { inline namespace v1
template <typename ExPolicy, typename FwdIter1, typename FwdIter2,
typename T, typename Op, typename Conv,
HPX_CONCEPT_REQUIRES_(
is_execution_policy<ExPolicy>::value &&
execution::is_execution_policy<ExPolicy>::value &&
hpx::traits::is_iterator<FwdIter1>::value &&
hpx::traits::is_iterator<FwdIter2>::value &&
hpx::traits::is_invocable<Conv,
Expand Down
8 changes: 4 additions & 4 deletions hpx/parallel/algorithms/transform_inclusive_scan.hpp
Expand Up @@ -185,7 +185,7 @@ namespace hpx { namespace parallel { inline namespace v1
"Requires at least output iterator.");

typedef std::integral_constant<bool,
is_sequenced_execution_policy<ExPolicy>::value ||
execution::is_sequenced_execution_policy<ExPolicy>::value ||
!hpx::traits::is_forward_iterator<FwdIter1>::value ||
!hpx::traits::is_forward_iterator<FwdIter2>::value
> is_seq;
Expand All @@ -197,7 +197,7 @@ namespace hpx { namespace parallel { inline namespace v1
(hpx::traits::is_forward_iterator<FwdIter2>::value),
"Requires at least forward iterator.");

typedef is_sequenced_execution_policy<ExPolicy> is_seq;
typedef execution::is_sequenced_execution_policy<ExPolicy> is_seq;
#endif
return detail::transform_inclusive_scan<FwdIter2>().call(
std::forward<ExPolicy>(policy), is_seq(),
Expand Down Expand Up @@ -374,7 +374,7 @@ namespace hpx { namespace parallel { inline namespace v1
template <typename ExPolicy, typename FwdIter1, typename FwdIter2,
typename T, typename Op, typename Conv,
HPX_CONCEPT_REQUIRES_(
is_execution_policy<ExPolicy>::value &&
execution::is_execution_policy<ExPolicy>::value &&
hpx::traits::is_iterator<FwdIter1>::value &&
hpx::traits::is_iterator<FwdIter2>::value &&
hpx::traits::is_invocable<Conv,
Expand Down Expand Up @@ -533,7 +533,7 @@ namespace hpx { namespace parallel { inline namespace v1
template <typename ExPolicy, typename FwdIter1, typename FwdIter2,
typename Conv, typename Op,
HPX_CONCEPT_REQUIRES_(
is_execution_policy<ExPolicy>::value &&
execution::is_execution_policy<ExPolicy>::value &&
hpx::traits::is_iterator<FwdIter1>::value &&
hpx::traits::is_iterator<FwdIter2>::value &&
hpx::traits::is_invocable<Conv,
Expand Down
2 changes: 1 addition & 1 deletion hpx/parallel/algorithms/transform_reduce.hpp
Expand Up @@ -288,7 +288,7 @@ namespace hpx { namespace parallel { inline namespace v1
template <typename ExPolicy, typename FwdIter, typename T, typename Reduce,
typename Convert,
HPX_CONCEPT_REQUIRES_(
is_execution_policy<ExPolicy>::value &&
execution::is_execution_policy<ExPolicy>::value &&
hpx::traits::is_iterator<FwdIter>::value &&
hpx::traits::is_invocable<Convert,
typename std::iterator_traits<FwdIter>::value_type
Expand Down

0 comments on commit 2651fc2

Please sign in to comment.