hpx/compute_local/host/block_fork_join_executor.hpp
hpx/compute_local/host/block_fork_join_executor.hpp#
Defined in header hpx/compute_local/host/block_fork_join_executor.hpp.
See Public API for a list of names and headers that are part of the public HPX API.
-
namespace hpx
-
namespace execution
-
namespace experimental
-
class block_fork_join_executor#
- #include <block_fork_join_executor.hpp>
An executor with fork-join (blocking) semantics.
The block_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.
This behaviour is similar to the plain fork_join_executor except that the block_fork_join_executor creates a hierarchy of fork_join_executors, one for each target used to initialize it.
Public Functions
-
inline explicit block_fork_join_executor(threads::thread_priority priority = threads::thread_priority::bound, threads::thread_stacksize stacksize = threads::thread_stacksize::small_, fork_join_executor::loop_schedule const schedule = fork_join_executor::loop_schedule::static_, std::chrono::nanoseconds yield_delay = std::chrono::milliseconds(1))#
Construct a block_fork_join_executor.
Note
This constructor will create one fork_join_executor for each numa domain
- Parameters
priority – The priority of the worker threads.
stacksize – The stacksize of the worker threads. Must not be nostack.
schedule – The loop schedule of the parallel regions.
yield_delay – The time after which the executor yields to other work if it has not received any new work for execution.
-
inline explicit block_fork_join_executor(std::vector<compute::host::target> const &targets, threads::thread_priority priority = threads::thread_priority::bound, threads::thread_stacksize stacksize = threads::thread_stacksize::small_, fork_join_executor::loop_schedule const schedule = fork_join_executor::loop_schedule::static_, std::chrono::nanoseconds yield_delay = std::chrono::milliseconds(1))#
Construct a block_fork_join_executor.
Note
This constructor will create one fork_join_executor for each given target
- Parameters
targets – The list of targets to use for thread placement
priority – The priority of the worker threads.
stacksize – The stacksize of the worker threads. Must not be nostack.
schedule – The loop schedule of the parallel regions.
yield_delay – The time after which the executor yields to other work if it has not received any new work for execution.
-
template<typename F, typename S, typename ...Ts>
inline void bulk_sync_execute_helper(F &&f, S const &shape, Ts&&... ts)#
-
template<typename F, typename S, typename ...Ts>
inline decltype(auto) friend tag_invoke(hpx::parallel::execution::bulk_async_execute_t, block_fork_join_executor &exec, F &&f, S const &shape, Ts&&... ts)#
-
template<typename F, typename ...Fs>
inline decltype(auto) friend tag_invoke(hpx::parallel::execution::sync_invoke_t, block_fork_join_executor const &exec, F &&f, Fs&&... fs)#
-
template<typename F, typename ...Fs>
inline decltype(auto) friend tag_invoke(hpx::parallel::execution::async_invoke_t, block_fork_join_executor const &exec, F &&f, Fs&&... fs)#
-
template<typename Tag>
inline decltype(auto) friend tag_invoke(Tag tag, block_fork_join_executor const &exec) noexcept#
Private Static Functions
Friends
-
template<typename F, typename S, typename ...Ts>
inline friend void tag_invoke(hpx::parallel::execution::bulk_sync_execute_t, block_fork_join_executor &exec, F &&f, S const &shape, Ts&&... ts)#
-
template<typename Tag, typename Property>
inline friend block_fork_join_executor tag_invoke(Tag tag, block_fork_join_executor const &exec, Property &&prop) noexcept#
-
inline explicit block_fork_join_executor(threads::thread_priority priority = threads::thread_priority::bound, threads::thread_stacksize stacksize = threads::thread_stacksize::small_, fork_join_executor::loop_schedule const schedule = fork_join_executor::loop_schedule::static_, std::chrono::nanoseconds yield_delay = std::chrono::milliseconds(1))#
-
class block_fork_join_executor#
-
namespace experimental
-
namespace parallel
-
namespace execution
-
namespace execution
-
namespace execution