Statically scheduled unit of work to be executed by an Executor as part of a task graph.
More...
#include <GREM/execution/Task.hpp>
Statically scheduled unit of work to be executed by an Executor as part of a task graph.
- See also
- Scheduler
◆ ParallelIndex
Index of a parallel sub-task.
◆ ParallelCount
Number of a parallel sub-tasks.
◆ Function
Callback function pointer that executes a task.
◆ GraphIndex
Index of a task in a task graph.
◆ Count
Number of tasks in a task graph.
◆ SharedMemoryOffset
Byte offset into the shared memory allocated for a task.
◆ SharedMemorySize
Size, in bytes, of shared memory allocated for a task.
◆ DependencyIndices
List of indices of previous tasks that a task depends on.
◆ Task()
Construct a task.
- Parameters
-
| function | callback function that executes the task. |
| sharedMemoryOffset | offset of the first byte allocated for this task in the shared task memory. |
| parallelIndex | sub-task index of the task. Must be less than parallelism. |
| parallelism | number of parallel sub-tasks that this task is part of. Must be positive. |
| dependencyIndices | list of indices of previous tasks that this task depends on. |
| name | owning pointer to a null-terminated UTF-8-encoded string containing the human-readable name of the task, or nullptr to create an unnamed task. |
◆ execute()
| void grem::execution::Task::execute |
( |
void * | context, |
|
|
byte * | sharedMemory ) const |
|
inline |
Execute the task.
- Parameters
-
| context | user-defined context pointer to pass to the callback function's void* context parameter. |
| sharedMemory | non-owning pointer to the start of the memory allocated for all tasks in the task graph. The callback function will be passed this pointer plus the value of the task's getSharedMemoryOffset(). |
- Exceptions
-
| any | exception thrown by the task's callback function. |
◆ getSharedMemoryOffset()
Get the expected offset of this task's reserved memory range in the total shared task memory allocated for the task graph.
- Returns
- the shared memory offset of the task.
◆ getDependencyIndices()
| Span< const GraphIndex > grem::execution::Task::getDependencyIndices |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
Get the task indices of this task's dependencies in the task graph.
- Returns
- the list of indices of previous tasks that this task depends on.
◆ getName()
Get the human-readable name of the task.
- Returns
- a UTF-8-encoded string containing the task name, or an empty string if the task is unnamed.
◆ MAX_GRAPH_SIZE
| size_t grem::execution::Task::MAX_GRAPH_SIZE = size_t{Limits<Count>::MAX} |
|
staticconstexpr |
The maximum supported number of tasks in a task graph.
The documentation for this class was generated from the following file: