class fork_join_executor

Declaration

class fork_join_executor { /* full declaration omitted */ };

Description

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.

Declared at: libs/pika/executors/include/pika/executors/fork_join_executor.hpp:55

Method Overview

  • public template <typename F, typename S, typename... Ts>decltype(auto) bulk_async_execute(F && f, const S & shape, Ts &&... ts)
  • public template <typename F, typename S, typename... Ts>void bulk_sync_execute(F && f, const S & shape, Ts &&... ts)
  • public const pika::execution::experimental::fork_join_executor & context() const noexcept
  • public fork_join_executor(threads::thread_priority priority = threads::thread_priority::high, threads::thread_stacksize stacksize = threads::thread_stacksize::small_, pika::execution::experimental::fork_join_executor::loop_schedule schedule = loop_schedule::static_, std::chrono::nanoseconds yield_delay = std::chrono::duration<long, std::ratio<1, 1000>>(1))

Methods

template <typename F, typename S, typename... Ts>
decltype(auto) bulk_async_execute(F&& f,
                                  const S& shape,
                                  Ts&&... ts)

Declared at: libs/pika/executors/include/pika/executors/fork_join_executor.hpp:613

Parameters

F&& f
const S& shape
Ts&&... ts

template <typename F, typename S, typename... Ts>
void bulk_sync_execute(F&& f,
                       const S& shape,
                       Ts&&... ts)

Declared at: libs/pika/executors/include/pika/executors/fork_join_executor.hpp:606

Parameters

F&& f
const S& shape
Ts&&... ts

const pika::execution::experimental::
    fork_join_executor&
    context() const noexcept

Declared at: libs/pika/executors/include/pika/executors/fork_join_executor.hpp:629

fork_join_executor(
    threads::thread_priority priority =
        threads::thread_priority::high,
    threads::thread_stacksize stacksize =
        threads::thread_stacksize::small_,
    pika::execution::experimental::
        fork_join_executor::loop_schedule
            schedule = loop_schedule::static_,
    std::chrono::nanoseconds yield_delay = std::
        chrono::duration<long,
                         std::ratio<1, 1000>>(1))

Description

Construct a fork_join_executor.

Declared at: libs/pika/executors/include/pika/executors/fork_join_executor.hpp:644

Parameters

threads::thread_priority priority = threads::thread_priority::high
The priority of the worker threads.
threads::thread_stacksize stacksize = threads::thread_stacksize::small_
The stacksize of the worker threads. Must not be nostack.
pika::execution::experimental:: fork_join_executor::loop_schedule schedule = loop_schedule::static_
The loop schedule of the parallel regions.
std::chrono::nanoseconds yield_delay = std::chrono::duration<long, std::ratio<1, 1000>>(1)
The time after which the executor yields to other work if it hasn't received any new work for bulk execution.