hpx/execution_base/execution.hpp#

Defined in header hpx/execution_base/execution.hpp.

See Public API for a list of names and headers that are part of the public HPX API.

namespace hpx
namespace execution
struct parallel_execution_tag#
#include <execution.hpp>

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.

struct sequenced_execution_tag#
#include <execution.hpp>

Function invocations executed by a group of sequential execution agents execute in sequential order.

struct unsequenced_execution_tag#
#include <execution.hpp>

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.

namespace parallel
namespace execution

Variables

constexpr struct hpx::parallel::execution::sync_execute_t sync_execute#
constexpr struct hpx::parallel::execution::async_execute_t async_execute#
constexpr struct hpx::parallel::execution::then_execute_t then_execute#
constexpr struct hpx::parallel::execution::post_t post#
constexpr struct hpx::parallel::execution::bulk_sync_execute_t bulk_sync_execute#
constexpr struct hpx::parallel::execution::bulk_async_execute_t bulk_async_execute#
constexpr struct hpx::parallel::execution::bulk_then_execute_t bulk_then_execute#
constexpr struct hpx::parallel::execution::async_invoke_t async_invoke#
constexpr struct hpx::parallel::execution::sync_invoke_t sync_invoke#
struct async_execute_t#
#include <execution.hpp>

Customization point for asynchronous execution agent creation.

This asynchronously creates a single function invocation f() using the associated executor.

Note

Executors have to implement only async_execute(). All other functions will be emulated by this or other customization points in terms of this single basic primitive. However, some executors will naturally specialize all operations for maximum efficiency.

Note

This is valid for one way executors (calls make_ready_future(exec.sync_execute(f, ts…) if it exists) and for two-way executors (calls exec.async_execute(f, ts…) if it exists).

Param exec

[in] The executor object to use for scheduling of the function f.

Param f

[in] The function which will be scheduled using the given executor.

Param ts

[in] Additional arguments to use to invoke f.

Return

f(ts…)’s result through a future

Public Functions

template<typename Executor, typename F, typename ...Ts>
inline decltype(auto) operator()(Executor &&exec, F &&f, Ts&&... ts) const#
template<executor_any Executor, typename F, typename ...Ts>
inline decltype(auto) operator()(Executor &&exec, F &&f, Ts&&... ts) const#
struct async_invoke_t#
#include <execution.hpp>

Asynchronously invoke the given set of nullary functions, each on its own execution agent

This creates a group of function invocations whose ordering is given by the execution_category associated with the executor.

All exceptions thrown by invocations of the functions are reported in a manner consistent with parallel algorithm execution through the returned future.

Note

This calls exec.async_invoke(fs…) if it exists; otherwise it executes async_execute(fs) for each fs.

Param exec

[in] The executor object to use for scheduling of the functions fs.

Param fs

[in] The functions which will be scheduled using the given executor.

Return

The return type of executor_type::async_invoke if defined by executor_type. Otherwise, a future<void> representing finishing the execution of all functions fs.

Public Functions

template<typename Executor, typename F, typename ...Fs>
inline decltype(auto) operator()(Executor &&exec, F &&f, Fs&&... fs) const#
template<executor_any Executor, typename F, typename ...Fs>
inline decltype(auto) operator()(Executor &&exec, F &&f, Fs&&... fs) const#
struct bulk_async_execute_t#
#include <execution.hpp>

Bulk form of asynchronous execution agent creation.

This asynchronously creates a group of function invocations f(i) whose ordering is given by the execution_category associated with the executor.

Here i takes on all values in the index space implied by shape. All exceptions thrown by invocations of f(i) are reported in a manner consistent with parallel algorithm execution through the returned future.

Note

This is deliberately different from the bulk_async_execute customization points specified in P0443.The bulk_async_execute customization point defined here is more generic and is used as the workhorse for implementing the specified APIs.

Note

This calls exec.bulk_async_execute(f, shape, ts…) if it exists; otherwise it executes async_execute(f, shape, ts…) as often as needed.

Param exec

[in] The executor object to use for scheduling of the function f.

Param f

[in] The function which will be scheduled using the given executor.

Param shape

[in] The shape objects which defines the iteration boundaries for the arguments to be passed to f.

Param ts

[in] Additional arguments to use to invoke f.

Return

The return type of executor_type::bulk_async_execute if defined by executor_type. Otherwise, a vector of futures holding the returned values of each invocation of f.

Public Functions

template<typename Executor, typename F, typename Shape, typename ...Ts>
inline decltype(auto) operator()(Executor &&exec, F &&f, Shape const &shape, Ts&&... ts) const#
template<typename Executor, typename F, typename Shape, typename ...Ts>
inline auto operator()(Executor &&exec, F &&f, Shape const &shape, Ts&&... ts) const -> decltype(HPX_FORWARD(Executor, exec).bulk_async_execute(HPX_FORWARD(F, f), shape, HPX_FORWARD(Ts, ts)...))#
template<executor_any Executor, typename F, typename Shape, typename ...Ts>
inline decltype(auto) operator()(Executor &&exec, F &&f, Shape const &shape, Ts&&... ts) const#
template<executor_any Executor, typename F, typename Shape, typename ...Ts>
inline decltype(auto) operator()(Executor &&exec, F &&f, Shape const &shape, Ts&&... ts) const
struct bulk_sync_execute_t#
#include <execution.hpp>

Bulk form of synchronous execution agent creation.

This synchronously creates a group of function invocations f(i) whose ordering is given by the execution_category associated with the executor. The function synchronizes the execution of all scheduled functions with the caller.

Here i takes on all values in the index space implied by shape. All exceptions thrown by invocations of f(i) are reported in a manner consistent with parallel algorithm execution through the returned future.

Note

This is deliberately different from the bulk_sync_execute customization points specified in P0443.The bulk_sync_execute customization point defined here is more generic and is used as the workhorse for implementing the specified APIs.

Note

This calls exec.bulk_sync_execute(f, shape, ts…) if it exists; otherwise it executes sync_execute(f, shape, ts…) as often as needed.

Param exec

[in] The executor object to use for scheduling of the function f.

Param f

[in] The function which will be scheduled using the given executor.

Param shape

[in] The shape objects which defines the iteration boundaries for the arguments to be passed to f.

Param ts

[in] Additional arguments to use to invoke f.

Return

The return type of executor_type::bulk_sync_execute if defined by executor_type. Otherwise, a vector holding the returned values of each invocation of f except when f returns void, which case void is returned.

Public Functions

template<typename Executor, typename F, typename Shape, typename ...Ts>
inline decltype(auto) operator()(Executor &&exec, F &&f, Shape const &shape, Ts&&... ts) const#
template<executor_any Executor, typename F, typename Shape, typename ...Ts>
inline decltype(auto) operator()(Executor &&exec, F &&f, Shape const &shape, Ts&&... ts) const#
template<executor_any Executor, typename F, typename Shape, typename ...Ts>
inline decltype(auto) operator()(Executor &&exec, F &&f, Shape const &shape, Ts&&... ts) const
struct bulk_then_execute_t#
#include <execution.hpp>

Bulk form of execution agent creation depending on a given future.

This creates a group of function invocations f(i) whose ordering is given by the execution_category associated with the executor.

Here i takes on all values in the index space implied by shape. All exceptions thrown by invocations of f(i) are reported in a manner consistent with parallel algorithm execution through the returned future.

Note

This is deliberately different from the then_sync_execute customization points specified in P0443.The bulk_then_execute customization point defined here is more generic and is used as the workhorse for implementing the specified APIs.

Note

This calls exec.bulk_then_execute(f, shape, pred, ts…) if it exists; otherwise it executes sync_execute(f, shape, pred.share(), ts…) (if this executor is also an OneWayExecutor), or async_execute(f, shape, pred.share(), ts…) (if this executor is also a TwoWayExecutor) - as often as needed.

Param exec

[in] The executor object to use for scheduling of the function f.

Param f

[in] The function which will be scheduled using the given executor.

Param shape

[in] The shape objects which defines the iteration boundaries for the arguments to be passed to f.

Param predecessor

[in] The future object the execution of the given function depends on.

Param ts

[in] Additional arguments to use to invoke f.

Return

The return type of executor_type::bulk_then_execute if defined by executor_type. Otherwise, a vector holding the returned values of each invocation of f.

Public Functions

template<typename Executor, typename F, typename Shape, typename Future, typename ...Ts>
inline decltype(auto) operator()(Executor &&exec, F &&f, Shape const &shape, Future &&predecessor, Ts&&... ts) const#
template<executor_any Executor, typename F, typename Shape, typename Future, typename ...Ts>
inline decltype(auto) operator()(Executor &&exec, F &&f, Shape const &shape, Future &&predecessor, Ts&&... ts) const#
template<executor_any Executor, typename F, typename Shape, typename Future, typename ...Ts>
inline decltype(auto) operator()(Executor &&exec, F &&f, Shape const &shape, Future &&predecessor, Ts&&... ts) const
struct post_t#
#include <execution.hpp>

Customization point for asynchronous fire & forget execution agent creation.

This asynchronously (fire & forget) creates a single function invocation f() using the associated executor.

Note

This is valid for two-way executors (calls exec.post(f, ts…), if available, otherwise it calls exec.async_execute(f, ts…) while discarding the returned future), and for non-blocking two-way executors (calls exec.post(f, ts…) if it exists).

Param exec

[in] The executor object to use for scheduling of the function f.

Param f

[in] The function which will be scheduled using the given executor.

Param ts

[in] Additional arguments to use to invoke f.

Public Functions

template<typename Executor, typename F, typename ...Ts>
inline decltype(auto) operator()(Executor &&exec, F &&f, Ts&&... ts) const#
template<executor_any Executor, typename F, typename ...Ts>
inline decltype(auto) operator()(Executor &&exec, F &&f, Ts&&... ts) const#
struct sync_execute_t#
#include <execution.hpp>

Customization point for synchronous execution agent creation.

This synchronously creates a single function invocation f() using the associated executor. The execution of the supplied function synchronizes with the caller

Note

It will call exec.sync_execute(f, ts…) if the executor exposes a corresponding member function. For two-way executors it will invoke async_execute and wait for the task’s completion before returning.

Param exec

[in] The executor object to use for scheduling of the function f.

Param f

[in] The function which will be scheduled using the given executor.

Param ts

[in] Additional arguments to use to invoke f.

Return

f(ts…)’s result

Public Functions

template<typename Executor, typename F, typename ...Ts>
inline decltype(auto) operator()(Executor &&exec, F &&f, Ts&&... ts) const#
template<executor_any Executor, typename F, typename ...Ts>
inline decltype(auto) operator()(Executor &&exec, F &&f, Ts&&... ts) const#
struct sync_invoke_t#
#include <execution.hpp>

Synchronously invoke the given set of nullary functions, each on its own execution agent

This creates a group of function invocations whose ordering is given by the execution_category associated with the executor.

All exceptions thrown by invocations of the functions are reported in a manner consistent with parallel algorithm execution through the returned future.

Note

This calls exec.sync_invoke(fs…) if it exists; otherwise it executes sync_execute(fs) for each fs.

Param exec

[in] The executor object to use for scheduling of the functions fs.

Param fs

[in] The functions which will be scheduled using the given executor.

Return

The return type of executor_type::async_invoke if defined by executor_type.

Public Functions

template<typename Executor, typename F, typename ...Fs>
inline decltype(auto) operator()(Executor &&exec, F &&f, Fs&&... fs) const#
template<executor_any Executor, typename F, typename ...Fs>
inline decltype(auto) operator()(Executor &&exec, F &&f, Fs&&... fs) const#
struct then_execute_t#
#include <execution.hpp>

Customization point for execution agent creation depending on a given future.

This creates a single function invocation f() using the associated executor after the given future object has become ready.

Note

This is valid for two-way executors (calls exec.then_execute(f, predecessor, ts…) if it exists) and for one way executors (calls predecessor.then(bind(f, ts…))).

Param exec

[in] The executor object to use for scheduling of the function f.

Param f

[in] The function which will be scheduled using the given executor.

Param predecessor

[in] The future object the execution of the given function depends on.

Param ts

[in] Additional arguments to use to invoke f.

Return

f(ts…)’s result through a future

Public Functions

template<typename Executor, typename F, typename Future, typename ...Ts>
inline decltype(auto) operator()(Executor &&exec, F &&f, Future &&predecessor, Ts&&... ts) const#
template<executor_any Executor, typename F, typename Future, typename ...Ts>
inline decltype(auto) operator()(Executor &&exec, F &&f, Future &&predecessor, Ts&&... ts) const#