|
@@ -16,10 +16,8 @@
|
|
|
|
|
|
#ifndef __STARPU_SCHED_COMPONENT_H__
|
|
|
#define __STARPU_SCHED_COMPONENT_H__
|
|
|
+
|
|
|
#include <starpu.h>
|
|
|
-#include <common/starpu_spinlock.h>
|
|
|
-#include <common/fxt.h>
|
|
|
-#include <starpu_bitmap.h>
|
|
|
|
|
|
#ifdef STARPU_HAVE_HWLOC
|
|
|
#include <hwloc.h>
|
|
@@ -49,36 +47,36 @@ struct starpu_sched_component
|
|
|
|
|
|
/* the set of workers in the component's subtree
|
|
|
*/
|
|
|
- struct starpu_bitmap * workers;
|
|
|
+ struct starpu_bitmap *workers;
|
|
|
/* the workers available in context
|
|
|
- * this member is set with :
|
|
|
+ * 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
|
|
|
*/
|
|
|
- struct starpu_bitmap * workers_in_ctx;
|
|
|
-
|
|
|
+ struct starpu_bitmap *workers_in_ctx;
|
|
|
+
|
|
|
/* component's private data, no restriction on use
|
|
|
*/
|
|
|
- void * data;
|
|
|
+ void *data;
|
|
|
|
|
|
/* the numbers of component's children
|
|
|
*/
|
|
|
int nchildren;
|
|
|
/* the vector of component's children
|
|
|
*/
|
|
|
- struct starpu_sched_component ** children;
|
|
|
+ struct starpu_sched_component **children;
|
|
|
/* the numbers of component's parents
|
|
|
*/
|
|
|
int nparents;
|
|
|
/* may be shared by several contexts
|
|
|
* so we need several parents
|
|
|
*/
|
|
|
- struct starpu_sched_component ** parents;
|
|
|
+ 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);
|
|
|
+ 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);
|
|
|
|
|
|
/* component->push_task(component, task)
|
|
|
* this function is called to push a task on component subtree, this can either
|
|
@@ -102,8 +100,8 @@ struct starpu_sched_component
|
|
|
* 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.
|
|
|
- */
|
|
|
- int (*can_push)(struct starpu_sched_component * component);
|
|
|
+ */
|
|
|
+ int (*can_push)(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
|
|
@@ -111,22 +109,22 @@ struct starpu_sched_component
|
|
|
* The basic implementation of this function is a recursive call to
|
|
|
* its children, until at least one worker have been woken up.
|
|
|
*/
|
|
|
- void (*can_pull)(struct starpu_sched_component * component);
|
|
|
+ void (*can_pull)(struct starpu_sched_component *component);
|
|
|
|
|
|
/* this function is an heuristic that compute load of subtree, basicaly
|
|
|
* it compute
|
|
|
* estimated_load(component) = sum(estimated_load(component_children)) +
|
|
|
* nb_local_tasks / average(relative_speedup(underlying_worker))
|
|
|
*/
|
|
|
- double (*estimated_load)(struct starpu_sched_component * component);
|
|
|
- double (*estimated_end)(struct starpu_sched_component * component);
|
|
|
+ double (*estimated_load)(struct starpu_sched_component *component);
|
|
|
+ double (*estimated_end)(struct starpu_sched_component *component);
|
|
|
|
|
|
/* this function is called by starpu_sched_component_destroy just before freeing component
|
|
|
*/
|
|
|
- void (*deinit_data)(struct starpu_sched_component * component);
|
|
|
+ void (*deinit_data)(struct starpu_sched_component *component);
|
|
|
/* this function is called for each component when workers are added or removed from a context
|
|
|
*/
|
|
|
- void (*notify_change_workers)(struct starpu_sched_component * component);
|
|
|
+ void (*notify_change_workers)(struct starpu_sched_component *component);
|
|
|
|
|
|
/* is_homogeneous is 0 if workers in the component's subtree are heterogeneous,
|
|
|
* this field is set and updated automaticaly, you shouldn't write on it
|
|
@@ -144,12 +142,12 @@ struct starpu_sched_component
|
|
|
|
|
|
struct starpu_sched_tree
|
|
|
{
|
|
|
- struct starpu_sched_component * root;
|
|
|
- struct starpu_bitmap * workers;
|
|
|
+ struct starpu_sched_component *root;
|
|
|
+ struct starpu_bitmap *workers;
|
|
|
unsigned sched_ctx_id;
|
|
|
|
|
|
/* this array store worker components */
|
|
|
- struct starpu_sched_component * worker_components[STARPU_NMAXWORKERS];
|
|
|
+ struct starpu_sched_component *worker_components[STARPU_NMAXWORKERS];
|
|
|
|
|
|
/* this lock is used to protect the scheduler,
|
|
|
* it is taken in read mode pushing a task
|
|
@@ -164,24 +162,24 @@ struct starpu_sched_tree
|
|
|
|
|
|
/* create an empty tree
|
|
|
*/
|
|
|
-struct starpu_sched_tree * starpu_sched_tree_create(unsigned sched_ctx_id);
|
|
|
-void starpu_sched_tree_destroy(struct starpu_sched_tree * tree);
|
|
|
-struct starpu_sched_tree * starpu_get_tree(unsigned sched_ctx_id);
|
|
|
+struct starpu_sched_tree *starpu_sched_tree_create(unsigned sched_ctx_id);
|
|
|
+void starpu_sched_tree_destroy(struct starpu_sched_tree *tree);
|
|
|
+struct starpu_sched_tree *starpu_get_tree(unsigned sched_ctx_id);
|
|
|
|
|
|
/* destroy component and all his child
|
|
|
* except if they are shared between several contexts
|
|
|
*/
|
|
|
-void starpu_sched_component_destroy_rec(struct starpu_sched_component * component);
|
|
|
+void starpu_sched_component_destroy_rec(struct starpu_sched_component *component);
|
|
|
|
|
|
/* update all the component->workers member recursively
|
|
|
*/
|
|
|
-void starpu_sched_tree_update_workers(struct starpu_sched_tree * t);
|
|
|
-/* idem for workers_in_ctx
|
|
|
+void starpu_sched_tree_update_workers(struct starpu_sched_tree *t);
|
|
|
+/* idem for workers_in_ctx
|
|
|
*/
|
|
|
-void starpu_sched_tree_update_workers_in_ctx(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();
|
|
|
+int starpu_sched_tree_push_task(struct starpu_task *task);
|
|
|
+struct starpu_task *starpu_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);
|
|
@@ -190,29 +188,29 @@ void starpu_sched_tree_remove_workers(unsigned sched_ctx_id, int *workerids, uns
|
|
|
* Generic Scheduling Component's Interface *
|
|
|
******************************************************************************/
|
|
|
|
|
|
-struct starpu_sched_component * starpu_sched_component_create(struct starpu_sched_tree *tree);
|
|
|
-void starpu_sched_component_destroy(struct starpu_sched_component * component);
|
|
|
+struct starpu_sched_component *starpu_sched_component_create(struct starpu_sched_tree *tree);
|
|
|
+void starpu_sched_component_destroy(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);
|
|
|
-void starpu_sched_component_prefetch_on_node(struct starpu_sched_component * component, struct starpu_task * task);
|
|
|
+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);
|
|
|
|
|
|
/*******************************************************************************
|
|
|
* Worker Component's Interface *
|
|
|
******************************************************************************/
|
|
|
|
|
|
/* no public create function for workers because we dont want to have several component_worker for a single workerid */
|
|
|
-struct starpu_sched_component * starpu_sched_component_worker_get(unsigned sched_ctx, int workerid);
|
|
|
-int starpu_sched_component_worker_get_workerid(struct starpu_sched_component * worker_component);
|
|
|
+struct starpu_sched_component *starpu_sched_component_worker_get(unsigned sched_ctx, int workerid);
|
|
|
+int starpu_sched_component_worker_get_workerid(struct starpu_sched_component *worker_component);
|
|
|
|
|
|
/* this function compare the available function of the component with the standard available for worker components*/
|
|
|
-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);
|
|
|
+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);
|
|
|
+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's Interface *
|
|
@@ -224,8 +222,8 @@ struct starpu_fifo_data
|
|
|
double exp_len_threshold;
|
|
|
};
|
|
|
|
|
|
-struct starpu_sched_component * starpu_sched_component_fifo_create(struct starpu_sched_tree *tree, struct starpu_fifo_data * fifo_data);
|
|
|
-int starpu_sched_component_is_fifo(struct starpu_sched_component * component);
|
|
|
+struct starpu_sched_component *starpu_sched_component_fifo_create(struct starpu_sched_tree *tree, struct starpu_fifo_data *fifo_data);
|
|
|
+int starpu_sched_component_is_fifo(struct starpu_sched_component *component);
|
|
|
|
|
|
/*******************************************************************************
|
|
|
* Flow-control Prio Component's Interface *
|
|
@@ -237,36 +235,36 @@ struct starpu_prio_data
|
|
|
double exp_len_threshold;
|
|
|
};
|
|
|
|
|
|
-struct starpu_sched_component * starpu_sched_component_prio_create(struct starpu_sched_tree *tree, struct starpu_prio_data * prio_data);
|
|
|
-int starpu_sched_component_is_prio(struct starpu_sched_component * component);
|
|
|
+struct starpu_sched_component *starpu_sched_component_prio_create(struct starpu_sched_tree *tree, struct starpu_prio_data *prio_data);
|
|
|
+int starpu_sched_component_is_prio(struct starpu_sched_component *component);
|
|
|
|
|
|
/*******************************************************************************
|
|
|
* Resource-mapping Work-Stealing Component's Interface *
|
|
|
******************************************************************************/
|
|
|
|
|
|
-struct starpu_sched_component * starpu_sched_component_work_stealing_create(struct starpu_sched_tree *tree, void * arg STARPU_ATTRIBUTE_UNUSED);
|
|
|
-int starpu_sched_component_is_work_stealing(struct starpu_sched_component * component);
|
|
|
+struct starpu_sched_component *starpu_sched_component_work_stealing_create(struct starpu_sched_tree *tree, void *arg STARPU_ATTRIBUTE_UNUSED);
|
|
|
+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's Interface *
|
|
|
******************************************************************************/
|
|
|
|
|
|
-struct starpu_sched_component * starpu_sched_component_random_create(struct starpu_sched_tree *tree, void * arg STARPU_ATTRIBUTE_UNUSED);
|
|
|
+struct starpu_sched_component *starpu_sched_component_random_create(struct starpu_sched_tree *tree, void *arg STARPU_ATTRIBUTE_UNUSED);
|
|
|
int starpu_sched_component_is_random(struct starpu_sched_component *);
|
|
|
|
|
|
/*******************************************************************************
|
|
|
* Resource-mapping Eager Component's Interface *
|
|
|
******************************************************************************/
|
|
|
|
|
|
-struct starpu_sched_component * starpu_sched_component_eager_create(struct starpu_sched_tree *tree, void * arg STARPU_ATTRIBUTE_UNUSED);
|
|
|
+struct starpu_sched_component *starpu_sched_component_eager_create(struct starpu_sched_tree *tree, void *arg STARPU_ATTRIBUTE_UNUSED);
|
|
|
int starpu_sched_component_is_eager(struct starpu_sched_component *);
|
|
|
|
|
|
/*******************************************************************************
|
|
|
* Resource-mapping Eager-Calibration Component's Interface *
|
|
|
******************************************************************************/
|
|
|
|
|
|
-struct starpu_sched_component * starpu_sched_component_eager_calibration_create(struct starpu_sched_tree *tree, void * arg STARPU_ATTRIBUTE_UNUSED);
|
|
|
+struct starpu_sched_component *starpu_sched_component_eager_calibration_create(struct starpu_sched_tree *tree, void *arg STARPU_ATTRIBUTE_UNUSED);
|
|
|
int starpu_sched_component_is_eager_calibration(struct starpu_sched_component *);
|
|
|
|
|
|
/*******************************************************************************
|
|
@@ -285,15 +283,15 @@ struct starpu_mct_data
|
|
|
a copy the struct starpu_mct_data * given is performed during the init_data call
|
|
|
the mct component doesnt do anything but pushing tasks on no_perf_model_component and calibrating_component
|
|
|
*/
|
|
|
-struct starpu_sched_component * starpu_sched_component_mct_create(struct starpu_sched_tree *tree, struct starpu_mct_data * mct_data);
|
|
|
-int starpu_sched_component_is_mct(struct starpu_sched_component * component);
|
|
|
+struct starpu_sched_component *starpu_sched_component_mct_create(struct starpu_sched_tree *tree, struct starpu_mct_data *mct_data);
|
|
|
+int starpu_sched_component_is_mct(struct starpu_sched_component *component);
|
|
|
|
|
|
/*******************************************************************************
|
|
|
* Resource-mapping HEFT Component's Interface *
|
|
|
******************************************************************************/
|
|
|
|
|
|
-struct starpu_sched_component * starpu_sched_component_heft_create(struct starpu_sched_tree *tree, struct starpu_mct_data * mct_data);
|
|
|
-int starpu_sched_component_is_heft(struct starpu_sched_component * component);
|
|
|
+struct starpu_sched_component *starpu_sched_component_heft_create(struct starpu_sched_tree *tree, struct starpu_mct_data *mct_data);
|
|
|
+int starpu_sched_component_is_heft(struct starpu_sched_component *component);
|
|
|
|
|
|
/*******************************************************************************
|
|
|
* Special-purpose Best_Implementation Component's Interface *
|
|
@@ -303,21 +301,21 @@ int starpu_sched_component_is_heft(struct starpu_sched_component * component);
|
|
|
* and fill task->predicted and task->predicted_transfer
|
|
|
* cannot have several child if push_task is called
|
|
|
*/
|
|
|
-struct starpu_sched_component * starpu_sched_component_best_implementation_create(struct starpu_sched_tree *tree, void * arg STARPU_ATTRIBUTE_UNUSED);
|
|
|
+struct starpu_sched_component *starpu_sched_component_best_implementation_create(struct starpu_sched_tree *tree, void *arg STARPU_ATTRIBUTE_UNUSED);
|
|
|
|
|
|
struct starpu_perfmodel_select_data
|
|
|
{
|
|
|
- struct starpu_sched_component * calibrator_component;
|
|
|
- struct starpu_sched_component * no_perfmodel_component;
|
|
|
- struct starpu_sched_component * perfmodel_component;
|
|
|
+ struct starpu_sched_component *calibrator_component;
|
|
|
+ struct starpu_sched_component *no_perfmodel_component;
|
|
|
+ struct starpu_sched_component *perfmodel_component;
|
|
|
};
|
|
|
|
|
|
/*******************************************************************************
|
|
|
* Special-purpose Perfmodel_Select Component's Interface *
|
|
|
******************************************************************************/
|
|
|
|
|
|
-struct starpu_sched_component * starpu_sched_component_perfmodel_select_create(struct starpu_sched_tree *tree, struct starpu_perfmodel_select_data * perfmodel_select_data);
|
|
|
-int starpu_sched_component_is_perfmodel_select(struct starpu_sched_component * component);
|
|
|
+struct starpu_sched_component *starpu_sched_component_perfmodel_select_create(struct starpu_sched_tree *tree, struct starpu_perfmodel_select_data *perfmodel_select_data);
|
|
|
+int starpu_sched_component_is_perfmodel_select(struct starpu_sched_component *component);
|
|
|
|
|
|
/*******************************************************************************
|
|
|
* Recipe Component's Interface *
|
|
@@ -326,14 +324,14 @@ int starpu_sched_component_is_perfmodel_select(struct starpu_sched_component * c
|
|
|
struct starpu_sched_component_composed_recipe;
|
|
|
|
|
|
/* create empty recipe */
|
|
|
-struct starpu_sched_component_composed_recipe * starpu_sched_component_create_recipe(void);
|
|
|
-struct starpu_sched_component_composed_recipe * starpu_sched_component_create_recipe_singleton(struct starpu_sched_component *(*create_component)(struct starpu_sched_tree *tree, void * arg), void * arg);
|
|
|
+struct starpu_sched_component_composed_recipe *starpu_sched_component_create_recipe(void);
|
|
|
+struct starpu_sched_component_composed_recipe *starpu_sched_component_create_recipe_singleton(struct starpu_sched_component *(*create_component)(struct starpu_sched_tree *tree, void *arg), void *arg);
|
|
|
|
|
|
/* add a function creation component to recipe */
|
|
|
-void starpu_sched_recipe_add_component(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_recipe_add_component(struct starpu_sched_component_composed_recipe *recipe, struct starpu_sched_component *(*create_component)(struct starpu_sched_tree *tree, void *arg), void *arg);
|
|
|
|
|
|
void starpu_destroy_composed_sched_component_recipe(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);
|
|
|
+struct starpu_sched_component *starpu_sched_component_composed_component_create(struct starpu_sched_tree *tree, struct starpu_sched_component_composed_recipe *recipe);
|
|
|
|
|
|
|
|
|
#ifdef STARPU_HAVE_HWLOC
|
|
@@ -341,23 +339,23 @@ struct starpu_sched_component * starpu_sched_component_composed_component_create
|
|
|
struct starpu_sched_specs
|
|
|
{
|
|
|
/* hw_loc_machine_composed_sched_component must be set as its the root of the topology */
|
|
|
- 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 *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;
|
|
|
|
|
|
/* this member should return a new allocated starpu_sched_component_composed_recipe or NULL
|
|
|
* the starpu_sched_component_composed_recipe_t must not include the worker component
|
|
|
*/
|
|
|
- struct starpu_sched_component_composed_recipe * (*worker_composed_sched_component)(enum starpu_worker_archtype archtype);
|
|
|
-
|
|
|
+ struct starpu_sched_component_composed_recipe *(*worker_composed_sched_component)(enum starpu_worker_archtype archtype);
|
|
|
+
|
|
|
/* this flag indicate if heterogenous workers should be brothers or cousins,
|
|
|
* as example, if a gpu and a cpu should share or not there numa node
|
|
|
*/
|
|
|
int mix_heterogeneous_workers;
|
|
|
};
|
|
|
|
|
|
-struct starpu_sched_tree * starpu_sched_component_make_scheduler(unsigned sched_ctx_id, struct starpu_sched_specs);
|
|
|
+struct starpu_sched_tree *starpu_sched_component_make_scheduler(unsigned sched_ctx_id, struct starpu_sched_specs);
|
|
|
#endif /* STARPU_HAVE_HWLOC */
|
|
|
|
|
|
|