executors

The contents of this module can be included with the header hpx/modules/executors.hpp. These headers may be used by user-code but are not guaranteed stable (neither header location nor contents). You are using these at your own risk. If you wish to use non-public functionality from a module we strongly suggest only including the module header hpx/modules/executors.hpp, not the particular header in which the functionality you would like to use is defined. See Public API for a list of names that are part of the public HPX API.

namespace hpx
namespace execution
namespace experimental

Functions

template<typename Executor>
constexpr auto tag_fallback_invoke(with_annotation_t, Executor &&exec, char const *annotation)
template<typename Executor>
auto tag_fallback_invoke(with_annotation_t, Executor &&exec, std::string annotation)
template<typename BaseExecutor>
struct annotating_executor
#include <annotating_executor.hpp>

A annotating_executor wraps any other executor and adds the capability to add annotations to the launched threads.

Public Functions

template<typename Executor, typename Enable = std::enable_if_t<hpx::traits::is_executor_any_v<Executor>>>
constexpr annotating_executor(Executor &&exec, char const *annotation = nullptr)
template<typename Executor, typename Enable = std::enable_if_t<hpx::traits::is_executor_any_v<Executor>>>
annotating_executor(Executor &&exec, std::string annotation)
namespace hpx
namespace parallel
namespace execution

Typedefs

using current_executor = parallel::execution::thread_pool_executor
namespace this_thread

Functions

parallel::execution::current_executor get_executor(error_code &ec = throws)

Returns a reference to the executor which was used to create the current thread.

Exceptions
  • If: &ec != &throws, never throws, but will set ec to an appropriate value when an error occurs. Otherwise, this function will throw an hpx::exception with an error code of hpx::yield_aborted if it is signaled with wait_aborted. If called outside of a HPX-thread, this function will throw an hpx::exception with an error code of hpx::null_thread_id. If this function is called while the thread-manager is not running, it will throw an hpx::exception with an error code of hpx::invalid_status.

namespace threads

Functions

parallel::execution::current_executor get_executor(thread_id_type const &id, error_code &ec = throws)

Returns a reference to the executor which was used to create the given thread.

Exceptions
  • If: &ec != &throws, never throws, but will set ec to an appropriate value when an error occurs. Otherwise, this function will throw an hpx::exception with an error code of hpx::yield_aborted if it is signaled with wait_aborted. If called outside of a HPX-thread, this function will throw an hpx::exception with an error code of hpx::null_thread_id. If this function is called while the thread-manager is not running, it will throw an hpx::exception with an error code of hpx::invalid_status.

namespace hpx
namespace execution

Variables

constexpr task_policy_tag task = {}

Default sequential execution policy object.

constexpr non_task_policy_tag non_task = {}
constexpr sequenced_policy seq = {}

Default sequential execution policy object.

constexpr parallel_policy par = {}

Default parallel execution policy object.

constexpr parallel_unsequenced_policy par_unseq = {}

Default vector execution policy object.

constexpr unsequenced_policy unseq = {}

Default vector execution policy object.

struct parallel_policy
#include <execution_policy.hpp>

The class parallel_policy is an execution policy type used as a unique type to disambiguate parallel algorithm overloading and indicate that a parallel algorithm’s execution may be parallelized.

Public Types

using executor_type = parallel_executor

The type of the executor associated with this execution policy.

using executor_parameters_type = parallel::execution::extract_executor_parameters<executor_type>::type

The type of the associated executor parameters object which is associated with this execution policy

using execution_category = parallel_execution_tag

The category of the execution agents created by this execution policy.

Public Functions

constexpr parallel_task_policy operator()(task_policy_tag) const

Create a new parallel_policy referencing a chunk size.

Return

The new parallel_policy

Parameters
  • tag: [in] Specify that the corresponding asynchronous execution policy should be used

constexpr decltype(auto) operator()(non_task_policy_tag) const

Create a new parallel_policy from itself

Return

The new parallel_policy

Parameters
  • tag: [in] Specify that the corresponding asynchronous execution policy should be used

template<typename Executor>
constexpr decltype(auto) on(Executor &&exec) const

Create a new parallel_policy referencing an executor and a chunk size.

Return

The new parallel_policy

Parameters
  • exec: [in] The executor to use for the execution of the parallel algorithm the returned execution policy is used with

template<typename ...Parameters>
constexpr decltype(auto) with(Parameters&&... params) const

Create a new parallel_policy from the given execution parameters

Note

Requires: is_executor_parameters<Parameters>::value is true

Return

The new parallel_policy

Template Parameters
  • Parameters: The type of the executor parameters to associate with this execution policy.

Parameters
  • params: [in] The executor parameters to use for the execution of the parallel algorithm the returned execution policy is used with.

executor_type &executor()

Return the associated executor object.

constexpr executor_type const &executor() const

Return the associated executor object.

executor_parameters_type &parameters()

Return the associated executor parameters object.

constexpr executor_parameters_type const &parameters() const

Return the associated executor parameters object.

Private Functions

template<typename Archive>
constexpr void serialize(Archive&, const unsigned int)

Private Members

executor_type exec_
executor_parameters_type params_

Friends

friend hpx::execution::hpx::parallel::execution::create_rebound_policy_t
friend hpx::execution::hpx::serialization::access
template<typename Executor_, typename Parameters_>
struct rebind
#include <execution_policy.hpp>

Rebind the type of executor used by this execution policy. The execution category of Executor shall not be weaker than that of this execution policy

Public Types

template<>
using type = parallel_policy_shim<Executor_, Parameters_>

The type of the rebound execution policy.

template<typename Executor, typename Parameters>
struct parallel_policy_shim
#include <execution_policy.hpp>

The class parallel_policy_shim is an execution policy type used as a unique type to disambiguate parallel algorithm overloading and indicate that a parallel algorithm’s execution may be parallelized.

Public Types

template<>
using executor_type = std::decay_t<Executor>

The type of the executor associated with this execution policy.

template<>
using executor_parameters_type = std::decay_t<Parameters>

The type of the associated executor parameters object which is associated with this execution policy

template<>
using execution_category = typename hpx::traits::executor_execution_category<executor_type>::type

The category of the execution agents created by this execution policy.

Public Functions

constexpr parallel_task_policy_shim<Executor, Parameters> operator()(task_policy_tag) const

Create a new parallel_policy referencing a chunk size.

Return

The new parallel_policy

Parameters
  • tag: [in] Specify that the corresponding asynchronous execution policy should be used

constexpr decltype(auto) operator()(non_task_policy_tag) const

Create a new parallel_policy from itself

Return

The new parallel_policy

Parameters
  • tag: [in] Specify that the corresponding asynchronous execution policy should be used

template<typename Executor_>
constexpr decltype(auto) on(Executor_ &&exec) const

Create a new parallel_policy from the given executor

Note

Requires: is_executor<Executor>::value is true

Return

The new parallel_policy

Template Parameters
  • Executor: The type of the executor to associate with this execution policy.

Parameters
  • exec: [in] The executor to use for the execution of the parallel algorithm the returned execution policy is used with.

template<typename ...Parameters_>
constexpr decltype(auto) with(Parameters_&&... params) const

Create a new parallel_policy_shim from the given execution parameters

Note

Requires: is_executor_parameters<Parameters>::value is true

Return

The new parallel_policy_shim

Template Parameters
  • Parameters: The type of the executor parameters to associate with this execution policy.

Parameters
  • params: [in] The executor parameters to use for the execution of the parallel algorithm the returned execution policy is used with.

executor_type &executor()

Return the associated executor object.

constexpr executor_type const &executor() const

Return the associated executor object.

executor_parameters_type &parameters()

Return the associated executor parameters object.

constexpr executor_parameters_type const &parameters() const

Return the associated executor parameters object.

template<typename Executor_, typename Parameters_>
struct rebind
#include <execution_policy.hpp>

Rebind the type of executor used by this execution policy. The execution category of Executor shall not be weaker than that of this execution policy

Public Types

template<>
template<>
using type = parallel_policy_shim<Executor_, Parameters_>

The type of the rebound execution policy.

struct parallel_task_policy
#include <execution_policy.hpp>

Extension: The class parallel_task_policy is an execution policy type used as a unique type to disambiguate parallel algorithm overloading and indicate that a parallel algorithm’s execution may be parallelized.

The algorithm returns a future representing the result of the corresponding algorithm when invoked with the parallel_policy.

Public Types

using executor_type = parallel_executor

The type of the executor associated with this execution policy.

using executor_parameters_type = parallel::execution::extract_executor_parameters<executor_type>::type

The type of the associated executor parameters object which is associated with this execution policy

using execution_category = parallel_execution_tag

The category of the execution agents created by this execution policy.

Public Functions

constexpr parallel_task_policy operator()(task_policy_tag) const

Create a new parallel_task_policy from itself

Return

The new parallel_task_policy

Parameters
  • tag: [in] Specify that the corresponding asynchronous execution policy should be used

constexpr decltype(auto) operator()(non_task_policy_tag) const

Create a new non task parallel policy from itself

Return

The new non task parallel_policy

Parameters
  • tag: [in] Specify that the corresponding execution policy should be used

template<typename Executor>
constexpr decltype(auto) on(Executor &&exec) const

Create a new parallel_task_policy from given executor

Note

Requires: is_executor<Executor>::value is true

Return

The new parallel_task_policy

Template Parameters
  • Executor: The type of the executor to associate with this execution policy.

Parameters
  • exec: [in] The executor to use for the execution of the parallel algorithm the returned execution policy is used with.

template<typename ...Parameters>
constexpr decltype(auto) with(Parameters&&... params) const

Create a new parallel_policy_shim from the given execution parameters

Note

Requires: all parameters are executor_parameters, different parameter types can’t be duplicated

Return

The new parallel_policy_shim

Template Parameters
  • Parameters: The type of the executor parameters to associate with this execution policy.

Parameters
  • params: [in] The executor parameters to use for the execution of the parallel algorithm the returned execution policy is used with.

executor_type &executor()

Return the associated executor object.

constexpr executor_type const &executor() const

Return the associated executor object.

executor_parameters_type &parameters()

Return the associated executor parameters object.

constexpr executor_parameters_type const &parameters() const

Return the associated executor parameters object.

Private Functions

template<typename Archive>
constexpr void serialize(Archive&, const unsigned int)

Private Members

executor_type exec_
executor_parameters_type params_

Friends

friend hpx::execution::hpx::parallel::execution::create_rebound_policy_t
friend hpx::execution::hpx::serialization::access
template<typename Executor_, typename Parameters_>
struct rebind
#include <execution_policy.hpp>

Rebind the type of executor used by this execution policy. The execution category of Executor shall not be weaker than that of this execution policy

Public Types

template<>
using type = parallel_task_policy_shim<Executor_, Parameters_>

The type of the rebound execution policy.

template<typename Executor, typename Parameters>
struct parallel_task_policy_shim
#include <execution_policy.hpp>

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 parallel_task_policy and an executor and indicate that a parallel algorithm’s execution may be parallelized.

Public Types

template<>
using executor_type = std::decay_t<Executor>

The type of the executor associated with this execution policy.

template<>
using executor_parameters_type = std::decay_t<Parameters>

The type of the associated executor parameters object which is associated with this execution policy

template<>
using execution_category = typename hpx::traits::executor_execution_category<executor_type>::type

The category of the execution agents created by this execution policy.

Public Functions

constexpr parallel_task_policy_shim operator()(task_policy_tag) const

Create a new parallel_task_policy_shim from itself

Return

The new sequenced_task_policy

Parameters
  • tag: [in] Specify that the corresponding asynchronous execution policy should be used

constexpr decltype(auto) operator()(non_task_policy_tag) const

Create a new non task parallel policy from itself

Return

The new non task parallel_policy_shim

Parameters
  • tag: [in] Specify that the corresponding execution policy should be used

template<typename Executor_>
constexpr decltype(auto) on(Executor_ &&exec) const

Create a new parallel_task_policy from the given executor

Note

Requires: is_executor<Executor>::value is true

Return

The new parallel_task_policy

Template Parameters
  • Executor: The type of the executor to associate with this execution policy.

Parameters
  • exec: [in] The executor to use for the execution of the parallel algorithm the returned execution policy is used with.

template<typename ...Parameters_>
constexpr decltype(auto) with(Parameters_&&... params) const

Create a new parallel_policy_shim from the given execution parameters

Note

Requires: all parameters are executor_parameters, different parameter types can’t be duplicated

Return

The new parallel_policy_shim

Template Parameters
  • Parameters: The type of the executor parameters to associate with this execution policy.

Parameters
  • params: [in] The executor parameters to use for the execution of the parallel algorithm the returned execution policy is used with.

executor_type &executor()

Return the associated executor object.

constexpr executor_type const &executor() const

Return the associated executor object.

executor_parameters_type &parameters()

Return the associated executor parameters object.

constexpr executor_parameters_type const &parameters() const

Return the associated executor parameters object.

template<typename Executor_, typename Parameters_>
struct rebind
#include <execution_policy.hpp>

Rebind the type of executor used by this execution policy. The execution category of Executor shall not be weaker than that of this execution policy

Public Types

template<>
template<>
using type = parallel_task_policy_shim<Executor_, Parameters_>

The type of the rebound execution policy.

struct parallel_unsequenced_policy
#include <execution_policy.hpp>

The class parallel_unsequenced_policy is an execution policy type used as a unique type to disambiguate parallel algorithm overloading and indicate that a parallel algorithm’s execution may be parallelized and vectorized.

Public Types

using executor_type = parallel_executor

The type of the executor associated with this execution policy.

using executor_parameters_type = parallel::execution::extract_executor_parameters<executor_type>::type

The type of the associated executor parameters object which is associated with this execution policy

using execution_category = parallel_execution_tag

The category of the execution agents created by this execution policy.

Public Functions

constexpr decltype(auto) operator()(non_task_policy_tag) const

Create a new non task policy from itself

Return

The non task parallel unsequenced policy

executor_type &executor()

Return the associated executor object.

constexpr executor_type const &executor() const

Return the associated executor object.

executor_parameters_type &parameters()

Return the associated executor parameters object.

constexpr executor_parameters_type const &parameters() const

Return the associated executor parameters object.

Private Functions

template<typename Archive>
constexpr void serialize(Archive&, const unsigned int)

Private Members

executor_type exec_
executor_parameters_type params_

Friends

friend hpx::execution::hpx::parallel::execution::create_rebound_policy_t
friend hpx::execution::hpx::serialization::access
struct sequenced_policy
#include <execution_policy.hpp>

The class sequenced_policy is an execution policy type used as a unique type to disambiguate parallel algorithm overloading and require that a parallel algorithm’s execution may not be parallelized.

Public Types

using executor_type = sequenced_executor

The type of the executor associated with this execution policy.

using executor_parameters_type = parallel::execution::extract_executor_parameters<executor_type>::type

The type of the associated executor parameters object which is associated with this execution policy

using execution_category = sequenced_execution_tag

The category of the execution agents created by this execution policy.

Public Functions

constexpr sequenced_task_policy operator()(task_policy_tag) const

Create a new sequenced_task_policy.

Return

The new sequenced_task_policy

Parameters
  • tag: [in] Specify that the corresponding asynchronous execution policy should be used

constexpr decltype(auto) operator()(non_task_policy_tag) const

Create a new sequenced_policy from itself.

Return

The new sequenced_policy

template<typename Executor>
constexpr decltype(auto) on(Executor &&exec) const

Create a new sequenced_policy from the given executor

Note

Requires: is_executor<Executor>::value is true

Return

The new sequenced_policy

Template Parameters
  • Executor: The type of the executor to associate with this execution policy.

Parameters
  • exec: [in] The executor to use for the execution of the parallel algorithm the returned execution policy is used with.

template<typename ...Parameters>
constexpr decltype(auto) with(Parameters&&... params) const

Create a new sequenced_policy from the given execution parameters

Note

Requires: all parameters are executor_parameters, different parameter types can’t be duplicated

Return

The new sequenced_policy

Template Parameters
  • Parameters: The type of the executor parameters to associate with this execution policy.

Parameters
  • params: [in] The executor parameters to use for the execution of the parallel algorithm the returned execution policy is used with.

executor_type &executor()

Return the associated executor object.

constexpr executor_type const &executor() const

Return the associated executor object.

executor_parameters_type &parameters()

Return the associated executor parameters object.

constexpr executor_parameters_type const &parameters() const

Return the associated executor parameters object.

Private Functions

template<typename Archive>
constexpr void serialize(Archive&, const unsigned int)

Private Members

executor_type exec_
executor_parameters_type params_

Friends

friend hpx::execution::hpx::parallel::execution::create_rebound_policy_t
friend hpx::execution::hpx::serialization::access
template<typename Executor_, typename Parameters_>
struct rebind
#include <execution_policy.hpp>

Rebind the type of executor used by this execution policy. The execution category of Executor shall not be weaker than that of this execution policy

Public Types

template<>
using type = sequenced_policy_shim<Executor_, Parameters_>

The type of the rebound execution policy.

template<typename Executor, typename Parameters>
struct sequenced_policy_shim
#include <execution_policy.hpp>

The class sequenced_policy is an execution policy type used as a unique type to disambiguate parallel algorithm overloading and require that a parallel algorithm’s execution may not be parallelized.

Public Types

template<>
using executor_type = std::decay_t<Executor>

The type of the executor associated with this execution policy.

template<>
using executor_parameters_type = std::decay_t<Parameters>

The type of the associated executor parameters object which is associated with this execution policy

template<>
using execution_category = typename hpx::traits::executor_execution_category<executor_type>::type

The category of the execution agents created by this execution policy.

Public Functions

constexpr sequenced_task_policy_shim<Executor, Parameters> operator()(task_policy_tag) const

Create a new sequenced_task_policy.

Return

The new sequenced_task_policy_shim

Parameters
  • tag: [in] Specify that the corresponding asynchronous execution policy should be used

constexpr decltype(auto) operator()(non_task_policy_tag) const

Create a new sequenced_policy from itself.

Return

The new sequenced_policy_shim

template<typename Executor_>
constexpr decltype(auto) on(Executor_ &&exec) const

Create a new sequenced_policy from the given executor

Note

Requires: is_executor<Executor>::value is true

Return

The new sequenced_policy

Template Parameters
  • Executor: The type of the executor to associate with this execution policy.

Parameters
  • exec: [in] The executor to use for the execution of the parallel algorithm the returned execution policy is used with.

template<typename ...Parameters_>
constexpr decltype(auto) with(Parameters_&&... params) const

Create a new sequenced_policy_shim from the given execution parameters

Note

Requires: all parameters are executor_parameters, different parameter types can’t be duplicated

Return

The new sequenced_policy_shim

Template Parameters
  • Parameters: The type of the executor parameters to associate with this execution policy.

Parameters
  • params: [in] The executor parameters to use for the execution of the parallel algorithm the returned execution policy is used with.

executor_type &executor()

Return the associated executor object.

constexpr executor_type const &executor() const

Return the associated executor object.

executor_parameters_type &parameters()

Return the associated executor parameters object.

constexpr executor_parameters_type const &parameters() const

Return the associated executor parameters object.

template<typename Executor_, typename Parameters_>
struct rebind
#include <execution_policy.hpp>

Rebind the type of executor used by this execution policy. The execution category of Executor shall not be weaker than that of this execution policy

Public Types

template<>
template<>
using type = sequenced_policy_shim<Executor_, Parameters_>

The type of the rebound execution policy.

struct sequenced_task_policy
#include <execution_policy.hpp>

Extension: The class sequenced_task_policy is an execution policy type used as a unique type to disambiguate parallel algorithm overloading and indicate that a parallel algorithm’s execution may not be parallelized (has to run sequentially).

The algorithm returns a future representing the result of the corresponding algorithm when invoked with the sequenced_policy.

Public Types

using executor_type = sequenced_executor

The type of the executor associated with this execution policy.

using executor_parameters_type = parallel::execution::extract_executor_parameters<executor_type>::type

The type of the associated executor parameters object which is associated with this execution policy

using execution_category = sequenced_execution_tag

The category of the execution agents created by this execution policy.

Public Functions

constexpr sequenced_task_policy operator()(task_policy_tag) const

Create a new sequenced_task_policy from itself

Return

The new sequenced_task_policy

Parameters
  • tag: [in] Specify that the corresponding asynchronous execution policy should be used

constexpr decltype(auto) operator()(non_task_policy_tag) const

Create a corresponding non task policy for this task policy

Return

The non task seqeuential policy

template<typename Executor>
constexpr decltype(auto) on(Executor &&exec) const

Create a new sequenced_task_policy from the given executor

Note

Requires: is_executor<Executor>::value is true

Return

The new sequenced_task_policy

Template Parameters
  • Executor: The type of the executor to associate with this execution policy.

Parameters
  • exec: [in] The executor to use for the execution of the parallel algorithm the returned execution policy is used with.

template<typename ...Parameters>
constexpr decltype(auto) with(Parameters&&... params) const

Create a new sequenced_task_policy from the given execution parameters

Note

Requires: all parameters are executor_parameters, different parameter types can’t be duplicated

Return

The new sequenced_task_policy

Template Parameters
  • Parameters: The type of the executor parameters to associate with this execution policy.

Parameters
  • params: [in] The executor parameters to use for the execution of the parallel algorithm the returned execution policy is used with.

executor_type &executor()

Return the associated executor object.

constexpr executor_type const &executor() const

Return the associated executor object.

executor_parameters_type &parameters()

Return the associated executor parameters object.

constexpr executor_parameters_type const &parameters() const

Return the associated executor parameters object.

Private Functions

template<typename Archive>
constexpr void serialize(Archive&, const unsigned int)

Private Members

executor_type exec_
executor_parameters_type params_

Friends

friend hpx::execution::hpx::parallel::execution::create_rebound_policy_t
friend hpx::execution::hpx::serialization::access
template<typename Executor_, typename Parameters_>
struct rebind
#include <execution_policy.hpp>

Rebind the type of executor used by this execution policy. The execution category of Executor shall not be weaker than that of this execution policy

Public Types

template<>
using type = sequenced_task_policy_shim<Executor_, Parameters_>

The type of the rebound execution policy.

template<typename Executor, typename Parameters>
struct sequenced_task_policy_shim
#include <execution_policy.hpp>

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 sequenced_task_policy and an executor and indicate that a parallel algorithm’s execution may not be parallelized (has to run sequentially).

The algorithm returns a future representing the result of the corresponding algorithm when invoked with the sequenced_policy.

Public Types

template<>
using executor_type = std::decay_t<Executor>

The type of the executor associated with this execution policy.

template<>
using executor_parameters_type = std::decay_t<Parameters>

The type of the associated executor parameters object which is associated with this execution policy

typedef hpx::traits::executor_execution_category<executor_type>::type execution_category

The category of the execution agents created by this execution policy.

Public Functions

constexpr sequenced_task_policy_shim const &operator()(task_policy_tag) const

Create a new sequenced_task_policy from itself

Return

The new sequenced_task_policy

Parameters
  • tag: [in] Specify that the corresponding asynchronous execution policy should be used

constexpr decltype(auto) operator()(non_task_policy_tag) const

Create a corresponding non task policy for this task policy

Return

The non task seqeuential shim policy

template<typename Executor_>
constexpr decltype(auto) on(Executor_ &&exec) const

Create a new sequenced_task_policy from the given executor

Note

Requires: is_executor<Executor>::value is true

Return

The new sequenced_task_policy

Template Parameters
  • Executor: The type of the executor to associate with this execution policy.

Parameters
  • exec: [in] The executor to use for the execution of the parallel algorithm the returned execution policy is used with.

template<typename ...Parameters_>
constexpr decltype(auto) with(Parameters_&&... params) const

Create a new sequenced_task_policy_shim from the given execution parameters

Note

Requires: all parameters are executor_parameters, different parameter types can’t be duplicated

Return

The new sequenced_task_policy_shim

Template Parameters
  • Parameters: The type of the executor parameters to associate with this execution policy.

Parameters
  • params: [in] The executor parameters to use for the execution of the parallel algorithm the returned execution policy is used with.

executor_type &executor()

Return the associated executor object.

constexpr executor_type const &executor() const

Return the associated executor object.

executor_parameters_type &parameters()

Return the associated executor parameters object.

constexpr executor_parameters_type const &parameters() const

Return the associated executor parameters object.

template<typename Executor_, typename Parameters_>
struct rebind
#include <execution_policy.hpp>

Rebind the type of executor used by this execution policy. The execution category of Executor shall not be weaker than that of this execution policy

Public Types

template<>
template<>
using type = sequenced_task_policy_shim<Executor_, Parameters_>

The type of the rebound execution policy.

struct unsequenced_policy
#include <execution_policy.hpp>

The class unsequenced_policy is an execution policy type used as a unique type to disambiguate parallel algorithm overloading and indicate that a parallel algorithm’s execution may be vectorized.

Public Types

using executor_type = sequenced_executor

The type of the executor associated with this execution policy.

using executor_parameters_type = parallel::execution::extract_executor_parameters<executor_type>::type

The type of the associated executor parameters object which is associated with this execution policy

using execution_category = sequenced_execution_tag

The category of the execution agents created by this execution policy.

Public Functions

constexpr decltype(auto) operator()(non_task_policy_tag) const

Create a new non task policy from itself

Return

The non task unsequenced policy

executor_type &executor()

Return the associated executor object.

constexpr executor_type const &executor() const

Return the associated executor object.

executor_parameters_type &parameters()

Return the associated executor parameters object.

constexpr executor_parameters_type const &parameters() const

Return the associated executor parameters object.

Private Functions

template<typename Archive>
constexpr void serialize(Archive&, const unsigned int)

Private Members

executor_type exec_
executor_parameters_type params_

Friends

friend hpx::execution::hpx::parallel::execution::create_rebound_policy_t
friend hpx::execution::hpx::serialization::access
namespace parallel
namespace execution

Typedefs

typedef hpx::execution::sequenced_executor instead
namespace hpx
namespace execution
namespace experimental

Functions

template<typename ExPolicy>
constexpr decltype(auto) tag_invoke(hpx::execution::experimental::with_annotation_t, ExPolicy &&policy, char const *annotation)
template<typename ExPolicy>
decltype(auto) tag_invoke(hpx::execution::experimental::with_annotation_t, ExPolicy &&policy, std::string annotation)
template<typename ExPolicy>
constexpr decltype(auto) tag_invoke(hpx::execution::experimental::get_annotation_t, ExPolicy &&policy)
namespace hpx
namespace execution
namespace experimental
class fork_join_executor
#include <fork_join_executor.hpp>

An executor with fork-join (blocking) semantics.

The fork_join_executor creates on construction a set of worker threads that are kept alive for the duration of the executor. Copying the executor has reference semantics, i.e. copies of a fork_join_executor hold a reference to the worker threads of the original instance. Scheduling work through the executor concurrently from different threads is undefined behaviour.

The executor keeps a set of worker threads alive for the lifetime of the executor, meaning other work will not be executed while the executor is busy or waiting for work. The executor has a customizable delay after which it will yield to other work. Since starting and resuming the worker threads is a slow operation the executor should be reused whenever possible for multiple adjacent parallel algorithms or invocations of bulk_(a)sync_execute.

Public Types

enum loop_schedule

Type of loop schedule for use with the fork_join_executor. loop_schedule::static_ implies no work-stealing; loop_schedule::dynamic allows stealing when a worker has finished its local work.

Values:

static_
dynamic

Public Functions

fork_join_executor(threads::thread_priority priority = threads::thread_priority::high, threads::thread_stacksize stacksize = threads::thread_stacksize::small_, loop_schedule schedule = loop_schedule::static_, std::chrono::nanoseconds yield_delay = std::chrono::milliseconds(1))

Construct a fork_join_executor.

Parameters
  • priority: The priority of the worker threads.

  • stacksize: The stacksize of the worker threads.

  • schedule: The loop schedule of the parallel regions.

  • yield_delay: The time after which the executor yields to other work if it hasn’t received any new work for bulk execution.

Defines

GUIDED_POOL_EXECUTOR_DEBUG
namespace hpx

Functions

static hpx::debug::enable_print<GUIDED_POOL_EXECUTOR_DEBUG> hpx::gpx_deb("GP_EXEC")
namespace parallel
namespace execution
template<typename Hint>
struct executor_execution_category<guided_pool_executor<Hint>>

Public Types

typedef hpx::execution::parallel_execution_tag type
template<typename Hint>
struct executor_execution_category<guided_pool_executor_shim<Hint>>

Public Types

typedef hpx::execution::parallel_execution_tag type
template<typename Tag>
struct guided_pool_executor<pool_numa_hint<Tag>>

Public Functions

guided_pool_executor(threads::thread_pool_base *pool, bool hp_sync = false)
guided_pool_executor(threads::thread_pool_base *pool, threads::thread_stacksize stacksize, bool hp_sync = false)
guided_pool_executor(threads::thread_pool_base *pool, threads::thread_priority priority, threads::thread_stacksize stacksize = threads::thread_stacksize::default_, bool hp_sync = false)
template<typename F, typename ...Ts>
future<typename hpx::util::detail::invoke_deferred_result<F, Ts...>::type> async_execute(F &&f, Ts&&... ts)
template<typename F, typename Future, typename ...Ts, typename = std::enable_if_t<hpx::traits::is_future<Future>::value>>
auto then_execute(F &&f, Future &&predecessor, Ts&&... ts)
template<typename F, template<typename> class OuterFuture, typename ...InnerFutures, typename ...Ts, typename = std::enable_if_t<detail::is_future_of_tuple_of_futures<OuterFuture<hpx::tuple<InnerFutures...>>>::value>, typename = std::enable_if_t<hpx::traits::is_future_tuple<hpx::tuple<InnerFutures...>>::value>>
auto then_execute(F &&f, OuterFuture<hpx::tuple<InnerFutures...>> &&predecessor, Ts&&... ts)
template<typename F, typename ...InnerFutures, typename = std::enable_if_t<hpx::traits::is_future_tuple<hpx::tuple<InnerFutures...>>::value>>
auto async_execute(F &&f, hpx::tuple<InnerFutures...> &&predecessor)

Private Members

threads::thread_pool_base *pool_
threads::thread_priority priority_
threads::thread_stacksize stacksize_
pool_numa_hint<Tag> hint_
bool hp_sync_

Friends

friend hpx::parallel::execution::guided_pool_executor_shim
template<typename H>
struct guided_pool_executor_shim

Public Functions

guided_pool_executor_shim(bool guided, threads::thread_pool_base *pool, bool hp_sync = false)
guided_pool_executor_shim(bool guided, threads::thread_pool_base *pool, threads::thread_stacksize stacksize, bool hp_sync = false)
guided_pool_executor_shim(bool guided, threads::thread_pool_base *pool, threads::thread_priority priority, threads::thread_stacksize stacksize = threads::thread_stacksize::default_, bool hp_sync = false)
template<typename F, typename ...Ts>
future<typename hpx::util::detail::invoke_deferred_result<F, Ts...>::type> async_execute(F &&f, Ts&&... ts)
template<typename F, typename Future, typename ...Ts, typename = std::enable_if_t<hpx::traits::is_future<Future>::value>>
auto then_execute(F &&f, Future &&predecessor, Ts&&... ts)

Public Members

bool guided_
guided_pool_executor<H> guided_exec_
namespace hpx
namespace execution
namespace experimental

Typedefs

using print_on = hpx::debug::enable_print<false>

Functions

static constexpr print_on hpx::execution::experimental::lim_debug("LIMEXEC")
template<typename BaseExecutor>
struct limiting_executor

Public Types

template<>
using execution_category = typename BaseExecutor::execution_category
template<>
using executor_parameters_type = typename BaseExecutor::executor_parameters_type

Public Functions

limiting_executor(BaseExecutor &ex, std::size_t lower, std::size_t upper, bool block_on_destruction = true)
limiting_executor(std::size_t lower, std::size_t upper, bool block_on_destruction = true)
~limiting_executor()
limiting_executor const &context() const
template<typename F, typename ...Ts>
decltype(auto) sync_execute(F &&f, Ts&&... ts) const
template<typename F, typename ...Ts>
decltype(auto) async_execute(F &&f, Ts&&... ts)
template<typename F, typename Future, typename ...Ts>
decltype(auto) then_execute(F &&f, Future &&predecessor, Ts&&... ts)
template<typename F, typename ...Ts>
void post(F &&f, Ts&&... ts)
template<typename F, typename S, typename ...Ts>
decltype(auto) bulk_async_execute(F &&f, S const &shape, Ts&&... ts)
template<typename F, typename S, typename Future, typename ...Ts>
decltype(auto) bulk_then_execute(F &&f, S const &shape, Future &&predecessor, Ts&&... ts)
void wait()
void wait_all()
void set_threshold(std::size_t lower, std::size_t upper)

Private Functions

void count_up()
void count_down() const
void set_and_wait(std::size_t lower, std::size_t upper)

Private Members

BaseExecutor executor_
std::atomic<std::size_t> count_
std::size_t lower_threshold_
std::size_t upper_threshold_
bool block_
struct on_exit

Public Functions

template<>
on_exit(limiting_executor const &this_e)
template<>
~on_exit()

Public Members

template<>
limiting_executor const &executor_
template<typename F, typename B = BaseExecutor, typename Enable = void>
struct throttling_wrapper

Public Functions

template<>
throttling_wrapper(limiting_executor &lim, BaseExecutor const&, F &&f)
template<typename ...Ts>
decltype(auto) operator()(Ts&&... ts)
template<>
bool exceeds_upper()
template<>
bool exceeds_lower()

Public Members

template<>
limiting_executor &limiting_
template<>
F f_
namespace hpx
namespace execution

Typedefs

using parallel_executor = parallel_policy_executor<hpx::launch>
template<typename Policy>
struct parallel_policy_executor
#include <parallel_executor.hpp>

A parallel_executor creates groups of parallel execution agents which execute in threads implicitly created by the executor. This executor prefers continuing with the creating thread first before executing newly created threads.

This executor conforms to the concepts of a TwoWayExecutor, and a BulkTwoWayExecutor

Public Types

template<>
using execution_category = parallel_execution_tag

Associate the parallel_execution_tag executor tag type as a default with this executor.

template<>
using executor_parameters_type = static_chunk_size

Associate the static_chunk_size executor parameters type as a default with this executor.

Public Functions

constexpr parallel_policy_executor(threads::thread_priority priority, threads::thread_stacksize stacksize = threads::thread_stacksize::default_, threads::thread_schedule_hint schedulehint = {}, Policy l = parallel::execution::detail::get_default_policy<Policy>::call(), std::size_t hierarchical_threshold = hierarchical_threshold_default_)

Create a new parallel executor.

constexpr parallel_policy_executor(threads::thread_stacksize stacksize, threads::thread_schedule_hint schedulehint = {}, Policy l = parallel::execution::detail::get_default_policy<Policy>::call())
constexpr parallel_policy_executor(threads::thread_schedule_hint schedulehint, Policy l = parallel::execution::detail::get_default_policy<Policy>::call())
constexpr parallel_policy_executor(Policy l = parallel::execution::detail::get_default_policy<Policy>::call())
constexpr parallel_policy_executor(threads::thread_pool_base *pool, threads::thread_priority priority = threads::thread_priority::default_, threads::thread_stacksize stacksize = threads::thread_stacksize::default_, threads::thread_schedule_hint schedulehint = {}, Policy l = parallel::execution::detail::get_default_policy<Policy>::call(), std::size_t hierarchical_threshold = hierarchical_threshold_default_)

Friends

friend constexpr parallel_policy_executor tag_invoke(hpx::execution::experimental::with_hint_t, parallel_policy_executor const &exec, hpx::threads::thread_schedule_hint hint)
friend constexpr hpx::threads::thread_schedule_hint tag_invoke(hpx::execution::experimental::get_hint_t, parallel_policy_executor const &exec)
friend constexpr parallel_policy_executor tag_invoke(hpx::execution::experimental::with_priority_t, parallel_policy_executor const &exec, hpx::threads::thread_priority priority)
friend constexpr hpx::threads::thread_priority tag_invoke(hpx::execution::experimental::get_priority_t, parallel_policy_executor const &exec)
friend constexpr parallel_policy_executor tag_invoke(hpx::execution::experimental::with_annotation_t, parallel_policy_executor const &exec, char const *annotation)
parallel_policy_executor tag_invoke(hpx::execution::experimental::with_annotation_t, parallel_policy_executor const &exec, std::string annotation)
friend constexpr char const *tag_invoke(hpx::execution::experimental::get_annotation_t, parallel_policy_executor const &exec)
template<>
struct parallel_policy_executor_aggregated<hpx::launch>

Public Types

template<>
using execution_category = hpx::execution::parallel_execution_tag

Associate the parallel_execution_tag executor tag type as a default with this executor.

template<>
using executor_parameters_type = hpx::execution::static_chunk_size

Associate the static_chunk_size executor parameters type as a default with this executor.

Public Functions

constexpr parallel_policy_executor_aggregated(hpx::launch l = hpx::launch::async_policy{}, std::size_t spread = 4, std::size_t tasks = std::size_t(-1))

Create a new parallel executor.

template<typename F, typename S, typename ...Ts>
std::vector<hpx::future<void>> bulk_async_execute(F &&f, S const &shape, Ts&&... ts) const
namespace hpx
namespace parallel
namespace execution

Typedefs

using parallel_executor_aggregated = parallel_policy_executor_aggregated<hpx::launch::async_policy>
template<typename Policy = hpx::launch::async_policy>
struct parallel_policy_executor_aggregated
#include <parallel_executor_aggregated.hpp>

A parallel_executor_aggregated creates groups of parallel execution agents that execute in threads implicitly created by the executor. This executor prefers continuing with the creating thread first before executing newly created threads.

This executor conforms to the concepts of a TwoWayExecutor, and a BulkTwoWayExecutor

Public Types

template<>
using execution_category = hpx::execution::parallel_execution_tag

Associate the parallel_execution_tag executor tag type as a default with this executor.

template<>
using executor_parameters_type = hpx::execution::static_chunk_size

Associate the static_chunk_size executor parameters type as a default with this executor.

Public Functions

constexpr parallel_policy_executor_aggregated(std::size_t spread = 4, std::size_t tasks = std::size_t(-1))

Create a new parallel executor.

template<typename F, typename S, typename ...Ts>
std::vector<hpx::future<void>> bulk_async_execute(F &&f, S const &shape, Ts&&... ts) const
template<>
struct parallel_policy_executor_aggregated<hpx::launch>

Public Types

template<>
using execution_category = hpx::execution::parallel_execution_tag

Associate the parallel_execution_tag executor tag type as a default with this executor.

template<>
using executor_parameters_type = hpx::execution::static_chunk_size

Associate the static_chunk_size executor parameters type as a default with this executor.

Public Functions

constexpr parallel_policy_executor_aggregated(hpx::launch l = hpx::launch::async_policy{}, std::size_t spread = 4, std::size_t tasks = std::size_t(-1))

Create a new parallel executor.

template<typename F, typename S, typename ...Ts>
std::vector<hpx::future<void>> bulk_async_execute(F &&f, S const &shape, Ts&&... ts) const
namespace hpx
namespace parallel
namespace execution
class restricted_thread_pool_executor

Public Types

typedef hpx::execution::parallel_execution_tag execution_category

Associate the parallel_execution_tag executor tag type as a default with this executor.

typedef hpx::execution::static_chunk_size executor_parameters_type

Associate the static_chunk_size executor parameters type as a default with this executor.

Public Functions

restricted_thread_pool_executor(std::size_t first_thread = 0, std::size_t num_threads = 1, threads::thread_priority priority = threads::thread_priority::default_, threads::thread_stacksize stacksize = threads::thread_stacksize::default_, threads::thread_schedule_hint schedulehint = {}, std::size_t hierarchical_threshold = hierarchical_threshold_default_)

Create a new parallel executor.

restricted_thread_pool_executor(restricted_thread_pool_executor const &other)

Private Members

threads::thread_pool_base *pool_ = nullptr
threads::thread_priority priority_ = threads::thread_priority::default_
threads::thread_stacksize stacksize_ = threads::thread_stacksize::default_
threads::thread_schedule_hint schedulehint_ = {}
std::size_t hierarchical_threshold_ = hierarchical_threshold_default_
std::size_t first_thread_
std::size_t num_threads_
std::atomic<std::size_t> os_thread_

Private Static Attributes

constexpr std::size_t hierarchical_threshold_default_ = 6
namespace hpx
namespace execution
namespace experimental

Functions

template<typename BaseScheduler>
scheduler_executor(BaseScheduler &&sched)
template<typename BaseScheduler>
struct scheduler_executor

Public Functions

constexpr scheduler_executor()
template<typename Scheduler, typename Enable = std::enable_if_t<hpx::execution::experimental::is_scheduler_v<Scheduler>>>
constexpr scheduler_executor(Scheduler &&sched)
constexpr scheduler_executor(scheduler_executor&&)
constexpr scheduler_executor &operator=(scheduler_executor&&)
constexpr scheduler_executor(scheduler_executor const&)
constexpr scheduler_executor &operator=(scheduler_executor const&)
namespace hpx
namespace execution
struct sequenced_executor
#include <sequenced_executor.hpp>

A sequential_executor creates groups of sequential execution agents which execute in the calling thread. The sequential order is given by the lexicographical order of indices in the index space.

namespace hpx
namespace parallel
namespace execution

Typedefs

using thread_pool_executor = hpx::execution::parallel_executor
namespace hpx
namespace execution
namespace experimental
struct thread_pool_scheduler

Public Functions

constexpr thread_pool_scheduler()
thread_pool_scheduler(hpx::threads::thread_pool_base *pool)
namespace hpx
namespace execution
namespace experimental

Functions

template<typename Sender, typename Shape, typename F>
constexpr auto tag_invoke(bulk_t, thread_pool_scheduler scheduler, Sender &&sender, Shape &&shape, F &&f)