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 21, 2018
1 parent 805c603 commit e32271d
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 48 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
2 changes: 2 additions & 0 deletions hpx/parallel/algorithms/inner_product.hpp
Expand Up @@ -71,6 +71,7 @@ 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,
typename util::detail::algorithm_result<ExPolicy, T>::type
Expand Down Expand Up @@ -166,6 +167,7 @@ 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,
typename util::detail::algorithm_result<ExPolicy, T>::type
Expand Down
88 changes: 49 additions & 39 deletions hpx/parallel/executors/rebind_executor.hpp
Expand Up @@ -7,43 +7,13 @@
#define HPX_PARALLEL_REBIND_EXECUTOR_SEP_07_2016_0658AM

#include <hpx/config.hpp>
#include <hpx/parallel/executors/execution_fwd.hpp>
#include <hpx/traits/executor_traits.hpp>
#include <hpx/traits/is_launch_policy.hpp>

#if defined(HPX_HAVE_EXECUTOR_COMPATIBILITY)
#include <hpx/parallel/executors/execution_fwd.hpp>
#include <hpx/parallel/executors/v1/executor_traits.hpp>
#include <hpx/util/decay.hpp>

#include <type_traits>

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
{
Expand All @@ -59,17 +29,17 @@ namespace hpx { namespace parallel { inline namespace v1
{};

template <>
struct is_not_weaker<parallel_execution_tag, vector_execution_tag>
struct is_not_weaker<parallel_execution_tag, unsequenced_execution_tag>
: std::true_type
{};

template <>
struct is_not_weaker<sequential_execution_tag, vector_execution_tag>
struct is_not_weaker<sequenced_execution_tag, unsequenced_execution_tag>
: std::true_type
{};

template <>
struct is_not_weaker<sequential_execution_tag, parallel_execution_tag>
struct is_not_weaker<sequenced_execution_tag, parallel_execution_tag>
: std::true_type
{};
/// \endcond
Expand All @@ -81,17 +51,17 @@ namespace hpx { namespace parallel { inline namespace v1
struct rebind_executor
{
/// \cond NOINTERNAL
typedef typename hpx::util::decay<Executor>::type executor_type;
typedef typename hpx::util::decay<Parameters>::type parameters_type;
typedef typename std::decay<Executor>::type executor_type;
typedef typename std::decay<Parameters>::type parameters_type;

typedef typename ExecutionPolicy::execution_category category1;
typedef typename hpx::traits::executor_execution_category<
executor_type
>::type category2;

static_assert(
(parallel::v1::detail::is_not_weaker<category2, category1>::value),
"parallel::v1::detail::is_not_weaker<category2, category1>::value"
detail::is_not_weaker<category2, category1>::value,
"detail::is_not_weaker<category2, category1>::value"
);
/// \endcond

Expand All @@ -101,6 +71,46 @@ namespace hpx { namespace parallel { inline namespace v1
>::type type;
};
}}}

#if defined(HPX_HAVE_EXECUTOR_COMPATIBILITY)
#include <hpx/parallel/executors/v1/executor_traits.hpp>

#include <type_traits>

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 <typename ExecutionPolicy, typename Executor, typename Parameters>
using rebind_executor = parallel::execution::
rebind_executor<ExecutionPolicy, Executor, Parameters>;
}}}
#endif

#endif
4 changes: 2 additions & 2 deletions hpx/parallel/executors/timed_executors.hpp
Expand Up @@ -196,7 +196,7 @@ namespace hpx { namespace parallel { namespace execution
};

template <>
struct async_execute_at_helper<sequential_execution_tag>
struct async_execute_at_helper<sequenced_execution_tag>
{
template <typename Executor, typename F, typename ... Ts>
static auto
Expand Down Expand Up @@ -294,7 +294,7 @@ namespace hpx { namespace parallel { namespace execution
};

template <>
struct post_at_helper<sequential_execution_tag>
struct post_at_helper<sequenced_execution_tag>
{
template <typename Executor, typename F, typename ... Ts>
static void
Expand Down

0 comments on commit e32271d

Please sign in to comment.