StarPU Handbook

Data Structures | Macros | Enumerations | Functions
Modularized Scheduler Interface

## Data Structures
struct | starpu_sched_component
struct | starpu_sched_tree
struct | starpu_sched_component_fifo_data
struct | starpu_sched_component_prio_data
struct | starpu_sched_component_mct_data
struct | starpu_sched_component_heteroprio_data
struct | starpu_sched_component_perfmodel_select_data
struct | starpu_sched_component_specs

## Macros
#define | STARPU_SCHED_COMPONENT_IS_HOMOGENEOUS(component)
#define | STARPU_SCHED_COMPONENT_IS_SINGLE_MEMORY_NODE(component)
#define | STARPU_COMPONENT_MUTEX_LOCK(m)
#define | STARPU_COMPONENT_MUTEX_TRYLOCK(m)
#define | STARPU_COMPONENT_MUTEX_UNLOCK(m)

## Enumerations
enum | starpu_sched_component_properties { STARPU_SCHED_COMPONENT_HOMOGENEOUS , STARPU_SCHED_COMPONENT_SINGLE_MEMORY_NODE }

## Functions
void | starpu_initialize_prio_center_policy (unsigned sched_ctx_id)

## Generic Scheduling Component API
typedef struct starpu_sched_component *(* | starpu_sched_component_create_t) (struct starpu_sched_tree *tree, void *data)
struct starpu_sched_component * | starpu_sched_component_create (struct starpu_sched_tree *tree, const char *name) STARPU_ATTRIBUTE_MALLOC
void | starpu_sched_component_destroy (struct starpu_sched_component *component)
void | starpu_sched_component_destroy_rec (struct starpu_sched_component *component)
void | starpu_sched_component_add_child (struct starpu_sched_component *component, struct starpu_sched_component *child)
int | starpu_sched_component_can_execute_task (struct starpu_sched_component *component, struct starpu_task *task)
int STARPU_WARN_UNUSED_RESULT | starpu_sched_component_execute_preds (struct starpu_sched_component *component, struct starpu_task *task, double *length)
double | starpu_sched_component_transfer_length (struct starpu_sched_component *component, struct starpu_task *task)
void | starpu_sched_component_prefetch_on_node (struct starpu_sched_component *component, struct starpu_task *task)

## Scheduling Tree API
struct starpu_sched_tree * | starpu_sched_tree_create (unsigned sched_ctx_id) STARPU_ATTRIBUTE_MALLOC
void | starpu_sched_tree_destroy (struct starpu_sched_tree *tree)
void | starpu_sched_tree_deinitialize (unsigned sched_ctx_id)
struct starpu_sched_tree * | starpu_sched_tree_get (unsigned sched_ctx_id)
void | starpu_sched_tree_update_workers (struct starpu_sched_tree *t)
void | starpu_sched_tree_update_workers_in_ctx (struct starpu_sched_tree *t)
int | starpu_sched_tree_push_task (struct starpu_task *task)
struct starpu_task * | starpu_sched_tree_pop_task (unsigned sched_ctx)
int | starpu_sched_component_push_task (struct starpu_sched_component *from, struct starpu_sched_component *to, struct starpu_task *task)
struct starpu_task * | starpu_sched_component_pull_task (struct starpu_sched_component *from, struct starpu_sched_component *to)
struct starpu_task * | starpu_sched_component_pump_to (struct starpu_sched_component *component, struct starpu_sched_component *to, int *success)
struct starpu_task * | starpu_sched_component_pump_downstream (struct starpu_sched_component *component, int *success)
int | starpu_sched_component_send_can_push_to_parents (struct starpu_sched_component *component)
void | starpu_sched_tree_add_workers (unsigned sched_ctx_id, int *workerids, unsigned nworkers)
void | starpu_sched_tree_remove_workers (unsigned sched_ctx_id, int *workerids, unsigned nworkers)
void | starpu_sched_component_connect (struct starpu_sched_component *parent, struct starpu_sched_component *child)

## Worker Component API
struct starpu_sched_component * | starpu_sched_component_worker_get (unsigned sched_ctx, int workerid)
struct starpu_sched_component * | starpu_sched_component_worker_new (unsigned sched_ctx, int workerid)
struct starpu_sched_component * | starpu_sched_component_parallel_worker_create (struct starpu_sched_tree *tree, unsigned nworkers, unsigned *workers)
int | starpu_sched_component_worker_get_workerid (struct starpu_sched_component *worker_component)
int | starpu_sched_component_is_worker (struct starpu_sched_component *component)
int | starpu_sched_component_is_simple_worker (struct starpu_sched_component *component)
int | starpu_sched_component_is_combined_worker (struct starpu_sched_component *component)
void | starpu_sched_component_worker_pre_exec_hook (struct starpu_task *task, unsigned sched_ctx_id)
void | starpu_sched_component_worker_post_exec_hook (struct starpu_task *task, unsigned sched_ctx_id)

## Flow-control Fifo Component API
struct starpu_task * | starpu_sched_component_parents_pull_task (struct starpu_sched_component *component, struct starpu_sched_component *to)
int | starpu_sched_component_can_push (struct starpu_sched_component *component, struct starpu_sched_component *to)
int | starpu_sched_component_can_pull (struct starpu_sched_component *component)
int | starpu_sched_component_can_pull_all (struct starpu_sched_component *component)
double | starpu_sched_component_estimated_load (struct starpu_sched_component *component)
double | starpu_sched_component_estimated_end_min (struct starpu_sched_component *component)
double | starpu_sched_component_estimated_end_min_add (struct starpu_sched_component *component, double exp_len)
double | starpu_sched_component_estimated_end_average (struct starpu_sched_component *component)
struct starpu_sched_component * | starpu_sched_component_fifo_create (struct starpu_sched_tree *tree, struct starpu_sched_component_fifo_data *fifo_data) STARPU_ATTRIBUTE_MALLOC
int | starpu_sched_component_is_fifo (struct starpu_sched_component *component)

## Flow-control Prio Component API
struct starpu_sched_component * | starpu_sched_component_prio_create (struct starpu_sched_tree *tree, struct starpu_sched_component_prio_data *prio_data) STARPU_ATTRIBUTE_MALLOC
int | starpu_sched_component_is_prio (struct starpu_sched_component *component)

## Resource-mapping Work-Stealing Component API
struct starpu_sched_component * | starpu_sched_component_work_stealing_create (struct starpu_sched_tree *tree, void *arg) STARPU_ATTRIBUTE_MALLOC
int | starpu_sched_component_is_work_stealing (struct starpu_sched_component *component)
int | starpu_sched_tree_work_stealing_push_task (struct starpu_task *task)

## Resource-mapping Random Component API
struct starpu_sched_component * | starpu_sched_component_random_create (struct starpu_sched_tree *tree, void *arg) STARPU_ATTRIBUTE_MALLOC
int | starpu_sched_component_is_random (struct starpu_sched_component *)

## Resource-mapping Eager Component API
struct starpu_sched_component * | starpu_sched_component_eager_create (struct starpu_sched_tree *tree, void *arg) STARPU_ATTRIBUTE_MALLOC
int | starpu_sched_component_is_eager (struct starpu_sched_component *)

## Resource-mapping Eager Prio Component API
struct starpu_sched_component * | starpu_sched_component_eager_prio_create (struct starpu_sched_tree *tree, void *arg) STARPU_ATTRIBUTE_MALLOC
int | starpu_sched_component_is_eager_prio (struct starpu_sched_component *)

## Resource-mapping Eager-Calibration Component API
struct starpu_sched_component * | starpu_sched_component_eager_calibration_create (struct starpu_sched_tree *tree, void *arg) STARPU_ATTRIBUTE_MALLOC
int | starpu_sched_component_is_eager_calibration (struct starpu_sched_component *)

## Resource-mapping MCT Component API
struct starpu_sched_component * | starpu_sched_component_mct_create (struct starpu_sched_tree *tree, struct starpu_sched_component_mct_data *mct_data) STARPU_ATTRIBUTE_MALLOC
int | starpu_sched_component_is_mct (struct starpu_sched_component *component)

## Resource-mapping Heft Component API
struct starpu_sched_component * | starpu_sched_component_heft_create (struct starpu_sched_tree *tree, struct starpu_sched_component_mct_data *mct_data) STARPU_ATTRIBUTE_MALLOC
int | starpu_sched_component_is_heft (struct starpu_sched_component *component)

## Resource-mapping Heteroprio Component API
struct starpu_sched_component * | starpu_sched_component_heteroprio_create (struct starpu_sched_tree *tree, struct starpu_sched_component_heteroprio_data *params) STARPU_ATTRIBUTE_MALLOC
int | starpu_sched_component_is_heteroprio (struct starpu_sched_component *component)

## Special-purpose Best_Implementation Component API
struct starpu_sched_component * | starpu_sched_component_best_implementation_create (struct starpu_sched_tree *tree, void *arg) STARPU_ATTRIBUTE_MALLOC

## Special-purpose Perfmodel_Select Component API
struct starpu_sched_component * | starpu_sched_component_perfmodel_select_create (struct starpu_sched_tree *tree, struct starpu_sched_component_perfmodel_select_data *perfmodel_select_data) STARPU_ATTRIBUTE_MALLOC
int | starpu_sched_component_is_perfmodel_select (struct starpu_sched_component *component)

## Staged pull Component API
struct starpu_sched_component * | starpu_sched_component_stage_create (struct starpu_sched_tree *tree, void *arg) STARPU_ATTRIBUTE_MALLOC
int | starpu_sched_component_is_stage (struct starpu_sched_component *component)

## User-choice push Component API
struct starpu_sched_component * | starpu_sched_component_userchoice_create (struct starpu_sched_tree *tree, void *arg) STARPU_ATTRIBUTE_MALLOC
int | starpu_sched_component_is_userchoice (struct starpu_sched_component *component)

## Recipe Component API
struct starpu_sched_component_composed_recipe * | starpu_sched_component_composed_recipe_create (void) STARPU_ATTRIBUTE_MALLOC
struct starpu_sched_component_composed_recipe * | starpu_sched_component_composed_recipe_create_singleton (struct starpu_sched_component *(*create_component)(struct starpu_sched_tree *tree, void *arg), void *arg) STARPU_ATTRIBUTE_MALLOC
void | starpu_sched_component_composed_recipe_add (struct starpu_sched_component_composed_recipe *recipe, struct starpu_sched_component *(*create_component)(struct starpu_sched_tree *tree, void *arg), void *arg)
void | starpu_sched_component_composed_recipe_destroy (struct starpu_sched_component_composed_recipe *)
struct starpu_sched_component * | starpu_sched_component_composed_component_create (struct starpu_sched_tree *tree, struct starpu_sched_component_composed_recipe *recipe) STARPU_ATTRIBUTE_MALLOC
struct starpu_sched_tree * | starpu_sched_component_make_scheduler (unsigned sched_ctx_id, struct starpu_sched_component_specs s)

## Basic API
void | starpu_sched_component_initialize_simple_scheduler (starpu_sched_component_create_t create_decision_component, void *data, unsigned flags, unsigned sched_ctx_id)
void | starpu_sched_component_initialize_simple_schedulers (unsigned sched_ctx_id, unsigned ndecisions,...)
#define | STARPU_SCHED_SIMPLE_DECIDE_MASK
#define | STARPU_SCHED_SIMPLE_DECIDE_WORKERS
#define | STARPU_SCHED_SIMPLE_DECIDE_MEMNODES
#define | STARPU_SCHED_SIMPLE_DECIDE_ARCHS
#define | STARPU_SCHED_SIMPLE_DECIDE_ALWAYS
#define | STARPU_SCHED_SIMPLE_PERFMODEL
#define | STARPU_SCHED_SIMPLE_IMPL
#define | STARPU_SCHED_SIMPLE_FIFO_ABOVE
#define | STARPU_SCHED_SIMPLE_FIFO_ABOVE_PRIO
#define | STARPU_SCHED_SIMPLE_FIFOS_BELOW
#define | STARPU_SCHED_SIMPLE_FIFOS_BELOW_PRIO
#define | STARPU_SCHED_SIMPLE_FIFOS_BELOW_READY
#define | STARPU_SCHED_SIMPLE_WS_BELOW
#define | STARPU_SCHED_SIMPLE_COMBINED_WORKERS
#define | STARPU_SCHED_SIMPLE_PRE_DECISION

## Detailed Description

## Data Structure Documentation

## ◆ starpu_sched_component

struct starpu_sched_component

Structure for a scheduler module. A scheduler is a tree-like structure of them, some parts of scheduler can be shared by several contexes to perform some local optimisations, so, for all components, a list of parent is defined by `sched_ctx_id`. They embed there specialised method in a pseudo object-style, so calls are like `component->push_task(component,task)`

### Data Fields
struct starpu_sched_tree * | tree
struct starpu_bitmap * | workers
struct starpu_bitmap * | workers_in_ctx
void * | data
char * | name
unsigned | nchildren
struct starpu_sched_component ** | children
unsigned | nparents
struct starpu_sched_component ** | parents
void(* | add_child )(struct starpu_sched_component *component, struct starpu_sched_component *child)
void(* | remove_child )(struct starpu_sched_component *component, struct starpu_sched_component *child)
void(* | add_parent )(struct starpu_sched_component *component, struct starpu_sched_component *parent)
void(* | remove_parent )(struct starpu_sched_component *component, struct starpu_sched_component *parent)
int(* | push_task )(struct starpu_sched_component *, struct starpu_task *)
struct starpu_task *(* | pull_task )(struct starpu_sched_component *from, struct starpu_sched_component *to)
int(* | can_push )(struct starpu_sched_component *from, struct starpu_sched_component *to)
int(* | can_pull )(struct starpu_sched_component *component)
int(* | notify )(struct starpu_sched_component *component, int message_ID, void *arg)
double(* | estimated_load )(struct starpu_sched_component *component)
double(* | estimated_end )(struct starpu_sched_component *component)
void(* | deinit_data )(struct starpu_sched_component *component)
void(* | notify_change_workers )(struct starpu_sched_component *component)
int | properties
hwloc_obj_t | obj

#### Field Documentation

## ◆ tree

struct starpu_sched_tree* starpu_sched_component::tree

The tree containing the component

## ◆ workers

struct starpu_bitmap* starpu_sched_component::workers

set of underlying workers

## ◆ workers_in_ctx

struct starpu_bitmap* starpu_sched_component::workers_in_ctx

subset of starpu_sched_component::workers that is currently available in the context The push method should take this value into account, it is set with: component->workers UNION tree->workers UNION component->child[i]->workers_in_ctx iff exist x such as component->children[i]->parents[x] == component

## ◆ data

void* starpu_sched_component::data

private data

## ◆ nchildren

unsigned starpu_sched_component::nchildren

number of compoments's children

## ◆ children

struct starpu_sched_component** starpu_sched_component::children

vector of component's children

## ◆ nparents

unsigned starpu_sched_component::nparents

number of component's parents

## ◆ parents

struct starpu_sched_component** starpu_sched_component::parents

vector of component's parents

## ◆ add_child

void(* starpu_sched_component::add_child) (struct starpu_sched_component *component, struct starpu_sched_component *child)

add a child to component

## ◆ remove_child

void(* starpu_sched_component::remove_child) (struct starpu_sched_component *component, struct starpu_sched_component *child)

remove a child from component

## ◆ push_task

int(* starpu_sched_component::push_task) (struct starpu_sched_component *, struct starpu_task *)

push a task in the scheduler module. this function is called to push a task on component subtree, this can either perform a recursive call on a child or store the task in the component, then it will be returned by a further pull_task call. the caller must ensure that component is able to execute task. This method must either return 0 if it the task was properly stored or passed over to a child component, or return a value different from 0 if the task could not be consumed (e.g. the queue is full).

## ◆ pull_task

struct starpu_task *(* starpu_sched_component::pull_task) (struct starpu_sched_component *from, struct starpu_sched_component *to)

pop a task from the scheduler module. this function is called by workers to get a task from their parents. this function should first return a locally stored task or perform a recursive call on the parents. the task returned by this function should be executable by the caller

## ◆ can_push

int(* starpu_sched_component::can_push) (struct starpu_sched_component *from, struct starpu_sched_component *to)

This function is called by a component which implements a queue, allowing it to signify to its parents that an empty slot is available in its queue. This should return 1 if some tasks could be pushed The basic implementation of this function is a recursive call to its parents, the user has to specify a personally-made function to catch those calls.

## ◆ can_pull

int(* starpu_sched_component::can_pull) (struct starpu_sched_component *component)

This function allow a component to wake up a worker. It is currently called by component which implements a queue, to signify to its children that a task have been pushed in its local queue, and is available to be popped by a worker, for example. This should return 1 if some some container or worker could (or will) pull some tasks. The basic implementation of this function is a recursive call to its children, until at least one worker have been woken up.

## ◆ estimated_load

double(* starpu_sched_component::estimated_load) (struct starpu_sched_component *component)

heuristic to compute load of scheduler module. Basically the number of tasks divided by the sum of relatives speedup of workers available in context. estimated_load(component) = sum(estimated_load(component_children)) + nb_local_tasks / average(relative_speedup(underlying_worker))

## ◆ estimated_end

double(* starpu_sched_component::estimated_end) (struct starpu_sched_component *component)

return the time when a worker will enter in starvation. This function is relevant only if the task->predicted member has been set.

## ◆ deinit_data

void(* starpu_sched_component::deinit_data) (struct starpu_sched_component *component)

called by starpu_sched_component_destroy. Should free data allocated during creation

## ◆ notify_change_workers

void(* starpu_sched_component::notify_change_workers) (struct starpu_sched_component *component)

this function is called for each component when workers are added or removed from a context

## ◆ obj

hwloc_obj_t starpu_sched_component::obj

the hwloc object associated to scheduler module. points to the part of topology that is binded to this component, eg: a numa node for a ws component that would balance load between underlying sockets

## ◆ starpu_sched_tree

struct starpu_sched_tree

The actual scheduler

Data Fields
struct starpu_sched_component * | root | entry module of the scheduler
struct starpu_bitmap * | workers | set of workers available in this context, this value is used to mask workers in modules
unsigned | sched_ctx_id | context id of the scheduler
starpu_pthread_mutex_t | lock | lock used to protect the scheduler, it is taken in read mode pushing a task and in write mode for adding or removing workers

## ◆ starpu_sched_component_fifo_data

struct starpu_sched_component_fifo_data

Data Fields
unsigned | ntasks_threshold |
double | exp_len_threshold |
int | ready |

## ◆ starpu_sched_component_prio_data

struct starpu_sched_component_prio_data

Data Fields
unsigned | ntasks_threshold |
double | exp_len_threshold |
int | ready |

## ◆ starpu_sched_component_mct_data

struct starpu_sched_component_mct_data

Data Fields
double | alpha |
double | beta |
double | _gamma |
double | idle_power |

## ◆ starpu_sched_component_heteroprio_data

struct starpu_sched_component_heteroprio_data

Data Fields
struct starpu_sched_component_mct_data * | mct |
unsigned | batch |

## ◆ starpu_sched_component_perfmodel_select_data

struct starpu_sched_component_perfmodel_select_data

Data Fields
struct starpu_sched_component * | calibrator_component |
struct starpu_sched_component * | no_perfmodel_component |
struct starpu_sched_component * | perfmodel_component |

## ◆ starpu_sched_component_specs

struct starpu_sched_component_specs

Define how build a scheduler according to topology. Each level (except for hwloc_machine_composed_sched_component) can be `NULL`, then the level is just skipped. Bugs everywhere, do not rely on.

### Data Fields
struct starpu_sched_component_composed_recipe * | hwloc_machine_composed_sched_component
struct starpu_sched_component_composed_recipe * | hwloc_component_composed_sched_component
struct starpu_sched_component_composed_recipe * | hwloc_socket_composed_sched_component
struct starpu_sched_component_composed_recipe * | hwloc_cache_composed_sched_component
struct starpu_sched_component_composed_recipe *(* | worker_composed_sched_component )(enum starpu_worker_archtype archtype)
int | mix_heterogeneous_workers

#### Field Documentation

## ◆ hwloc_machine_composed_sched_component

struct starpu_sched_component_composed_recipe* starpu_sched_component_specs::hwloc_machine_composed_sched_component

the composed component to put on the top of the scheduler this member must not be `NULL` as it is the root of the topology

## ◆ hwloc_component_composed_sched_component

struct starpu_sched_component_composed_recipe* starpu_sched_component_specs::hwloc_component_composed_sched_component

the composed component to put for each memory component

## ◆ hwloc_socket_composed_sched_component

struct starpu_sched_component_composed_recipe* starpu_sched_component_specs::hwloc_socket_composed_sched_component

the composed component to put for each socket

## ◆ hwloc_cache_composed_sched_component

struct starpu_sched_component_composed_recipe* starpu_sched_component_specs::hwloc_cache_composed_sched_component

the composed component to put for each cache

## ◆ worker_composed_sched_component

struct starpu_sched_component_composed_recipe *(* starpu_sched_component_specs::worker_composed_sched_component) (enum starpu_worker_archtype archtype)

a function that return a starpu_sched_component_composed_recipe to put on top of a worker of type `archtype`. `NULL` is a valid return value, then no component will be added on top

## ◆ mix_heterogeneous_workers

int starpu_sched_component_specs::mix_heterogeneous_workers

this flag is a dirty hack because of the poor expressivity of this interface. As example, if you want to build a heft component with a fifo component per numa component, and you also have GPUs, if this flag is set, GPUs will share those fifos. If this flag is not set, a new fifo will be built for each of them (if they have the same starpu_perf_arch and the same numa component it will be shared. it indicates if heterogenous workers should be brothers or cousins, as example, if a gpu and a cpu should share or not there numa node

## Macro Definition Documentation

## ◆ STARPU_SCHED_COMPONENT_IS_HOMOGENEOUS

#define STARPU_SCHED_COMPONENT_IS_HOMOGENEOUS | ( |  | component | ) |

indicate if component is homogeneous

## ◆ STARPU_SCHED_COMPONENT_IS_SINGLE_MEMORY_NODE

#define STARPU_SCHED_COMPONENT_IS_SINGLE_MEMORY_NODE | ( |  | component | ) |

indicate if all workers have the same memory component

## ◆ STARPU_SCHED_SIMPLE_DECIDE_WORKERS

#define STARPU_SCHED_SIMPLE_DECIDE_WORKERS

Request to create downstream queues per worker, i.e. the scheduling decision-making component will choose exactly which workers tasks should got to.

## ◆ STARPU_SCHED_SIMPLE_DECIDE_MEMNODES

#define STARPU_SCHED_SIMPLE_DECIDE_MEMNODES

Request to create downstream queues per memory nodes, i.e. the scheduling decision-making component will choose which memory node tasks will go to.

## ◆ STARPU_SCHED_SIMPLE_DECIDE_ARCHS

#define STARPU_SCHED_SIMPLE_DECIDE_ARCHS

Request to create downstream queues per computation arch, i.e. the scheduling decision-making component will choose whether tasks go to CPUs, or CUDA, or OpenCL, etc.

## ◆ STARPU_SCHED_SIMPLE_DECIDE_ALWAYS

#define STARPU_SCHED_SIMPLE_DECIDE_ALWAYS

Request to create the scheduling decision-making component even if there is only one available choice. This is useful for instance when the decision-making component will store tasks itself (and not use STARPU_SCHED_SIMPLE_FIFO_ABOVE) to decide in which order tasks should be passed below.

## ◆ STARPU_SCHED_SIMPLE_PERFMODEL

#define STARPU_SCHED_SIMPLE_PERFMODEL

Request to add a perfmodel selector above the scheduling decision-making component. That way, only tasks with a calibrated performance model will be given to the component, other tasks will go to an eager branch that will distributed tasks so that their performance models will get calibrated. In other words, this is needed when using a component which needs performance models for tasks.

## ◆ STARPU_SCHED_SIMPLE_IMPL

#define STARPU_SCHED_SIMPLE_IMPL

Request that a component be added just above workers, that chooses the best task implementation.

## ◆ STARPU_SCHED_SIMPLE_FIFO_ABOVE

#define STARPU_SCHED_SIMPLE_FIFO_ABOVE

Request to create a fifo above the scheduling decision-making component, otherwise tasks will be pushed directly to the component.

This is useful to store tasks if there is a fifo below which limits the number of tasks to be scheduld in advance. The scheduling decision-making component can also store tasks itself, in which case this flag is not useful.

## ◆ STARPU_SCHED_SIMPLE_FIFO_ABOVE_PRIO

#define STARPU_SCHED_SIMPLE_FIFO_ABOVE_PRIO

Request that the fifo above be sorted by priorities

## ◆ STARPU_SCHED_SIMPLE_FIFOS_BELOW

#define STARPU_SCHED_SIMPLE_FIFOS_BELOW

Request to create fifos below the scheduling decision-making component, otherwise tasks will be pulled directly from workers.

This is useful to be able to schedule a (tunable) small number of tasks in advance only.

## ◆ STARPU_SCHED_SIMPLE_FIFOS_BELOW_PRIO

#define STARPU_SCHED_SIMPLE_FIFOS_BELOW_PRIO

Request that the fifos below be sorted by priorities

## ◆ STARPU_SCHED_SIMPLE_FIFOS_BELOW_READY

#define STARPU_SCHED_SIMPLE_FIFOS_BELOW_READY

Request that the fifos below be pulled rather ready tasks

## ◆ STARPU_SCHED_SIMPLE_WS_BELOW

#define STARPU_SCHED_SIMPLE_WS_BELOW

Request that work between workers using the same fifo below be distributed using a work stealing component.

## ◆ STARPU_SCHED_SIMPLE_COMBINED_WORKERS

#define STARPU_SCHED_SIMPLE_COMBINED_WORKERS

Request to not only choose between simple workers, but also choose between combined workers.

## ◆ STARPU_SCHED_SIMPLE_PRE_DECISION

#define STARPU_SCHED_SIMPLE_PRE_DECISION

Request to prepend a component before the decision component. This should be used alone and followed by the component creation function pointer and its data.

## Enumeration Type Documentation

## ◆ starpu_sched_component_properties

enum starpu_sched_component_properties

flags for starpu_sched_component::properties

Enumerator
STARPU_SCHED_COMPONENT_HOMOGENEOUS | indicate that all workers have the same starpu_worker_archtype
STARPU_SCHED_COMPONENT_SINGLE_MEMORY_NODE | indicate that all workers have the same memory component

## Function Documentation

## ◆ starpu_sched_tree_create()

struct starpu_sched_tree * starpu_sched_tree_create | ( | unsigned | sched_ctx_id | ) |

create a empty initialized starpu_sched_tree

## ◆ starpu_sched_tree_destroy()

void starpu_sched_tree_destroy | ( | struct starpu_sched_tree * | tree | ) |

destroy tree and free all non shared component in it.

## ◆ starpu_sched_tree_deinitialize()

void starpu_sched_tree_deinitialize | ( | unsigned | sched_ctx_id | ) |

calls starpu_sched_tree_destroy, ready for use for starpu_sched_policy::deinit_sched field.

## ◆ starpu_sched_tree_update_workers()

void starpu_sched_tree_update_workers | ( | struct starpu_sched_tree * | t | ) |

recursively set all starpu_sched_component::workers, do not take into account shared parts (except workers).

## ◆ starpu_sched_tree_update_workers_in_ctx()

void starpu_sched_tree_update_workers_in_ctx | ( | struct starpu_sched_tree * | t | ) |

recursively set all starpu_sched_component::workers_in_ctx, do not take into account shared parts (except workers)

## ◆ starpu_sched_tree_push_task()

int starpu_sched_tree_push_task | ( | struct starpu_task * | task | ) |

compatibility with starpu_sched_policy interface

## ◆ starpu_sched_tree_pop_task()

struct starpu_task * starpu_sched_tree_pop_task | ( | unsigned | sched_ctx | ) |

compatibility with starpu_sched_policy interface

## ◆ starpu_sched_component_push_task()

int starpu_sched_component_push_task | ( | struct starpu_sched_component * | from,
|  | struct starpu_sched_component * | to,
|  | struct starpu_task * | task
| ) |  |

Push a task to a component. This is a helper for `component->push_task(component, task)` plus tracing.

## ◆ starpu_sched_component_pull_task()

struct starpu_task * starpu_sched_component_pull_task | ( | struct starpu_sched_component * | from,
|  | struct starpu_sched_component * | to
| ) |  |

Pull a task from a component. This is a helper for `component->pull_task(component)` plus tracing.

## ◆ starpu_sched_tree_add_workers()

void starpu_sched_tree_add_workers | ( | unsigned | sched_ctx_id,
|  | int * | workerids,
|  | unsigned | nworkers
| ) |  |

compatibility with starpu_sched_policy interface

## ◆ starpu_sched_tree_remove_workers()

void starpu_sched_tree_remove_workers | ( | unsigned | sched_ctx_id,
|  | int * | workerids,
|  | unsigned | nworkers
| ) |  |

compatibility with starpu_sched_policy interface

## ◆ starpu_sched_component_connect()

void starpu_sched_component_connect | ( | struct starpu_sched_component * | parent,
|  | struct starpu_sched_component * | child
| ) |  |

Attach component `child` to parent `parent`. Some component may accept only one child, others accept several (e.g. MCT)

## ◆ starpu_sched_component_create()

struct starpu_sched_component * starpu_sched_component_create | ( | struct starpu_sched_tree * | tree,
|  | const char * | name
| ) |  |

allocate and initialize component field with defaults values : .pop_task make recursive call on father .estimated_load compute relative speedup and tasks in sub tree .estimated_end return the minimum of recursive call on children .add_child is starpu_sched_component_add_child .remove_child is starpu_sched_component_remove_child .notify_change_workers does nothing .deinit_data does nothing

## ◆ starpu_sched_component_destroy()

void starpu_sched_component_destroy | ( | struct starpu_sched_component * | component | ) |

free data allocated by starpu_sched_component_create and call component->deinit_data(component) set to `NULL` the member starpu_sched_component::fathers[sched_ctx_id] of all child if its equal to `component`

## ◆ starpu_sched_component_destroy_rec()

void starpu_sched_component_destroy_rec | ( | struct starpu_sched_component * | component | ) |

recursively destroy non shared parts of a `component` 's tree

## ◆ starpu_sched_component_can_execute_task()

int starpu_sched_component_can_execute_task | ( | struct starpu_sched_component * | component,
|  | struct starpu_task * | task
| ) |  |

return true iff `component` can execute `task`, this function take into account the workers available in the scheduling context

## ◆ starpu_sched_component_execute_preds()

int STARPU_WARN_UNUSED_RESULT starpu_sched_component_execute_preds | ( | struct starpu_sched_component * | component,
|  | struct starpu_task * | task,
|  | double * | length
| ) |  |

return a non `NULL` value if `component` can execute `task`. write the execution prediction length for the best implementation of the best worker available and write this at `length` address. this result is more relevant if starpu_sched_component::is_homogeneous is non `NULL`. if a worker need to be calibrated for an implementation, nan is set to `length`.

## ◆ starpu_sched_component_transfer_length()

double starpu_sched_component_transfer_length | ( | struct starpu_sched_component * | component,
|  | struct starpu_task * | task
| ) |  |

return the average time to transfer `task` data to underlying `component` workers.

## ◆ starpu_sched_component_worker_get()

struct starpu_sched_component * starpu_sched_component_worker_get | ( | unsigned | sched_ctx,
|  | int | workerid
| ) |  |

return the struct starpu_sched_component corresponding to `workerid`. Undefined if `workerid` is not a valid workerid

## ◆ starpu_sched_component_parallel_worker_create()

struct starpu_sched_component * starpu_sched_component_parallel_worker_create | ( | struct starpu_sched_tree * | tree,
|  | unsigned | nworkers,
|  | unsigned * | workers
| ) |  |

Create a combined worker that pushes tasks in parallel to workers `workers` (size `nworkers`).

## ◆ starpu_sched_component_worker_get_workerid()

int starpu_sched_component_worker_get_workerid | ( | struct starpu_sched_component * | worker_component | ) |

return the workerid of `worker_component`, undefined if starpu_sched_component_is_worker(worker_component) == 0

## ◆ starpu_sched_component_is_worker()

int starpu_sched_component_is_worker | ( | struct starpu_sched_component * | component | ) |

return true iff `component` is a worker component

## ◆ starpu_sched_component_is_simple_worker()

int starpu_sched_component_is_simple_worker | ( | struct starpu_sched_component * | component | ) |

return true iff `component` is a simple worker component

## ◆ starpu_sched_component_is_combined_worker()

int starpu_sched_component_is_combined_worker | ( | struct starpu_sched_component * | component | ) |

return true iff `component` is a combined worker component

## ◆ starpu_sched_component_worker_pre_exec_hook()

void starpu_sched_component_worker_pre_exec_hook | ( | struct starpu_task * | task,
|  | unsigned | sched_ctx_id
| ) |  |

compatibility with starpu_sched_policy interface update predictions for workers

## ◆ starpu_sched_component_worker_post_exec_hook()

void starpu_sched_component_worker_post_exec_hook | ( | struct starpu_task * | task,
|  | unsigned | sched_ctx_id
| ) |  |

compatibility with starpu_sched_policy interface

## ◆ starpu_sched_component_parents_pull_task()

struct starpu_task * starpu_sched_component_parents_pull_task | ( | struct starpu_sched_component * | component,
|  | struct starpu_sched_component * | to
| ) |  |

default function for the pull component method, just call pull of parents until one of them returns a task

## ◆ starpu_sched_component_can_push()

int starpu_sched_component_can_push | ( | struct starpu_sched_component * | component,
|  | struct starpu_sched_component * | to
| ) |  |

default function for the can_push component method, just call can_push of parents until one of them returns non-zero

## ◆ starpu_sched_component_can_pull()

int starpu_sched_component_can_pull | ( | struct starpu_sched_component * | component | ) |

default function for the can_pull component method, just call can_pull of children until one of them returns non-zero

## ◆ starpu_sched_component_can_pull_all()

int starpu_sched_component_can_pull_all | ( | struct starpu_sched_component * | component | ) |

function for the can_pull component method, call can_pull of all children

## ◆ starpu_sched_component_estimated_load()

double starpu_sched_component_estimated_load | ( | struct starpu_sched_component * | component | ) |

default function for the estimated_load component method, just sum up the loads of the children of the component.

## ◆ starpu_sched_component_estimated_end_min()

double starpu_sched_component_estimated_end_min | ( | struct starpu_sched_component * | component | ) |

function that can be used for the estimated_end component method, compute the minimum completion time of the children.

## ◆ starpu_sched_component_estimated_end_min_add()

double starpu_sched_component_estimated_end_min_add | ( | struct starpu_sched_component * | component,
|  | double | exp_len
| ) |  |

function that can be used for the estimated_end component method, compute the minimum completion time of the children, and add to it an estimation of how existing queued work, plus the exp_len work, can be completed. This is typically used instead of starpu_sched_component_estimated_end_min when the component contains a queue of tasks, which thus needs to be added to the estimations.

## ◆ starpu_sched_component_estimated_end_average()

double starpu_sched_component_estimated_end_average | ( | struct starpu_sched_component * | component | ) |

default function for the estimated_end component method, compute the average completion time of the children.

## ◆ starpu_sched_component_fifo_create()

struct starpu_sched_component * starpu_sched_component_fifo_create | ( | struct starpu_sched_tree * | tree,
|  | struct starpu_sched_component_fifo_data * | fifo_data
| ) |  |

Return a struct starpu_sched_component with a fifo. A stable sort is performed according to tasks priorities. A push_task call on this component does not perform recursive calls, underlying components will have to call pop_task to get it. starpu_sched_component::estimated_end function compute the estimated length by dividing the sequential length by the number of underlying workers.

## ◆ starpu_sched_component_is_fifo()

int starpu_sched_component_is_fifo | ( | struct starpu_sched_component * | component | ) |

return true iff `component` is a fifo component

## ◆ starpu_sched_component_work_stealing_create()

struct starpu_sched_component * starpu_sched_component_work_stealing_create | ( | struct starpu_sched_tree * | tree,
|  | void * | arg
| ) |  |

return a component that perform a work stealing scheduling. Tasks are pushed in a round robin way. estimated_end return the average of expected length of fifos, starting at the average of the expected_end of his children. When a worker have to steal a task, it steal a task in a round robin way, and get the last pushed task of the higher priority.

## ◆ starpu_sched_component_is_work_stealing()

int starpu_sched_component_is_work_stealing | ( | struct starpu_sched_component * | component | ) |

return true iff `component` is a work stealing component

## ◆ starpu_sched_tree_work_stealing_push_task()

int starpu_sched_tree_work_stealing_push_task | ( | struct starpu_task * | task | ) |

undefined if there is no work stealing component in the scheduler. If any, `task` is pushed in a default way if the caller is the application, and in the caller's fifo if its a worker.

## ◆ starpu_sched_component_random_create()

struct starpu_sched_component * starpu_sched_component_random_create | ( | struct starpu_sched_tree * | tree,
|  | void * | arg
| ) |  |

create a component that perform a random scheduling

## ◆ starpu_sched_component_is_random()

int starpu_sched_component_is_random | ( | struct starpu_sched_component * |  | ) |

return true iff `component` is a random component

## ◆ starpu_sched_component_mct_create()

struct starpu_sched_component * starpu_sched_component_mct_create | ( | struct starpu_sched_tree * | tree,
|  | struct starpu_sched_component_mct_data * | mct_data
| ) |  |

create a component with mct_data paremeters. the mct component doesnt do anything but pushing tasks on no_perf_model_component and calibrating_component

## ◆ starpu_sched_component_best_implementation_create()

struct starpu_sched_component * starpu_sched_component_best_implementation_create | ( | struct starpu_sched_tree * | tree,
|  | void * | arg
| ) |  |

Select the implementation that offer the shortest computation length for the first worker that can execute the task. Or an implementation that need to be calibrated. Also set starpu_task::predicted and starpu_task::predicted_transfer for memory component of the first suitable workerid. If starpu_sched_component::push method is called and starpu_sched_component::nchild > 1 the result is undefined.

## ◆ starpu_sched_component_composed_recipe_create()

struct starpu_sched_component_composed_recipe * starpu_sched_component_composed_recipe_create | ( | void |  | ) |

return an empty recipe for a composed component, it should not be used without modification

## ◆ starpu_sched_component_composed_recipe_create_singleton()

struct starpu_sched_component_composed_recipe * starpu_sched_component_composed_recipe_create_singleton | ( | struct starpu_sched_component *(*)(struct starpu_sched_tree *tree, void *arg) | create_component,
|  | void * | arg
| ) |  |

return a recipe to build a composed component with a `create_component`

## ◆ starpu_sched_component_composed_recipe_add()

void starpu_sched_component_composed_recipe_add | ( | struct starpu_sched_component_composed_recipe * | recipe,
|  | struct starpu_sched_component *(*)(struct starpu_sched_tree *tree, void *arg) | create_component,
|  | void * | arg
| ) |  |

add `create_component` under all previous components in recipe

## ◆ starpu_sched_component_composed_recipe_destroy()

void starpu_sched_component_composed_recipe_destroy | ( | struct starpu_sched_component_composed_recipe * |  | ) |

destroy composed_sched_component, this should be done after starpu_sched_component_composed_component_create was called

## ◆ starpu_sched_component_composed_component_create()

struct starpu_sched_component * starpu_sched_component_composed_component_create | ( | struct starpu_sched_tree * | tree,
|  | struct starpu_sched_component_composed_recipe * | recipe
| ) |  |

create a component that behave as all component of recipe where linked. Except that you cant use starpu_sched_component_is_foo function if recipe contain a single create_foo arg_foo pair, create_foo(arg_foo) is returned instead of a composed component

## ◆ starpu_sched_component_make_scheduler()

struct starpu_sched_tree * starpu_sched_component_make_scheduler | ( | unsigned | sched_ctx_id,
|  | struct starpu_sched_component_specs | s
| ) |  |

build a scheduler for `sched_ctx_id` according to `s` and the hwloc topology of the machine.

## ◆ starpu_sched_component_initialize_simple_scheduler()

void starpu_sched_component_initialize_simple_scheduler | ( | starpu_sched_component_create_t | create_decision_component,
|  | void * | data,
|  | unsigned | flags,
|  | unsigned | sched_ctx_id
| ) |  |

Create a simple modular scheduler tree around a scheduling decision-making component `component`. The details of what should be built around `component` is described by `flags`. The different STARPU_SCHED_SIMPL_DECIDE_* flags are mutually exclusive. `data` is passed to the `create_decision_component` function when creating the decision component.

## ◆ starpu_sched_component_initialize_simple_schedulers()

void starpu_sched_component_initialize_simple_schedulers | ( | unsigned | sched_ctx_id,
|  | unsigned | ndecisions,
|  |  | ...
| ) |  |

Create a simple modular scheduler tree around several scheduling decision-making components. The parameters are similar to starpu_sched_component_initialize_simple_scheduler, but per scheduling decision, for instance:

starpu_sched_component_initialize_simple_schedulers(sched_ctx_id, 2, create1, data1, flags1, create2, data2, flags2);

The different flags parameters must be coherent: same decision flags. They must not include the perfmodel flag (not supported yet).