|
@@ -58,23 +58,13 @@ Schedulers :
|
|
|
- Eager-based Schedulers (with/without prefetching) : \n
|
|
|
Naive scheduler, which tries to map a task on the first available resource
|
|
|
it finds.
|
|
|
- - tree-eager
|
|
|
- - tree-eager-prefetching
|
|
|
|
|
|
- Prio-based Schedulers (with/without prefetching) : \n
|
|
|
Similar to Eager-Based Schedulers. Can handle tasks which have a defined
|
|
|
priority and schedule them accordingly.
|
|
|
- - tree-prio
|
|
|
- - tree-prio-prefetching
|
|
|
|
|
|
- Random-based Schedulers (with/without prefetching) : \n
|
|
|
Selects randomly a resource to be mapped on for each task.
|
|
|
- - With fifos :
|
|
|
- - tree-random
|
|
|
- - tree-random-prefetching
|
|
|
- - With prios :
|
|
|
- - tree-random-prio
|
|
|
- - tree-random-prio-prefetching
|
|
|
|
|
|
- HEFT Scheduler : \n
|
|
|
Heterogeneous Earliest Finish Time Scheduler.
|
|
@@ -82,7 +72,6 @@ This scheduler needs that every task submitted to StarPU have a
|
|
|
defined performance model (\ref PerformanceModelCalibration)
|
|
|
to work efficiently, but can handle tasks without a performance
|
|
|
model.
|
|
|
- - tree-heft
|
|
|
|
|
|
|
|
|
\subsection ExampleTreeEagerPrefetchingStrategy An Example : The Tree-Eager-Prefetching Strategy
|
|
@@ -122,7 +111,7 @@ to be able to interact with other Scheduling Components.
|
|
|
belongs to the calling Component. The Hierarchical Schedulers'
|
|
|
model relies on this function to perform prefetching.
|
|
|
|
|
|
- - Pull (Caller_Component, Parent_Component) -> Task \n
|
|
|
+ - Pull (Caller_Component, Parent_Component) -> Task \n
|
|
|
The calling Scheduling Component requests a task from
|
|
|
its Parent Component. When the Pull function ends, the returned
|
|
|
task belongs to the calling Component.
|
|
@@ -142,29 +131,25 @@ to be able to interact with other Scheduling Components.
|
|
|
|
|
|
StarPU is currently shipped with the following four Scheduling Components :
|
|
|
|
|
|
- - Flow-control Components :
|
|
|
+ - Flow-control Components : Fifo, Prio \n
|
|
|
Components which store tasks. They can also prioritize them if
|
|
|
they have a defined priority. It is possible to define a threshold
|
|
|
for those Components following two criterias : the number of tasks
|
|
|
stored in the Component, or the sum of the expected length of all
|
|
|
tasks stored in the Component.
|
|
|
- - Fifo, Prio
|
|
|
|
|
|
- - Resource-Mapping Components :
|
|
|
+ - Resource-Mapping Components : Mct, Heft, Eager, Random, Work-Stealing \n
|
|
|
"Core" of the Scheduling Strategy, those Components are the
|
|
|
ones who make scheduling choices.
|
|
|
- - Mct, Eager, Random, Work-Stealing
|
|
|
|
|
|
- - Worker Components :
|
|
|
+ - Worker Components : Worker \n
|
|
|
Each Worker Component modelize a concrete worker.
|
|
|
- - Worker
|
|
|
|
|
|
- - Special-Purpose Components :
|
|
|
+ - Special-Purpose Components : Perfmodel_Select, Best_Implementation \n
|
|
|
Components dedicated to original purposes. The Perfmodel_Select
|
|
|
Component decides which Resource-Mapping Component should be used to
|
|
|
schedule a task. The Best_Implementation Component chooses which
|
|
|
implementation of a task should be used on the choosen resource.
|
|
|
- - Perfmodel_Select, Best_Implementation
|
|
|
|
|
|
\subsection ProgressionAndValidationRules Progression And Validation Rules
|
|
|
|
|
@@ -192,62 +177,82 @@ shown in Section \ref ExampleTreeEagerPrefetchingStrategy is implemented :
|
|
|
|
|
|
static void initialize_eager_prefetching_center_policy(unsigned sched_ctx_id)
|
|
|
{
|
|
|
- unsigned ntasks_threshold = _STARPU_SCHED_NTASKS_THRESHOLD_DEFAULT;
|
|
|
- double exp_len_threshold = _STARPU_SCHED_EXP_LEN_THRESHOLD_DEFAULT;
|
|
|
-
|
|
|
- [...]
|
|
|
-
|
|
|
- starpu_sched_ctx_create_worker_collection(sched_ctx_id, STARPU_WORKER_LIST);
|
|
|
-
|
|
|
- /* Create the Scheduling Tree */
|
|
|
- struct starpu_sched_tree *t = starpu_sched_tree_create(sched_ctx_id);
|
|
|
-
|
|
|
- /* The Root Component is a Flow-control Fifo Component */
|
|
|
- t->root = starpu_sched_component_fifo_create(NULL);
|
|
|
-
|
|
|
- /* The Resource-mapping Component of the strategy is an Eager Component */
|
|
|
- struct starpu_sched_component * eager_component = starpu_sched_component_eager_create(NULL);
|
|
|
-
|
|
|
- /* Create links between Components : the Eager Component is the child
|
|
|
- * of the Root Component */
|
|
|
- t->root->add_child(t->root, eager_component);
|
|
|
- eager_component->add_father(eager_component, t->root);
|
|
|
-
|
|
|
- /* A task threshold is set for the Flow-control Components which will be connected
|
|
|
- * to Worker Components. By doing so, this Hierarchical Scheduler will be able to
|
|
|
- * perform some prefetching on the resources */
|
|
|
- struct starpu_fifo_data fifo_data =
|
|
|
- {
|
|
|
- .ntasks_threshold = ntasks_threshold,
|
|
|
- .exp_len_threshold = exp_len_threshold,
|
|
|
- };
|
|
|
-
|
|
|
- unsigned i;
|
|
|
- for(i = 0; i < starpu_worker_get_count() + starpu_combined_worker_get_count() ; i++)
|
|
|
- {
|
|
|
- /* Each Worker Component has a Flow-control Fifo Component as father */
|
|
|
- struct starpu_sched_component * worker_component = starpu_sched_component_worker_get(i);
|
|
|
-
|
|
|
- struct starpu_sched_component * fifo_component = starpu_sched_component_fifo_create(&fifo_data);
|
|
|
- fifo_component->add_child(fifo_component, worker_component);
|
|
|
- worker_component->add_father(worker_component, fifo_component);
|
|
|
-
|
|
|
- /* Each Flow-control Fifo Component associated to a Worker Component
|
|
|
- * is linked to the Eager Component as one of its children */
|
|
|
- eager_component->add_child(eager_component, fifo_component);
|
|
|
- fifo_component->add_father(fifo_component, eager_component);
|
|
|
- }
|
|
|
-
|
|
|
- starpu_sched_tree_update_workers(t);
|
|
|
- starpu_sched_ctx_set_policy_data(sched_ctx_id, (void*)t);
|
|
|
+ unsigned ntasks_threshold = _STARPU_SCHED_NTASKS_THRESHOLD_DEFAULT;
|
|
|
+ double exp_len_threshold = _STARPU_SCHED_EXP_LEN_THRESHOLD_DEFAULT;
|
|
|
+
|
|
|
+ [...]
|
|
|
+
|
|
|
+ starpu_sched_ctx_create_worker_collection
|
|
|
+ (sched_ctx_id, STARPU_WORKER_LIST);
|
|
|
+
|
|
|
+ /* Create the Scheduling Tree */
|
|
|
+ struct starpu_sched_tree * t =
|
|
|
+ starpu_sched_tree_create(sched_ctx_id);
|
|
|
+
|
|
|
+ /* The Root Component is a Flow-control Fifo Component */
|
|
|
+ t->root = starpu_sched_component_fifo_create(NULL);
|
|
|
+
|
|
|
+ /* The Resource-mapping Component of the strategy is an Eager Component
|
|
|
+ */
|
|
|
+ struct starpu_sched_component * eager_component =
|
|
|
+ starpu_sched_component_eager_create(NULL);
|
|
|
+
|
|
|
+ /* Create links between Components : the Eager Component is the child
|
|
|
+ * of the Root Component */
|
|
|
+ t->root->add_child
|
|
|
+ (t->root, eager_component);
|
|
|
+ eager_component->add_father
|
|
|
+ (eager_component, t->root);
|
|
|
+
|
|
|
+ /* A task threshold is set for the Flow-control Components which will
|
|
|
+ * be connected to Worker Components. By doing so, this Hierarchical
|
|
|
+ * Scheduler will be able to perform some prefetching on the resources
|
|
|
+ */
|
|
|
+ struct starpu_fifo_data fifo_data =
|
|
|
+ {
|
|
|
+ .ntasks_threshold = ntasks_threshold,
|
|
|
+ .exp_len_threshold = exp_len_threshold,
|
|
|
+ };
|
|
|
+
|
|
|
+ unsigned i;
|
|
|
+ for(i = 0;
|
|
|
+ i < starpu_worker_get_count() +
|
|
|
+ starpu_combined_worker_get_count();
|
|
|
+ i++)
|
|
|
+ {
|
|
|
+ /* Each Worker Component has a Flow-control Fifo Component as
|
|
|
+ * father */
|
|
|
+ struct starpu_sched_component * worker_component =
|
|
|
+ starpu_sched_component_worker_get(i);
|
|
|
+ struct starpu_sched_component * fifo_component =
|
|
|
+ starpu_sched_component_fifo_create(&fifo_data);
|
|
|
+ fifo_component->add_child
|
|
|
+ (fifo_component, worker_component);
|
|
|
+ worker_component->add_father
|
|
|
+ (worker_component, fifo_component);
|
|
|
+
|
|
|
+ /* Each Flow-control Fifo Component associated to a Worker
|
|
|
+ * Component is linked to the Eager Component as one of its
|
|
|
+ * children */
|
|
|
+ eager_component->add_child
|
|
|
+ (eager_component, fifo_component);
|
|
|
+ fifo_component->add_father
|
|
|
+ (fifo_component, eager_component);
|
|
|
+ }
|
|
|
+
|
|
|
+ starpu_sched_tree_update_workers(t);
|
|
|
+ starpu_sched_ctx_set_policy_data
|
|
|
+ (sched_ctx_id, (void*)t);
|
|
|
}
|
|
|
|
|
|
/* Properly destroy the Scheduling Tree and all its Components */
|
|
|
static void deinitialize_eager_prefetching_center_policy(unsigned sched_ctx_id)
|
|
|
{
|
|
|
- struct starpu_sched_tree *tree = (struct starpu_sched_tree*)starpu_sched_ctx_get_policy_data(sched_ctx_id);
|
|
|
- starpu_sched_tree_destroy(tree);
|
|
|
- starpu_sched_ctx_delete_worker_collection(sched_ctx_id);
|
|
|
+ struct starpu_sched_tree * tree =
|
|
|
+ (struct starpu_sched_tree*)starpu_sched_ctx_get_policy_data(sched_ctx_id);
|
|
|
+ starpu_sched_tree_destroy(tree);
|
|
|
+ starpu_sched_ctx_delete_worker_collection
|
|
|
+ (sched_ctx_id);
|
|
|
}
|
|
|
|
|
|
/* Initializing the starpu_sched_policy struct associated to the Hierarchical
|
|
@@ -255,24 +260,25 @@ static void deinitialize_eager_prefetching_center_policy(unsigned sched_ctx_id)
|
|
|
* implement a Hierarchical Scheduler */
|
|
|
struct starpu_sched_policy _starpu_sched_tree_eager_prefetching_policy =
|
|
|
{
|
|
|
- .init_sched = initialize_eager_prefetching_center_policy,
|
|
|
- .deinit_sched = deinitialize_eager_prefetching_center_policy,
|
|
|
- .add_workers = starpu_sched_tree_add_workers,
|
|
|
- .remove_workers = starpu_sched_tree_remove_workers,
|
|
|
- .push_task = starpu_sched_tree_push_task,
|
|
|
- .pop_task = starpu_sched_tree_pop_task,
|
|
|
- .pre_exec_hook = starpu_sched_component_worker_pre_exec_hook,
|
|
|
- .post_exec_hook = starpu_sched_component_worker_post_exec_hook,
|
|
|
- .pop_every_task = NULL,
|
|
|
- .policy_name = "tree-eager-prefetching",
|
|
|
- .policy_description = "eager with prefetching tree policy"
|
|
|
+ .init_sched = initialize_eager_prefetching_center_policy,
|
|
|
+ .deinit_sched = deinitialize_eager_prefetching_center_policy,
|
|
|
+ .add_workers = starpu_sched_tree_add_workers,
|
|
|
+ .remove_workers = starpu_sched_tree_remove_workers,
|
|
|
+ .push_task = starpu_sched_tree_push_task,
|
|
|
+ .pop_task = starpu_sched_tree_pop_task,
|
|
|
+ .pre_exec_hook = starpu_sched_component_worker_pre_exec_hook,
|
|
|
+ .post_exec_hook = starpu_sched_component_worker_post_exec_hook,
|
|
|
+ .pop_every_task = NULL,
|
|
|
+ .policy_name = "tree-eager-prefetching",
|
|
|
+ .policy_description = "eager with prefetching tree policy"
|
|
|
};
|
|
|
\endcode
|
|
|
|
|
|
\section WriteASchedulingComponent Write a Scheduling Component
|
|
|
|
|
|
-\subsection SchedulingComponentsProgressionAndValidationRules Scheduling Components : Progression and Validation Rules by Type
|
|
|
-\subsection GenericComponentsInstanciation Generic Components' instanciation
|
|
|
+\subsection GenericSchedulingComponent Generic Scheduling Component
|
|
|
+\subsection InstanciationRedefineInterface Instanciation : Redefine the Interface
|
|
|
+\subsection DetailedProgressionAndValidationRules Detailed Progression and Validation Rules
|
|
|
|
|
|
|
|
|
*/
|