GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
grem::execution::Scheduler< EntReg, ResReg > Class Template Reference

Statically scheduled task graph builder. More...

#include <GREM/execution/Scheduler.hpp>

Public Member Functions

void clear () noexcept
 Erase all tasks from the task list and reset the scheduler to an empty state.
template<auto TaskFunction>
Scheduler & addTask (String name={})
 Append a basic task to the task list.
template<auto TaskFunction>
Scheduler & addOptionalTask (String name={})
 Append an optional basic task to the task list.
template<auto TaskFunction>
Scheduler & addParallelTask (Task::ParallelCount parallelism, String name={})
 Append a data-parallel task to the task list that performs a chunked operation over a specific resource.
template<auto TaskFunction>
Scheduler & addOptionalParallelTask (Task::ParallelCount parallelism, String name={})
 Append an optional data-parallel task to the task list that performs a chunked operation over a specific resource.
template<auto TaskFunction>
Scheduler & addUnsafeParallelTask (Task::ParallelCount parallelism, String name={})
 Append a data-parallel task to the task list that performs a chunked operation over a specific resource, without any of the compile-time safety checks that prevent sub-tasks from accidentally mutating shared data.
template<auto TaskFunction>
Scheduler & addOptionalUnsafeParallelTask (Task::ParallelCount parallelism, String name={})
 Append an optional data-parallel task to the task list that performs a chunked operation over a specific resource, without any of the compile-time safety checks that prevent sub-tasks from accidentally mutating shared data.
template<auto TaskFunction>
Scheduler & addParallelTransformationTask (Task::ParallelCount parallelism, String name={})
 Append a data-parallel task to the task list that performs a chunked transformation over a specific entity range.
template<auto TaskFunction>
Scheduler & addOptionalParallelTransformationTask (Task::ParallelCount parallelism, String name={})
 Append an optional data-parallel task to the task list that performs a chunked transformation over a specific entity range.
template<auto TaskFunction>
Scheduler & addUnsafeParallelTransformationTask (Task::ParallelCount parallelism, String name={})
 Append a data-parallel task to the task list that performs a chunked transformation over a specific entity range, without any of the compile-time safety checks that prevent sub-tasks from accidentally mutating shared data.
template<auto TaskFunction>
Scheduler & addOptionalUnsafeParallelTransformationTask (Task::ParallelCount parallelism, String name={})
 Append an optional data-parallel task to the task list that performs a chunked transformation over a specific entity range, without any of the compile-time safety checks that prevent sub-tasks from accidentally mutating shared data.
template<auto TaskFunction, auto ReductionFunction>
Scheduler & addParallelReductionTask (Task::ParallelCount parallelism, String name={})
 Append a data-parallel task to the task list that performs a chunked reduction operation over a specific entity range and outputs the result to a specific resource.
template<auto TaskFunction, auto ReductionFunction>
Scheduler & addOptionalParallelReductionTask (Task::ParallelCount parallelism, String name={})
 Append an optional data-parallel task to the task list that performs a chunked reduction operation over a specific entity range and outputs the result to a specific resource.
Scheduler & addBarrier ()
 Append a full synchronization barrier to the task list.
Schedule< EntReg, ResReg > buildSchedule (String name={})
 Consume the current task list, calculate the dependencies between the tasks and schedule the final execution graph.

Detailed Description

template<typename EntReg, typename ResReg>
class grem::execution::Scheduler< EntReg, ResReg >

Statically scheduled task graph builder.

This class is intended to be used at application startup to automatically determine the data dependencies between a dynamic list of ordered tasks (which can e.g. be loaded by dynamically linked plugins) and generate a static execution graph in the form of a Schedule that specifies which tasks are able to be run independently in parallel, such that they can be efficiently executed by a multithreaded Executor any number of times.

There are four kinds of tasks that can be scheduled, using the following categories of functions:

  • addTask(): For basic tasks that perform some self-contained unit of work, with arbitrary read/write access to any entities, component pools or resources needed by the task. These tasks can be run in parallel with other tasks that don't have overlapping access to the same mutable components/resources.
  • addParallelTask(): For tasks that perform a chunked operation over a specific resource, with read-only access to all other data. These tasks are split into per-chunk sub-tasks that can be run in parallel with each other, as well as with any other tasks that don't have overlapping access to the same mutable components/resources.
  • addParallelTransformationTask(): For tasks that perform a chunked transformation over a specific entity range, with read-only access to all other data. These tasks are split into per-chunk sub-tasks that can be run in parallel with each other, as well as with any other tasks that don't have overlapping access to the same mutable components/resources.
  • addParallelReductionTask(): For tasks that perform a chunked reduction operation (e.g. a sum or min/max) over a specific entity range and output the result to a specific resource, with read-only access to all other data. These tasks are split into per-chunk sub-tasks that can be run in parallel with each other, as well as with any other tasks that don't have overlapping access to the same mutable components/resources, followed by a single task that combines all of the intermediate per-chunk results and writes the final output to the resource.

The parallel task types also have "unsafe" variants, e.g. addUnsafeParallelTask(), that don't enforce read-only access to the non-chunked data. These can be useful when doing manual synchronization/separation of the shared data, separate from the scheduling system.

Each task type also has a corresponding "optional" variant, e.g. addOptionalTask(), that does not throw an exception when there are missing task arguments, and simply skips the task instead in that case.

Template Parameters
EntRegconcrete entity registry type used by the scheduled tasks, e.g. some specialization of EntityRegistry or EntityTable.
ResRegconcrete resource registry type used by the scheduled tasks, e.g. some specialization of ResourceRegistry or ResourceTable.

Member Function Documentation

◆ clear()

template<typename EntReg, typename ResReg>
void grem::execution::Scheduler< EntReg, ResReg >::clear ( )
inlinenoexcept

Erase all tasks from the task list and reset the scheduler to an empty state.

◆ addTask()

template<typename EntReg, typename ResReg>
template<auto TaskFunction>
Scheduler & grem::execution::Scheduler< EntReg, ResReg >::addTask ( String name = {})
inline

Append a basic task to the task list.

Template Parameters
TaskFunctioncontextless function object that executes the task. The task function should return void and may accept the following kinds of parameters:
  • T&: Mutable access to a singleton resource of type T from the resource registry that is provided on execution of the schedule.
  • T or const T&: Read-only access to a singleton resource of type T from the resource registry that is provided on execution of the schedule.
  • An entity range type, such as Entities or Columns, from the entity registry that is provided on execution of the schedule.
  • A component pool reference type, such as ComponentPool, from the entity registry that is provided on execution of the schedule. The task function will be wrapped in a thunk that retrieves the required arguments from the task context and throws an execution::Error if any of the task function's parameters are missing from the provided registries when the task is executed.
Parameters
nameoptional UTF-8-encoded human-readable name of the task.
Returns
*this, for chaining.
Exceptions
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

◆ addOptionalTask()

template<typename EntReg, typename ResReg>
template<auto TaskFunction>
Scheduler & grem::execution::Scheduler< EntReg, ResReg >::addOptionalTask ( String name = {})
inline

Append an optional basic task to the task list.

Template Parameters
TaskFunctioncontextless function object that executes the task. The task function should return void and may accept the following kinds of parameters:
  • T&: Mutable access to a singleton resource of type T from the resource registry that is provided on execution of the schedule.
  • T or const T&: Read-only access to a singleton resource of type T from the resource registry that is provided on execution of the schedule.
  • An entity range type, such as Entities or Columns, from the entity registry that is provided on execution of the schedule.
  • A component pool reference type, such as ComponentPool, from the entity registry that is provided on execution of the schedule. The task function will be wrapped in a thunk that retrieves the required arguments from the task context and skips the task if any of the task function's parameters are missing from the provided registries when the task is executed.
Parameters
nameoptional UTF-8-encoded human-readable name of the task.
Returns
*this, for chaining.
Exceptions
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

◆ addParallelTask()

template<typename EntReg, typename ResReg>
template<auto TaskFunction>
Scheduler & grem::execution::Scheduler< EntReg, ResReg >::addParallelTask ( Task::ParallelCount parallelism,
String name = {} )
inline

Append a data-parallel task to the task list that performs a chunked operation over a specific resource.

Template Parameters
TaskFunctioncontextless function object that executes one chunk of the task. The task function should return void and may accept the following kinds of parameters:
  • Chunk<T>: Mutable access to a subrange of a singleton resource of type T. Each parallel invocation of the task function will be provided a distinct non-overlapping subrange of the full resource, such that the full range is covered.
  • Chunk<const T>: Read-only access to a subrange of a singleton resource of type T. Each parallel invocation of the task function will be provided a distinct non-overlapping subrange of the full resource, such that the full range is covered.
  • T or const T&: Read-only access to a singleton resource of type T from the resource registry that is provided on execution of the schedule.
  • A read-only entity range type, such as Entities or Columns, from the entity registry that is provided on execution of the schedule.
  • A read-only component pool reference type, such as ComponentPool, from the entity registry that is provided on execution of the schedule. The task function will be wrapped in a thunk that retrieves the required arguments from the task context and throws an execution::Error if any of the task function's parameters are missing from the provided registries when the task is executed.
Parameters
parallelismnumber of parallel chunks to split the task into. Should typically be less than or equal to the executor.getMaxParallelism() value of the executor that the schedule will be executed on.
nameoptional UTF-8-encoded human-readable name of the task.
Returns
*this, for chaining.
Exceptions
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

◆ addOptionalParallelTask()

template<typename EntReg, typename ResReg>
template<auto TaskFunction>
Scheduler & grem::execution::Scheduler< EntReg, ResReg >::addOptionalParallelTask ( Task::ParallelCount parallelism,
String name = {} )
inline

Append an optional data-parallel task to the task list that performs a chunked operation over a specific resource.

Template Parameters
TaskFunctioncontextless function object that executes one chunk of the task. The task function should return void and may accept the following kinds of parameters:
  • Chunk<T>: Mutable access to a subrange of a singleton resource of type T. Each parallel invocation of the task function will be provided a distinct non-overlapping subrange of the full resource, such that the full range is covered.
  • Chunk<const T>: Read-only access to a subrange of a singleton resource of type T. Each parallel invocation of the task function will be provided a distinct non-overlapping subrange of the full resource, such that the full range is covered.
  • T or const T&: Read-only access to a singleton resource of type T from the resource registry that is provided on execution of the schedule.
  • A read-only entity range type, such as Entities or Columns, from the entity registry that is provided on execution of the schedule.
  • A read-only component pool reference type, such as ComponentPool, from the entity registry that is provided on execution of the schedule. The task function will be wrapped in a thunk that retrieves the required arguments from the task context and skips the task if any of the task function's parameters are missing from the provided registries when the task is executed.
Parameters
parallelismnumber of parallel chunks to split the task into. Should typically be less than or equal to the executor.getMaxParallelism() value of the executor that the schedule will be executed on.
nameoptional UTF-8-encoded human-readable name of the task.
Returns
*this, for chaining.
Exceptions
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

◆ addUnsafeParallelTask()

template<typename EntReg, typename ResReg>
template<auto TaskFunction>
Scheduler & grem::execution::Scheduler< EntReg, ResReg >::addUnsafeParallelTask ( Task::ParallelCount parallelism,
String name = {} )
inline

Append a data-parallel task to the task list that performs a chunked operation over a specific resource, without any of the compile-time safety checks that prevent sub-tasks from accidentally mutating shared data.

Template Parameters
TaskFunctioncontextless function object that executes one chunk of the task. The task function should return void and may accept the following kinds of parameters:
  • Chunk<T>: Mutable access to a subrange of a singleton resource of type T. Each parallel invocation of the task function will be provided a distinct non-overlapping subrange of the full resource, such that the full range is covered.
  • Chunk<const T>: Read-only access to a subrange of a singleton resource of type T. Each parallel invocation of the task function will be provided a distinct non-overlapping subrange of the full resource, such that the full range is covered.
  • T or const T&: Read-only access to a singleton resource of type T from the resource registry that is provided on execution of the schedule.
  • A read-only entity range type, such as Entities or Columns, from the entity registry that is provided on execution of the schedule.
  • A read-only component pool reference type, such as ComponentPool, from the entity registry that is provided on execution of the schedule. The task function will be wrapped in a thunk that retrieves the required arguments from the task context and throws an execution::Error if any of the task function's parameters are missing from the provided registries when the task is executed.
Parameters
parallelismnumber of parallel chunks to split the task into. Should typically be less than or equal to the executor.getMaxParallelism() value of the executor that the schedule will be executed on.
nameoptional UTF-8-encoded human-readable name of the task.
Returns
*this, for chaining.
Exceptions
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

◆ addOptionalUnsafeParallelTask()

template<typename EntReg, typename ResReg>
template<auto TaskFunction>
Scheduler & grem::execution::Scheduler< EntReg, ResReg >::addOptionalUnsafeParallelTask ( Task::ParallelCount parallelism,
String name = {} )
inline

Append an optional data-parallel task to the task list that performs a chunked operation over a specific resource, without any of the compile-time safety checks that prevent sub-tasks from accidentally mutating shared data.

Template Parameters
TaskFunctioncontextless function object that executes one chunk of the task. The task function should return void and may accept the following kinds of parameters:
  • Chunk<T>: Mutable access to a subrange of a singleton resource of type T. Each parallel invocation of the task function will be provided a distinct non-overlapping subrange of the full resource, such that the full range is covered.
  • Chunk<const T>: Read-only access to a subrange of a singleton resource of type T. Each parallel invocation of the task function will be provided a distinct non-overlapping subrange of the full resource, such that the full range is covered.
  • T or const T&: Read-only access to a singleton resource of type T from the resource registry that is provided on execution of the schedule.
  • A read-only entity range type, such as Entities or Columns, from the entity registry that is provided on execution of the schedule.
  • A read-only component pool reference type, such as ComponentPool, from the entity registry that is provided on execution of the schedule. The task function will be wrapped in a thunk that retrieves the required arguments from the task context and skips the task if any of the task function's parameters are missing from the provided registries when the task is executed.
Parameters
parallelismnumber of parallel chunks to split the task into. Should typically be less than or equal to the executor.getMaxParallelism() value of the executor that the schedule will be executed on.
nameoptional UTF-8-encoded human-readable name of the task.
Returns
*this, for chaining.
Exceptions
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

◆ addParallelTransformationTask()

template<typename EntReg, typename ResReg>
template<auto TaskFunction>
Scheduler & grem::execution::Scheduler< EntReg, ResReg >::addParallelTransformationTask ( Task::ParallelCount parallelism,
String name = {} )
inline

Append a data-parallel task to the task list that performs a chunked transformation over a specific entity range.

Template Parameters
TaskFunctioncontextless function object that executes one chunk of the task. The task function should return void and may accept the following kinds of parameters:
  • T or const T&: Read-only access to a singleton resource of type T from the resource registry that is provided on execution of the schedule.
  • An entity range type, such as Entities or Columns, from the entity registry that is provided on execution of the schedule. Each parallel invocation of the task function will be provided a distinct non-overlapping subrange of the full entity range, such that the full range is covered.
  • A read-only component pool reference type, such as ComponentPool, from the entity registry that is provided on execution of the schedule. The task function will be wrapped in a thunk that retrieves the required arguments from the task context and throws an execution::Error if any of the task function's parameters are missing from the provided registries when the task is executed.
Parameters
parallelismnumber of parallel chunks to split the task into. Should typically be less than or equal to the executor.getMaxParallelism() value of the executor that the schedule will be executed on.
nameoptional UTF-8-encoded human-readable name of the task.
Returns
*this, for chaining.
Exceptions
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

◆ addOptionalParallelTransformationTask()

template<typename EntReg, typename ResReg>
template<auto TaskFunction>
Scheduler & grem::execution::Scheduler< EntReg, ResReg >::addOptionalParallelTransformationTask ( Task::ParallelCount parallelism,
String name = {} )
inline

Append an optional data-parallel task to the task list that performs a chunked transformation over a specific entity range.

Template Parameters
TaskFunctioncontextless function object that executes one chunk of the task. The task function should return void and may accept the following kinds of parameters:
  • T or const T&: Read-only access to a singleton resource of type T from the resource registry that is provided on execution of the schedule.
  • An entity range type, such as Entities or Columns, from the entity registry that is provided on execution of the schedule. Each parallel invocation of the task function will be provided a distinct non-overlapping subrange of the full entity range, such that the full range is covered.
  • A read-only component pool reference type, such as ComponentPool, from the entity registry that is provided on execution of the schedule. The task function will be wrapped in a thunk that retrieves the required arguments from the task context and skips the task if any of the task function's parameters are missing from the provided registries when the task is executed.
Parameters
parallelismnumber of parallel chunks to split the task into. Should typically be less than or equal to the executor.getMaxParallelism() value of the executor that the schedule will be executed on.
nameoptional UTF-8-encoded human-readable name of the task.
Returns
*this, for chaining.
Exceptions
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

◆ addUnsafeParallelTransformationTask()

template<typename EntReg, typename ResReg>
template<auto TaskFunction>
Scheduler & grem::execution::Scheduler< EntReg, ResReg >::addUnsafeParallelTransformationTask ( Task::ParallelCount parallelism,
String name = {} )
inline

Append a data-parallel task to the task list that performs a chunked transformation over a specific entity range, without any of the compile-time safety checks that prevent sub-tasks from accidentally mutating shared data.

Template Parameters
TaskFunctioncontextless function object that executes one chunk of the task. The task function should return void and may accept the following kinds of parameters:
  • T or const T&: Read-only access to a singleton resource of type T from the resource registry that is provided on execution of the schedule.
  • An entity range type, such as Entities or Columns, from the entity registry that is provided on execution of the schedule. Each parallel invocation of the task function will be provided a distinct non-overlapping subrange of the full entity range, such that the full range is covered.
  • A read-only component pool reference type, such as ComponentPool, from the entity registry that is provided on execution of the schedule. The task function will be wrapped in a thunk that retrieves the required arguments from the task context and throws an execution::Error if any of the task function's parameters are missing from the provided registries when the task is executed.
Parameters
parallelismnumber of parallel chunks to split the task into. Should typically be less than or equal to the executor.getMaxParallelism() value of the executor that the schedule will be executed on.
nameoptional UTF-8-encoded human-readable name of the task.
Returns
*this, for chaining.
Exceptions
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

◆ addOptionalUnsafeParallelTransformationTask()

template<typename EntReg, typename ResReg>
template<auto TaskFunction>
Scheduler & grem::execution::Scheduler< EntReg, ResReg >::addOptionalUnsafeParallelTransformationTask ( Task::ParallelCount parallelism,
String name = {} )
inline

Append an optional data-parallel task to the task list that performs a chunked transformation over a specific entity range, without any of the compile-time safety checks that prevent sub-tasks from accidentally mutating shared data.

Template Parameters
TaskFunctioncontextless function object that executes one chunk of the task. The task function should return void and may accept the following kinds of parameters:
  • T or const T&: Read-only access to a singleton resource of type T from the resource registry that is provided on execution of the schedule.
  • An entity range type, such as Entities or Columns, from the entity registry that is provided on execution of the schedule. Each parallel invocation of the task function will be provided a distinct non-overlapping subrange of the full entity range, such that the full range is covered.
  • A read-only component pool reference type, such as ComponentPool, from the entity registry that is provided on execution of the schedule. The task function will be wrapped in a thunk that retrieves the required arguments from the task context and skips the task if any of the task function's parameters are missing from the provided registries when the task is executed.
Parameters
parallelismnumber of parallel chunks to split the task into. Should typically be less than or equal to the executor.getMaxParallelism() value of the executor that the schedule will be executed on.
nameoptional UTF-8-encoded human-readable name of the task.
Returns
*this, for chaining.
Exceptions
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

◆ addParallelReductionTask()

template<typename EntReg, typename ResReg>
template<auto TaskFunction, auto ReductionFunction>
Scheduler & grem::execution::Scheduler< EntReg, ResReg >::addParallelReductionTask ( Task::ParallelCount parallelism,
String name = {} )
inline

Append a data-parallel task to the task list that performs a chunked reduction operation over a specific entity range and outputs the result to a specific resource.

Template Parameters
TaskFunctioncontextless function object that executes one chunk of the task. The task function should return void and may accept the following kinds of parameters:
  • T&: Mutable access to a singleton resource of type T to write the result of the reduction operation to.
  • T or const T&: Read-only access to a singleton resource of type T from the resource registry that is provided on execution of the schedule.
  • An entity range type, such as Entities or Columns, from the entity registry that is provided on execution of the schedule. Each parallel invocation of the task function will be provided a distinct non-overlapping subrange of the full entity range, such that the full range is covered.
  • A read-only component pool reference type, such as ComponentPool, from the entity registry that is provided on execution of the schedule. The task function will be wrapped in a thunk that retrieves the required arguments from the task context and throws an execution::Error if any of the task function's parameters are missing from the provided registries when the task is executed.
ReductionFunctioncontextless function object that takes two instances of the resource type output by TaskFunction and reduces them into one, returning the result. This reduction function is used to combine the intermediate results produced by the main task function for each chunk. It may also, in addition to the two resource instances, accept the same kinds of read-only parameters as the main task function at the end of the parameter list.
Parameters
parallelismnumber of parallel chunks to split the task into. Should typically be less than or equal to the executor.getMaxParallelism() value of the executor that the schedule will be executed on.
nameoptional UTF-8-encoded human-readable name of the task.
Returns
*this, for chaining.
Exceptions
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

◆ addOptionalParallelReductionTask()

template<typename EntReg, typename ResReg>
template<auto TaskFunction, auto ReductionFunction>
Scheduler & grem::execution::Scheduler< EntReg, ResReg >::addOptionalParallelReductionTask ( Task::ParallelCount parallelism,
String name = {} )
inline

Append an optional data-parallel task to the task list that performs a chunked reduction operation over a specific entity range and outputs the result to a specific resource.

Template Parameters
TaskFunctioncontextless function object that executes one chunk of the task. The task function should return void and may accept the following kinds of parameters:
  • T&: Mutable access to a singleton resource of type T to write the result of the reduction operation to.
  • T or const T&: Read-only access to a singleton resource of type T from the resource registry that is provided on execution of the schedule.
  • An entity range type, such as Entities or Columns, from the entity registry that is provided on execution of the schedule. Each parallel invocation of the task function will be provided a distinct non-overlapping subrange of the full entity range, such that the full range is covered.
  • A read-only component pool reference type, such as ComponentPool, from the entity registry that is provided on execution of the schedule. The task function will be wrapped in a thunk that retrieves the required arguments from the task context and skips the task if any of the task function's parameters are missing from the provided registries when the task is executed.
ReductionFunctioncontextless function object that takes two instances of the resource type output by TaskFunction and reduces them into one, returning the result. This reduction function is used to combine the intermediate results produced by the main task function for each chunk. It may also, in addition to the two resource instances, accept the same kinds of read-only parameters as the main task function at the end of the parameter list.
Parameters
parallelismnumber of parallel chunks to split the task into. Should typically be less than or equal to the executor.getMaxParallelism() value of the executor that the schedule will be executed on.
nameoptional UTF-8-encoded human-readable name of the task.
Returns
*this, for chaining.
Exceptions
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

◆ addBarrier()

template<typename EntReg, typename ResReg>
Scheduler & grem::execution::Scheduler< EntReg, ResReg >::addBarrier ( )
inline

Append a full synchronization barrier to the task list.

This causes all subsequent tasks added to the task list to unconditionally synchronize with all tasks that were added before the barrier, preventing them from running in parallel with those tasks.

This may be useful for synchronizing tasks that have global data dependencies, unknown to the scheduling system.

Returns
*this, for chaining.

◆ buildSchedule()

template<typename EntReg, typename ResReg>
Schedule< EntReg, ResReg > grem::execution::Scheduler< EntReg, ResReg >::buildSchedule ( String name = {})
inlinenodiscard

Consume the current task list, calculate the dependencies between the tasks and schedule the final execution graph.

Parameters
nameoptional UTF-8-encoded human-readable name of the schedule.
Returns
the final task schedule built by the scheduler.
Exceptions
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.
Note
This function resets the scheduler to an empty state.

The documentation for this class was generated from the following file: