StarPU Handbook
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Modularized Scheduler Interface

Data Structures

struct  starpu_sched_component
 
struct  starpu_sched_tree
 
struct  starpu_sched_component_composed_recipe
 
struct  starpu_sched_component_specs
 

Macros

#define STARPU_SCHED_COMPONENT_IS_HOMOGENEOUS(component)
 
#define STARPU_SCHED_COMPONENT_IS_SINGLE_MEMORY_NODE(component)
 

Enumerations

enum  starpu_sched_component_properties { STARPU_SCHED_COMPONENT_HOMOGENEOUS, STARPU_SCHED_COMPONENT_SINGLE_MEMORY_NODE }
 

Scheduling Tree API

struct starpu_sched_treestarpu_sched_tree_create (unsigned sched_ctx_id)
 
void starpu_sched_tree_destroy (struct starpu_sched_tree *tree)
 
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_taskstarpu_sched_tree_pop_task ()
 
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)
 

Generic Scheduling Component API

struct starpu_sched_componentstarpu_sched_component_create (struct starpu_sched_tree *tree)
 
void starpu_sched_component_destroy (struct starpu_sched_component *component)
 
void starpu_sched_component_destroy_rec (struct starpu_sched_component *component)
 
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)
 

Worker Component API

struct starpu_sched_componentstarpu_sched_component_worker_get (unsigned sched_ctx, int workerid)
 
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)
 
void starpu_sched_component_worker_post_exec_hook (struct starpu_task *task)
 

Flow-control Fifo Component API

struct starpu_sched_componentstarpu_sched_component_fifo_create (struct starpu_sched_tree *tree, struct starpu_sched_component_fifo_data *fifo_data)
 
int starpu_sched_component_is_fifo (struct starpu_sched_component *component)
 

Flow-control Prio Component API

struct starpu_sched_componentstarpu_sched_component_prio_create (struct starpu_sched_tree *tree, struct starpu_sched_component_prio_data *prio_data)
 
int starpu_sched_component_is_prio (struct starpu_sched_component *component)
 

Resource-mapping Work-Stealing Component API

int starpu_sched_tree_work_stealing_push_task (struct starpu_task *task)
 
int starpu_sched_component_is_work_stealing (struct starpu_sched_component *component)
 

Resource-mapping Random Component API

int starpu_sched_component_is_random (struct starpu_sched_component *)
 

Resource-mapping Eager Component API

int starpu_sched_component_is_eager (struct starpu_sched_component *)
 

Resource-mapping Eager-Calibration Component API

int starpu_sched_component_is_eager_calibration (struct starpu_sched_component *)
 

Resource-mapping MCT Component API

struct starpu_sched_componentstarpu_sched_component_mct_create (struct starpu_sched_tree *tree, struct starpu_sched_component_mct_data *mct_data)
 
int starpu_sched_component_is_mct (struct starpu_sched_component *component)
 

Resource-mapping Heft Component API

struct starpu_sched_componentstarpu_sched_component_heft_create (struct starpu_sched_tree *tree, struct starpu_sched_component_mct_data *mct_data)
 
int starpu_sched_component_is_heft (struct starpu_sched_component *component)
 

Special-purpose Perfmodel_Select Component API

struct starpu_sched_componentstarpu_sched_component_perfmodel_select_create (struct starpu_sched_tree *tree, struct starpu_sched_component_perfmodel_select_data *perfmodel_select_data)
 
int starpu_sched_component_is_perfmodel_select (struct starpu_sched_component *component)
 

Recipe Component API

struct
starpu_sched_component_composed_recipe
starpu_sched_component_composed_recipe_create (void)
 
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)
 
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_componentstarpu_sched_component_composed_component_create (struct starpu_sched_tree *tree, struct starpu_sched_component_composed_recipe *recipe)
 
struct starpu_sched_treestarpu_sched_component_make_scheduler (unsigned sched_ctx_id, struct starpu_sched_component_specs s)
 

Detailed Description


Data Structure Documentation

struct starpu_sched_component

This structure represent 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 indexed 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_treetree
 
struct starpu_bitmap * workers
 
struct starpu_bitmap * workers_in_ctx
 
void * data
 
int nchildren
 
struct starpu_sched_component ** children
 
int 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 *)
 
int(* can_push )(struct starpu_sched_component *component)
 
void(* can_pull )(struct starpu_sched_component *component)
 
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

struct starpu_sched_tree * starpu_sched_component::tree

The tree containing the component

struct starpu_bitmap * starpu_sched_component::workers

this member contain the set of underlying workers

starpu_sched_component::workers_in_ctx

this member contain the subset of starpu_sched_component::workers that is currently available in the context The push method should take this member into account. this member 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

void * starpu_sched_component::data

private data

int starpu_sched_component::nchildren

the number of compoments's children

struct starpu_sched_component ** starpu_sched_component::children

the vector of component's children

int starpu_sched_component::nparents

the numbers of component's parents

struct starpu_sched_component ** starpu_sched_component::parents

the vector of component's parents

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

add a child to component

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

remove a child from component

void(* starpu_sched_component::add_parent)(struct starpu_sched_component *component, struct starpu_sched_component *parent)

todo

void(* starpu_sched_component::remove_parent)(struct starpu_sched_component *component, struct starpu_sched_component *parent)

todo

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.

struct starpu_task *(* starpu_sched_component::pull_task)(struct starpu_sched_component *)

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 is executable by the caller

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

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. The basic implementation of this function is a recursive call to its parents, the user have to specify a personally-made function to catch those calls.

void(* 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 been popped by a worker, for example. The basic implementation of this function is a recursive call to its children, until at least one worker have been woken up.

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

is an 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))

starpu_sched_component::estimated_end

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

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

called by starpu_sched_component_destroy. Should free data allocated during creation

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

int starpu_sched_component::properties

todo

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

struct starpu_sched_tree

The actual scheduler

Data Fields
struct starpu_sched_component * root

this is the entry module of the scheduler

struct starpu_bitmap * workers

this is the set of workers available in this context, this value is used to mask workers in modules

unsigned sched_ctx_id

the context id of the scheduler

struct starpu_sched_component * worker_components[STARPU_NMAXWORKERS]

worker components

starpu_pthread_mutex_t lock

this lock is used to protect the scheduler, it is taken in read mode pushing a task and in write mode for adding or removing workers

struct starpu_sched_component_composed_recipe

parameters for starpu_sched_component_composed_component_create

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
 

Macro Definition Documentation

#define STARPU_SCHED_COMPONENT_IS_HOMOGENEOUS (   component)

indicate if component is homogeneous

#define STARPU_SCHED_COMPONENT_IS_SINGLE_MEMORY_NODE (   component)

indicate if all workers have the same memory component

Enumeration Type Documentation

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

struct starpu_sched_tree * starpu_sched_tree_create ( unsigned  sched_ctx_id)

create a empty initialized starpu_sched_tree

void starpu_sched_tree_destroy ( struct starpu_sched_tree tree)

destroy tree and free all non shared component in it.

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).

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)

int starpu_sched_tree_push_task ( struct starpu_task task)

compatibility with starpu_sched_policy interface

struct starpu_task * starpu_sched_tree_pop_task ( )

compatibility with starpu_sched_policy interface

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

compatibility with starpu_sched_policy interface

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

compatibility with starpu_sched_policy interface

struct starpu_sched_component * starpu_sched_component_create ( struct starpu_sched_tree tree)

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 average 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

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

void starpu_sched_component_destroy_rec ( struct starpu_sched_component component)

recursively destroy non shared parts of a component 's tree

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

int 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.

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.

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

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

int starpu_sched_component_is_worker ( struct starpu_sched_component component)

return true iff component is a worker component

int starpu_sched_component_is_simple_worker ( struct starpu_sched_component component)

return true iff component is a simple worker component

int starpu_sched_component_is_combined_worker ( struct starpu_sched_component component)

return true iff component is a combined worker component

void starpu_sched_component_worker_pre_exec_hook ( struct starpu_task task)

compatibility with starpu_sched_policy interface update predictions for workers

void starpu_sched_component_worker_post_exec_hook ( struct starpu_task task)

compatibility with starpu_sched_policy interface

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. Do not take into account tasks that are currently executed.

int starpu_sched_component_is_fifo ( struct starpu_sched_component component)

return true iff component is a fifo component

struct starpu_sched_component * starpu_sched_component_prio_create ( struct starpu_sched_tree tree,
struct starpu_sched_component_prio_data prio_data 
)

todo

int starpu_sched_component_is_prio ( struct starpu_sched_component component)

todo

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.

int starpu_sched_component_is_work_stealing ( struct starpu_sched_component component)

return true iff component is a work stealing component

int starpu_sched_component_is_random ( struct starpu_sched_component )

return true iff component is a random component

int starpu_sched_component_is_eager ( struct starpu_sched_component )

todo

int starpu_sched_component_is_eager_calibration ( struct starpu_sched_component )

todo

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

int starpu_sched_component_is_mct ( struct starpu_sched_component component)

todo

struct starpu_sched_component * starpu_sched_component_heft_create ( struct starpu_sched_tree tree,
struct starpu_sched_component_mct_data mct_data 
)

this component perform a heft scheduling

int starpu_sched_component_is_heft ( struct starpu_sched_component component)

return true iff component is a heft component

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 
)

todo

int starpu_sched_component_is_perfmodel_select ( struct starpu_sched_component component)

todo

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

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

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

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

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

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

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