瀏覽代碼

Adding a first draft of Hierarchical Schedulers' Documentation. The fourth part and the technical documentation will be completed

Marc Sergent 11 年之前
父節點
當前提交
6348e255b9

+ 350 - 0
doc/doxygen/chapters/api/hierarchical_scheduler.doxy

@@ -0,0 +1,350 @@
+/*! \defgroup API_Hierarchical_Scheduler Hierarchical Scheduler Interface
+
+\struct starpu_sched_component
+\ingroup API_Hierarchical_Scheduler
+This structure represent a scheduler module.
+
+\var starpu_sched_component::push_task
+	push a task in the scheduler module.
+\var starpu_sched_component::pop_task
+	pop a task from the scheduler module, the task returned by this function is executable by the caller
+	It should use starpu_sched_component::fathers[sched_ctx_id] to perform a recursive call.
+
+\var starpu_sched_component::estimated_load
+	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.
+\var 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.
+\var starpu_sched_component::nchildren
+	the number of modules downstairs
+\var starpu_sched_component::children
+	modules downstairs
+\var starpu_sched_component::workers
+	this member contain the set of underlying workers
+\var 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.
+\var starpu_sched_component::properties
+	flags starpu_sched_component_properties for things
+\var starpu_sched_component::data
+	data used by the scheduler module
+\var starpu_sched_component::add_child
+	add a child to component
+\var starpu_sched_component::remove_child
+	remove a child from component
+
+\var starpu_sched_component::fathers
+	the array of scheduler module above indexed by scheduling context index
+
+\var starpu_sched_component::notify_change_workers
+	this function is called when starpu_sched_component::workers_in_ctx or starpu_sched_component::workers is changed
+\var starpu_sched_component::deinit_data
+	called by starpu_sched_component_destroy. Should free data allocated during creation
+\var starpu_sched_component::obj
+	the hwloc object associated to scheduler module
+
+\enum starpu_sched_component_properties
+\ingroup API_Hierarchical_Scheduler
+flags for starpu_sched_component::properties
+\var STARPU_SCHED_component_HOMOGENEOUS
+     indicate that all workers have the same starpu_worker_archtype
+\var STARPU_SCHED_component_SINGLE_MEMORY_component
+     indicate that all workers have the same memory component
+
+\def STARPU_SCHED_component_IS_HOMOGENEOUS
+\ingroup API_Hierarchical_Scheduler
+     indicate if component is homogeneous
+\def STARPU_SCHED_component_IS_SINGLE_MEMORY_component
+\ingroup API_Hierarchical_Scheduler
+     indicate if all workers have the same memory component
+
+
+\struct starpu_sched_tree
+\ingroup API_Hierarchical_Scheduler
+The actual scheduler
+\var starpu_sched_tree::root
+	this is the entry module of the scheduler
+\var starpu_sched_tree::workers
+	this is the set of workers available in this context, this value is used to mask workers in modules
+\var starpu_sched_tree::lock
+	this lock protect concurrent access from the hypervisor and the application.
+\var starpu_sched_tree::sched_ctx_id
+	the context id of the scheduler
+
+\fn struct starpu_sched_component * starpu_sched_component_create(void)
+\ingroup API_Hierarchical_Scheduler
+	 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
+
+
+\fn void starpu_sched_component_destroy(struct starpu_sched_component * component)
+\ingroup API_Hierarchical_Scheduler
+	 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 \p component
+
+\fn void starpu_sched_component_set_father(struct starpu_sched_component * component, struct starpu_sched_component * father_component, unsigned sched_ctx_id)
+\ingroup API_Hierarchical_Scheduler
+	 set component->fathers[sched_ctx_id] to father_component
+
+\fn void starpu_sched_component_add_child(struct starpu_sched_component* component, struct starpu_sched_component * child)
+\ingroup API_Hierarchical_Scheduler
+	 add child to component->children and increment nchildren as well.
+	 and do not modify child->fathers
+	 \p child must not be already in starpu_sched_component::children of \p component
+
+\fn void starpu_sched_component_remove_child(struct starpu_sched_component * component, struct starpu_sched_component * child)
+\ingroup API_Hierarchical_Scheduler
+	 remove child from component->children and decrements nchildren
+	 \p child must be in starpu_sched_component::child of \p component
+
+
+\fn int starpu_sched_component_can_execute_task(struct starpu_sched_component * component, struct starpu_task * task)
+\ingroup API_Hierarchical_Scheduler
+	 return true iff \p component can execute \p task, this function take into account the workers available in the scheduling context
+
+\fn int STARPU_WARN_UNUSED_RESULT starpu_sched_component_execute_preds(struct starpu_sched_component * component, struct starpu_task * task, double * length);
+\ingroup API_Hierarchical_Scheduler
+	 return a non null value if \p component can execute \p task.
+	 write the execution prediction length for the best implementation of the best worker available and write this at \p 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 \p length.
+
+\fn double starpu_sched_component_transfer_length(struct starpu_sched_component * component, struct starpu_task * task);
+\ingroup API_Hierarchical_Scheduler
+	 return the average time to transfer \p task data to underlying \p component workers.
+
+\fn struct starpu_sched_component * starpu_sched_component_worker_get(int workerid)
+\ingroup API_Hierarchical_Scheduler
+	 return the struct starpu_sched_component corresponding to \p workerid. Undefined if \p workerid is not a valid workerid
+
+
+\fn int starpu_sched_component_is_worker(struct starpu_sched_component * component)
+\ingroup API_Hierarchical_Scheduler
+	 return true iff \p component is a worker component
+\fn int starpu_sched_component_is_simple_worker(struct starpu_sched_component * component)
+\ingroup API_Hierarchical_Scheduler
+	 return true iff \p component is a simple worker component
+\fn int starpu_sched_component_is_combined_worker(struct starpu_sched_component * component)
+\ingroup API_Hierarchical_Scheduler
+	 return true iff \p component is a combined worker component
+\fn int starpu_sched_component_worker_get_workerid(struct starpu_sched_component * worker_component)
+\ingroup API_Hierarchical_Scheduler
+	 return the workerid of \p worker_component, undefined if starpu_sched_component_is_worker(worker_component) == 0
+
+
+\fn struct starpu_sched_component * starpu_sched_component_fifo_create(void * arg STARPU_ATTRIBUTE_UNUSED)
+\ingroup API_Hierarchical_Scheduler
+	 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.
+
+\fn int starpu_sched_component_is_fifo(struct starpu_sched_component * component)
+\ingroup API_Hierarchical_Scheduler
+	 return true iff \p component is a fifo component
+
+\fn struct starpu_sched_component * starpu_sched_component_work_stealing_create(void * arg STARPU_ATTRIBUTE_UNUSED)
+\ingroup API_Hierarchical_Scheduler
+	 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.
+
+
+\fn int starpu_sched_tree_work_stealing_push_task(struct starpu_task *task)
+\ingroup API_Hierarchical_Scheduler
+	 undefined if there is no work stealing component in the scheduler. If any, \p task is pushed in a default way if the caller is the application, and in the caller's fifo if its a worker.
+
+\fn int starpu_sched_component_is_work_stealing(struct starpu_sched_component * component)
+\ingroup API_Hierarchical_Scheduler
+	 return true iff \p component is a work stealing component
+
+\fn struct starpu_sched_component * starpu_sched_component_random_create(void * arg STARPU_ATTRIBUTE_UNUSED)
+\ingroup API_Hierarchical_Scheduler
+	 create a component that perform a random scheduling
+
+\fn int starpu_sched_component_is_random(struct starpu_sched_component *);
+\ingroup API_Hierarchical_Scheduler
+	 return true iff \p component is a random component
+
+\fn struct starpu_sched_component * starpu_sched_component_heft_create(struct starpu_heft_data * heft_data)
+\ingroup API_Hierarchical_Scheduler
+	 this component perform a heft scheduling
+
+\fn int starpu_sched_component_is_heft(struct starpu_sched_component * component)
+\ingroup API_Hierarchical_Scheduler
+	 return true iff \p component is a heft component
+
+\struct starpu_heft_data
+\ingroup API_Hierarchical_Scheduler
+starpu_sched_component_heft_create parameters
+\var starpu_heft_data::alpha
+	 coefficient applied to computation length
+\var starpu_heft_data::beta
+	 coefficient applied to communication length
+\var starpu_heft_data::gamma
+	 coefficient applied to power consumption
+\var starpu_heft_data::idle_power
+	 idle consumption of the machine
+\var starpu_heft_data::no_perf_model_component_create
+	 called to create the component to push task for whom no perf model is available
+\var starpu_heft_data::arg_no_perf_model
+	 argument passed to starpu_heft_data::no_perf_model_component_create
+\var starpu_heft_data::calibrating_component_create
+	 idem for tasks with an non calibrated implementation
+\var starpu_heft_data::arg_calibrating_component
+	 argument passed to starpu_heft_data::calibrating_component_create
+
+
+\fn struct starpu_sched_component * starpu_sched_component_best_implementation_create(void * arg STARPU_ATTRIBUTE_UNUSED);
+\ingroup API_Hierarchical_Scheduler
+	 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.
+
+
+
+\fn struct starpu_sched_tree * starpu_sched_tree_create(void)
+\ingroup API_Hierarchical_Scheduler
+	 create a empty initialized starpu_sched_tree
+\fn void starpu_sched_tree_destroy(struct starpu_sched_tree * tree, unsigned sched_ctx_id)
+\ingroup API_Hierarchical_Scheduler
+	 destroy tree and free all non shared component in it.
+\fn void starpu_sched_component_destroy_rec (struct starpu_sched_component *component, unsigned sched_ctx_id)
+\ingroup API_Hierarchical_Scheduler
+	 recursively destroy non shared parts of a \p component 's tree
+
+
+\fn starpu_sched_component_available(struct starpu_sched_component * component)
+\ingroup API_Hierarchical_Scheduler
+	 notify all component's underlying workers that a task is available to pop
+
+\fn int starpu_sched_tree_push_task(struct starpu_task * task)
+\ingroup API_Hierarchical_Scheduler
+	 compatibility with starpu_sched_policy interface
+\fn struct starpu_task * starpu_sched_tree_pop_task(unsigned sched_ctx_id)
+\ingroup API_Hierarchical_Scheduler
+	 compatibility with starpu_sched_policy interface
+\fn void starpu_sched_tree_add_workers(unsigned sched_ctx_id, int *workerids, unsigned nworkers)
+\ingroup API_Hierarchical_Scheduler
+	 compatibility with starpu_sched_policy interface
+\fn void starpu_sched_tree_remove_workers(unsigned sched_ctx_id, int *workerids, unsigned nworkers)
+\ingroup API_Hierarchical_Scheduler
+	 compatibility with starpu_sched_policy interface
+\fn void starpu_sched_component_worker_pre_exec_hook(struct starpu_task * task)
+\ingroup API_Hierarchical_Scheduler
+	 compatibility with starpu_sched_policy interface
+	 update predictions for workers
+\fn void starpu_sched_component_worker_post_exec_hook(struct starpu_task * task)
+\ingroup API_Hierarchical_Scheduler
+	 compatibility with starpu_sched_policy interface
+
+
+\fn void starpu_sched_tree_update_workers(struct starpu_sched_tree * t)
+\ingroup API_Hierarchical_Scheduler
+	 recursively set all starpu_sched_component::workers, do not take into account shared parts (except workers).
+
+\fn void starpu_sched_tree_update_workers_in_ctx(struct starpu_sched_tree * t)
+\ingroup API_Hierarchical_Scheduler
+	 recursively set all starpu_sched_component::workers_in_ctx, do not take into account shared parts (except workers)
+
+\struct starpu_bitmap;
+\ingroup API_Hierarchical_Scheduler
+	 implement a simple bitmap
+\fn struct starpu_bitmap * starpu_bitmap_create(void)
+\ingroup API_Hierarchical_Scheduler
+	 create a empty starpu_bitmap
+\fn void starpu_bitmap_destroy(struct starpu_bitmap *)
+\ingroup API_Hierarchical_Scheduler
+	 free a starpu_bitmap
+
+\fn void starpu_bitmap_set(struct starpu_bitmap * bitmap, int e)
+\ingroup API_Hierarchical_Scheduler
+	 set bit \p e in \p bitmap
+\fn void starpu_bitmap_unset(struct starpu_bitmap * bitmap, int e)
+\ingroup API_Hierarchical_Scheduler
+	 unset bit \p e in \p bitmap
+
+\fn void starpu_bitmap_unset_all(struct starpu_bitmap * bitmap)
+\ingroup API_Hierarchical_Scheduler
+	 unset all bits in \b bitmap
+
+\fn int starpu_bitmap_get(struct starpu_bitmap * bitmap, int e);
+\ingroup API_Hierarchical_Scheduler
+	 return true iff bit \p e is set in \p bitmap
+
+\fn int starpu_bitmap_cardinal(struct starpu_bitmap * bitmap);
+\ingroup API_Hierarchical_Scheduler
+	 return the number of set bits in \p bitmap
+
+
+\fn int starpu_bitmap_first(struct starpu_bitmap * bitmap)
+\ingroup API_Hierarchical_Scheduler
+	 return the position of the first set bit of \p bitmap, -1 if none
+\fn int starpu_bitmap_last(struct starpu_bitmap * bitmap)
+\ingroup API_Hierarchical_Scheduler
+	 return the position of the last set bit of \p bitmap, -1 if none
+
+\fn int starpu_bitmap_next(struct starpu_bitmap *, int e)
+\ingroup API_Hierarchical_Scheduler
+	 return the position of set bit right after \p e in \p bitmap, -1 if none
+
+
+\struct starpu_sched_component_composed_recipe;
+\ingroup API_Hierarchical_Scheduler
+	parameters for starpu_sched_component_composed_component_create
+
+\fn struct starpu_sched_component_composed_recipe * starpu_sched_component_create_recipe(void)
+\ingroup API_Hierarchical_Scheduler
+	 return an empty recipe for a composed component, it should not be used without modification
+
+
+\fn struct starpu_sched_component_composed_recipe * starpu_sched_component_create_recipe_singleton(struct starpu_sched_component *(*create_component)(void * arg), void * arg)
+\ingroup API_Hierarchical_Scheduler
+	 return a recipe to build a composed component with a \p create_component
+
+\fn void starpu_sched_recipe_add_component(struct starpu_sched_component_composed_recipe * recipe, struct starpu_sched_component *(*create_component)(void * arg), void * arg)
+\ingroup API_Hierarchical_Scheduler
+	 add \p create_component under all previous components in recipe
+
+\fn void starpu_destroy_composed_sched_component_recipe(struct starpu_sched_component_composed_recipe *)
+\ingroup API_Hierarchical_Scheduler
+	 destroy composed_sched_component, this should be done after starpu_sched_component_composed_component_create was called
+
+\fn struct starpu_sched_component * starpu_sched_component_composed_component_create(struct starpu_sched_component_composed_recipe * recipe)
+\ingroup API_Hierarchical_Scheduler
+	 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_specs
+\ingroup API_Hierarchical_Scheduler
+	 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.
+\var starpu_sched_specs::hwloc_machine_composed_sched_component
+     the composed component to put on the top of the scheduler
+     this member must not be NULL
+\var starpu_sched_specs::hwloc_component_composed_sched_component
+     the composed component to put for each memory component
+\var starpu_sched_specs::hwloc_socket_composed_sched_component
+     the composed component to put for each socket
+\var starpu_sched_specs::hwloc_cache_composed_sched_component
+     the composed component to put for each cache
+     
+\var starpu_sched_specs::worker_composed_sched_component
+     a function that return a starpu_sched_component_composed_recipe to put on top of a worker of type \p archtype.
+     NULL is a valid return value, then no component will be added on top
+\var starpu_sched_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
+
+\fn struct starpu_sched_tree * starpu_sched_component_make_scheduler(unsigned sched_ctx_id, struct starpu_sched_specs s);
+\ingroup API_Hierarchical_Scheduler
+	 this function build a scheduler for \p sched_ctx_id according to \p s and the hwloc topology of the machine.
+*/

+ 0 - 350
doc/doxygen/chapters/api/modularized_scheduler.doxy

@@ -1,350 +0,0 @@
-/*! \defgroup API_Modularized_Scheduler Modularized Scheduler Interface
-
-\struct starpu_sched_node
-\ingroup API_Modularized_Scheduler
-This structure represent a scheduler module.
-
-\var starpu_sched_node::push_task
-	push a task in the scheduler module.
-\var starpu_sched_node::pop_task
-	pop a task from the scheduler module, the task returned by this function is executable by the caller
-	It should use starpu_sched_node::fathers[sched_ctx_id] to perform a recursive call.
-
-\var starpu_sched_node::estimated_load
-	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.
-\var starpu_sched_node::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.
-\var starpu_sched_node::nchilds
-	the number of modules downstairs
-\var starpu_sched_node::childs
-	modules downstairs
-\var starpu_sched_node::workers
-	this member contain the set of underlying workers
-\var starpu_sched_node::workers_in_ctx
-	this member contain the subset of starpu_sched_node::workers that is currently available in the context
-	The push method should take this member into account.
-\var starpu_sched_node::properties
-	flags starpu_sched_node_properties for things
-\var starpu_sched_node::data
-	data used by the scheduler module
-\var starpu_sched_node::add_child
-	add a child to node
-\var starpu_sched_node::remove_child
-	remove a child from node
-
-\var starpu_sched_node::fathers
-	the array of scheduler module above indexed by scheduling context index
-
-\var starpu_sched_node::notify_change_workers
-	this function is called when starpu_sched_node::workers_in_ctx or starpu_sched_node::workers is changed
-\var starpu_sched_node::deinit_data
-	called by starpu_sched_node_destroy. Should free data allocated during creation
-\var starpu_sched_node::obj
-	the hwloc object associated to scheduler module
-
-\enum starpu_sched_node_properties
-\ingroup API_Modularized_Scheduler
-flags for starpu_sched_node::properties
-\var STARPU_SCHED_NODE_HOMOGENEOUS
-     indicate that all workers have the same starpu_worker_archtype
-\var STARPU_SCHED_NODE_SINGLE_MEMORY_NODE
-     indicate that all workers have the same memory node
-
-\def STARPU_SCHED_NODE_IS_HOMOGENEOUS
-\ingroup API_Modularized_Scheduler
-     indicate if node is homogeneous
-\def STARPU_SCHED_NODE_IS_SINGLE_MEMORY_NODE
-\ingroup API_Modularized_Scheduler
-     indicate if all workers have the same memory node
-
-
-\struct starpu_sched_tree
-\ingroup API_Modularized_Scheduler
-The actual scheduler
-\var starpu_sched_tree::root
-	this is the entry module of the scheduler
-\var starpu_sched_tree::workers
-	this is the set of workers available in this context, this value is used to mask workers in modules
-\var starpu_sched_tree::lock
-	this lock protect concurrent access from the hypervisor and the application.
-\var starpu_sched_tree::sched_ctx_id
-	the context id of the scheduler
-
-\fn struct starpu_sched_node * starpu_sched_node_create(void)
-\ingroup API_Modularized_Scheduler
-	 allocate and initialize node 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 childs
-	.add_child is starpu_sched_node_add_child
-	.remove_child is starpu_sched_node_remove_child
-	.notify_change_workers does nothing
-	.deinit_data does nothing
-
-
-\fn void starpu_sched_node_destroy(struct starpu_sched_node * node)
-\ingroup API_Modularized_Scheduler
-	 free data allocated by starpu_sched_node_create and call node->deinit_data(node)
-	 set to null the member starpu_sched_node::fathers[sched_ctx_id] of all child if its equal to \p node
-
-\fn void starpu_sched_node_set_father(struct starpu_sched_node * node, struct starpu_sched_node * father_node, unsigned sched_ctx_id)
-\ingroup API_Modularized_Scheduler
-	 set node->fathers[sched_ctx_id] to father_node
-
-\fn void starpu_sched_node_add_child(struct starpu_sched_node* node, struct starpu_sched_node * child)
-\ingroup API_Modularized_Scheduler
-	 add child to node->childs and increment nchilds as well.
-	 and do not modify child->fathers
-	 \p child must not be already in starpu_sched_node::childs of \p node
-
-\fn void starpu_sched_node_remove_child(struct starpu_sched_node * node, struct starpu_sched_node * child)
-\ingroup API_Modularized_Scheduler
-	 remove child from node->childs and decrements nchilds
-	 \p child must be in starpu_sched_node::child of \p node
-
-
-\fn int starpu_sched_node_can_execute_task(struct starpu_sched_node * node, struct starpu_task * task)
-\ingroup API_Modularized_Scheduler
-	 return true iff \p node can execute \p task, this function take into account the workers available in the scheduling context
-
-\fn int STARPU_WARN_UNUSED_RESULT starpu_sched_node_execute_preds(struct starpu_sched_node * node, struct starpu_task * task, double * length);
-\ingroup API_Modularized_Scheduler
-	 return a non null value if \p node can execute \p task.
-	 write the execution prediction length for the best implementation of the best worker available and write this at \p length address.
-	 this result is more relevant if starpu_sched_node::is_homogeneous is non null.
-	 if a worker need to be calibrated for an implementation, nan is set to \p length.
-
-\fn double starpu_sched_node_transfer_length(struct starpu_sched_node * node, struct starpu_task * task);
-\ingroup API_Modularized_Scheduler
-	 return the average time to transfer \p task data to underlying \p node workers.
-
-\fn struct starpu_sched_node * starpu_sched_node_worker_get(int workerid)
-\ingroup API_Modularized_Scheduler
-	 return the struct starpu_sched_node corresponding to \p workerid. Undefined if \p workerid is not a valid workerid
-
-
-\fn int starpu_sched_node_is_worker(struct starpu_sched_node * node)
-\ingroup API_Modularized_Scheduler
-	 return true iff \p node is a worker node
-\fn int starpu_sched_node_is_simple_worker(struct starpu_sched_node * node)
-\ingroup API_Modularized_Scheduler
-	 return true iff \p node is a simple worker node
-\fn int starpu_sched_node_is_combined_worker(struct starpu_sched_node * node)
-\ingroup API_Modularized_Scheduler
-	 return true iff \p node is a combined worker node
-\fn int starpu_sched_node_worker_get_workerid(struct starpu_sched_node * worker_node)
-\ingroup API_Modularized_Scheduler
-	 return the workerid of \p worker_node, undefined if starpu_sched_node_is_worker(worker_node) == 0
-
-
-\fn struct starpu_sched_node * starpu_sched_node_fifo_create(void * arg STARPU_ATTRIBUTE_UNUSED)
-\ingroup API_Modularized_Scheduler
-	 Return a struct starpu_sched_node with a fifo. A stable sort is performed according to tasks priorities.
-	 A push_task call on this node does not perform recursive calls, underlying nodes will have to call pop_task to get it.
-	 starpu_sched_node::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.
-
-\fn int starpu_sched_node_is_fifo(struct starpu_sched_node * node)
-\ingroup API_Modularized_Scheduler
-	 return true iff \p node is a fifo node
-
-\fn struct starpu_sched_node * starpu_sched_node_work_stealing_create(void * arg STARPU_ATTRIBUTE_UNUSED)
-\ingroup API_Modularized_Scheduler
-	 return a node 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 childs. 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.
-
-
-\fn int starpu_sched_tree_work_stealing_push_task(struct starpu_task *task)
-\ingroup API_Modularized_Scheduler
-	 undefined if there is no work stealing node in the scheduler. If any, \p task is pushed in a default way if the caller is the application, and in the caller's fifo if its a worker.
-
-\fn int starpu_sched_node_is_work_stealing(struct starpu_sched_node * node)
-\ingroup API_Modularized_Scheduler
-	 return true iff \p node is a work stealing node
-
-\fn struct starpu_sched_node * starpu_sched_node_random_create(void * arg STARPU_ATTRIBUTE_UNUSED)
-\ingroup API_Modularized_Scheduler
-	 create a node that perform a random scheduling
-
-\fn int starpu_sched_node_is_random(struct starpu_sched_node *);
-\ingroup API_Modularized_Scheduler
-	 return true iff \p node is a random node
-
-\fn struct starpu_sched_node * starpu_sched_node_heft_create(struct starpu_heft_data * heft_data)
-\ingroup API_Modularized_Scheduler
-	 this node perform a heft scheduling
-
-\fn int starpu_sched_node_is_heft(struct starpu_sched_node * node)
-\ingroup API_Modularized_Scheduler
-	 return true iff \p node is a heft node
-
-\struct starpu_heft_data
-\ingroup API_Modularized_Scheduler
-starpu_sched_node_heft_create parameters
-\var starpu_heft_data::alpha
-	 coefficient applied to computation length
-\var starpu_heft_data::beta
-	 coefficient applied to communication length
-\var starpu_heft_data::gamma
-	 coefficient applied to power consumption
-\var starpu_heft_data::idle_power
-	 idle consumption of the machine
-\var starpu_heft_data::no_perf_model_node_create
-	 called to create the node to push task for whom no perf model is available
-\var starpu_heft_data::arg_no_perf_model
-	 argument passed to starpu_heft_data::no_perf_model_node_create
-\var starpu_heft_data::calibrating_node_create
-	 idem for tasks with an non calibrated implementation
-\var starpu_heft_data::arg_calibrating_node
-	 argument passed to starpu_heft_data::calibrating_node_create
-
-
-\fn struct starpu_sched_node * starpu_sched_node_best_implementation_create(void * arg STARPU_ATTRIBUTE_UNUSED);
-\ingroup API_Modularized_Scheduler
-	 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 node of the first suitable workerid.
-	 If starpu_sched_node::push method is called and starpu_sched_node::nchild > 1 the result is undefined.
-
-
-
-\fn struct starpu_sched_tree * starpu_sched_tree_create(void)
-\ingroup API_Modularized_Scheduler
-	 create a empty initialized starpu_sched_tree
-\fn void starpu_sched_tree_destroy(struct starpu_sched_tree * tree, unsigned sched_ctx_id)
-\ingroup API_Modularized_Scheduler
-	 destroy tree and free all non shared node in it.
-\fn void starpu_sched_node_destroy_rec (struct starpu_sched_node *node, unsigned sched_ctx_id)
-\ingroup API_Modularized_Scheduler
-	 recursively destroy non shared parts of a \p node 's tree
-
-
-\fn starpu_sched_node_available(struct starpu_sched_node * node)
-\ingroup API_Modularized_Scheduler
-	 notify all node's underlying workers that a task is available to pop
-
-\fn int starpu_sched_tree_push_task(struct starpu_task * task)
-\ingroup API_Modularized_Scheduler
-	 compatibility with starpu_sched_policy interface
-\fn struct starpu_task * starpu_sched_tree_pop_task(unsigned sched_ctx_id)
-\ingroup API_Modularized_Scheduler
-	 compatibility with starpu_sched_policy interface
-\fn void starpu_sched_tree_add_workers(unsigned sched_ctx_id, int *workerids, unsigned nworkers)
-\ingroup API_Modularized_Scheduler
-	 compatibility with starpu_sched_policy interface
-\fn void starpu_sched_tree_remove_workers(unsigned sched_ctx_id, int *workerids, unsigned nworkers)
-\ingroup API_Modularized_Scheduler
-	 compatibility with starpu_sched_policy interface
-\fn void starpu_sched_node_worker_pre_exec_hook(struct starpu_task * task)
-\ingroup API_Modularized_Scheduler
-	 compatibility with starpu_sched_policy interface
-	 update predictions for workers
-\fn void starpu_sched_node_worker_post_exec_hook(struct starpu_task * task)
-\ingroup API_Modularized_Scheduler
-	 compatibility with starpu_sched_policy interface
-
-
-\fn void starpu_sched_tree_update_workers(struct starpu_sched_tree * t)
-\ingroup API_Modularized_Scheduler
-	 recursively set all starpu_sched_node::workers, do not take into account shared parts (except workers).
-
-\fn void starpu_sched_tree_update_workers_in_ctx(struct starpu_sched_tree * t)
-\ingroup API_Modularized_Scheduler
-	 recursively set all starpu_sched_node::workers_in_ctx, do not take into account shared parts (except workers)
-
-\struct starpu_bitmap;
-\ingroup API_Modularized_Scheduler
-	 implement a simple bitmap
-\fn struct starpu_bitmap * starpu_bitmap_create(void)
-\ingroup API_Modularized_Scheduler
-	 create a empty starpu_bitmap
-\fn void starpu_bitmap_destroy(struct starpu_bitmap *)
-\ingroup API_Modularized_Scheduler
-	 free a starpu_bitmap
-
-\fn void starpu_bitmap_set(struct starpu_bitmap * bitmap, int e)
-\ingroup API_Modularized_Scheduler
-	 set bit \p e in \p bitmap
-\fn void starpu_bitmap_unset(struct starpu_bitmap * bitmap, int e)
-\ingroup API_Modularized_Scheduler
-	 unset bit \p e in \p bitmap
-
-\fn void starpu_bitmap_unset_all(struct starpu_bitmap * bitmap)
-\ingroup API_Modularized_Scheduler
-	 unset all bits in \b bitmap
-
-\fn int starpu_bitmap_get(struct starpu_bitmap * bitmap, int e);
-\ingroup API_Modularized_Scheduler
-	 return true iff bit \p e is set in \p bitmap
-
-\fn int starpu_bitmap_cardinal(struct starpu_bitmap * bitmap);
-\ingroup API_Modularized_Scheduler
-	 return the number of set bits in \p bitmap
-
-
-\fn int starpu_bitmap_first(struct starpu_bitmap * bitmap)
-\ingroup API_Modularized_Scheduler
-	 return the position of the first set bit of \p bitmap, -1 if none
-\fn int starpu_bitmap_last(struct starpu_bitmap * bitmap)
-\ingroup API_Modularized_Scheduler
-	 return the position of the last set bit of \p bitmap, -1 if none
-
-\fn int starpu_bitmap_next(struct starpu_bitmap *, int e)
-\ingroup API_Modularized_Scheduler
-	 return the position of set bit right after \p e in \p bitmap, -1 if none
-
-
-\struct starpu_sched_node_composed_recipe;
-\ingroup API_Modularized_Scheduler
-	parameters for starpu_sched_node_composed_node_create
-
-\fn struct starpu_sched_node_composed_recipe * starpu_sched_node_create_recipe(void)
-\ingroup API_Modularized_Scheduler
-	 return an empty recipe for a composed node, it should not be used without modification
-
-
-\fn struct starpu_sched_node_composed_recipe * starpu_sched_node_create_recipe_singleton(struct starpu_sched_node *(*create_node)(void * arg), void * arg)
-\ingroup API_Modularized_Scheduler
-	 return a recipe to build a composed node with a \p create_node
-
-\fn void starpu_sched_recipe_add_node(struct starpu_sched_node_composed_recipe * recipe, struct starpu_sched_node *(*create_node)(void * arg), void * arg)
-\ingroup API_Modularized_Scheduler
-	 add \p create_node under all previous nodes in recipe
-
-\fn void starpu_destroy_composed_sched_node_recipe(struct starpu_sched_node_composed_recipe *)
-\ingroup API_Modularized_Scheduler
-	 destroy composed_sched_node, this should be done after starpu_sched_node_composed_node_create was called
-
-\fn struct starpu_sched_node * starpu_sched_node_composed_node_create(struct starpu_sched_node_composed_recipe * recipe)
-\ingroup API_Modularized_Scheduler
-	 create a node that behave as all node of recipe where linked. Except that you cant use starpu_sched_node_is_foo function
-	 if recipe contain a single create_foo arg_foo pair, create_foo(arg_foo) is returned instead of a composed node
-
-
-\struct starpu_sched_specs
-\ingroup API_Modularized_Scheduler
-	 Define how build a scheduler according to topology. Each level (except for hwloc_machine_composed_sched_node) can be NULL, then
-	 the level is just skipped. Bugs everywhere, do not rely on.
-\var starpu_sched_specs::hwloc_machine_composed_sched_node
-     the composed node to put on the top of the scheduler
-     this member must not be NULL
-\var starpu_sched_specs::hwloc_node_composed_sched_node
-     the composed node to put for each memory node
-\var starpu_sched_specs::hwloc_socket_composed_sched_node
-     the composed node to put for each socket
-\var starpu_sched_specs::hwloc_cache_composed_sched_node
-     the composed node to put for each cache
-     
-\var starpu_sched_specs::worker_composed_sched_node
-     a function that return a starpu_sched_node_composed_recipe to put on top of a worker of type \p archtype.
-     NULL is a valid return value, then no node will be added on top
-\var starpu_sched_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 node with a fifo node per numa node, 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 node it will be shared
-
-\fn struct starpu_sched_tree * starpu_sched_node_make_scheduler(unsigned sched_ctx_id, struct starpu_sched_specs s);
-\ingroup API_Modularized_Scheduler
-	 this function build a scheduler for \p sched_ctx_id according to \p s and the hwloc topology of the machine.
-*/

+ 1 - 1
doc/doxygen/chapters/files.doxy

@@ -31,7 +31,7 @@
 \file starpu_profiling.h
 \file starpu_bound.h
 \file starpu_scheduler.h
-\file starpu_sched_node.h
+\file starpu_sched_component.h
 \file starpu_sched_ctx.h
 \file starpu_sched_ctx_hypervisor.h
 \file starpu_top.h

+ 273 - 0
doc/doxygen/chapters/hierarchical_scheduler.doxy

@@ -0,0 +1,273 @@
+/*
+ * This file is part of the StarPU Handbook.
+ * Copyright (C) 2013 Simon Archipoff
+ * Copyright (C) 2013 INRIA
+ * See the file version.doxy for copying conditions.
+ */
+
+/*! \page HierarchicalScheduler Hierarchical Schedulers
+
+\section Introduction
+
+StarPU's Hierarchical Schedulers are made of individual Scheduling Components 
+hierarchically assembled as a Scheduling Tree. Each Scheduling Component has an 
+unique purpose, such as prioritizing tasks or mapping tasks over resources.
+A typical Scheduling Tree is shown below.
+
+<pre>
+                                  |
+              starpu_push_task    |
+                                  |
+                                  v
+                            Fifo_Component
+                                |  ^
+                                |  |        
+                                v  |
+                           Eager_Component
+                                |  ^
+                                |  |    
+                                v  |
+                 --------><--------------><--------
+                 |  ^                          |  ^
+                 |  |                          |  |        
+                 v  |                          v  |
+             Fifo_Component                 Fifo_Component
+                 |  ^                          |  ^
+                 |  |                          |  |        
+                 v  |                          v  |
+            Worker_Component               Worker_Component
+</pre>
+
+When a task is pushed by StarPU in a Hierarchical Scheduler, the task moves from
+a Scheduling Component to an other, following the hierarchy of the
+Scheduling Tree, and is stored in one of the Scheduling Components of the 
+strategy.
+When a worker wants to pop a task from the Hierarchical Scheduler, the
+corresponding Worker Component of the Scheduling Tree tries to pull a task from 
+its fathers, following the hierarchy, and gives it to the worker if it succeded 
+to get one.
+
+
+\section UsingHierarchicalSchedulers Using Hierarchical Schedulers
+
+\subsection ExistingHierarchicalSchedulers Existing Hierarchical Schedulers
+
+StarPU is currently shipped with the following pre-defined Hierarchical 
+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.
+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
+
+<pre>
+                                 |
+             starpu_push_task    |
+                                 |
+                                 v
+                           Fifo_Component
+                                |  ^
+                        Push    |  |    Can_Push
+                                v  |
+                          Eager_Component
+                                |  ^
+                                |  |    
+                                v  |
+              --------><-------------------><---------
+              |  ^                                |  ^
+      Push    |  |    Can_Push            Push    |  |    Can_Push
+              v  |                                v  |
+         Fifo_Component                       Fifo_Component
+              |  ^                                |  ^
+      Pull    |  |    Can_Pull            Pull    |  |    Can_Pull
+              v  |                                v  |
+        Worker_Component                     Worker_Component
+</pre>
+
+\subsection Interface
+
+Each Scheduling Component must follow the following pre-defined Interface 
+to be able to interact with other Scheduling Components.
+
+	- Push (Caller_Component, Child_Component, Task) \n
+	The calling Scheduling Component transfers a task to its 
+	Child Component. When the Push function returns, the task no longer 
+	belongs to the calling Component. The Hierarchical Schedulers' 
+	model relies on this function to perform prefetching.
+
+	- 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.
+
+	- Can_Push (Caller_Component, Parent_Component) \n
+	The calling Scheduling Component notifies its Parent Component that 
+	it is ready to accept new tasks.
+
+	- Can_Pull (Caller_Component, Child_Component) \n
+	The calling Scheduling Component notifies its Child Component
+	that it is ready to give new tasks.
+
+
+\section BuildAHierarchicalScheduler Build a Hierarchical Scheduler
+
+\subsection PreImplementedComponents Pre-implemented Components
+
+StarPU is currently shipped with the following four Scheduling Components : 
+
+	- Flow-control Components : 
+	Those Components store tasks. They can also prioritize them if
+	they have a defined priority.
+		- Fifo, Prio
+
+	- Resource-Mapping Components : 
+	"Core" of the Scheduling Strategy, those Components are the
+	ones who make scheduling choices.
+		- Mct, Eager, Random, Work-Stealing
+
+	- Worker Components :
+	Each Worker Component modelize a concrete worker.
+		- Worker
+
+	- Special-Purpose Components :
+	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
+
+Some rules must be followed to ensure the correctness of a Hierarchical 
+Scheduler :
+
+	- At least one Flow-control Component per Worker Component is needed in 
+	a Hierarchical Scheduler, to store incoming tasks from StarPU and to 
+	give tasks to Worker Components who asks for it. It is possible to use 
+	one Flow-control Component per Worker Component, or one for all Worker
+	Components, depending on how the Scheduling Tree is defined.
+
+	- At least one Resource-Mapping Component is needed in a Hierarchical
+	Scheduler. Resource-Mapping Components are the only ones who can make
+	scheduling choices, and so the only ones who can have several child.
+
+\subsection ImplementAHierarchicalScheduler Implement a Hierarchical Scheduler
+
+The following code present how the Tree-Eager-Prefetching Scheduler
+shown in Section \ref ExampleTreeEagerPrefetchingStrategy is implemented :
+
+\code{.c}
+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);
+
+	/* Creating 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);
+
+	/* Creating 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);
+
+	/* It is possible to define thresholds following several criterias for 
+	 * Flow-control Components : this will be explained further in Section 4.1°) 
+	 */
+	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);
+}
+
+/* Initializing the starpu_sched_policy struct associated to the Hierarchical
+ * Scheduler : only the init_sched and deinit_sched needs to be defined to
+ * 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"
+};
+\endcode
+
+\section WriteASchedulingComponent Write a Scheduling Component
+
+\subsection SchedulingComponentsProgressionAndValidationRules Scheduling Components : Progression and Validation Rules by Type
+\subsection GenericComponentsInstanciation Generic Components' instanciation
+
+
+*/
+

+ 2 - 2
doc/doxygen/chapters/introduction.doxy

@@ -220,9 +220,9 @@ The documentation chapters include
 <li> \ref cExtensions
 <li> \ref SOCLOpenclExtensions
 <li> \ref SchedulingContexts
-<li> \ref ModularizedScheduler
+<li> \ref HierarchicalScheduler
 <li> \ref SchedulingContextHypervisor
-<li> \ref ModularizedScheduler
+<li> \ref HierarchicalScheduler
 </ul>
 </li>
 <li> Part: Inside StarPU

+ 0 - 145
doc/doxygen/chapters/modularized_scheduler.doxy

@@ -1,145 +0,0 @@
-/*
- * This file is part of the StarPU Handbook.
- * Copyright (C) 2013 Simon Archipoff
- * See the file version.doxy for copying conditions.
- */
-
-/*! \page ModularizedScheduler Modularized Scheduler
-
-
-\section Introduction
-
-Scheduler are a tree-like structure of homogeneous nodes that each
-provides push and pop primitives. Each node may have one father by
-context, specially worker nodes as they are shared between all contexts.
-
-Tasks make a top bottom traversal of tree.
-
-A push call on a node make either a recursive call on one of its
-childs or make the task stored in the node and made available to a
-pop, in this case that node should call starpu_sched_node_available to wake workers
-up. Push must be called on a child, and only if this child can execute
-the task.
-
-A pop call on a node can either return a locally stored task or perform
-a recursive call on its father in its current context. Only workers
-should call pop.
-
-
-\section Initialization
-Scheduler node are created with the starpu_sched_node_foo_create() functions
-and then must be assembled using them starpu_sched_node::add_child and
-starpu_sched_node::remove_child functions.
-A father can be set to allow him to be reachable by a starpu_sched_node::pop_task
-call.
-
-Underlyings workers are memoized in starpu_sched_node::workers. Hence the
-function starpu_sched_tree_update_workers should be called when the scheduler is
-finished, or modified.
-
-
-\section Push
-All scheduler node must define a starpu_sched_node::push_task
-function. The caller ensure that the node can actually execute the task.
-
-\section Pop
-starpu_sched_node::push_task should either return a local task or
-perform a recursive call on
-starpu_sched_node::fathers[sched_ctx_id], or \c NULL if its a root
-node.
-
-
-\section WorkersAndCombinedWorkers Workers and Combined workers
-
-Leafs are either a worker node that is bind to a starpu workers or a
-combined worker node that is bind to several worker nodes.
-
-Pushing a task on a combined worker node will in fact push a copy of
-that task on each worker node of the combined worker.
-
-A push call simply enqueue task in worker queue, no sort is performed
-here.
-If a worker call pop and get a parallel task, it will execute it with the
-combined worker it belong to.
-
-\section Example
-
-Here we build a simple scheduler with a heft node on top and a work stealing node per memory node, and a best_impl node per worker,
-which use random node to push uncalibrated tasks and tasks with no perf model, this is probably stupid.
-
-\code{.c}
-
-static void initialize_scheduler(unsigned sched_ctx_id)
-{
-	starpu_sched_ctx_create_worker_collection(sched_ctx_id, STARPU_WORKER_LIST);
-	struct starpu_sched_tree * t = starpu_sched_tree_create(sched_ctx_id);
-	
-	struct starpu_sched_node * ws_nodes[STARPU_NMAXWORKERS] = {0};
-
-	struct starpu_heft_data data =
-		{
-			.alpha = 1,
-			.beta = 2,
-			.gamma = 0,
-			.idle_power = 0,
-			.no_perf_model_node_create = starpu_sched_node_random_create,
-			.arg_no_perf_model = NULL,
-			.calibrating_node_create = starpu_sched_node_random_create,
-			.arg_calibrating_node = NULL
-		};
-
-	struct starpu_sched_node * heft = starpu_sched_node_heft_create(&data);
-
-	unsigned i;
-	for(i = 0; i < starpu_worker_get_count() + starpu_combined_worker_get_count(); i++)
-	{
-		struct starpu_sched_node * worker_node = starpu_sched_node_worker_get(i);
-		struct starpu_sched_node * best_impl = starpu_sched_node_best_implementation_create(NULL);
-		best_impl->add_child(best_impl, worker_node);
-		starpu_sched_node_set_father(worker_node, best_impl, sched_ctx_id);
-		
-		int memory_node = starpu_worker_get_memory_node(i);
-
-		if(!ws_nodes[memory_node])
-		{
-			ws_nodes[memory_node] = starpu_sched_node_work_stealing_create(NULL);
-			heft->add_child(heft, ws_nodes[memory_node]);
-			starpu_sched_node_set_father(ws_nodes[memory_node], heft, sched_ctx_id);
-		}
-
-		struct starpu_sched_node * ws = ws_nodes[memory_node];
-		ws->add_child(ws,best_impl);
-		starpu_sched_node_set_father(best_impl, ws, sched_ctx_id);
-	}
-
-	t->root = heft;
-	starpu_sched_tree_update_workers(t);
-	starpu_sched_ctx_set_policy_data(sched_ctx_id, (void*)t);
-}
-
-static void deinitialize_scheduler(unsigned sched_ctx_id)
-{
-	struct starpu_sched_tree *t = (struct starpu_sched_tree*)starpu_sched_ctx_get_policy_data(sched_ctx_id);
-	starpu_sched_tree_destroy(t);
-	starpu_sched_ctx_delete_worker_collection(sched_ctx_id);
-}
-
-
-struct starpu_sched_policy scheduling_policy =
-{
-	.init_sched = initialize_scheduler,
-	.deinit_sched = deinitialize_scheduler,
-	.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_node_worker_pre_exec_hook,
-	.post_exec_hook = starpu_sched_node_worker_post_exec_hook,
-	.pop_every_task = NULL,
-	.policy_name = "heft-ws",
-	.policy_description = "heft + ws scheduler"
-};
-\endcode
-
-
-*/

+ 1 - 1
doc/doxygen/doxygen-config.cfg.in

@@ -53,7 +53,7 @@ INPUT                  = @top_srcdir@/doc/doxygen/chapters \
 			 @top_srcdir@/include/starpu_top.h \
 			 @top_srcdir@/include/starpu_util.h \
 			 @top_srcdir@/include/starpu_worker.h \
-			 @top_srcdir@/include/starpu_sched_node.h \
+			 @top_srcdir@/include/starpu_sched_component.h \
 			 @top_srcdir@/mpi/include/ \
 			 @top_srcdir@/starpufft/starpufft.h \
 			 @top_srcdir@/sc_hypervisor/include

+ 5 - 5
doc/doxygen/refman.tex

@@ -168,10 +168,10 @@ Documentation License”.
 \hypertarget{SchedulingContextHypervisor}{}
 \input{SchedulingContextHypervisor}
 
-\chapter{Modularized Scheduler}
-\label{ModularizedScheduler}
-\hypertarget{ModularizedScheduler}{}
-\input{ModularizedScheduler}
+\chapter{Hierarchical Scheduler}
+\label{HierarchicalScheduler}
+\hypertarget{HierarchicalScheduler}{}
+\input{HierarchicalScheduler}
 
 \part{Inside StarPU}
 
@@ -228,7 +228,7 @@ Documentation License”.
 \input{group__API__Scheduling__Policy}
 \input{group__API__SC__Hypervisor__usage}
 \input{group__API__SC__Hypervisor}
-\input{group__API__Modularized__Scheduler}
+\input{group__API__Hierarchical__Scheduler}
 
 \chapter{File Index}
 \input{files}