dispenso 1.6.0
A library for task parallelism
Loading...
Searching...
No Matches
task_set.h File Reference
#include <dispenso/detail/task_set_impl.h>

Go to the source code of this file.

Classes

class  dispenso::TaskSet
 
class  dispenso::ConcurrentTaskSet
 

Enumerations

enum class  dispenso::TaskCost { kLightweight , kHeavy }
 

Functions

DISPENSO_DLL_ACCESS TaskSetBase * dispenso::parentTaskSet ()
 

Detailed Description

A file providing TaskSet and ConcurrentTaskSet. These interfaces allow the user to submit/schedule multiple closures and then wait on them.

Definition in file task_set.h.

Enumeration Type Documentation

◆ TaskCost

enum class dispenso::TaskCost
strong

Hint to ConcurrentTaskSet about how much work each scheduled task does. Affects how the task set distributes work across pool threads.

kHeavy (default) — Each task does meaningful work — typically anything taking microseconds or longer (e.g. a parallel_for chunk, a tree-build subproblem, image-tile processing, a numerical kernel). Choose kHeavy if you want best scaling across many cores, or if many threads will concurrently submit tasks (e.g. fork-join recursion).

kLightweight — Each task does very little work and you are submitting a large number of them, where submission cost matters more than scaling. Typical: short callbacks, small counter updates, simple per-element operations from a single producer.

If unsure, leave at kHeavy. Picking kHeavy for genuinely tiny tasks costs a small constant overhead per submission; picking kLightweight for heavy parallel work can leave many cores idle.

Definition at line 46 of file task_set.h.

Function Documentation

◆ parentTaskSet()

DISPENSO_DLL_ACCESS TaskSetBase * dispenso::parentTaskSet ( )

Get access to the parent task set that scheduled the currently running code. nullptr if called outside the context of a (Concurrent)TaskSet schedule.