浏览代码

Several renamings for Hierarchical Schedulers to adapt the naming
of files and functions to the theory, and to correct some English
mistakes :
node ==> component
node->room ==> component->can_push
node->avail ==> component->can_pull
node->nchilds ==> component->nchildren
node->childs ==> component->children

Marc Sergent 11 年之前
父节点
当前提交
913b6e242b
共有 38 个文件被更改,包括 2239 次插入2248 次删除
  1. 301 0
      include/starpu_sched_component.h
  2. 0 302
      include/starpu_sched_node.h
  3. 13 13
      src/Makefile.am
  4. 8 8
      src/common/fxt.h
  5. 2 2
      src/debug/traces/starpu_fxt.c
  6. 16 16
      src/sched_policies/README
  7. 14 14
      src/sched_policies/node_best_implementation.c
  8. 233 0
      src/sched_policies/component_composed.c
  9. 80 0
      src/sched_policies/component_eager.c
  10. 19 19
      src/sched_policies/node_eager_calibration.c
  11. 59 59
      src/sched_policies/node_fifo.c
  12. 53 53
      src/sched_policies/node_heft.c
  13. 42 42
      src/sched_policies/node_mct.c
  14. 111 0
      src/sched_policies/component_perfmodel_select.c
  15. 68 68
      src/sched_policies/node_prio.c
  16. 32 32
      src/sched_policies/node_random.c
  17. 578 0
      src/sched_policies/component_sched.c
  18. 86 94
      src/sched_policies/node_work_stealing.c
  19. 198 198
      src/sched_policies/node_worker.c
  20. 1 1
      src/sched_policies/deque_queues.c
  21. 12 12
      src/sched_policies/helper_mct.c
  22. 2 2
      src/sched_policies/helper_mct.h
  23. 18 18
      src/sched_policies/hierarchical_heft.c
  24. 0 233
      src/sched_policies/node_composed.c
  25. 0 80
      src/sched_policies/node_eager.c
  26. 0 111
      src/sched_policies/node_perfmodel_select.c
  27. 0 578
      src/sched_policies/node_sched.c
  28. 11 11
      src/sched_policies/sched_node.h
  29. 98 98
      src/sched_policies/scheduler_maker.c
  30. 11 11
      src/sched_policies/tree_eager.c
  31. 14 14
      src/sched_policies/tree_eager_prefetching.c
  32. 50 50
      src/sched_policies/tree_heft.c
  33. 38 38
      src/sched_policies/tree_heft2.c
  34. 11 11
      src/sched_policies/tree_prio.c
  35. 14 14
      src/sched_policies/tree_prio_prefetching.c
  36. 17 17
      src/sched_policies/tree_random.c
  37. 23 23
      src/sched_policies/tree_random_prefetching.c
  38. 6 6
      src/sched_policies/tree_ws.c

+ 301 - 0
include/starpu_sched_component.h

@@ -0,0 +1,301 @@
+/* StarPU --- Runtime system for heterogeneous multicore architectures.
+ *
+ * Copyright (C) 2013  Simon Archipoff
+ *
+ * StarPU is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * StarPU is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * See the GNU Lesser General Public License in COPYING.LGPL for more details.
+ */
+
+#ifndef __STARPU_SCHED_COMPONENT_H__
+#define __STARPU_SCHED_COMPONENT_H__
+#include <starpu.h>
+#include <common/starpu_spinlock.h>
+#include <starpu_bitmap.h>
+
+#ifdef STARPU_HAVE_HWLOC
+#include <hwloc.h>
+#endif
+
+/* struct starpu_sched_component are scheduler modules, 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 father 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)
+ *
+ */
+struct starpu_sched_component
+{
+	/* component->push_task(component, task)
+	 * 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 pop_task call
+	 *
+	 * the caller must ensure that component is able to execute task
+	 */
+	int (*push_task)(struct starpu_sched_component *,
+			 struct starpu_task *);
+	/* this function is called by workers to get a task on them fathers
+	 * this function should first return a localy stored task or perform
+	 * a recursive call on father
+	 *
+	 * a default implementation simply do a recursive call on father
+	 */
+	struct starpu_task * (*pop_task)(struct starpu_sched_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);
+	/* the numbers of component's children
+	 */
+	int nchildren;
+	/* the vector of component's children
+	 */
+	struct starpu_sched_component ** children;
+	/* may be shared by several contexts
+	 * so we need several fathers
+	 */
+	struct starpu_sched_component ** fathers;
+	int nfathers;
+	/* the set of workers in the component's subtree
+	 */
+	struct starpu_bitmap * workers;
+	/* the workers available in context
+	 * 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]->fathers[x] == component
+	 */
+	struct starpu_bitmap * workers_in_ctx;
+	
+	/* component's private data, no restriction on use
+	 */
+	void * data;
+
+	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_father)(struct starpu_sched_component * component, struct starpu_sched_component * father);
+	void (*remove_father)(struct starpu_sched_component * component, struct starpu_sched_component * father);
+
+	/* 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);
+
+	/* this function is called by starpu_sched_component_destroy just before freeing component
+	 */
+	void (*deinit_data)(struct starpu_sched_component * component);
+	/* is_homogeneous is 0 iff workers in the component's subtree are heterogeneous,
+	 * this field is set and updated automaticaly, you shouldn't write on it
+	 */
+	int properties;
+
+	/* This function is called by a component which implements a queue, allowing it to
+	 * signify to its fathers that an empty slot is available in its queue.
+	 * The basic implementation of this function is a recursive call to its
+	 * fathers, the user have to specify a personally-made function to catch those
+	 * calls.
+	 */ 
+	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
+	 * 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.
+	 */
+	void (*can_pull)(struct starpu_sched_component * component);
+
+#ifdef STARPU_HAVE_HWLOC
+	/* in case of a hierarchical scheduler, this is set 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
+	 */
+	hwloc_obj_t obj;
+#endif
+};
+enum starpu_sched_component_properties
+{
+	STARPU_SCHED_COMPONENT_HOMOGENEOUS = (1<<0),
+	STARPU_SCHED_COMPONENT_SINGLE_MEMORY_NODE = (1<<1)
+};
+
+#define STARPU_SCHED_COMPONENT_IS_HOMOGENEOUS(component) ((component)->properties & STARPU_SCHED_COMPONENT_HOMOGENEOUS)
+#define STARPU_SCHED_COMPONENT_IS_SINGLE_MEMORY_NODE(component) ((component)->properties & STARPU_SCHED_COMPONENT_SINGLE_MEMORY_NODE)
+
+struct starpu_sched_tree
+{
+	struct starpu_sched_component * root;
+	struct starpu_bitmap * workers;
+	unsigned sched_ctx_id;
+	/* 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
+	 */
+	starpu_pthread_mutex_t lock;
+};
+
+struct starpu_sched_component * starpu_sched_component_create(void);
+
+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);
+
+
+/* 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(int workerid);
+
+
+/* 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_worker_get_workerid(struct starpu_sched_component * worker_component);
+
+struct starpu_fifo_data
+{
+	unsigned ntasks_threshold;
+	double exp_len_threshold;
+};
+
+struct starpu_sched_component * starpu_sched_component_fifo_create(struct starpu_fifo_data * fifo_data);
+int starpu_sched_component_is_fifo(struct starpu_sched_component * component);
+
+struct starpu_prio_data
+{
+	unsigned ntasks_threshold;
+	double exp_len_threshold;
+};
+
+struct starpu_sched_component * starpu_sched_component_prio_create(struct starpu_prio_data * prio_data);
+int starpu_sched_component_is_prio(struct starpu_sched_component * component);
+
+struct starpu_sched_component * starpu_sched_component_work_stealing_create(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);
+
+struct starpu_sched_component * starpu_sched_component_random_create(void * arg STARPU_ATTRIBUTE_UNUSED);
+int starpu_sched_component_is_random(struct starpu_sched_component *);
+
+struct starpu_sched_component * starpu_sched_component_eager_create(void * arg STARPU_ATTRIBUTE_UNUSED);
+int starpu_sched_component_is_eager(struct starpu_sched_component *);
+
+struct starpu_sched_component * starpu_sched_component_eager_calibration_create(void * arg STARPU_ATTRIBUTE_UNUSED);
+int starpu_sched_component_is_eager_calibration(struct starpu_sched_component *);
+
+
+struct starpu_mct_data
+{
+	double alpha;
+	double beta;
+	double gamma;
+	double idle_power;
+};
+
+/* create a component with mct_data paremeters
+   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_mct_data * mct_data);
+
+int starpu_sched_component_is_mct(struct starpu_sched_component * component);
+
+struct starpu_sched_component * starpu_sched_component_heft_create(struct starpu_mct_data * mct_data);
+
+int starpu_sched_component_is_heft(struct starpu_sched_component * component);
+
+/* this component select the best implementation for the first worker in context that can execute task.
+ * 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(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 * starpu_sched_component_perfmodel_select_create(struct starpu_perfmodel_select_data * perfmodel_select_data);
+int starpu_sched_component_is_perfmodel_select(struct starpu_sched_component * component);
+
+/*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);
+
+/* 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);
+
+/* 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_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();
+void starpu_sched_tree_add_workers(unsigned sched_ctx_id, int *workerids, unsigned nworkers);
+void starpu_sched_tree_remove_workers(unsigned sched_ctx_id, int *workerids, unsigned nworkers);
+void starpu_sched_component_worker_pre_exec_hook(struct starpu_task * task);
+void starpu_sched_component_worker_post_exec_hook(struct starpu_task * task);
+
+
+
+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)(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)(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_component_composed_recipe * recipe);
+
+
+#ifdef STARPU_HAVE_HWLOC
+/* null pointer mean to ignore a level L of hierarchy, then components of levels > L become children of level L - 1 */
+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;
+
+	/* 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);
+ 
+	/* 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);
+#endif /* STARPU_HAVE_HWLOC */
+
+
+#endif

+ 0 - 302
include/starpu_sched_node.h

@@ -1,302 +0,0 @@
-/* StarPU --- Runtime system for heterogeneous multicore architectures.
- *
- * Copyright (C) 2013  Simon Archipoff
- *
- * StarPU is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at
- * your option) any later version.
- *
- * StarPU is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * See the GNU Lesser General Public License in COPYING.LGPL for more details.
- */
-
-#ifndef __STARPU_SCHED_NODE_H__
-#define __STARPU_SCHED_NODE_H__
-#include <starpu.h>
-#include <common/starpu_spinlock.h>
-#include <starpu_bitmap.h>
-
-#ifdef STARPU_HAVE_HWLOC
-#include <hwloc.h>
-#endif
-
-/* struct starpu_sched_node are scheduler modules, 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 nodes, a list of father is
- * defined indexed by sched_ctx_id
- *
- * they embed there specialised method in a pseudo object-style, so calls are like node->push_task(node,task)
- *
- */
-struct starpu_sched_node
-{
-	/* node->push_task(node, task)
-	 * this function is called to push a task on node subtree, this can either
-	 * perform a recursive call on a child or store the task in the node, then
-	 * it will be returned by a further pop_task call
-	 *
-	 * the caller must ensure that node is able to execute task
-	 */
-	int (*push_task)(struct starpu_sched_node *,
-			 struct starpu_task *);
-	/* this function is called by workers to get a task on them fathers
-	 * this function should first return a localy stored task or perform
-	 * a recursive call on father
-	 *
-	 * a default implementation simply do a recursive call on father
-	 */
-	struct starpu_task * (*pop_task)(struct starpu_sched_node *);
-
-	/* this function is an heuristic that compute load of subtree, basicaly
-	 * it compute
-	 * estimated_load(node) = sum(estimated_load(node_childs)) +
-	 *          nb_local_tasks / average(relative_speedup(underlying_worker))
-	 */
-	double (*estimated_load)(struct starpu_sched_node * node);
-
-	double (*estimated_end)(struct starpu_sched_node * node);
-	/* the numbers of node's childs
-	 */
-	int nchilds;
-	/* the vector of node's childs
-	 */
-	struct starpu_sched_node ** childs;
-	/* may be shared by several contexts
-	 * so we need several fathers
-	 */
-	struct starpu_sched_node ** fathers;
-	int nfathers;
-	/* the set of workers in the node's subtree
-	 */
-	struct starpu_bitmap * workers;
-	/* the workers available in context
-	 * this member is set with : 
-	 * node->workers UNION tree->workers UNION
-	 * node->child[i]->workers_in_ctx iff exist x such as node->childs[i]->fathers[x] == node
-	 */
-	struct starpu_bitmap * workers_in_ctx;
-	
-	/* node's private data, no restriction on use
-	 */
-	void * data;
-
-	void (*add_child)(struct starpu_sched_node * node, struct starpu_sched_node * child);
-	void (*remove_child)(struct starpu_sched_node * node, struct starpu_sched_node * child);
-	void (*add_father)(struct starpu_sched_node * node, struct starpu_sched_node * father);
-	void (*remove_father)(struct starpu_sched_node * node, struct starpu_sched_node * father);
-
-	/* this function is called for each node when workers are added or removed from a context
-	 */
-	void (*notify_change_workers)(struct starpu_sched_node * node);
-
-	/* this function is called by starpu_sched_node_destroy just before freeing node
-	 */
-	void (*deinit_data)(struct starpu_sched_node * node);
-	/* is_homogeneous is 0 iff workers in the node's subtree are heterogeneous,
-	 * this field is set and updated automaticaly, you shouldn't write on it
-	 */
-	int properties;
-
-	/* This function is called by a node which implements a queue, allowing it to
-	 * signify to its fathers that an empty slot is available in its queue.
-	 * The basic implementation of this function is a recursive call to its
-	 * fathers, the user have to specify a personally-made function to catch those
-	 * calls.
-	 */ 
-	int (*room)(struct starpu_sched_node * node);
-	/* This function allow a node to wake up a worker.
-	 * It is currently called by node which implements a queue, to signify to
-	 * its childs 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 childs, until at least one worker have been woken up.
-	 */
-	void (*avail)(struct starpu_sched_node * node);
-
-#ifdef STARPU_HAVE_HWLOC
-	/* in case of a hierarchical scheduler, this is set to the part of
-	 * topology that is binded to this node, eg: a numa node for a ws
-	 * node that would balance load between underlying sockets
-	 */
-	hwloc_obj_t obj;
-#endif
-};
-enum starpu_sched_node_properties
-{
-	STARPU_SCHED_NODE_HOMOGENEOUS = (1<<0),
-	STARPU_SCHED_NODE_SINGLE_MEMORY_NODE = (1<<1)
-};
-
-#define STARPU_SCHED_NODE_IS_HOMOGENEOUS(node) ((node)->properties & STARPU_SCHED_NODE_HOMOGENEOUS)
-#define STARPU_SCHED_NODE_IS_SINGLE_MEMORY_NODE(node) ((node)->properties & STARPU_SCHED_NODE_SINGLE_MEMORY_NODE)
-
-struct starpu_sched_tree
-{
-	struct starpu_sched_node * root;
-	struct starpu_bitmap * workers;
-	unsigned sched_ctx_id;
-	/* 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
-	 */
-	starpu_pthread_mutex_t lock;
-};
-
-struct starpu_sched_node * starpu_sched_node_create(void);
-
-void starpu_sched_node_destroy(struct starpu_sched_node * node);
-
-int starpu_sched_node_can_execute_task(struct starpu_sched_node * node, struct starpu_task * task);
-int STARPU_WARN_UNUSED_RESULT starpu_sched_node_execute_preds(struct starpu_sched_node * node, struct starpu_task * task, double * length);
-double starpu_sched_node_transfer_length(struct starpu_sched_node * node, struct starpu_task * task);
-void starpu_sched_node_prefetch_on_node(struct starpu_sched_node * node, struct starpu_task * task);
-
-
-/* no public create function for workers because we dont want to have several node_worker for a single workerid */
-struct starpu_sched_node * starpu_sched_node_worker_get(int workerid);
-
-
-/* this function compare the available function of the node with the standard available for worker nodes*/
-int starpu_sched_node_is_worker(struct starpu_sched_node * node);
-int starpu_sched_node_is_simple_worker(struct starpu_sched_node * node);
-int starpu_sched_node_is_combined_worker(struct starpu_sched_node * node);
-int starpu_sched_node_worker_get_workerid(struct starpu_sched_node * worker_node);
-
-struct starpu_fifo_data
-{
-	unsigned ntasks_threshold;
-	double exp_len_threshold;
-};
-
-struct starpu_sched_node * starpu_sched_node_fifo_create(struct starpu_fifo_data * fifo_data);
-int starpu_sched_node_is_fifo(struct starpu_sched_node * node);
-
-struct starpu_prio_data
-{
-	unsigned ntasks_threshold;
-	double exp_len_threshold;
-};
-
-struct starpu_sched_node * starpu_sched_node_prio_create(struct starpu_prio_data * prio_data);
-int starpu_sched_node_is_prio(struct starpu_sched_node * node);
-
-struct starpu_sched_node * starpu_sched_node_work_stealing_create(void * arg STARPU_ATTRIBUTE_UNUSED);
-int starpu_sched_node_is_work_stealing(struct starpu_sched_node * node);
-int starpu_sched_tree_work_stealing_push_task(struct starpu_task *task);
-
-struct starpu_sched_node * starpu_sched_node_random_create(void * arg STARPU_ATTRIBUTE_UNUSED);
-int starpu_sched_node_is_random(struct starpu_sched_node *);
-
-struct starpu_sched_node * starpu_sched_node_eager_create(void * arg STARPU_ATTRIBUTE_UNUSED);
-int starpu_sched_node_is_eager(struct starpu_sched_node *);
-
-struct starpu_sched_node * starpu_sched_node_eager_calibration_create(void * arg STARPU_ATTRIBUTE_UNUSED);
-int starpu_sched_node_is_eager_calibration(struct starpu_sched_node *);
-
-
-struct starpu_mct_data
-{
-	double alpha;
-	double beta;
-	double gamma;
-	double idle_power;
-};
-
-/* create a node with mct_data paremeters
-   a copy the struct starpu_mct_data * given is performed during the init_data call
-   the mct node doesnt do anything but pushing tasks on no_perf_model_node and calibrating_node
-*/
-struct starpu_sched_node * starpu_sched_node_mct_create(struct starpu_mct_data * mct_data);
-
-int starpu_sched_node_is_mct(struct starpu_sched_node * node);
-
-struct starpu_sched_node * starpu_sched_node_heft_create(struct starpu_mct_data * mct_data);
-
-int starpu_sched_node_is_heft(struct starpu_sched_node * node);
-
-/* this node select the best implementation for the first worker in context that can execute task.
- * and fill task->predicted and task->predicted_transfer
- * cannot have several childs if push_task is called
- */
-struct starpu_sched_node * starpu_sched_node_best_implementation_create(void * arg STARPU_ATTRIBUTE_UNUSED);
-
-struct starpu_perfmodel_select_data
-{
-	struct starpu_sched_node * calibrator_node;
-	struct starpu_sched_node * no_perfmodel_node;
-	struct starpu_sched_node * perfmodel_node;
-};
-
-struct starpu_sched_node * starpu_sched_node_perfmodel_select_create(struct starpu_perfmodel_select_data * perfmodel_select_data);
-int starpu_sched_node_is_perfmodel_select(struct starpu_sched_node * node);
-int starpu_sched_node_perfmodel_select_room(struct starpu_sched_node * node, unsigned sched_ctx_id);
-
-/*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);
-
-/* destroy node and all his child
- * except if they are shared between several contexts
- */
-void starpu_sched_node_destroy_rec(struct starpu_sched_node * node);
-
-/* update all the node->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_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();
-void starpu_sched_tree_add_workers(unsigned sched_ctx_id, int *workerids, unsigned nworkers);
-void starpu_sched_tree_remove_workers(unsigned sched_ctx_id, int *workerids, unsigned nworkers);
-void starpu_sched_node_worker_pre_exec_hook(struct starpu_task * task);
-void starpu_sched_node_worker_post_exec_hook(struct starpu_task * task);
-
-
-
-struct starpu_sched_node_composed_recipe;
-
-/* create empty recipe */
-struct starpu_sched_node_composed_recipe * starpu_sched_node_create_recipe(void);
-struct starpu_sched_node_composed_recipe * starpu_sched_node_create_recipe_singleton(struct starpu_sched_node *(*create_node)(void * arg), void * arg);
-
-/* add a function creation node to recipe */
-void starpu_sched_recipe_add_node(struct starpu_sched_node_composed_recipe * recipe, struct starpu_sched_node *(*create_node)(void * arg), void * arg);
-
-void starpu_destroy_composed_sched_node_recipe(struct starpu_sched_node_composed_recipe *);
-struct starpu_sched_node * starpu_sched_node_composed_node_create(struct starpu_sched_node_composed_recipe * recipe);
-
-
-#ifdef STARPU_HAVE_HWLOC
-/* null pointer mean to ignore a level L of hierarchy, then nodes of levels > L become childs of level L - 1 */
-struct starpu_sched_specs
-{
-	/* hw_loc_machine_composed_sched_node must be set as its the root of the topology */
-	struct starpu_sched_node_composed_recipe * hwloc_machine_composed_sched_node;
-	struct starpu_sched_node_composed_recipe * hwloc_node_composed_sched_node;
-	struct starpu_sched_node_composed_recipe * hwloc_socket_composed_sched_node;
-	struct starpu_sched_node_composed_recipe * hwloc_cache_composed_sched_node;
-
-	/* this member should return a new allocated starpu_sched_node_composed_recipe or NULL
-	 * the starpu_sched_node_composed_recipe_t must not include the worker node
-	 */
-	struct starpu_sched_node_composed_recipe * (*worker_composed_sched_node)(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_node_make_scheduler(unsigned sched_ctx_id, struct starpu_sched_specs);
-#endif /* STARPU_HAVE_HWLOC */
-
-
-#endif

+ 13 - 13
src/Makefile.am

@@ -135,7 +135,7 @@ noinst_HEADERS = 						\
 	top/starpu_top_connection.h				\
 	top/starpu_top_core.h					\
 	sched_policies/prio_deque.h				\
-	sched_policies/sched_node.h
+	sched_policies/sched_component.h
 
 libstarpu_@STARPU_EFFECTIVE_VERSION@_la_SOURCES = 		\
 	common/barrier.c					\
@@ -243,20 +243,20 @@ libstarpu_@STARPU_EFFECTIVE_VERSION@_la_SOURCES = 		\
 	top/starpu_top_message_queue.c				\
 	top/starpu_top_connection.c                        	\
 	worker_collection/worker_list.c				\
-	sched_policies/node_worker.c				\
-	sched_policies/node_sched.c				\
-	sched_policies/node_fifo.c 				\
+	sched_policies/component_worker.c				\
+	sched_policies/component_sched.c				\
+	sched_policies/component_fifo.c 				\
 	sched_policies/prio_deque.c				\
 	sched_policies/helper_mct.c				\
-	sched_policies/node_prio.c 				\
-	sched_policies/node_random.c				\
-	sched_policies/node_eager.c				\
-	sched_policies/node_eager_calibration.c				\
-	sched_policies/node_mct.c				\
-	sched_policies/node_heft.c				\
-	sched_policies/node_best_implementation.c		\
-	sched_policies/node_perfmodel_select.c				\
-	sched_policies/node_composed.c				\
+	sched_policies/component_prio.c 				\
+	sched_policies/component_random.c				\
+	sched_policies/component_eager.c				\
+	sched_policies/component_eager_calibration.c				\
+	sched_policies/component_mct.c				\
+	sched_policies/component_heft.c				\
+	sched_policies/component_best_implementation.c		\
+	sched_policies/component_perfmodel_select.c				\
+	sched_policies/component_composed.c				\
 	sched_policies/tree_eager.c				\
 	sched_policies/tree_eager_prefetching.c				\
 	sched_policies/tree_prio.c				\

+ 8 - 8
src/common/fxt.h

@@ -146,8 +146,8 @@
 #define	_STARPU_FUT_START_WRITEBACK	0x5158
 #define	_STARPU_FUT_END_WRITEBACK	0x5159
 
-#define _STARPU_FUT_SCHED_NODE_PUSH_PRIO 	0x515a
-#define _STARPU_FUT_SCHED_NODE_POP_PRIO 	0x515b
+#define _STARPU_FUT_SCHED_COMPONENT_PUSH_PRIO 	0x515a
+#define _STARPU_FUT_SCHED_COMPONENT_POP_PRIO 	0x515b
 
 #define	_STARPU_FUT_HYPERVISOR_BEGIN    0x5160
 #define	_STARPU_FUT_HYPERVISOR_END	0x5161
@@ -620,11 +620,11 @@ do {										\
 #define _STARPU_TRACE_END_UNPARTITION(handle, memnode)		\
 	FUT_DO_PROBE3(_STARPU_FUT_END_UNPARTITION, memnode, _starpu_gettid(), handle);
 
-#define _STARPU_TRACE_SCHED_NODE_PUSH_PRIO(workerid, ntasks, exp_len)		\
-	FUT_DO_PROBE4(_STARPU_FUT_SCHED_NODE_PUSH_PRIO, _starpu_gettid(), workerid, ntasks, exp_len);
+#define _STARPU_TRACE_SCHED_COMPONENT_PUSH_PRIO(workerid, ntasks, exp_len)		\
+	FUT_DO_PROBE4(_STARPU_FUT_SCHED_COMPONENT_PUSH_PRIO, _starpu_gettid(), workerid, ntasks, exp_len);
 
-#define _STARPU_TRACE_SCHED_NODE_POP_PRIO(workerid, ntasks, exp_len)		\
-	FUT_DO_PROBE4(_STARPU_FUT_SCHED_NODE_POP_PRIO, _starpu_gettid(), workerid, ntasks, exp_len);
+#define _STARPU_TRACE_SCHED_COMPONENT_POP_PRIO(workerid, ntasks, exp_len)		\
+	FUT_DO_PROBE4(_STARPU_FUT_SCHED_COMPONENT_POP_PRIO, _starpu_gettid(), workerid, ntasks, exp_len);
 
 #else // !STARPU_USE_FXT
 
@@ -697,8 +697,8 @@ do {										\
 #define _STARPU_TRACE_MEMORY_FULL(size)				do {} while(0)
 #define _STARPU_TRACE_START_UNPARTITION(handle, memnode)	do {} while(0)
 #define _STARPU_TRACE_END_UNPARTITION(handle, memnode)		do {} while(0)
-#define _STARPU_TRACE_SCHED_NODE_PUSH_PRIO(workerid, ntasks, exp_len)	do {} while(0)
-#define _STARPU_TRACE_SCHED_NODE_POP_PRIO(workerid, ntasks, exp_len)	do {} while(0)
+#define _STARPU_TRACE_SCHED_COMPONENT_PUSH_PRIO(workerid, ntasks, exp_len)	do {} while(0)
+#define _STARPU_TRACE_SCHED_COMPONENT_POP_PRIO(workerid, ntasks, exp_len)	do {} while(0)
 #define _STARPU_TRACE_HYPERVISOR_BEGIN()        do {} while(0)
 #define _STARPU_TRACE_HYPERVISOR_END()                  do {} while(0)
 

+ 2 - 2
src/debug/traces/starpu_fxt.c

@@ -1695,10 +1695,10 @@ void starpu_fxt_parse_new_file(char *filename_in, struct starpu_fxt_options *opt
 			case _STARPU_FUT_MEMORY_FULL:
 				break;
 
-			case _STARPU_FUT_SCHED_NODE_POP_PRIO:
+			case _STARPU_FUT_SCHED_COMPONENT_POP_PRIO:
 				break;
 
-			case _STARPU_FUT_SCHED_NODE_PUSH_PRIO:
+			case _STARPU_FUT_SCHED_COMPONENT_PUSH_PRIO:
 				break;
 
 			case _STARPU_FUT_HYPERVISOR_BEGIN:

+ 16 - 16
src/sched_policies/README

@@ -28,16 +28,16 @@ The hypervisor must take all of them to modifying the scheduler.
 
 Creation/Destruction
 
-All the struct starpu_sched_node * starpu_sched_node_foo_create()
-function return a initialized struct starpu_sched_node.
+All the struct starpu_sched_component * starpu_sched_component_foo_create()
+function return a initialized struct starpu_sched_component.
 
-The void starpu_sched_node_destroy(struct starpu_sched_node * node)
-function call node->deinit_data(node) to free data allocated during
+The void starpu_sched_component_destroy(struct starpu_sched_component * component)
+function call component->deinit_data(component) to free data allocated during
 creation
 
-Workers nodes are particulars, there is no creation function, only
-accessor to guaranty uniqueness of worker nodes. worker_node->workers and
-worker_node->workers_in_ctx should not be modified.
+Workers components are particulars, there is no creation function, only
+accessor to guaranty uniqueness of worker components. worker_component->workers and
+worker_component->workers_in_ctx should not be modified.
 
 
 
@@ -45,17 +45,17 @@ Add/Remove workers
 
 I see 2 way for adding/removing workers of the scheduler
 The hypervisor block all the scheduling and modify the scheduler in
-the way it wants, and then update all node->workers_in_ctx bitmaps, and
-all node->push_task should respect it.
+the way it wants, and then update all component->workers_in_ctx bitmaps, and
+all component->push_task should respect it.
 
 And the second one may be done in an atomic way. The struct
 starpu_sched_tree hold a struct starpu_bitmap * that represent
-available workers in context. All node can make a call to struct starpu_bitmap
-* starpu_sched_node_get_worker_mask(unsigned sched_ctx_id) to see
+available workers in context. All component can make a call to struct starpu_bitmap
+* starpu_sched_component_get_worker_mask(unsigned sched_ctx_id) to see
 where they can push a task according to available workers.
-But with this way we have a problem for node->estimated_end, in case
+But with this way we have a problem for component->estimated_end, in case
 of fifo, we have to know how many workers are available to the fifo
-node. We also have a problem for shared object. The first way seems to
+component. We also have a problem for shared object. The first way seems to
 be better.
 
 
@@ -63,14 +63,14 @@ Hierarchical construction
 
 Bugs everywhere, works only in simple and particulars cases.
 Its difficult to guess where we should plug accelerators because we cant rely on
-hwloc topology. Hierarchical heft seems to work on simple machines with numa nodes
+hwloc topology. Hierarchical heft seems to work on simple machines with numa components
 and GPUs
-this fail if hwloc_socket_composed_sched_node or hwloc_cache_composed_sched_node is not
+this fail if hwloc_socket_composed_sched_component or hwloc_cache_composed_sched_component is not
 NULL
 
 
 Various things
 
 In several place realloc is used (in prio_deque and for
-starpu_sched_node_add_child), because we should not have a lot
+starpu_sched_component_add_child), because we should not have a lot
 different priority level nor adding too many childs.

+ 14 - 14
src/sched_policies/node_best_implementation.c

@@ -15,7 +15,7 @@
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
 
-#include <starpu_sched_node.h>
+#include <starpu_sched_component.h>
 #include <starpu_scheduler.h>
 
 #include <float.h>
@@ -73,24 +73,24 @@ static void select_best_implementation_and_set_preds(struct starpu_bitmap * work
 }
 
 
-static int select_best_implementation_push_task(struct starpu_sched_node * node, struct starpu_task * task)
+static int select_best_implementation_push_task(struct starpu_sched_component * component, struct starpu_task * task)
 {
-	STARPU_ASSERT(node->nchilds == 1);
-	select_best_implementation_and_set_preds(node->workers_in_ctx, task);
-	return node->childs[0]->push_task(node->childs[0],task);
+	STARPU_ASSERT(component->nchildren == 1);
+	select_best_implementation_and_set_preds(component->workers_in_ctx, task);
+	return component->children[0]->push_task(component->children[0],task);
 }
 
-static struct starpu_task * select_best_implementation_pop_task(struct starpu_sched_node * node)
+static struct starpu_task * select_best_implementation_pop_task(struct starpu_sched_component * component)
 {
 	struct starpu_task * task = NULL;
 	int i;
-	for(i=0; i < node->nfathers; i++)
+	for(i=0; i < component->nfathers; i++)
 	{
-		if(node->fathers[i] == NULL)
+		if(component->fathers[i] == NULL)
 			continue;
 		else
 		{
-			task = node->fathers[i]->pop_task(node->fathers[i]);
+			task = component->fathers[i]->pop_task(component->fathers[i]);
 			if(task)
 				break;
 		}
@@ -101,10 +101,10 @@ static struct starpu_task * select_best_implementation_pop_task(struct starpu_sc
 	return task;
 }
 
-struct starpu_sched_node * starpu_sched_node_best_implementation_create(void * ARG STARPU_ATTRIBUTE_UNUSED)
+struct starpu_sched_component * starpu_sched_component_best_implementation_create(void * ARG STARPU_ATTRIBUTE_UNUSED)
 {
-	struct starpu_sched_node * node = starpu_sched_node_create();
-	node->push_task = select_best_implementation_push_task;
-	node->pop_task = select_best_implementation_pop_task;
-	return node;
+	struct starpu_sched_component * component = starpu_sched_component_create();
+	component->push_task = select_best_implementation_push_task;
+	component->pop_task = select_best_implementation_pop_task;
+	return component;
 }

+ 233 - 0
src/sched_policies/component_composed.c

@@ -0,0 +1,233 @@
+/* StarPU --- Runtime system for heterogeneous multicore architectures.
+ *
+ * Copyright (C) 2013  INRIA
+ * Copyright (C) 2013  Simon Archipoff
+ *
+ * StarPU is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * StarPU is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * See the GNU Lesser General Public License in COPYING.LGPL for more details.
+ */
+
+#include <starpu_sched_component.h>
+#include <common/list.h>
+
+
+/* a composed component is parametred by a list of pair
+ * (create_component_function(arg), arg)
+ */
+LIST_TYPE(fun_create_component,
+	  struct starpu_sched_component *(*create_component)(void * arg);
+	  void * arg;
+);
+
+
+struct starpu_sched_component_composed_recipe
+{
+	struct fun_create_component_list * list;
+};
+
+
+struct starpu_sched_component_composed_recipe * starpu_sched_component_create_recipe(void)
+{
+	struct starpu_sched_component_composed_recipe * recipe = malloc(sizeof(*recipe));
+	recipe->list = fun_create_component_list_new();
+	return recipe;
+}
+
+void starpu_sched_recipe_add_component(struct starpu_sched_component_composed_recipe * recipe,
+				  struct starpu_sched_component *(*create_component)(void * arg),
+				  void * arg)
+{
+	struct fun_create_component * e = fun_create_component_new();
+	e->create_component = create_component;
+	e->arg = arg;
+	fun_create_component_list_push_back(recipe->list, e);
+}
+struct starpu_sched_component_composed_recipe * starpu_sched_component_create_recipe_singleton(struct starpu_sched_component *(*create_component)(void * arg),
+										      void * arg)
+{
+	struct starpu_sched_component_composed_recipe * r = starpu_sched_component_create_recipe();
+	starpu_sched_recipe_add_component(r, create_component, arg);
+	return r;
+}
+void starpu_destroy_composed_sched_component_recipe(struct starpu_sched_component_composed_recipe * recipe)
+{
+	if(!recipe)
+		return;
+	while(!fun_create_component_list_empty(recipe->list))
+		fun_create_component_delete(fun_create_component_list_pop_back(recipe->list));
+	fun_create_component_list_delete(recipe->list);
+	free(recipe);
+}
+
+
+
+struct composed_component
+{
+	struct starpu_sched_component *top,*bottom;
+};
+
+/* this function actualy build the composed component data by changing the list of
+ * (component_create_fun, arg_create_fun) into a tree where all components have 1 childs
+ */
+struct composed_component create_composed_component(struct starpu_sched_component_composed_recipe * recipe
+#ifdef STARPU_HAVE_HWLOC
+					  ,hwloc_obj_t obj
+#endif
+	)
+{
+	struct composed_component c;
+	STARPU_ASSERT(recipe);
+
+	struct fun_create_component_list * list = recipe->list;
+	struct fun_create_component * i = fun_create_component_list_begin(list);
+	STARPU_ASSERT(i);
+	STARPU_ASSERT(i->create_component(i->arg));
+	c.top = c.bottom = i->create_component(i->arg);
+#ifdef STARPU_HAVE_HWLOC
+	c.top->obj = obj;
+#endif
+	for(i  = fun_create_component_list_next(i);
+	    i != fun_create_component_list_end(list);
+	    i  = fun_create_component_list_next(i))
+	{
+		STARPU_ASSERT(i->create_component(i->arg));
+		struct starpu_sched_component * component = i->create_component(i->arg);
+#ifdef STARPU_HAVE_HWLOC
+		component->obj = obj;
+#endif
+		c.bottom->add_child(c.bottom, component);
+
+		/* we want to be able to traverse scheduler bottom up for all sched ctxs
+		 * when a worker call pop()
+		 */
+		unsigned j;
+		for(j = 0; j < STARPU_NMAX_SCHED_CTXS; j++)
+			component->add_father(component, c.bottom);
+		c.bottom = component;
+	}
+	STARPU_ASSERT(!starpu_sched_component_is_worker(c.bottom));
+	return c;
+}
+
+
+static int composed_component_push_task(struct starpu_sched_component * component, struct starpu_task * task)
+{
+	struct composed_component *c = component->data;
+	return c->top->push_task(c->top,task);
+}
+struct starpu_task * composed_component_pop_task(struct starpu_sched_component *component)
+{
+	struct composed_component *c = component->data;
+	struct starpu_task * task = NULL;
+	
+	task = c->bottom->pop_task(c->bottom);
+	if(task)
+		return task;
+
+	int i;
+	for(i=0; i < component->nfathers; i++)
+	{
+		if(component->fathers[i] == NULL)
+			continue;
+		else
+		{
+			task = component->fathers[i]->pop_task(component->fathers[i]);
+			if(task)
+				break;
+		}
+	}
+	return task;
+}
+
+double composed_component_estimated_load(struct starpu_sched_component * component)
+{
+	struct composed_component * c = component->data;
+	return c->top->estimated_load(c->top);
+}
+
+static void composed_component_add_child(struct starpu_sched_component * component, struct starpu_sched_component * child)
+{
+	struct composed_component * c = component->data;
+	component->add_child(component, child);
+	c->bottom->add_child(c->bottom, child);
+}
+static void composed_component_remove_child(struct starpu_sched_component * component, struct starpu_sched_component * child)
+{
+	struct composed_component * c = component->data;
+	component->remove_child(component, child);
+	c->bottom->remove_child(c->bottom, child);
+}
+
+static void composed_component_notify_change_workers(struct starpu_sched_component * component)
+{
+	struct composed_component * c = component->data;
+	struct starpu_bitmap * workers = component->workers;
+	struct starpu_bitmap * workers_in_ctx = component->workers_in_ctx;
+	struct starpu_sched_component * n;
+	for(n = c->top; ;n = n->children[0])
+	{
+		starpu_bitmap_unset_all(n->workers);
+		starpu_bitmap_or(n->workers, workers);
+
+		starpu_bitmap_unset_all(n->workers_in_ctx);
+		starpu_bitmap_or(n->workers_in_ctx, workers_in_ctx);
+
+		n->properties = component->properties;
+		if(n == c->bottom)
+			break;
+	}
+}
+
+void composed_component_deinit_data(struct starpu_sched_component * _component)
+{
+	struct composed_component *c = _component->data;
+	c->bottom->children = NULL;
+	c->bottom->nchildren = 0;
+	struct starpu_sched_component * component = c->top;
+	struct starpu_sched_component * next = NULL;
+	do
+	{
+		component->workers = NULL;
+		next = component->children ? component->children[0] : NULL;
+		starpu_sched_component_destroy(component);
+	}while(next);
+	free(c);
+	_component->data = NULL;
+}
+
+struct starpu_sched_component * starpu_sched_component_composed_component_create(struct starpu_sched_component_composed_recipe * recipe)
+{
+	STARPU_ASSERT(!fun_create_component_list_empty(recipe->list));
+	struct fun_create_component_list * l = recipe->list;
+	if(l->_head == l->_tail)
+		return l->_head->create_component(l->_head->arg);
+	struct starpu_sched_component * component = starpu_sched_component_create();
+
+	struct composed_component * c = malloc(sizeof(struct composed_component));
+	*c = create_composed_component(recipe
+#ifdef STARPU_HAVE_HWLOC
+				  ,component->obj
+#endif
+);
+	c->bottom->nchildren = component->nchildren;
+	c->bottom->children = component->children;
+	c->bottom->nfathers = component->nfathers;
+	c->bottom->fathers = component->fathers;
+
+	component->data = c;
+	component->push_task = composed_component_push_task;
+	component->pop_task = composed_component_pop_task;
+	component->estimated_load = composed_component_estimated_load;
+	component->add_child = composed_component_add_child;
+	component->remove_child = composed_component_remove_child;
+	component->notify_change_workers = composed_component_notify_change_workers;
+	return component;
+}

+ 80 - 0
src/sched_policies/component_eager.c

@@ -0,0 +1,80 @@
+/* StarPU --- Runtime system for heterogeneous multicore architectures.
+ *
+ * Copyright (C) 2013  INRIA
+ *
+ * StarPU is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * StarPU is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * See the GNU Lesser General Public License in COPYING.LGPL for more details.
+ */
+
+#include <starpu_sched_component.h>
+#include <starpu_scheduler.h>
+
+static int eager_push_task(struct starpu_sched_component * component, struct starpu_task * task)
+{
+	STARPU_ASSERT(component && task && starpu_sched_component_is_eager(component));
+	STARPU_ASSERT(starpu_sched_component_can_execute_task(component,task));
+	
+	int workerid;
+	for(workerid = starpu_bitmap_first(component->workers_in_ctx);
+	    workerid != -1;
+	    workerid = starpu_bitmap_next(component->workers_in_ctx, workerid))
+	{
+		int nimpl;
+		for(nimpl = 0; nimpl < STARPU_MAXIMPLEMENTATIONS; nimpl++)
+		{
+			if(starpu_worker_can_execute_task(workerid,task,nimpl)
+			   || starpu_combined_worker_can_execute_task(workerid, task, nimpl))
+			{
+				int i;
+				for (i = 0; i < component->nchildren; i++)
+				{
+					int idworker,ret;
+					for(idworker = starpu_bitmap_first(component->children[i]->workers);
+						idworker != -1;
+						idworker = starpu_bitmap_next(component->children[i]->workers, idworker))
+					{
+						if (idworker == workerid)
+						{
+							if(starpu_sched_component_is_worker(component->children[i]))
+							{
+								component->children[i]->can_pull(component->children[i]);
+								return 1;
+							}
+							else
+							{
+								ret = component->children[i]->push_task(component->children[i],task);
+								if(!ret)
+								{
+									component->children[i]->can_pull(component->children[i]);
+									return ret;
+								}
+							}
+						}
+					}
+				}
+			}
+		}
+	}
+	return 1;
+}
+
+int starpu_sched_component_is_eager(struct starpu_sched_component * component)
+{
+	return component->push_task == eager_push_task;
+}
+
+struct starpu_sched_component * starpu_sched_component_eager_create(void * ARG STARPU_ATTRIBUTE_UNUSED)
+{
+	struct starpu_sched_component * component = starpu_sched_component_create();
+	component->push_task = eager_push_task;
+
+	return component;
+}

+ 19 - 19
src/sched_policies/node_eager_calibration.c

@@ -14,20 +14,20 @@
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
 
-#include <starpu_sched_node.h>
+#include <starpu_sched_component.h>
 #include <starpu_scheduler.h>
 
-static int eager_calibration_push_task(struct starpu_sched_node * node, struct starpu_task * task)
+static int eager_calibration_push_task(struct starpu_sched_component * component, struct starpu_task * task)
 {
-	STARPU_ASSERT(node && task && starpu_sched_node_is_eager_calibration(node));
-	STARPU_ASSERT(starpu_sched_node_can_execute_task(node,task));
+	STARPU_ASSERT(component && task && starpu_sched_component_is_eager_calibration(component));
+	STARPU_ASSERT(starpu_sched_component_can_execute_task(component,task));
 	
 	starpu_task_bundle_t bundle = task->bundle;
 
 	int workerid;
-	for(workerid = starpu_bitmap_first(node->workers_in_ctx);
+	for(workerid = starpu_bitmap_first(component->workers_in_ctx);
 	    workerid != -1;
-	    workerid = starpu_bitmap_next(node->workers_in_ctx, workerid))
+	    workerid = starpu_bitmap_next(component->workers_in_ctx, workerid))
 	{
 		struct starpu_perfmodel_arch* archtype = starpu_worker_get_perf_archtype(workerid);
 		int nimpl;
@@ -46,26 +46,26 @@ static int eager_calibration_push_task(struct starpu_sched_node * node, struct s
 				if(isnan(d))
 				{
 					int i;
-					for (i = 0; i < node->nchilds; i++)
+					for (i = 0; i < component->nchildren; i++)
 					{
 						int idworker,ret;
-						for(idworker = starpu_bitmap_first(node->childs[i]->workers);
+						for(idworker = starpu_bitmap_first(component->children[i]->workers);
 							idworker != -1;
-							idworker = starpu_bitmap_next(node->childs[i]->workers, idworker))
+							idworker = starpu_bitmap_next(component->children[i]->workers, idworker))
 						{
 							if (idworker == workerid)
 							{
-								if(starpu_sched_node_is_worker(node->childs[i]))
+								if(starpu_sched_component_is_worker(component->children[i]))
 								{
-									node->childs[i]->avail(node->childs[i]);
+									component->children[i]->can_pull(component->children[i]);
 									return 1;
 								}
 								else
 								{
-									ret = node->childs[i]->push_task(node->childs[i],task);
+									ret = component->children[i]->push_task(component->children[i],task);
 									if(!ret)
 									{
-										node->childs[i]->avail(node->childs[i]);
+										component->children[i]->can_pull(component->children[i]);
 										return ret;
 									}
 								}
@@ -79,15 +79,15 @@ static int eager_calibration_push_task(struct starpu_sched_node * node, struct s
 	return 1;
 }
 
-int starpu_sched_node_is_eager_calibration(struct starpu_sched_node * node)
+int starpu_sched_component_is_eager_calibration(struct starpu_sched_component * component)
 {
-	return node->push_task == eager_calibration_push_task;
+	return component->push_task == eager_calibration_push_task;
 }
 
-struct starpu_sched_node * starpu_sched_node_eager_calibration_create(void * ARG STARPU_ATTRIBUTE_UNUSED)
+struct starpu_sched_component * starpu_sched_component_eager_calibration_create(void * ARG STARPU_ATTRIBUTE_UNUSED)
 {
-	struct starpu_sched_node * node = starpu_sched_node_create();
-	node->push_task = eager_calibration_push_task;
+	struct starpu_sched_component * component = starpu_sched_component_create();
+	component->push_task = eager_calibration_push_task;
 
-	return node;
+	return component;
 }

+ 59 - 59
src/sched_policies/node_fifo.c

@@ -15,11 +15,11 @@
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
 
-#include <starpu_sched_node.h>
+#include <starpu_sched_component.h>
 #include <starpu_scheduler.h>
 
 #include "fifo_queues.h"
-#include "sched_node.h"
+#include "sched_component.h"
 
 
 struct _starpu_fifo_data
@@ -30,22 +30,22 @@ struct _starpu_fifo_data
 	double exp_len_threshold;
 };
 
-void fifo_node_deinit_data(struct starpu_sched_node * node)
+void fifo_component_deinit_data(struct starpu_sched_component * component)
 {
-	STARPU_ASSERT(node && node->data);
-	struct _starpu_fifo_data * f = node->data;
+	STARPU_ASSERT(component && component->data);
+	struct _starpu_fifo_data * f = component->data;
 	_starpu_destroy_fifo(f->fifo);
 	STARPU_PTHREAD_MUTEX_DESTROY(&f->mutex);
 	free(f);
 }
 
-static double fifo_estimated_end(struct starpu_sched_node * node)
+static double fifo_estimated_end(struct starpu_sched_component * component)
 {
-	STARPU_ASSERT(node && node->data);
-	struct _starpu_fifo_data * data = node->data;
+	STARPU_ASSERT(component && component->data);
+	struct _starpu_fifo_data * data = component->data;
 	struct _starpu_fifo_taskq * fifo = data->fifo;
 	starpu_pthread_mutex_t * mutex = &data->mutex;
-	int card = starpu_bitmap_cardinal(node->workers_in_ctx);
+	int card = starpu_bitmap_cardinal(component->workers_in_ctx);
 	STARPU_ASSERT(card != 0);
 	STARPU_PTHREAD_MUTEX_LOCK(mutex);
 	fifo->exp_start = STARPU_MAX(fifo->exp_start, starpu_timing_now());
@@ -55,18 +55,18 @@ static double fifo_estimated_end(struct starpu_sched_node * node)
 	return estimated_end;
 }
 
-static double fifo_estimated_load(struct starpu_sched_node * node)
+static double fifo_estimated_load(struct starpu_sched_component * component)
 {
-	STARPU_ASSERT(node && node->data);
-	STARPU_ASSERT(starpu_bitmap_cardinal(node->workers_in_ctx) != 0);
-	struct _starpu_fifo_data * data = node->data;
+	STARPU_ASSERT(component && component->data);
+	STARPU_ASSERT(starpu_bitmap_cardinal(component->workers_in_ctx) != 0);
+	struct _starpu_fifo_data * data = component->data;
 	struct _starpu_fifo_taskq * fifo = data->fifo;
 	starpu_pthread_mutex_t * mutex = &data->mutex;
 	double relative_speedup = 0.0;
 	double load;
-	if(STARPU_SCHED_NODE_IS_HOMOGENEOUS(node))
+	if(STARPU_SCHED_COMPONENT_IS_HOMOGENEOUS(component))
 	{		
-		int first_worker = starpu_bitmap_first(node->workers_in_ctx);
+		int first_worker = starpu_bitmap_first(component->workers_in_ctx);
 		relative_speedup = starpu_worker_get_relative_speedup(starpu_worker_get_perf_archtype(first_worker));
 		STARPU_PTHREAD_MUTEX_LOCK(mutex);
 		load = fifo->ntasks / relative_speedup;
@@ -76,30 +76,30 @@ static double fifo_estimated_load(struct starpu_sched_node * node)
 	else
 	{
 		int i;
-		for(i = starpu_bitmap_first(node->workers_in_ctx);
+		for(i = starpu_bitmap_first(component->workers_in_ctx);
 		    i != -1;
-		    i = starpu_bitmap_next(node->workers_in_ctx, i))
+		    i = starpu_bitmap_next(component->workers_in_ctx, i))
 			relative_speedup += starpu_worker_get_relative_speedup(starpu_worker_get_perf_archtype(i));
-		relative_speedup /= starpu_bitmap_cardinal(node->workers_in_ctx);
+		relative_speedup /= starpu_bitmap_cardinal(component->workers_in_ctx);
 		STARPU_ASSERT(!_STARPU_IS_ZERO(relative_speedup));
 		STARPU_PTHREAD_MUTEX_LOCK(mutex);
 		load = fifo->ntasks / relative_speedup;
 		STARPU_PTHREAD_MUTEX_UNLOCK(mutex);
 	}
 	int i;
-	for(i = 0; i < node->nchilds; i++)
+	for(i = 0; i < component->nchildren; i++)
 	{
-		struct starpu_sched_node * c = node->childs[i];
+		struct starpu_sched_component * c = component->children[i];
 		load += c->estimated_load(c);
 	}
 	return load;
 }
 
-static int fifo_push_local_task(struct starpu_sched_node * node, struct starpu_task * task, unsigned is_pushback)
+static int fifo_push_local_task(struct starpu_sched_component * component, struct starpu_task * task, unsigned is_pushback)
 {
-	STARPU_ASSERT(node && node->data && task);
-	STARPU_ASSERT(starpu_sched_node_can_execute_task(node,task));
-	struct _starpu_fifo_data * data = node->data;
+	STARPU_ASSERT(component && component->data && task);
+	STARPU_ASSERT(starpu_sched_component_can_execute_task(component,task));
+	struct _starpu_fifo_data * data = component->data;
 	struct _starpu_fifo_taskq * fifo = data->fifo;
 	starpu_pthread_mutex_t * mutex = &data->mutex;
 	int ret = 0;
@@ -117,9 +117,10 @@ static int fifo_push_local_task(struct starpu_sched_node * node, struct starpu_t
 		static int warned;
 		if(task->predicted > data->exp_len_threshold && !warned)
 		{
-			_STARPU_DISP("Warning : a predicted task length (%lf) exceeds the expected length threshold (%lf) of a prio node queue, you should reconsider the value of this threshold. This message will not be printed again for further thresholds exceeding.\n",task->predicted,data->exp_len_threshold);
+			_STARPU_DISP("Warning : a predicted task length (%lf) exceeds the expected length threshold (%lf) of a prio component queue, you should reconsider the value of this threshold. This message will not be printed again for further thresholds exceeding.\n",task->predicted,data->exp_len_threshold);
 			warned = 1;
 		}
+		STARPU_ASSERT(!is_pushback);
 		ret = 1;
 		STARPU_PTHREAD_MUTEX_UNLOCK(mutex);
 	}
@@ -130,7 +131,7 @@ static int fifo_push_local_task(struct starpu_sched_node * node, struct starpu_t
 		else
 		{
 			ret = _starpu_fifo_push_task(fifo,task);
-			starpu_sched_node_prefetch_on_node(node, task);
+			starpu_sched_component_prefetch_on_node(component, task);
 		}
 
 		if(!isnan(task->predicted))
@@ -147,21 +148,20 @@ static int fifo_push_local_task(struct starpu_sched_node * node, struct starpu_t
 	return ret;
 }
 
-static int fifo_push_task(struct starpu_sched_node * node, struct starpu_task * task)
+static int fifo_push_task(struct starpu_sched_component * component, struct starpu_task * task)
 {
-	int ret = fifo_push_local_task(node, task, 0);
-	return ret;
+	return fifo_push_local_task(component, task, 0);
 }
 
-int starpu_sched_node_is_fifo(struct starpu_sched_node * node)
+int starpu_sched_component_is_fifo(struct starpu_sched_component * component)
 {
-	return node->push_task == fifo_push_task;
+	return component->push_task == fifo_push_task;
 }
 
-static struct starpu_task * fifo_pop_task(struct starpu_sched_node * node)
+static struct starpu_task * fifo_pop_task(struct starpu_sched_component * component)
 {
-	STARPU_ASSERT(node && node->data);
-	struct _starpu_fifo_data * data = node->data;
+	STARPU_ASSERT(component && component->data);
+	struct _starpu_fifo_data * data = component->data;
 	struct _starpu_fifo_taskq * fifo = data->fifo;
 	starpu_pthread_mutex_t * mutex = &data->mutex;
 	STARPU_PTHREAD_MUTEX_LOCK(mutex);
@@ -182,16 +182,16 @@ static struct starpu_task * fifo_pop_task(struct starpu_sched_node * node)
 	STARPU_ASSERT(!isnan(fifo->exp_start));
 	STARPU_PTHREAD_MUTEX_UNLOCK(mutex);
 
-	// When a pop is called, a room is called for pushing tasks onto
+	// When a pop is called, a can_push is called for pushing tasks onto
 	// the empty place of the queue left by the popped task.
 	int i,ret;
-	for(i=0; i < node->nfathers; i++)
+	for(i=0; i < component->nfathers; i++)
 	{
-		if(node->fathers[i] == NULL)
+		if(component->fathers[i] == NULL)
 			continue;
 		else
 		{
-			ret = node->fathers[i]->room(node->fathers[i]);
+			ret = component->fathers[i]->can_push(component->fathers[i]);
 			if(ret)
 				break;
 		}
@@ -203,22 +203,22 @@ static struct starpu_task * fifo_pop_task(struct starpu_sched_node * node)
 	return NULL;
 }
 
-/* When a room is caught by this function, we try to pop and push
+/* When a can_push is caught by this function, we try to pop and push
  * tasks from our local queue as much as possible, until a
- * push fails, which means that the worker fifo_nodes are
+ * push fails, which means that the worker fifo_components are
  * currently "full".
  */
-static int fifo_room(struct starpu_sched_node * node)
+static int fifo_can_push(struct starpu_sched_component * component)
 {
-	STARPU_ASSERT(node && starpu_sched_node_is_fifo(node));
+	STARPU_ASSERT(component && starpu_sched_component_is_fifo(component));
 	int ret = 0;
 	int res = 0;
 
-	STARPU_ASSERT(node->nchilds == 1);
-	struct starpu_sched_node * child = node->childs[0];
+	STARPU_ASSERT(component->nchildren == 1);
+	struct starpu_sched_component * child = component->children[0];
 
-	_starpu_sched_node_unlock_scheduling();
-	struct starpu_task * task = node->pop_task(node);
+	_starpu_sched_component_unlock_scheduling();
+	struct starpu_task * task = component->pop_task(component);
 	if(task)
 		ret = child->push_task(child,task);	
 	while(task && !ret) 
@@ -226,30 +226,30 @@ static int fifo_room(struct starpu_sched_node * node)
 		if(!res)
 			res = 1;
 
-		task = node->pop_task(node);
+		task = component->pop_task(component);
 		if(task)
 			ret = child->push_task(child,task);	
 	} 
-	_starpu_sched_node_lock_scheduling();
+	_starpu_sched_component_lock_scheduling();
 	if(task && ret)
-		fifo_push_local_task(node,task,1); 
+		fifo_push_local_task(component,task,1); 
 
 	return res;
 }
 
-struct starpu_sched_node * starpu_sched_node_fifo_create(struct starpu_fifo_data * params)
+struct starpu_sched_component * starpu_sched_component_fifo_create(struct starpu_fifo_data * params)
 {
-	struct starpu_sched_node * node = starpu_sched_node_create();
+	struct starpu_sched_component * component = starpu_sched_component_create();
 	struct _starpu_fifo_data * data = malloc(sizeof(*data));
 	data->fifo = _starpu_create_fifo();
 	STARPU_PTHREAD_MUTEX_INIT(&data->mutex,NULL);
-	node->data = data;
-	node->estimated_end = fifo_estimated_end;
-	node->estimated_load = fifo_estimated_load;
-	node->push_task = fifo_push_task;
-	node->pop_task = fifo_pop_task;
-	node->room = fifo_room;
-	node->deinit_data = fifo_node_deinit_data;
+	component->data = data;
+	component->estimated_end = fifo_estimated_end;
+	component->estimated_load = fifo_estimated_load;
+	component->push_task = fifo_push_task;
+	component->pop_task = fifo_pop_task;
+	component->can_push = fifo_can_push;
+	component->deinit_data = fifo_component_deinit_data;
 
 	if(params)
 	{
@@ -262,5 +262,5 @@ struct starpu_sched_node * starpu_sched_node_fifo_create(struct starpu_fifo_data
 		data->exp_len_threshold=0.0;
 	}
 
-	return node;
+	return component;
 }

+ 53 - 53
src/sched_policies/node_heft.c

@@ -20,9 +20,9 @@
  * the first of its scheduling window, and actually schedule the task for which
  * the most benefit is achieved.  */
 
-#include <starpu_sched_node.h>
+#include <starpu_sched_component.h>
 #include "prio_deque.h"
-#include "sched_node.h"
+#include "sched_component.h"
 #include <starpu_perfmodel.h>
 #include "helper_mct.h"
 #include <float.h>
@@ -36,12 +36,12 @@ struct _starpu_heft_data
 	struct _starpu_mct_data *mct_data;
 };
 
-static void heft_progress(struct starpu_sched_node *node);
+static void heft_progress(struct starpu_sched_component *component);
 
-static int heft_push_task(struct starpu_sched_node * node, struct starpu_task * task)
+static int heft_push_task(struct starpu_sched_component * component, struct starpu_task * task)
 {
-	STARPU_ASSERT(node && task && starpu_sched_node_is_heft(node));
-	struct _starpu_heft_data * data = node->data;
+	STARPU_ASSERT(component && task && starpu_sched_component_is_heft(component));
+	struct _starpu_heft_data * data = component->data;
 	struct _starpu_prio_deque * prio = &data->prio;
 	starpu_pthread_mutex_t * mutex = &data->mutex;
 
@@ -49,14 +49,14 @@ static int heft_push_task(struct starpu_sched_node * node, struct starpu_task *
 	_starpu_prio_deque_push_task(prio,task);
 	STARPU_PTHREAD_MUTEX_UNLOCK(mutex);
 
-	heft_progress(node);
+	heft_progress(component);
 
 	return 0;
 }
 
-static int heft_progress_one(struct starpu_sched_node *node)
+static int heft_progress_one(struct starpu_sched_component *component)
 {
-	struct _starpu_heft_data * data = node->data;
+	struct _starpu_heft_data * data = component->data;
 	starpu_pthread_mutex_t * mutex = &data->mutex;
 	struct _starpu_prio_deque * prio = &data->prio;
 	struct starpu_task * (tasks[NTASKS]);
@@ -79,38 +79,38 @@ static int heft_progress_one(struct starpu_sched_node *node)
 
 	{
 		struct _starpu_mct_data * d = data->mct_data;
-		struct starpu_sched_node * best_node = NULL;
+		struct starpu_sched_component * best_component = NULL;
 
 		/* Estimated task duration for each child */
-		double estimated_lengths[node->nchilds * ntasks];
+		double estimated_lengths[component->nchildren * ntasks];
 		/* Estimated transfer duration for each child */
-		double estimated_transfer_length[node->nchilds * ntasks];
+		double estimated_transfer_length[component->nchildren * ntasks];
 		/* Estimated transfer+task termination for each child */
-		double estimated_ends_with_task[node->nchilds * ntasks];
+		double estimated_ends_with_task[component->nchildren * ntasks];
 
 		/* Minimum transfer+task termination on all children */
 		double min_exp_end_with_task[ntasks];
 		/* Maximum transfer+task termination on all children */
 		double max_exp_end_with_task[ntasks];
 
-		int suitable_nodes[node->nchilds * ntasks];
+		int suitable_components[component->nchildren * ntasks];
 
-		unsigned nsuitable_nodes[ntasks];
+		unsigned nsuitable_components[ntasks];
 
 		/* Estimate durations */
 		for (n = 0; n < ntasks; n++)
 		{
-			int offset = node->nchilds * n;
+			int offset = component->nchildren * n;
 
 			min_exp_end_with_task[n] = DBL_MAX;
 			max_exp_end_with_task[n] = 0.0;
 
-			nsuitable_nodes[n] = starpu_mct_compute_expected_times(node, tasks[n],
+			nsuitable_components[n] = starpu_mct_compute_expected_times(component, tasks[n],
 					estimated_lengths + offset,
 					estimated_transfer_length + offset,
 					estimated_ends_with_task + offset,
 					&min_exp_end_with_task[n], &max_exp_end_with_task[n],
-					suitable_nodes + offset);
+					suitable_components + offset);
 		}
 
 		int best_task = 0;
@@ -128,7 +128,7 @@ static int heft_progress_one(struct starpu_sched_node *node)
 		}
 
 		double best_fitness = DBL_MAX;
-		int best_inode = -1;
+		int best_icomponent = -1;
 
 		/* Push back the other tasks */
 		STARPU_PTHREAD_MUTEX_LOCK(mutex);
@@ -139,38 +139,38 @@ static int heft_progress_one(struct starpu_sched_node *node)
 
 		/* And now find out which worker suits best for this task,
 		 * including data transfer */
-		for(i = 0; i < nsuitable_nodes[best_task]; i++)
+		for(i = 0; i < nsuitable_components[best_task]; i++)
 		{
-			int offset = node->nchilds * best_task;
-			int inode = suitable_nodes[offset + i];
+			int offset = component->nchildren * best_task;
+			int icomponent = suitable_components[offset + i];
 #ifdef STARPU_DEVEL
 #warning FIXME: take power consumption into account
 #endif
 			double tmp = starpu_mct_compute_fitness(d,
-						     estimated_ends_with_task[offset + inode],
+						     estimated_ends_with_task[offset + icomponent],
 						     min_exp_end_with_task[best_task],
 						     max_exp_end_with_task[best_task],
-						     estimated_transfer_length[offset + inode],
+						     estimated_transfer_length[offset + icomponent],
 						     0.0);
 
 			if(tmp < best_fitness)
 			{
 				best_fitness = tmp;
-				best_inode = inode;
+				best_icomponent = icomponent;
 			}
 		}
 
-		STARPU_ASSERT(best_inode != -1);
+		STARPU_ASSERT(best_icomponent != -1);
 		STARPU_ASSERT(best_task >= 0);
-		best_node = node->childs[best_inode];
+		best_component = component->children[best_icomponent];
 
-		if(starpu_sched_node_is_worker(best_node))
+		if(starpu_sched_component_is_worker(best_component))
 		{
-			best_node->avail(best_node);
+			best_component->can_pull(best_component);
 			return 1;
 		}
 
-		int ret = best_node->push_task(best_node, tasks[best_task]);
+		int ret = best_component->push_task(best_component, tasks[best_task]);
 
 		if (ret)
 		{
@@ -182,33 +182,33 @@ static int heft_progress_one(struct starpu_sched_node *node)
 		}
 		else
 		{
-			best_node->avail(best_node);
+			best_component->can_pull(best_component);
 			return 0;
 		}
 	}
 }
 
 /* Try to push some tasks below */
-static void heft_progress(struct starpu_sched_node *node)
+static void heft_progress(struct starpu_sched_component *component)
 {
-	STARPU_ASSERT(node && starpu_sched_node_is_heft(node));
-	while (!heft_progress_one(node))
+	STARPU_ASSERT(component && starpu_sched_component_is_heft(component));
+	while (!heft_progress_one(component))
 		;
 }
 
-static int heft_room(struct starpu_sched_node *node)
+static int heft_can_push(struct starpu_sched_component *component)
 {
-	_starpu_sched_node_unlock_scheduling();
-	heft_progress(node);
-	_starpu_sched_node_lock_scheduling();
+	_starpu_sched_component_unlock_scheduling();
+	heft_progress(component);
+	_starpu_sched_component_lock_scheduling();
 	int ret, j;
-	for(j=0; j < node->nfathers; j++)
+	for(j=0; j < component->nfathers; j++)
 	{
-		if(node->fathers[j] == NULL)
+		if(component->fathers[j] == NULL)
 			continue;
 		else
 		{
-			ret = node->fathers[j]->room(node->fathers[j]);
+			ret = component->fathers[j]->can_push(component->fathers[j]);
 			if(ret)
 				break;
 		}
@@ -216,32 +216,32 @@ static int heft_room(struct starpu_sched_node *node)
 	return ret;
 }
 
-void heft_node_deinit_data(struct starpu_sched_node * node)
+void heft_component_deinit_data(struct starpu_sched_component * component)
 {
-	STARPU_ASSERT(starpu_sched_node_is_heft(node));
-	struct _starpu_mct_data * d = node->data;
+	STARPU_ASSERT(starpu_sched_component_is_heft(component));
+	struct _starpu_mct_data * d = component->data;
 	free(d);
 }
 
-int starpu_sched_node_is_heft(struct starpu_sched_node * node)
+int starpu_sched_component_is_heft(struct starpu_sched_component * component)
 {
-	return node->push_task == heft_push_task;
+	return component->push_task == heft_push_task;
 }
 
-struct starpu_sched_node * starpu_sched_node_heft_create(struct starpu_mct_data * params)
+struct starpu_sched_component * starpu_sched_component_heft_create(struct starpu_mct_data * params)
 {
-	struct starpu_sched_node * node = starpu_sched_node_create();
+	struct starpu_sched_component * component = starpu_sched_component_create();
 	struct _starpu_mct_data *mct_data = starpu_mct_init_parameters(params);
 	struct _starpu_heft_data *data = malloc(sizeof(*data));
 
 	_starpu_prio_deque_init(&data->prio);
 	STARPU_PTHREAD_MUTEX_INIT(&data->mutex,NULL);
 	data->mct_data = mct_data;
-	node->data = data;
+	component->data = data;
 
-	node->push_task = heft_push_task;
-	node->room = heft_room;
-	node->deinit_data = heft_node_deinit_data;
+	component->push_task = heft_push_task;
+	component->can_push = heft_can_push;
+	component->deinit_data = heft_component_deinit_data;
 
-	return node;
+	return component;
 }

+ 42 - 42
src/sched_policies/node_mct.c

@@ -16,27 +16,27 @@
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
 
-#include <starpu_sched_node.h>
-#include "sched_node.h"
+#include <starpu_sched_component.h>
+#include "sched_component.h"
 #include <starpu_perfmodel.h>
 #include "helper_mct.h"
 #include <float.h>
 
-static int mct_push_task(struct starpu_sched_node * node, struct starpu_task * task)
+static int mct_push_task(struct starpu_sched_component * component, struct starpu_task * task)
 {
-	STARPU_ASSERT(node && task && starpu_sched_node_is_mct(node));
-	struct _starpu_mct_data * d = node->data;	
-	struct starpu_sched_node * best_node = NULL;
+	STARPU_ASSERT(component && task && starpu_sched_component_is_mct(component));
+	struct _starpu_mct_data * d = component->data;	
+	struct starpu_sched_component * best_component = NULL;
 
 	/* Estimated task duration for each child */
-	double estimated_lengths[node->nchilds];
+	double estimated_lengths[component->nchildren];
 	/* Estimated transfer duration for each child */
-	double estimated_transfer_length[node->nchilds];
+	double estimated_transfer_length[component->nchildren];
 	/* Estimated transfer+task termination for each child */
-	double estimated_ends_with_task[node->nchilds];
+	double estimated_ends_with_task[component->nchildren];
 
 	int i;
-	for(i=0; i < node->nchilds; i++)
+	for(i=0; i < component->nchildren; i++)
 	{
 		estimated_lengths[i] = 0.0;
 		estimated_transfer_length[i] = 0.0;
@@ -48,85 +48,85 @@ static int mct_push_task(struct starpu_sched_node * node, struct starpu_task * t
 	/* Maximum transfer+task termination on all children */
 	double max_exp_end_with_task = 0.0;
 
-	int suitable_nodes[node->nchilds];
-	int nsuitable_nodes = 0;
+	int suitable_components[component->nchildren];
+	int nsuitable_components = 0;
 
-	nsuitable_nodes = starpu_mct_compute_expected_times(node, task,
+	nsuitable_components = starpu_mct_compute_expected_times(component, task,
 			estimated_lengths, estimated_transfer_length, estimated_ends_with_task,
-			&min_exp_end_with_task, &max_exp_end_with_task, suitable_nodes);
+			&min_exp_end_with_task, &max_exp_end_with_task, suitable_components);
 
-	/* If no suitable nodes were found, it means that the perfmodel of
-	 * the task had been purged since it has been pushed on the mct node.
+	/* If no suitable components were found, it means that the perfmodel of
+	 * the task had been purged since it has been pushed on the mct component.
 	 * We should send a push_fail message to its father so that it will
 	 * be able to reschedule the task properly. */
-	if(nsuitable_nodes == 0)
+	if(nsuitable_components == 0)
 		return 1;
 
 	double best_fitness = DBL_MAX;
-	int best_inode = -1;
-	for(i = 0; i < nsuitable_nodes; i++)
+	int best_icomponent = -1;
+	for(i = 0; i < nsuitable_components; i++)
 	{
-		int inode = suitable_nodes[i];
+		int icomponent = suitable_components[i];
 #ifdef STARPU_DEVEL
 #warning FIXME: take power consumption into account
 #endif
 		double tmp = starpu_mct_compute_fitness(d,
-					     estimated_ends_with_task[inode],
+					     estimated_ends_with_task[icomponent],
 					     min_exp_end_with_task,
 					     max_exp_end_with_task,
-					     estimated_transfer_length[inode],
+					     estimated_transfer_length[icomponent],
 					     0.0);
 
 		if(tmp < best_fitness)
 		{
 			best_fitness = tmp;
-			best_inode = inode;
+			best_icomponent = icomponent;
 		}
 	}
 
-	/* If no best node is found, it means that the perfmodel of
-	 * the task had been purged since it has been pushed on the mct node.
+	/* If no best component is found, it means that the perfmodel of
+	 * the task had been purged since it has been pushed on the mct component.
 	 * We should send a push_fail message to its father so that it will
 	 * be able to reschedule the task properly. */
-	if(best_inode == -1)
+	if(best_icomponent == -1)
 		return 1;
 
-	best_node = node->childs[best_inode];
+	best_component = component->children[best_icomponent];
 
-	if(starpu_sched_node_is_worker(best_node))
+	if(starpu_sched_component_is_worker(best_component))
 	{
-		best_node->avail(best_node);
+		best_component->can_pull(best_component);
 		return 1;
 	}
 
-	int ret = best_node->push_task(best_node, task);
+	int ret = best_component->push_task(best_component, task);
 	if(!ret)
-		best_node->avail(best_node);
+		best_component->can_pull(best_component);
 
 	return ret;
 }
 
-void mct_node_deinit_data(struct starpu_sched_node * node)
+void mct_component_deinit_data(struct starpu_sched_component * component)
 {
-	STARPU_ASSERT(starpu_sched_node_is_mct(node));
-	struct _starpu_mct_data * d = node->data;
+	STARPU_ASSERT(starpu_sched_component_is_mct(component));
+	struct _starpu_mct_data * d = component->data;
 	free(d);
 }
 
-int starpu_sched_node_is_mct(struct starpu_sched_node * node)
+int starpu_sched_component_is_mct(struct starpu_sched_component * component)
 {
-	return node->push_task == mct_push_task;
+	return component->push_task == mct_push_task;
 }
 
-struct starpu_sched_node * starpu_sched_node_mct_create(struct starpu_mct_data * params)
+struct starpu_sched_component * starpu_sched_component_mct_create(struct starpu_mct_data * params)
 {
-	struct starpu_sched_node * node = starpu_sched_node_create();
+	struct starpu_sched_component * component = starpu_sched_component_create();
 	struct _starpu_mct_data *data = starpu_mct_init_parameters(params);
 
-	node->data = data;
+	component->data = data;
 
-	node->push_task = mct_push_task;
-	node->deinit_data = mct_node_deinit_data;
+	component->push_task = mct_push_task;
+	component->deinit_data = mct_component_deinit_data;
 
-	return node;
+	return component;
 }

+ 111 - 0
src/sched_policies/component_perfmodel_select.c

@@ -0,0 +1,111 @@
+/* StarPU --- Runtime system for heterogeneous multicore architectures.
+ *
+ * Copyright (C) 2013  INRIA
+ *
+ * StarPU is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * StarPU is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * See the GNU Lesser General Public License in COPYING.LGPL for more details.
+ */
+
+#include <starpu_sched_component.h>
+#include <starpu_scheduler.h>
+
+/* The decision component takes care of the scheduling of tasks which are not
+ * calibrated, or tasks which don't have a performance model, because the scheduling
+ * architecture of this scheduler for tasks with no performance model is exactly
+ * the same as the tree-prio scheduler.
+ * Tasks with a perfmodel are pushed to the perfmodel_component, which takes care of the
+ * scheduling of those tasks on the correct worker_component.
+ */
+
+struct _starpu_perfmodel_select_data
+{
+	struct starpu_sched_component * calibrator_component;
+	struct starpu_sched_component * no_perfmodel_component;
+	struct starpu_sched_component * perfmodel_component;
+};
+
+static int perfmodel_select_push_task(struct starpu_sched_component * component, struct starpu_task * task)
+{
+	STARPU_ASSERT(component && component->data && task && starpu_sched_component_is_perfmodel_select(component));
+	STARPU_ASSERT(starpu_sched_component_can_execute_task(component,task));
+
+	struct _starpu_perfmodel_select_data * data = component->data;
+	double length;
+	int can_execute = starpu_sched_component_execute_preds(component,task,&length);
+	
+	if(can_execute)
+	{
+		if(isnan(length))
+			return data->calibrator_component->push_task(data->calibrator_component,task);
+		if(_STARPU_IS_ZERO(length))
+			return data->no_perfmodel_component->push_task(data->no_perfmodel_component,task);
+		return data->perfmodel_component->push_task(data->perfmodel_component,task);
+	}
+	else
+		return 1;
+
+}
+
+int starpu_sched_component_is_perfmodel_select(struct starpu_sched_component * component)
+{
+	return component->push_task == perfmodel_select_push_task;
+}
+
+static void perfmodel_select_notify_change_in_workers(struct starpu_sched_component * component)
+{
+	STARPU_ASSERT(starpu_sched_component_is_perfmodel_select(component));
+	struct _starpu_perfmodel_select_data * data = component->data;
+
+	starpu_bitmap_unset_all(data->no_perfmodel_component->workers_in_ctx);
+	starpu_bitmap_unset_all(data->no_perfmodel_component->workers);
+	starpu_bitmap_or(data->no_perfmodel_component->workers_in_ctx, component->workers_in_ctx);
+	starpu_bitmap_or(data->no_perfmodel_component->workers, component->workers);
+	data->no_perfmodel_component->properties = component->properties;
+
+	starpu_bitmap_unset_all(data->perfmodel_component->workers_in_ctx);
+	starpu_bitmap_unset_all(data->perfmodel_component->workers);
+	starpu_bitmap_or(data->perfmodel_component->workers_in_ctx, component->workers_in_ctx);
+	starpu_bitmap_or(data->perfmodel_component->workers, component->workers);
+	data->perfmodel_component->properties = component->properties;
+
+	starpu_bitmap_unset_all(data->calibrator_component->workers_in_ctx);
+	starpu_bitmap_unset_all(data->calibrator_component->workers);
+	starpu_bitmap_or(data->calibrator_component->workers_in_ctx, component->workers_in_ctx);
+	starpu_bitmap_or(data->calibrator_component->workers, component->workers);
+	data->calibrator_component->properties = component->properties;
+}
+
+void perfmodel_select_component_deinit_data(struct starpu_sched_component * component)
+
+{
+	STARPU_ASSERT(component && component->data);
+	struct _starpu_perfmodel_select_data * d = component->data;
+	free(d);
+}
+
+struct starpu_sched_component * starpu_sched_component_perfmodel_select_create(struct starpu_perfmodel_select_data * params)
+{
+	STARPU_ASSERT(params);
+	STARPU_ASSERT(params->calibrator_component && params->no_perfmodel_component && params->perfmodel_component);
+	struct starpu_sched_component * component = starpu_sched_component_create();
+
+	struct _starpu_perfmodel_select_data * data = malloc(sizeof(*data));
+	data->calibrator_component = params->calibrator_component;
+	data->no_perfmodel_component = params->no_perfmodel_component;
+	data->perfmodel_component = params->perfmodel_component;
+	
+	component->data = data;
+	component->push_task = perfmodel_select_push_task;
+	component->deinit_data = perfmodel_select_component_deinit_data;
+	component->notify_change_workers = perfmodel_select_notify_change_in_workers;
+
+	return component;
+}

+ 68 - 68
src/sched_policies/node_prio.c

@@ -14,24 +14,24 @@
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
 
-#include <starpu_sched_node.h>
+#include <starpu_sched_component.h>
 #include <starpu_scheduler.h>
 
 #include "prio_deque.h"
-#include "sched_node.h"
+#include "sched_component.h"
 
-#define STARPU_TRACE_SCHED_NODE_PUSH_PRIO(node,ntasks,exp_len) do {                                 \
+#define STARPU_TRACE_SCHED_COMPONENT_PUSH_PRIO(component,ntasks,exp_len) do {                                 \
 	int workerid = STARPU_NMAXWORKERS + 1;									\
-	if((node->nchilds == 1) && starpu_sched_node_is_worker(node->childs[0])) \
-		workerid = starpu_sched_node_worker_get_workerid(node->childs[0]); \
-	_STARPU_TRACE_SCHED_NODE_PUSH_PRIO(workerid, ntasks, exp_len); \
+	if((component->nchildren == 1) && starpu_sched_component_is_worker(component->children[0])) \
+		workerid = starpu_sched_component_worker_get_workerid(component->children[0]); \
+	_STARPU_TRACE_SCHED_COMPONENT_PUSH_PRIO(workerid, ntasks, exp_len); \
 } while (0)
 
-#define STARPU_TRACE_SCHED_NODE_POP_PRIO(node,ntasks,exp_len) do {                                 \
+#define STARPU_TRACE_SCHED_COMPONENT_POP_PRIO(component,ntasks,exp_len) do {                                 \
 	int workerid = STARPU_NMAXWORKERS + 1;									\
-	if((node->nchilds == 1) && starpu_sched_node_is_worker(node->childs[0])) \
-		workerid = starpu_sched_node_worker_get_workerid(node->childs[0]); \
-	_STARPU_TRACE_SCHED_NODE_POP_PRIO(workerid, ntasks, exp_len); \
+	if((component->nchildren == 1) && starpu_sched_component_is_worker(component->children[0])) \
+		workerid = starpu_sched_component_worker_get_workerid(component->children[0]); \
+	_STARPU_TRACE_SCHED_COMPONENT_POP_PRIO(workerid, ntasks, exp_len); \
 } while (0)
 
 
@@ -43,22 +43,22 @@ struct _starpu_prio_data
 	double exp_len_threshold;
 };
 
-void prio_node_deinit_data(struct starpu_sched_node * node)
+void prio_component_deinit_data(struct starpu_sched_component * component)
 {
-	STARPU_ASSERT(node && node->data);
-	struct _starpu_prio_data * f = node->data;
+	STARPU_ASSERT(component && component->data);
+	struct _starpu_prio_data * f = component->data;
 	_starpu_prio_deque_destroy(&f->prio);
 	STARPU_PTHREAD_MUTEX_DESTROY(&f->mutex);
 	free(f);
 }
 
-static double prio_estimated_end(struct starpu_sched_node * node)
+static double prio_estimated_end(struct starpu_sched_component * component)
 {
-	STARPU_ASSERT(node && node->data);
-	struct _starpu_prio_data * data = node->data;
+	STARPU_ASSERT(component && component->data);
+	struct _starpu_prio_data * data = component->data;
 	struct _starpu_prio_deque * prio = &data->prio;
 	starpu_pthread_mutex_t * mutex = &data->mutex;
-	int card = starpu_bitmap_cardinal(node->workers_in_ctx);
+	int card = starpu_bitmap_cardinal(component->workers_in_ctx);
 	STARPU_ASSERT(card != 0);
 	STARPU_PTHREAD_MUTEX_LOCK(mutex);
 	prio->exp_start = STARPU_MAX(prio->exp_start, starpu_timing_now());
@@ -68,18 +68,18 @@ static double prio_estimated_end(struct starpu_sched_node * node)
 	return estimated_end;
 }
 
-static double prio_estimated_load(struct starpu_sched_node * node)
+static double prio_estimated_load(struct starpu_sched_component * component)
 {
-	STARPU_ASSERT(node && node->data);
-	STARPU_ASSERT(starpu_bitmap_cardinal(node->workers_in_ctx) != 0);
-	struct _starpu_prio_data * data = node->data;
+	STARPU_ASSERT(component && component->data);
+	STARPU_ASSERT(starpu_bitmap_cardinal(component->workers_in_ctx) != 0);
+	struct _starpu_prio_data * data = component->data;
 	struct _starpu_prio_deque * prio = &data->prio;
 	starpu_pthread_mutex_t * mutex = &data->mutex;
 	double relative_speedup = 0.0;
 	double load;
-	if(STARPU_SCHED_NODE_IS_HOMOGENEOUS(node))
+	if(STARPU_SCHED_COMPONENT_IS_HOMOGENEOUS(component))
 	{		
-		int first_worker = starpu_bitmap_first(node->workers_in_ctx);
+		int first_worker = starpu_bitmap_first(component->workers_in_ctx);
 		relative_speedup = starpu_worker_get_relative_speedup(starpu_worker_get_perf_archtype(first_worker));
 		STARPU_PTHREAD_MUTEX_LOCK(mutex);
 		load = prio->ntasks / relative_speedup;
@@ -89,30 +89,30 @@ static double prio_estimated_load(struct starpu_sched_node * node)
 	else
 	{
 		int i;
-		for(i = starpu_bitmap_first(node->workers_in_ctx);
+		for(i = starpu_bitmap_first(component->workers_in_ctx);
 		    i != -1;
-		    i = starpu_bitmap_next(node->workers_in_ctx, i))
+		    i = starpu_bitmap_next(component->workers_in_ctx, i))
 			relative_speedup += starpu_worker_get_relative_speedup(starpu_worker_get_perf_archtype(i));
-		relative_speedup /= starpu_bitmap_cardinal(node->workers_in_ctx);
+		relative_speedup /= starpu_bitmap_cardinal(component->workers_in_ctx);
 		STARPU_ASSERT(!_STARPU_IS_ZERO(relative_speedup));
 		STARPU_PTHREAD_MUTEX_LOCK(mutex);
 		load = prio->ntasks / relative_speedup;
 		STARPU_PTHREAD_MUTEX_UNLOCK(mutex);
 	}
 	int i;
-	for(i = 0; i < node->nchilds; i++)
+	for(i = 0; i < component->nchildren; i++)
 	{
-		struct starpu_sched_node * c = node->childs[i];
+		struct starpu_sched_component * c = component->children[i];
 		load += c->estimated_load(c);
 	}
 	return load;
 }
 
-static int prio_push_local_task(struct starpu_sched_node * node, struct starpu_task * task, unsigned is_pushback)
+static int prio_push_local_task(struct starpu_sched_component * component, struct starpu_task * task, unsigned is_pushback)
 {
-	STARPU_ASSERT(node && node->data && task);
-	STARPU_ASSERT(starpu_sched_node_can_execute_task(node,task));
-	struct _starpu_prio_data * data = node->data;
+	STARPU_ASSERT(component && component->data && task);
+	STARPU_ASSERT(starpu_sched_component_can_execute_task(component,task));
+	struct _starpu_prio_data * data = component->data;
 	struct _starpu_prio_deque * prio = &data->prio;
 	starpu_pthread_mutex_t * mutex = &data->mutex;
 	int ret;
@@ -130,7 +130,7 @@ static int prio_push_local_task(struct starpu_sched_node * node, struct starpu_t
 		static int warned;
 		if(task->predicted > data->exp_len_threshold && !warned)
 		{
-			_STARPU_DISP("Warning : a predicted task length (%lf) exceeds the expected length threshold (%lf) of a prio node queue, you should reconsider the value of this threshold. This message will not be printed again for further thresholds exceeding.\n",task->predicted,data->exp_len_threshold);
+			_STARPU_DISP("Warning : a predicted task length (%lf) exceeds the expected length threshold (%lf) of a prio component queue, you should reconsider the value of this threshold. This message will not be printed again for further thresholds exceeding.\n",task->predicted,data->exp_len_threshold);
 			warned = 1;
 		}
 		ret = 1;
@@ -143,8 +143,8 @@ static int prio_push_local_task(struct starpu_sched_node * node, struct starpu_t
 		else
 		{
 			ret = _starpu_prio_deque_push_task(prio,task);
-			starpu_sched_node_prefetch_on_node(node, task);
-			STARPU_TRACE_SCHED_NODE_PUSH_PRIO(node, prio->ntasks, exp_len);
+			starpu_sched_component_prefetch_on_node(component, task);
+			STARPU_TRACE_SCHED_COMPONENT_PUSH_PRIO(component, prio->ntasks, exp_len);
 		}
 
 		if(!isnan(task->predicted))
@@ -161,21 +161,21 @@ static int prio_push_local_task(struct starpu_sched_node * node, struct starpu_t
 	return ret;
 }
 
-static int prio_push_task(struct starpu_sched_node * node, struct starpu_task * task)
+static int prio_push_task(struct starpu_sched_component * component, struct starpu_task * task)
 {
-	int ret = prio_push_local_task(node, task, 0);
+	int ret = prio_push_local_task(component, task, 0);
 	return ret;
 }
 
-int starpu_sched_node_is_prio(struct starpu_sched_node * node)
+int starpu_sched_component_is_prio(struct starpu_sched_component * component)
 {
-	return node->push_task == prio_push_task;
+	return component->push_task == prio_push_task;
 }
 
-static struct starpu_task * prio_pop_task(struct starpu_sched_node * node)
+static struct starpu_task * prio_pop_task(struct starpu_sched_component * component)
 {
-	STARPU_ASSERT(node && node->data);
-	struct _starpu_prio_data * data = node->data;
+	STARPU_ASSERT(component && component->data);
+	struct _starpu_prio_data * data = component->data;
 	struct _starpu_prio_deque * prio = &data->prio;
 	starpu_pthread_mutex_t * mutex = &data->mutex;
 	STARPU_PTHREAD_MUTEX_LOCK(mutex);
@@ -191,23 +191,23 @@ static struct starpu_task * prio_pop_task(struct starpu_sched_node * node)
 		if(prio->ntasks == 0)
 			prio->exp_len = 0.0;
 		
-		STARPU_TRACE_SCHED_NODE_POP_PRIO(node, prio->ntasks, prio->exp_len);
+		STARPU_TRACE_SCHED_COMPONENT_POP_PRIO(component, prio->ntasks, prio->exp_len);
 	}
 	STARPU_ASSERT(!isnan(prio->exp_end));
 	STARPU_ASSERT(!isnan(prio->exp_len));
 	STARPU_ASSERT(!isnan(prio->exp_start));
 	STARPU_PTHREAD_MUTEX_UNLOCK(mutex);
 
-	// When a pop is called, a room is called for pushing tasks onto
+	// When a pop is called, a can_push is called for pushing tasks onto
 	// the empty place of the queue left by the popped task.
 	int i,ret;
-	for(i=0; i < node->nfathers; i++)
+	for(i=0; i < component->nfathers; i++)
 	{
-		if(node->fathers[i] == NULL)
+		if(component->fathers[i] == NULL)
 			continue;
 		else
 		{
-			ret = node->fathers[i]->room(node->fathers[i]);
+			ret = component->fathers[i]->can_push(component->fathers[i]);
 			if(ret)
 				break;
 		}
@@ -219,22 +219,22 @@ static struct starpu_task * prio_pop_task(struct starpu_sched_node * node)
 	return NULL;
 }
 
-/* When a room is caught by this function, we try to pop and push
+/* When a can_push is caught by this function, we try to pop and push
  * tasks from our local queue as much as possible, until a
- * push fails, which means that the worker prio_nodes are
+ * push fails, which means that the worker prio_components are
  * currently "full".
  */
-static int prio_room(struct starpu_sched_node * node)
+static int prio_can_push(struct starpu_sched_component * component)
 {
-	STARPU_ASSERT(node && starpu_sched_node_is_prio(node));
+	STARPU_ASSERT(component && starpu_sched_component_is_prio(component));
 	int ret = 0;
 	int res = 0;
 
-	STARPU_ASSERT(node->nchilds == 1);
-	struct starpu_sched_node * child = node->childs[0];
+	STARPU_ASSERT(component->nchildren == 1);
+	struct starpu_sched_component * child = component->children[0];
 
-	_starpu_sched_node_unlock_scheduling();
-	struct starpu_task * task = node->pop_task(node);
+	_starpu_sched_component_unlock_scheduling();
+	struct starpu_task * task = component->pop_task(component);
 	if(task)
 		ret = child->push_task(child,task);	
 	while(task && !ret) 
@@ -242,30 +242,30 @@ static int prio_room(struct starpu_sched_node * node)
 		if(!res)
 			res = 1;
 
-		task = node->pop_task(node);
+		task = component->pop_task(component);
 		if(task)
 			ret = child->push_task(child,task);	
 	} 
-	_starpu_sched_node_lock_scheduling();
+	_starpu_sched_component_lock_scheduling();
 	if(task && ret)
-		prio_push_local_task(node,task,1); 
+		prio_push_local_task(component,task,1); 
 
 	return res;
 }
 
-struct starpu_sched_node * starpu_sched_node_prio_create(struct starpu_prio_data * params)
+struct starpu_sched_component * starpu_sched_component_prio_create(struct starpu_prio_data * params)
 {
-	struct starpu_sched_node * node = starpu_sched_node_create();
+	struct starpu_sched_component * component = starpu_sched_component_create();
 	struct _starpu_prio_data * data = malloc(sizeof(*data));
 	_starpu_prio_deque_init(&data->prio);
 	STARPU_PTHREAD_MUTEX_INIT(&data->mutex,NULL);
-	node->data = data;
-	node->estimated_end = prio_estimated_end;
-	node->estimated_load = prio_estimated_load;
-	node->push_task = prio_push_task;
-	node->pop_task = prio_pop_task;
-	node->room = prio_room;
-	node->deinit_data = prio_node_deinit_data;
+	component->data = data;
+	component->estimated_end = prio_estimated_end;
+	component->estimated_load = prio_estimated_load;
+	component->push_task = prio_push_task;
+	component->pop_task = prio_pop_task;
+	component->can_push = prio_can_push;
+	component->deinit_data = prio_component_deinit_data;
 
 	if(params)
 	{
@@ -278,5 +278,5 @@ struct starpu_sched_node * starpu_sched_node_prio_create(struct starpu_prio_data
 		data->exp_len_threshold=0.0;
 	}
 
-	return node;
+	return component;
 }

+ 32 - 32
src/sched_policies/node_random.c

@@ -15,16 +15,16 @@
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
 
-#include <starpu_sched_node.h>
+#include <starpu_sched_component.h>
 #include <core/workers.h>
 
-static double compute_relative_speedup(struct starpu_sched_node * node)
+static double compute_relative_speedup(struct starpu_sched_component * component)
 {
 	double sum = 0.0;
 	int id;
-	for(id = starpu_bitmap_first(node->workers_in_ctx);
+	for(id = starpu_bitmap_first(component->workers_in_ctx);
 	    id != -1;
-	    id = starpu_bitmap_next(node->workers_in_ctx, id))
+	    id = starpu_bitmap_next(component->workers_in_ctx, id))
 	{
 		struct starpu_perfmodel_arch* perf_arch = starpu_worker_get_perf_archtype(id);
 		sum += starpu_worker_get_relative_speedup(perf_arch);
@@ -35,32 +35,32 @@ static double compute_relative_speedup(struct starpu_sched_node * node)
 }
 
 
-static int random_push_task(struct starpu_sched_node * node, struct starpu_task * task)
+static int random_push_task(struct starpu_sched_component * component, struct starpu_task * task)
 {
-	STARPU_ASSERT(node->nchilds > 0);
+	STARPU_ASSERT(component->nchildren > 0);
 
-	/* indexes_nodes and size are used to memoize node that can execute tasks
-	 * during the first phase of algorithm, it contain the size indexes of the nodes
+	/* indexes_components and size are used to memoize component that can execute tasks
+	 * during the first phase of algorithm, it contain the size indexes of the components
 	 * that can execute task.
 	 */
-	int indexes_nodes[node->nchilds];
+	int indexes_components[component->nchildren];
 	int size=0;
 
 	/* speedup[i] is revelant only if i is in the size firsts elements of
-	 * indexes_nodes
+	 * indexes_components
 	 */
-	double speedup[node->nchilds];
+	double speedup[component->nchildren];
 
 	double alpha_sum = 0.0;
 
 	int i;
-	for(i = 0; i < node->nchilds ; i++)
+	for(i = 0; i < component->nchildren ; i++)
 	{
-		if(starpu_sched_node_can_execute_task(node->childs[i],task))
+		if(starpu_sched_component_can_execute_task(component->children[i],task))
 		{
-			speedup[size] = compute_relative_speedup(node->childs[i]);
+			speedup[size] = compute_relative_speedup(component->children[i]);
 			alpha_sum += speedup[size];
-			indexes_nodes[size] = i;
+			indexes_components[size] = i;
 			size++;
 		}
 	}
@@ -72,52 +72,52 @@ static int random_push_task(struct starpu_sched_node * node, struct starpu_task
 	 */
 	double random = starpu_drand48()*alpha_sum;
 	double alpha = 0.0;
-	struct starpu_sched_node * select  = NULL;
+	struct starpu_sched_component * select  = NULL;
 	
 	for(i = 0; i < size ; i++)
 	{
-		int index = indexes_nodes[i];
+		int index = indexes_components[i];
 		if(alpha + speedup[i] >= random)
 		{	
-			select = node->childs[index];
+			select = component->children[index];
 			break;
 		}
 		alpha += speedup[i];
 	}
 	STARPU_ASSERT(select != NULL);
-	if(starpu_sched_node_is_worker(select))
+	if(starpu_sched_component_is_worker(select))
 	{
-		select->avail(select);
+		select->can_pull(select);
 		return 1;
 	}
 
 	int ret_val = select->push_task(select,task);
 	if(!ret_val)
-		select->avail(select);
+		select->can_pull(select);
 
 	return ret_val;
 }
 /* taking the min of estimated_end not seems to be a good value to return here
  * as random scheduler balance between childs very poorly
  */
-double random_estimated_end(struct starpu_sched_node * node)
+double random_estimated_end(struct starpu_sched_component * component)
 {
 	double sum = 0.0;
 	int i;
-	for(i = 0; i < node->nchilds; i++)
-		sum += node->childs[i]->estimated_end(node->childs[i]);
-	return sum / node->nchilds;
+	for(i = 0; i < component->nchildren; i++)
+		sum += component->children[i]->estimated_end(component->children[i]);
+	return sum / component->nchildren;
 }
 
-struct starpu_sched_node * starpu_sched_node_random_create(void * arg STARPU_ATTRIBUTE_UNUSED)
+struct starpu_sched_component * starpu_sched_component_random_create(void * arg STARPU_ATTRIBUTE_UNUSED)
 {
-	struct starpu_sched_node * node = starpu_sched_node_create();
-	node->estimated_end = random_estimated_end;
-	node->push_task = random_push_task;
-	return node;
+	struct starpu_sched_component * component = starpu_sched_component_create();
+	component->estimated_end = random_estimated_end;
+	component->push_task = random_push_task;
+	return component;
 }
 
-int starpu_sched_node_is_random(struct starpu_sched_node *node)
+int starpu_sched_component_is_random(struct starpu_sched_component *component)
 {
-	return node->push_task == random_push_task;
+	return component->push_task == random_push_task;
 }

+ 578 - 0
src/sched_policies/component_sched.c

@@ -0,0 +1,578 @@
+/* StarPU --- Runtime system for heterogeneous multicore architectures.
+ *
+ * Copyright (C) 2013  INRIA
+ * Copyright (C) 2013  Simon Archipoff
+ *
+ * StarPU is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * StarPU is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * See the GNU Lesser General Public License in COPYING.LGPL for more details.
+ */
+
+#include <core/jobs.h>
+#include <core/workers.h>
+#include <starpu_sched_component.h>
+#include <starpu_thread_util.h>
+
+#include <float.h>
+
+#include "sched_component.h"
+
+/* default implementation for component->pop_task()
+ * just perform a recursive call on father
+ */
+static struct starpu_task * pop_task_component(struct starpu_sched_component * component)
+{
+	STARPU_ASSERT(component);
+	struct starpu_task * task = NULL;
+	int i;
+	for(i=0; i < component->nfathers; i++)
+	{
+		if(component->fathers[i] == NULL)
+			continue;
+		else
+		{
+			task = component->fathers[i]->pop_task(component->fathers[i]);
+			if(task)
+				break;
+		}
+	}
+	return task;
+}
+
+/******************************************************************************
+ *          functions for struct starpu_sched_policy interface                *
+ ******************************************************************************/
+int starpu_sched_tree_push_task(struct starpu_task * task)
+{
+	STARPU_ASSERT(task);
+	unsigned sched_ctx_id = task->sched_ctx;
+	struct starpu_sched_tree *tree = starpu_sched_ctx_get_policy_data(sched_ctx_id);
+	int workerid = starpu_worker_get_id();
+	/* application should take tree->lock to prevent concurent acces from hypervisor
+	 * worker take they own mutexes
+	 */
+	if(-1 == workerid)
+		STARPU_PTHREAD_MUTEX_LOCK(&tree->lock);
+	else
+		_starpu_sched_component_lock_worker(workerid);
+		
+	int ret_val = tree->root->push_task(tree->root,task);
+	if(-1 == workerid)
+		STARPU_PTHREAD_MUTEX_UNLOCK(&tree->lock);
+	else
+		_starpu_sched_component_unlock_worker(workerid);
+	return ret_val;
+}
+
+struct starpu_task * starpu_sched_tree_pop_task(unsigned sched_ctx STARPU_ATTRIBUTE_UNUSED)
+{
+	int workerid = starpu_worker_get_id();
+	struct starpu_sched_component * component = starpu_sched_component_worker_get(workerid);
+
+	/* _starpu_sched_component_lock_worker(workerid) is called by component->pop_task()
+	 */
+	struct starpu_task * task = component->pop_task(component);
+	return task;
+}
+
+void starpu_sched_tree_add_workers(unsigned sched_ctx_id, int *workerids, unsigned nworkers)
+{
+	STARPU_ASSERT(sched_ctx_id < STARPU_NMAX_SCHED_CTXS);
+	STARPU_ASSERT(workerids);
+	struct starpu_sched_tree * t = starpu_sched_ctx_get_policy_data(sched_ctx_id);
+
+	STARPU_PTHREAD_MUTEX_LOCK(&t->lock);
+	_starpu_sched_component_lock_all_workers();
+
+	unsigned i;
+	for(i = 0; i < nworkers; i++)
+		starpu_bitmap_set(t->workers, workerids[i]);
+
+	starpu_sched_tree_update_workers_in_ctx(t);
+
+	_starpu_sched_component_unlock_all_workers();
+	STARPU_PTHREAD_MUTEX_UNLOCK(&t->lock);
+}
+
+void starpu_sched_tree_remove_workers(unsigned sched_ctx_id, int *workerids, unsigned nworkers)
+{
+	STARPU_ASSERT(sched_ctx_id < STARPU_NMAX_SCHED_CTXS);
+	STARPU_ASSERT(workerids);
+	struct starpu_sched_tree * t = starpu_sched_ctx_get_policy_data(sched_ctx_id);
+
+	STARPU_PTHREAD_MUTEX_LOCK(&t->lock);
+	_starpu_sched_component_lock_all_workers();
+
+	unsigned i;
+	for(i = 0; i < nworkers; i++)
+		starpu_bitmap_unset(t->workers, workerids[i]);
+
+	starpu_sched_tree_update_workers_in_ctx(t);
+
+	_starpu_sched_component_unlock_all_workers();
+	STARPU_PTHREAD_MUTEX_UNLOCK(&t->lock);
+}
+
+void starpu_sched_component_destroy_rec(struct starpu_sched_component * component)
+{
+	if(component == NULL)
+		return;
+
+	int i;
+	if(component->nchildren > 0)
+	{
+		for(i=0; i < component->nchildren; i++)
+			starpu_sched_component_destroy_rec(component->children[i]);
+	}
+
+	starpu_sched_component_destroy(component);
+}
+
+struct starpu_sched_tree * starpu_sched_tree_create(unsigned sched_ctx_id)
+{
+	STARPU_ASSERT(sched_ctx_id < STARPU_NMAX_SCHED_CTXS);
+	struct starpu_sched_tree * t = malloc(sizeof(*t));
+	memset(t, 0, sizeof(*t));
+	t->sched_ctx_id = sched_ctx_id;
+	t->workers = starpu_bitmap_create();
+	STARPU_PTHREAD_MUTEX_INIT(&t->lock,NULL);
+	return t;
+}
+
+void starpu_sched_tree_destroy(struct starpu_sched_tree * tree)
+{
+	STARPU_ASSERT(tree);
+	if(tree->root)
+		starpu_sched_component_destroy_rec(tree->root);
+	starpu_bitmap_destroy(tree->workers);
+	STARPU_PTHREAD_MUTEX_DESTROY(&tree->lock);
+	free(tree);
+}
+
+static void starpu_sched_component_add_child(struct starpu_sched_component* component, struct starpu_sched_component * child)
+{
+	STARPU_ASSERT(component && child);
+	STARPU_ASSERT(!starpu_sched_component_is_worker(component));
+	int i;
+	for(i = 0; i < component->nchildren; i++){
+		STARPU_ASSERT(component->children[i] != component);
+		STARPU_ASSERT(component->children[i] != NULL);
+	}
+
+	component->children = realloc(component->children, sizeof(struct starpu_sched_component *) * (component->nchildren + 1));
+	component->children[component->nchildren] = child;
+	component->nchildren++;
+}
+
+static void starpu_sched_component_remove_child(struct starpu_sched_component * component, struct starpu_sched_component * child)
+{
+	STARPU_ASSERT(component && child);
+	STARPU_ASSERT(!starpu_sched_component_is_worker(component));
+	int pos;
+	for(pos = 0; pos < component->nchildren; pos++)
+		if(component->children[pos] == child)
+			break;
+	STARPU_ASSERT(pos != component->nchildren);
+	component->children[pos] = component->children[--component->nchildren];
+}
+
+static void starpu_sched_component_add_father(struct starpu_sched_component* component, struct starpu_sched_component * father)
+{
+	STARPU_ASSERT(component && father);
+	int i;
+	for(i = 0; i < component->nfathers; i++){
+		STARPU_ASSERT(component->fathers[i] != component);
+		STARPU_ASSERT(component->fathers[i] != NULL);
+	}
+
+	component->fathers = realloc(component->fathers, sizeof(struct starpu_sched_component *) * (component->nfathers + 1));
+	component->fathers[component->nfathers] = father;
+	component->nfathers++;
+}
+
+static void starpu_sched_component_remove_father(struct starpu_sched_component * component, struct starpu_sched_component * father)
+{
+	STARPU_ASSERT(component && father);
+	int pos;
+	for(pos = 0; pos < component->nfathers; pos++)
+		if(component->fathers[pos] == father)
+			break;
+	STARPU_ASSERT(pos != component->nfathers);
+	component->fathers[pos] = component->fathers[--component->nfathers];
+}
+
+struct starpu_bitmap * _starpu_get_worker_mask(unsigned sched_ctx_id)
+{
+	STARPU_ASSERT(sched_ctx_id < STARPU_NMAX_SCHED_CTXS);
+	struct starpu_sched_tree * t = starpu_sched_ctx_get_policy_data(sched_ctx_id);
+	STARPU_ASSERT(t);
+	return t->workers;
+}
+
+static double estimated_load(struct starpu_sched_component * component)
+{
+	double sum = 0.0;
+	int i;
+	for( i = 0; i < component->nchildren; i++)
+	{
+		struct starpu_sched_component * c = component->children[i];
+		sum += c->estimated_load(c);
+	}
+	return sum;
+}
+
+static double _starpu_sched_component_estimated_end_min(struct starpu_sched_component * component)
+{
+	STARPU_ASSERT(component);
+	double min = DBL_MAX;
+	int i;
+	for(i = 0; i < component->nchildren; i++)
+	{
+		double tmp = component->children[i]->estimated_end(component->children[i]);
+		if(tmp < min)
+			min = tmp;
+	}
+	return min;
+}
+
+/* this function find the best implementation or an implementation that need to be calibrated for a worker available
+ * and set prediction in *length. nan if a implementation need to be calibrated, 0.0 if no perf model are available
+ * return false if no worker on the component can execute that task
+ */
+int starpu_sched_component_execute_preds(struct starpu_sched_component * component, struct starpu_task * task, double * length)
+{
+	STARPU_ASSERT(component && task);
+	int can_execute = 0;
+	starpu_task_bundle_t bundle = task->bundle;
+	double len = DBL_MAX;
+	
+
+	int workerid;
+	for(workerid = starpu_bitmap_first(component->workers_in_ctx);
+	    workerid != -1;
+	    workerid = starpu_bitmap_next(component->workers_in_ctx, workerid))
+	{
+		struct starpu_perfmodel_arch* archtype = starpu_worker_get_perf_archtype(workerid);
+		int nimpl;
+		for(nimpl = 0; nimpl < STARPU_MAXIMPLEMENTATIONS; nimpl++)
+		{
+			if(starpu_worker_can_execute_task(workerid,task,nimpl)
+			   || starpu_combined_worker_can_execute_task(workerid, task, nimpl))
+			{
+				double d;
+				can_execute = 1;
+				if(bundle)
+					d = starpu_task_bundle_expected_length(bundle, archtype, nimpl);
+				else
+					d = starpu_task_expected_length(task, archtype, nimpl);
+				if(isnan(d))
+				{
+					*length = d;
+					return can_execute;
+						
+				}
+				if(_STARPU_IS_ZERO(d) && !can_execute)
+				{
+					can_execute = 1;
+					continue;
+				}
+				if(d < len)
+				{
+					len = d;
+				}
+			}
+		}
+		if(STARPU_SCHED_COMPONENT_IS_HOMOGENEOUS(component))
+			break;
+	}
+
+	if(len == DBL_MAX) /* we dont have perf model */
+		len = 0.0; 
+	if(length)
+		*length = len;
+	return can_execute;
+}
+
+/* very similar function that dont compute prediction */
+int starpu_sched_component_can_execute_task(struct starpu_sched_component * component, struct starpu_task * task)
+{
+	STARPU_ASSERT(task);
+	STARPU_ASSERT(component);
+	unsigned nimpl;
+	int worker;
+	for (nimpl = 0; nimpl < STARPU_MAXIMPLEMENTATIONS; nimpl++)
+		for(worker = starpu_bitmap_first(component->workers_in_ctx);
+		    -1 != worker;
+		    worker = starpu_bitmap_next(component->workers_in_ctx, worker))
+			if (starpu_worker_can_execute_task(worker, task, nimpl)
+			     || starpu_combined_worker_can_execute_task(worker, task, nimpl))
+			    return 1;
+	return 0;
+}
+
+/* compute the average of transfer length for tasks on all workers
+ * maybe this should be optimised if all workers are under the same numa component
+ */
+double starpu_sched_component_transfer_length(struct starpu_sched_component * component, struct starpu_task * task)
+{
+	STARPU_ASSERT(component && task);
+	int nworkers = starpu_bitmap_cardinal(component->workers_in_ctx);
+	double sum = 0.0;
+	int worker;
+	if(STARPU_SCHED_COMPONENT_IS_SINGLE_MEMORY_NODE(component))
+	{
+		unsigned memory_node  = starpu_worker_get_memory_node(starpu_bitmap_first(component->workers_in_ctx));
+		if(task->bundle)
+			return starpu_task_bundle_expected_data_transfer_time(task->bundle,memory_node);
+		else
+			return starpu_task_expected_data_transfer_time(memory_node, task);
+	}
+
+	for(worker = starpu_bitmap_first(component->workers_in_ctx);
+	    worker != -1;
+	    worker = starpu_bitmap_next(component->workers_in_ctx, worker))
+	{
+		unsigned memory_node  = starpu_worker_get_memory_node(worker);
+		if(task->bundle)
+		{
+			sum += starpu_task_bundle_expected_data_transfer_time(task->bundle,memory_node);
+		}
+		else
+		{
+			sum += starpu_task_expected_data_transfer_time(memory_node, task);
+			/* sum += starpu_task_expected_conversion_time(task, starpu_worker_get_perf_archtype(worker), impl ?)
+			 * I dont know what to do as we dont know what implementation would be used here...
+			 */
+		}
+	}
+	return sum / nworkers;
+}
+
+/* This function can be called by components when they think that a prefetching request can be submitted.
+ * For example, it is currently used by the MCT component to begin the prefetching on accelerators 
+ * on which it pushed tasks as soon as possible.
+ */
+void starpu_sched_component_prefetch_on_node(struct starpu_sched_component * component, struct starpu_task * task)
+{
+	if (starpu_get_prefetch_flag() && (!task->prefetched)
+		&& (component->properties >= STARPU_SCHED_COMPONENT_SINGLE_MEMORY_NODE))
+	{
+		int worker = starpu_bitmap_first(component->workers_in_ctx);
+		unsigned memory_node = starpu_worker_get_memory_node(worker);
+		starpu_prefetch_task_input_on_node(task, memory_node);
+		task->prefetched = 1;
+	}
+}
+
+/* The default implementation of the can_push function is a recursive call to its fathers.
+ * A personally-made can_push in a component (like in prio components) is necessary to catch
+ * this recursive call somewhere, if the user wants to exploit it.
+ */
+static int starpu_sched_component_can_push(struct starpu_sched_component * component)
+{
+	STARPU_ASSERT(component);
+	int ret = 0;
+	if(component->nfathers > 0)
+	{
+		int i;
+		for(i=0; i < component->nfathers; i++)
+		{
+			struct starpu_sched_component * father = component->fathers[i];
+			if(father != NULL)
+				ret = father->can_push(father);
+			if(ret)
+				break;
+		}
+	}
+	return ret;
+}
+
+/* A can_pull call will try to wake up one worker associated to the childs of the
+ * component. It is currenly called by components which holds a queue (like fifo and prio
+ * components) to signify its childs that a task has been pushed on its local queue.
+ */
+static void starpu_sched_component_can_pull(struct starpu_sched_component * component)
+{
+	STARPU_ASSERT(component);
+	STARPU_ASSERT(!starpu_sched_component_is_worker(component));
+	int i;
+	for(i = 0; i < component->nchildren; i++)
+		component->children[i]->can_pull(component->children[i]);
+}
+
+/* Allows a worker to lock/unlock scheduling mutexes. Currently used in 
+ * self-defined can_push calls to allow can_pull calls to take those mutexes while the 
+ * current worker is pushing tasks on other workers (or itself). 
+ */
+void _starpu_sched_component_lock_scheduling(void)
+{
+	int workerid = starpu_worker_get_id();
+	starpu_pthread_mutex_t *sched_mutex;
+	starpu_pthread_cond_t *sched_cond;
+	starpu_worker_get_sched_condition(workerid, &sched_mutex, &sched_cond);
+	_starpu_sched_component_lock_worker(workerid);	
+	STARPU_PTHREAD_MUTEX_LOCK(sched_mutex);
+}
+
+void _starpu_sched_component_unlock_scheduling(void)
+{
+	int workerid = starpu_worker_get_id();
+	starpu_pthread_mutex_t *sched_mutex;
+	starpu_pthread_cond_t *sched_cond;
+	starpu_worker_get_sched_condition(workerid, &sched_mutex, &sched_cond);
+	STARPU_PTHREAD_MUTEX_UNLOCK(sched_mutex);
+	_starpu_sched_component_unlock_worker(workerid);	
+}
+
+void take_component_and_does_nothing(struct starpu_sched_component * component STARPU_ATTRIBUTE_UNUSED)
+{
+}
+
+struct starpu_sched_component * starpu_sched_component_create(void)
+{
+	struct starpu_sched_component * component = malloc(sizeof(*component));
+	memset(component,0,sizeof(*component));
+	component->workers = starpu_bitmap_create();
+	component->workers_in_ctx = starpu_bitmap_create();
+	component->add_child = starpu_sched_component_add_child;
+	component->remove_child = starpu_sched_component_remove_child;
+	component->add_father = starpu_sched_component_add_father;
+	component->remove_father = starpu_sched_component_remove_father;
+	component->pop_task = pop_task_component;
+	component->can_push = starpu_sched_component_can_push;
+	component->can_pull = starpu_sched_component_can_pull;
+	component->estimated_load = estimated_load;
+	component->estimated_end = _starpu_sched_component_estimated_end_min;
+	component->deinit_data = take_component_and_does_nothing;
+	component->notify_change_workers = take_component_and_does_nothing;
+	return component;
+}
+
+/* remove all child
+ * for all child of component, if child->fathers[x] == component, set child->fathers[x] to null 
+ * call component->deinit_data
+ */
+void starpu_sched_component_destroy(struct starpu_sched_component *component)
+{
+	STARPU_ASSERT(component);
+	if(starpu_sched_component_is_worker(component))
+		return;
+	int i,j;
+	for(i = 0; i < component->nchildren; i++)
+	{
+		struct starpu_sched_component * child = component->children[i];
+		for(j = 0; j < child->nfathers; j++)
+			if(child->fathers[j] == component)
+				child->remove_father(child,component);
+
+	}
+	while(component->nchildren != 0)
+		component->remove_child(component, component->children[0]);
+	for(i = 0; i < component->nfathers; i++)
+	{
+		struct starpu_sched_component * father = component->fathers[i];
+		for(j = 0; j < father->nchildren; j++)
+			if(father->children[j] == component)
+				father->remove_child(father,component);
+
+	}
+	while(component->nfathers != 0)
+		component->remove_father(component, component->fathers[0]);
+	component->deinit_data(component);
+	free(component->children);
+	free(component->fathers);
+	starpu_bitmap_destroy(component->workers);
+	starpu_bitmap_destroy(component->workers_in_ctx);
+	free(component);
+}
+
+static void set_properties(struct starpu_sched_component * component)
+{
+	STARPU_ASSERT(component);
+	component->properties = 0;
+
+	int worker = starpu_bitmap_first(component->workers_in_ctx);
+	if (worker == -1)
+		return;
+	uint32_t first_worker = _starpu_get_worker_struct(worker)->worker_mask;
+	unsigned first_memory_node = _starpu_get_worker_struct(worker)->memory_node;
+	int is_homogeneous = 1;
+	int is_all_same_component = 1;
+	for(;
+	    worker != -1;
+	    worker = starpu_bitmap_next(component->workers_in_ctx, worker))		
+	{
+		if(first_worker != _starpu_get_worker_struct(worker)->worker_mask)
+			is_homogeneous = 0;
+		if(first_memory_node != _starpu_get_worker_struct(worker)->memory_node)
+			is_all_same_component = 0;
+	}
+	
+
+	if(is_homogeneous)
+		component->properties |= STARPU_SCHED_COMPONENT_HOMOGENEOUS;
+	if(is_all_same_component)
+		component->properties |= STARPU_SCHED_COMPONENT_SINGLE_MEMORY_NODE;
+}
+
+
+/* recursively set the component->workers member of component's subtree
+ */
+void _starpu_sched_component_update_workers(struct starpu_sched_component * component)
+{
+	STARPU_ASSERT(component);
+	if(starpu_sched_component_is_worker(component))
+		return;
+	starpu_bitmap_unset_all(component->workers);
+	int i;
+	for(i = 0; i < component->nchildren; i++)
+	{
+		_starpu_sched_component_update_workers(component->children[i]);
+		starpu_bitmap_or(component->workers, component->children[i]->workers);
+		component->notify_change_workers(component);
+	}
+}
+
+/* recursively set the component->workers_in_ctx in component's subtree
+ */
+void _starpu_sched_component_update_workers_in_ctx(struct starpu_sched_component * component, unsigned sched_ctx_id)
+{
+	STARPU_ASSERT(component);
+	if(starpu_sched_component_is_worker(component))
+		return;
+	struct starpu_bitmap * workers_in_ctx = _starpu_get_worker_mask(sched_ctx_id);
+	starpu_bitmap_unset_and(component->workers_in_ctx,component->workers, workers_in_ctx);
+	int i,j;
+	for(i = 0; i < component->nchildren; i++)
+	{
+		struct starpu_sched_component * child = component->children[i];
+		_starpu_sched_component_update_workers_in_ctx(child, sched_ctx_id);
+		for(j = 0; j < STARPU_NMAX_SCHED_CTXS; j++)
+			if(child->fathers[j] == component)
+			{
+				starpu_bitmap_or(component->workers_in_ctx, child->workers_in_ctx);
+				break;
+			}
+	}
+	set_properties(component);
+	component->notify_change_workers(component);
+}
+
+void starpu_sched_tree_update_workers_in_ctx(struct starpu_sched_tree * t)
+{
+	STARPU_ASSERT(t);
+	_starpu_sched_component_update_workers_in_ctx(t->root, t->sched_ctx_id);
+}
+
+void starpu_sched_tree_update_workers(struct starpu_sched_tree * t)
+{
+	STARPU_ASSERT(t);
+	_starpu_sched_component_update_workers(t->root);
+}

+ 86 - 94
src/sched_policies/node_work_stealing.c

@@ -15,7 +15,7 @@
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
 
-#include <starpu_sched_node.h>
+#include <starpu_sched_component.h>
 #include <starpu_scheduler.h>
 #include <starpu.h>
 
@@ -40,11 +40,11 @@ struct _starpu_work_stealing_data
  * steal a task in a round robin way
  * return NULL if none available
  */
-static struct starpu_task *  steal_task_round_robin(struct starpu_sched_node *node, int workerid)
+static struct starpu_task *  steal_task_round_robin(struct starpu_sched_component *component, int workerid)
 {
-	struct _starpu_work_stealing_data *wsd = node->data;
+	struct _starpu_work_stealing_data *wsd = component->data;
 	unsigned i = wsd->last_pop_child;
-	wsd->last_pop_child = (wsd->last_pop_child + 1) % node->nchilds;
+	wsd->last_pop_child = (wsd->last_pop_child + 1) % component->nchildren;
 	/* If the worker's queue have no suitable tasks, let's try
 	 * the next ones */
 	struct starpu_task * task = NULL;
@@ -69,7 +69,7 @@ static struct starpu_task *  steal_task_round_robin(struct starpu_sched_node *no
 			 * don't go in infinite loop */
 			return NULL;
 		}
-		i = (i + 1) % node->nchilds;
+		i = (i + 1) % component->nchildren;
 	
 	}
 	return task;
@@ -79,10 +79,10 @@ static struct starpu_task *  steal_task_round_robin(struct starpu_sched_node *no
  * Return a worker to whom add a task.
  * Selecting a worker is done in a round-robin fashion.
  */
-static unsigned select_worker_round_robin(struct starpu_sched_node * node)
+static unsigned select_worker_round_robin(struct starpu_sched_component * component)
 {
-	struct _starpu_work_stealing_data *ws = (struct _starpu_work_stealing_data*)node->data;
-	unsigned i = (ws->last_push_child + 1) % node->nchilds ;
+	struct _starpu_work_stealing_data *ws = (struct _starpu_work_stealing_data*)component->data;
+	unsigned i = (ws->last_push_child + 1) % component->nchildren ;
 	ws->last_push_child = i;
 	return i;
 }
@@ -93,9 +93,9 @@ static unsigned select_worker_round_robin(struct starpu_sched_node * node)
  * This is a phony function used to call the right
  * function depending on the value of USE_OVERLOAD.
  */
-static inline struct starpu_task * steal_task(struct starpu_sched_node * node, int workerid)
+static inline struct starpu_task * steal_task(struct starpu_sched_component * component, int workerid)
 {
-	return steal_task_round_robin(node, workerid);
+	return steal_task_round_robin(component, workerid);
 }
 
 /**
@@ -103,30 +103,30 @@ static inline struct starpu_task * steal_task(struct starpu_sched_node * node, i
  * This is a phony function used to call the right
  * function depending on the value of USE_OVERLOAD.
  */
-static inline unsigned select_worker(struct starpu_sched_node * node)
+static inline unsigned select_worker(struct starpu_sched_component * component)
 {
-	return select_worker_round_robin(node);
+	return select_worker_round_robin(component);
 }
 
 
-static int is_worker_of_node(struct starpu_sched_node * node, int workerid)
+static int is_worker_of_component(struct starpu_sched_component * component, int workerid)
 {
-	return starpu_bitmap_get(node->workers, workerid);
+	return starpu_bitmap_get(component->workers, workerid);
 }
 
 
 
-static struct starpu_task * pop_task(struct starpu_sched_node * node)
+static struct starpu_task * pop_task(struct starpu_sched_component * component)
 {
 	int workerid = starpu_worker_get_id();
 	int i;
-	for(i = 0; i < node->nchilds; i++)
+	for(i = 0; i < component->nchildren; i++)
 	{
-		if(is_worker_of_node(node->childs[i], workerid))
+		if(is_worker_of_component(component->children[i], workerid))
 			break;
 	}
-	STARPU_ASSERT(i < node->nchilds);
-	struct _starpu_work_stealing_data * wsd = node->data;
+	STARPU_ASSERT(i < component->nchildren);
+	struct _starpu_work_stealing_data * wsd = component->data;
 	STARPU_PTHREAD_MUTEX_LOCK(wsd->mutexes[i]);
 	struct starpu_task * task = _starpu_prio_deque_pop_task(wsd->fifos[i]);
 	if(task)
@@ -146,7 +146,7 @@ static struct starpu_task * pop_task(struct starpu_sched_node * node)
 		return task;
 	}
 	
-	task  = steal_task(node, workerid);
+	task  = steal_task(component, workerid);
 	if(task)
 	{
 		STARPU_PTHREAD_MUTEX_LOCK(wsd->mutexes[i]);
@@ -155,13 +155,13 @@ static struct starpu_task * pop_task(struct starpu_sched_node * node)
 
 		return task;
 	}
-	for(i=0; i < node->nfathers; i++)
+	for(i=0; i < component->nfathers; i++)
 	{
-		if(node->fathers[i] == NULL)
+		if(component->fathers[i] == NULL)
 			continue;
 		else
 		{
-			task = node->fathers[i]->pop_task(node->fathers[i]);
+			task = component->fathers[i]->pop_task(component->fathers[i]);
 			if(task)
 				break;
 		}
@@ -172,14 +172,14 @@ static struct starpu_task * pop_task(struct starpu_sched_node * node)
 		return NULL;
 }
 
-double _ws_estimated_end(struct starpu_sched_node * node)
+double _ws_estimated_end(struct starpu_sched_component * component)
 {
-	STARPU_ASSERT(starpu_sched_node_is_work_stealing(node));
-	struct _starpu_work_stealing_data * wsd = node->data;
+	STARPU_ASSERT(starpu_sched_component_is_work_stealing(component));
+	struct _starpu_work_stealing_data * wsd = component->data;
 	double sum_len = 0.0;
 	double sum_start = 0.0;
 	int i;
-	for(i = 0; i < node->nchilds; i++)
+	for(i = 0; i < component->nchildren; i++)
 	{
 		STARPU_PTHREAD_MUTEX_LOCK(wsd->mutexes[i]);
 		sum_len += wsd->fifos[i]->exp_len;
@@ -188,18 +188,18 @@ double _ws_estimated_end(struct starpu_sched_node * node)
 		STARPU_PTHREAD_MUTEX_UNLOCK(wsd->mutexes[i]);
 
 	}
-	int nb_workers = starpu_bitmap_cardinal(node->workers_in_ctx);
+	int nb_workers = starpu_bitmap_cardinal(component->workers_in_ctx);
 
 	return (sum_start + sum_len) / nb_workers;
 }
 
-double _ws_estimated_load(struct starpu_sched_node * node)
+double _ws_estimated_load(struct starpu_sched_component * component)
 {
-	STARPU_ASSERT(starpu_sched_node_is_work_stealing(node));
-	struct _starpu_work_stealing_data * wsd = node->data;
+	STARPU_ASSERT(starpu_sched_component_is_work_stealing(component));
+	struct _starpu_work_stealing_data * wsd = component->data;
 	int ntasks = 0;
 	int i;
-	for(i = 0; i < node->nchilds; i++)
+	for(i = 0; i < component->nchildren; i++)
 	{
 		STARPU_PTHREAD_MUTEX_LOCK(wsd->mutexes[i]);
 		ntasks += wsd->fifos[i]->ntasks;
@@ -207,9 +207,9 @@ double _ws_estimated_load(struct starpu_sched_node * node)
 	}
 	double speedup = 0.0;
 	int workerid;
-	for(workerid = starpu_bitmap_first(node->workers_in_ctx);
+	for(workerid = starpu_bitmap_first(component->workers_in_ctx);
 	    -1 != workerid;
-	    workerid = starpu_bitmap_next(node->workers_in_ctx, workerid))
+	    workerid = starpu_bitmap_next(component->workers_in_ctx, workerid))
 	{
 		speedup += starpu_worker_get_relative_speedup(starpu_worker_get_perf_archtype(workerid));
 	}
@@ -217,19 +217,19 @@ double _ws_estimated_load(struct starpu_sched_node * node)
 	return ntasks / speedup;
 }
 
-static int push_task(struct starpu_sched_node * node, struct starpu_task * task)
+static int push_task(struct starpu_sched_component * component, struct starpu_task * task)
 {
-	struct _starpu_work_stealing_data * wsd = node->data;
+	struct _starpu_work_stealing_data * wsd = component->data;
 	int ret = -1;
 	int i = wsd->last_push_child;
-	i = (i+1)%node->nchilds;
+	i = (i+1)%component->nchildren;
 
 	STARPU_PTHREAD_MUTEX_LOCK(wsd->mutexes[i]);
 	ret = _starpu_prio_deque_push_task(wsd->fifos[i], task);
 	STARPU_PTHREAD_MUTEX_UNLOCK(wsd->mutexes[i]);
 
 	wsd->last_push_child = i;
-	node->avail(node);
+	component->can_pull(component);
 	return ret;
 }
 
@@ -242,22 +242,22 @@ int starpu_sched_tree_work_stealing_push_task(struct starpu_task *task)
 		return starpu_sched_tree_push_task(task);
 
 	unsigned sched_ctx_id = task->sched_ctx;
-	struct starpu_sched_node * node =starpu_sched_node_worker_get(workerid);
-	while(node->fathers[sched_ctx_id] != NULL)
+	struct starpu_sched_component * component =starpu_sched_component_worker_get(workerid);
+	while(component->fathers[sched_ctx_id] != NULL)
 	{
-		node = node->fathers[sched_ctx_id];
-		if(starpu_sched_node_is_work_stealing(node))
+		component = component->fathers[sched_ctx_id];
+		if(starpu_sched_component_is_work_stealing(component))
 		{
-			if(!starpu_sched_node_can_execute_task(node, task))
+			if(!starpu_sched_component_can_execute_task(component, task))
 				return starpu_sched_tree_push_task(task);
 
 			int i;
-			for(i = 0; i < node->nchilds; i++)
-				if(is_worker_of_node(node->childs[i], workerid))
+			for(i = 0; i < component->nchildren; i++)
+				if(is_worker_of_component(component->children[i], workerid))
 					break;
-			STARPU_ASSERT(i < node->nchilds);
+			STARPU_ASSERT(i < component->nchildren);
 			
-			struct _starpu_work_stealing_data * wsd = node->data;
+			struct _starpu_work_stealing_data * wsd = component->data;
 			STARPU_PTHREAD_MUTEX_LOCK(wsd->mutexes[i]);
 			int ret = _starpu_prio_deque_push_task(wsd->fifos[i] , task);
 			if(ret == 0 && !isnan(task->predicted))
@@ -265,15 +265,7 @@ int starpu_sched_tree_work_stealing_push_task(struct starpu_task *task)
 			STARPU_PTHREAD_MUTEX_UNLOCK(wsd->mutexes[i]);
 			
 			//we need to wake all workers
-/*			int j;
-			for(j = 0; j < node->nchilds; j++)
-			{
-				if(j == i)
-					continue;
-				node->childs[j]->available(node->childs[j]);
-			}
-*/
-			node->avail(node);
+			component->can_pull(component);
 			return ret;
 		}
 	}
@@ -283,78 +275,78 @@ int starpu_sched_tree_work_stealing_push_task(struct starpu_task *task)
 }
 
 
-void _ws_add_child(struct starpu_sched_node * node, struct starpu_sched_node * child)
+void _ws_add_child(struct starpu_sched_component * component, struct starpu_sched_component * child)
 {
-	struct _starpu_work_stealing_data * wsd = node->data;
-	node->add_child(node, child);
-	if(wsd->size < node->nchilds)
+	struct _starpu_work_stealing_data * wsd = component->data;
+	component->add_child(component, child);
+	if(wsd->size < component->nchildren)
 	{
-		STARPU_ASSERT(wsd->size == node->nchilds - 1);
-		wsd->fifos = realloc(wsd->fifos, node->nchilds * sizeof(*wsd->fifos));
-		wsd->mutexes = realloc(wsd->mutexes, node->nchilds * sizeof(*wsd->mutexes));
-		wsd->size = node->nchilds;
+		STARPU_ASSERT(wsd->size == component->nchildren - 1);
+		wsd->fifos = realloc(wsd->fifos, component->nchildren * sizeof(*wsd->fifos));
+		wsd->mutexes = realloc(wsd->mutexes, component->nchildren * sizeof(*wsd->mutexes));
+		wsd->size = component->nchildren;
 	}
 
 	struct _starpu_prio_deque * fifo = malloc(sizeof(*fifo));
 	_starpu_prio_deque_init(fifo);
-	wsd->fifos[node->nchilds - 1] = fifo;
+	wsd->fifos[component->nchildren - 1] = fifo;
 
 	starpu_pthread_mutex_t * mutex = malloc(sizeof(*mutex));
 	STARPU_PTHREAD_MUTEX_INIT(mutex,NULL);
-	wsd->mutexes[node->nchilds - 1] = mutex;
+	wsd->mutexes[component->nchildren - 1] = mutex;
 }
 
-void _ws_remove_child(struct starpu_sched_node * node, struct starpu_sched_node * child)
+void _ws_remove_child(struct starpu_sched_component * component, struct starpu_sched_component * child)
 {
-	struct _starpu_work_stealing_data * wsd = node->data;
+	struct _starpu_work_stealing_data * wsd = component->data;
 
-	STARPU_PTHREAD_MUTEX_DESTROY(wsd->mutexes[node->nchilds - 1]);
-	free(wsd->mutexes[node->nchilds - 1]);
+	STARPU_PTHREAD_MUTEX_DESTROY(wsd->mutexes[component->nchildren - 1]);
+	free(wsd->mutexes[component->nchildren - 1]);
 
-	int i_node;
-	for(i_node = 0; i_node < node->nchilds; i_node++)
+	int i_component;
+	for(i_component = 0; i_component < component->nchildren; i_component++)
 	{
-		if(node->childs[i_node] == child)
+		if(component->children[i_component] == child)
 			break;
 	}
-	STARPU_ASSERT(i_node != node->nchilds);
-	struct _starpu_prio_deque * tmp_fifo = wsd->fifos[i_node];
-	wsd->fifos[i_node] = wsd->fifos[node->nchilds - 1];
+	STARPU_ASSERT(i_component != component->nchildren);
+	struct _starpu_prio_deque * tmp_fifo = wsd->fifos[i_component];
+	wsd->fifos[i_component] = wsd->fifos[component->nchildren - 1];
 
 	
-	node->childs[i_node] = node->childs[node->nchilds - 1];
-	node->nchilds--;
+	component->children[i_component] = component->children[component->nchildren - 1];
+	component->nchildren--;
 	struct starpu_task * task;
 	while((task = _starpu_prio_deque_pop_task(tmp_fifo)))
 	{
-		node->push_task(node, task);
+		component->push_task(component, task);
 	}
 	_starpu_prio_deque_destroy(tmp_fifo);
 	free(tmp_fifo);
 }
 
-void _work_stealing_node_deinit_data(struct starpu_sched_node * node)
+void _work_stealing_component_deinit_data(struct starpu_sched_component * component)
 {
-	free(node->data);
+	free(component->data);
 }
 
-int starpu_sched_node_is_work_stealing(struct starpu_sched_node * node)
+int starpu_sched_component_is_work_stealing(struct starpu_sched_component * component)
 {
-	return node->push_task == push_task;
+	return component->push_task == push_task;
 }
 
-struct starpu_sched_node * starpu_sched_node_work_stealing_create(void * arg STARPU_ATTRIBUTE_UNUSED)
+struct starpu_sched_component * starpu_sched_component_work_stealing_create(void * arg STARPU_ATTRIBUTE_UNUSED)
 {
-	struct starpu_sched_node * node = starpu_sched_node_create();
+	struct starpu_sched_component * component = starpu_sched_component_create();
 	struct _starpu_work_stealing_data * wsd = malloc(sizeof(*wsd));
 	memset(wsd, 0, sizeof(*wsd));
-	node->pop_task = pop_task;
-	node->push_task = push_task;
-	node->add_child = _ws_add_child;
-	node->remove_child = _ws_remove_child;
-	node->estimated_end = _ws_estimated_end;
-	node->estimated_load = _ws_estimated_load;
-	node->deinit_data = _work_stealing_node_deinit_data;
-	node->data = wsd;
-	return  node;
+	component->pop_task = pop_task;
+	component->push_task = push_task;
+	component->add_child = _ws_add_child;
+	component->remove_child = _ws_remove_child;
+	component->estimated_end = _ws_estimated_end;
+	component->estimated_load = _ws_estimated_load;
+	component->deinit_data = _work_stealing_component_deinit_data;
+	component->data = wsd;
+	return  component;
 }

+ 198 - 198
src/sched_policies/node_worker.c

@@ -19,7 +19,7 @@
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
 
-#include <starpu_sched_node.h>
+#include <starpu_sched_component.h>
 #include <core/workers.h>
 
 #include <float.h>
@@ -71,7 +71,7 @@ struct _starpu_task_grid
 	 * all the others use the pntasks that point to it
 	 *
 	 * when the counter reach 0, all the left and right member are set to NULL,
-	 * that mean that we will free that nodes.
+	 * that mean that we will free that components.
 	 */
 	union
 	{
@@ -82,7 +82,7 @@ struct _starpu_task_grid
 
 
 /* list->exp_start, list->exp_len, list-exp_end and list->ntasks
- * are updated by starpu_sched_node_worker_push_task(node, task) and pre_exec_hook
+ * are updated by starpu_sched_component_worker_push_task(component, task) and pre_exec_hook
  */
 struct _starpu_worker_task_list
 {
@@ -92,14 +92,14 @@ struct _starpu_worker_task_list
 	starpu_pthread_mutex_t mutex;
 };
 
-enum _starpu_worker_node_status
+enum _starpu_worker_component_status
 {
-	NODE_STATUS_SLEEPING,
-	NODE_STATUS_RESET,
-	NODE_STATUS_CHANGED
+	COMPONENT_STATUS_SLEEPING,
+	COMPONENT_STATUS_RESET,
+	COMPONENT_STATUS_CHANGED
 };
 
-struct _starpu_worker_node_data
+struct _starpu_worker_component_data
 {
 	union 
 	{
@@ -111,11 +111,11 @@ struct _starpu_worker_node_data
 		struct _starpu_combined_worker * combined_worker;
 	};
 	struct _starpu_worker_task_list * list;
-	enum _starpu_worker_node_status status;
+	enum _starpu_worker_component_status status;
 };
 
-/* this array store worker nodes */
-static struct starpu_sched_node * _worker_nodes[STARPU_NMAXWORKERS];
+/* this array store worker components */
+static struct starpu_sched_component * _worker_components[STARPU_NMAXWORKERS];
 	
 
 static struct _starpu_worker_task_list * _starpu_worker_task_list_create(void)
@@ -274,135 +274,135 @@ static inline struct starpu_task * _starpu_worker_task_list_pop(struct _starpu_w
 
 
 
-static struct starpu_sched_node * starpu_sched_node_worker_create(int workerid);
-static struct starpu_sched_node * starpu_sched_node_combined_worker_create(int workerid);
-struct starpu_sched_node * starpu_sched_node_worker_get(int workerid)
+static struct starpu_sched_component * starpu_sched_component_worker_create(int workerid);
+static struct starpu_sched_component * starpu_sched_component_combined_worker_create(int workerid);
+struct starpu_sched_component * starpu_sched_component_worker_get(int workerid)
 {
 	STARPU_ASSERT(workerid >= 0 && workerid < STARPU_NMAXWORKERS);
 	/* we may need to take a mutex here */
-	if(_worker_nodes[workerid])
-		return _worker_nodes[workerid];
+	if(_worker_components[workerid])
+		return _worker_components[workerid];
 	else
 	{
-		struct starpu_sched_node * node;
+		struct starpu_sched_component * component;
 		if(workerid < (int) starpu_worker_get_count())
-			node = starpu_sched_node_worker_create(workerid);
+			component = starpu_sched_component_worker_create(workerid);
 		else
-			node = starpu_sched_node_combined_worker_create(workerid);
-		_worker_nodes[workerid] = node;
-		return node;
+			component = starpu_sched_component_combined_worker_create(workerid);
+		_worker_components[workerid] = component;
+		return component;
 	}
 }
 
-struct _starpu_worker * _starpu_sched_node_worker_get_worker(struct starpu_sched_node * worker_node)
+struct _starpu_worker * _starpu_sched_component_worker_get_worker(struct starpu_sched_component * worker_component)
 {
-	STARPU_ASSERT(starpu_sched_node_is_simple_worker(worker_node));
-	struct _starpu_worker_node_data * data = worker_node->data;
+	STARPU_ASSERT(starpu_sched_component_is_simple_worker(worker_component));
+	struct _starpu_worker_component_data * data = worker_component->data;
 	return data->worker;
 }
-struct _starpu_combined_worker * _starpu_sched_node_combined_worker_get_combined_worker(struct starpu_sched_node * worker_node)
+struct _starpu_combined_worker * _starpu_sched_component_combined_worker_get_combined_worker(struct starpu_sched_component * worker_component)
 {
-	STARPU_ASSERT(starpu_sched_node_is_combined_worker(worker_node));
-	struct _starpu_worker_node_data * data = worker_node->data;
+	STARPU_ASSERT(starpu_sched_component_is_combined_worker(worker_component));
+	struct _starpu_worker_component_data * data = worker_component->data;
 	return data->combined_worker;
 }
 
 /*
-enum starpu_perfmodel_archtype starpu_sched_node_worker_get_perf_arch(struct starpu_sched_node * worker_node)
+enum starpu_perfmodel_archtype starpu_sched_component_worker_get_perf_arch(struct starpu_sched_component * worker_component)
 {
-	STARPU_ASSERT(starpu_sched_node_is_worker(worker_node));
-	if(starpu_sched_node_is_simple_worker(worker_node))
-		return _starpu_sched_node_worker_get_worker(worker_node)->perf_arch;
+	STARPU_ASSERT(starpu_sched_component_is_worker(worker_component));
+	if(starpu_sched_component_is_simple_worker(worker_component))
+		return _starpu_sched_component_worker_get_worker(worker_component)->perf_arch;
 	else
-		return _starpu_sched_node_combined_worker_get_combined_worker(worker_node)->perf_arch;
+		return _starpu_sched_component_combined_worker_get_combined_worker(worker_component)->perf_arch;
 }
 */
 
-static void _starpu_sched_node_worker_set_sleep_status(struct starpu_sched_node * worker_node)
+static void _starpu_sched_component_worker_set_sleep_status(struct starpu_sched_component * worker_component)
 {
-	STARPU_ASSERT(starpu_sched_node_is_worker(worker_node));
-	struct _starpu_worker_node_data * data = worker_node->data;
-	data->status = NODE_STATUS_SLEEPING;
+	STARPU_ASSERT(starpu_sched_component_is_worker(worker_component));
+	struct _starpu_worker_component_data * data = worker_component->data;
+	data->status = COMPONENT_STATUS_SLEEPING;
 }
 
-static void _starpu_sched_node_worker_set_changed_status(struct starpu_sched_node * worker_node)
+static void _starpu_sched_component_worker_set_changed_status(struct starpu_sched_component * worker_component)
 {
-	STARPU_ASSERT(starpu_sched_node_is_worker(worker_node));
-	struct _starpu_worker_node_data * data = worker_node->data;
-	data->status = NODE_STATUS_CHANGED;
+	STARPU_ASSERT(starpu_sched_component_is_worker(worker_component));
+	struct _starpu_worker_component_data * data = worker_component->data;
+	data->status = COMPONENT_STATUS_CHANGED;
 }
 
-static void _starpu_sched_node_worker_reset_status(struct starpu_sched_node * worker_node)
+static void _starpu_sched_component_worker_reset_status(struct starpu_sched_component * worker_component)
 {
-	STARPU_ASSERT(starpu_sched_node_is_worker(worker_node));
-	struct _starpu_worker_node_data * data = worker_node->data;
-	data->status = NODE_STATUS_RESET;
+	STARPU_ASSERT(starpu_sched_component_is_worker(worker_component));
+	struct _starpu_worker_component_data * data = worker_component->data;
+	data->status = COMPONENT_STATUS_RESET;
 }
 
-static int _starpu_sched_node_worker_is_reset_status(struct starpu_sched_node * worker_node)
+static int _starpu_sched_component_worker_is_reset_status(struct starpu_sched_component * worker_component)
 {
-	STARPU_ASSERT(starpu_sched_node_is_worker(worker_node));
-	struct _starpu_worker_node_data * data = worker_node->data;
-	return (data->status == NODE_STATUS_RESET);
+	STARPU_ASSERT(starpu_sched_component_is_worker(worker_component));
+	struct _starpu_worker_component_data * data = worker_component->data;
+	return (data->status == COMPONENT_STATUS_RESET);
 }
 
-static int _starpu_sched_node_worker_is_changed_status(struct starpu_sched_node * worker_node)
+static int _starpu_sched_component_worker_is_changed_status(struct starpu_sched_component * worker_component)
 {
-	STARPU_ASSERT(starpu_sched_node_is_worker(worker_node));
-	struct _starpu_worker_node_data * data = worker_node->data;
-	return (data->status == NODE_STATUS_CHANGED);
+	STARPU_ASSERT(starpu_sched_component_is_worker(worker_component));
+	struct _starpu_worker_component_data * data = worker_component->data;
+	return (data->status == COMPONENT_STATUS_CHANGED);
 }
 
-static int _starpu_sched_node_worker_is_sleeping_status(struct starpu_sched_node * worker_node)
+static int _starpu_sched_component_worker_is_sleeping_status(struct starpu_sched_component * worker_component)
 {
-	STARPU_ASSERT(starpu_sched_node_is_worker(worker_node));
-	struct _starpu_worker_node_data * data = worker_node->data;
-	return (data->status == NODE_STATUS_SLEEPING);
+	STARPU_ASSERT(starpu_sched_component_is_worker(worker_component));
+	struct _starpu_worker_component_data * data = worker_component->data;
+	return (data->status == COMPONENT_STATUS_SLEEPING);
 }
 
-void _starpu_sched_node_lock_worker(int workerid)
+void _starpu_sched_component_lock_worker(int workerid)
 {
 	STARPU_ASSERT(0 <= workerid && workerid < (int) starpu_worker_get_count());
-	struct _starpu_worker_node_data * data = starpu_sched_node_worker_create(workerid)->data;
+	struct _starpu_worker_component_data * data = starpu_sched_component_worker_create(workerid)->data;
 	STARPU_PTHREAD_MUTEX_LOCK(&data->lock);
 }
-void _starpu_sched_node_unlock_worker(int workerid)
+void _starpu_sched_component_unlock_worker(int workerid)
 {
 	STARPU_ASSERT(0 <= workerid && workerid < (int)starpu_worker_get_count());
-	struct _starpu_worker_node_data * data = starpu_sched_node_worker_create(workerid)->data;
+	struct _starpu_worker_component_data * data = starpu_sched_component_worker_create(workerid)->data;
 	STARPU_PTHREAD_MUTEX_UNLOCK(&data->lock);
 }
 
-static void simple_worker_available(struct starpu_sched_node * worker_node)
+static void simple_worker_can_pull(struct starpu_sched_component * worker_component)
 {
-	(void) worker_node;
-	struct _starpu_worker * w = _starpu_sched_node_worker_get_worker(worker_node);
-	_starpu_sched_node_lock_worker(w->workerid);
-	if(_starpu_sched_node_worker_is_reset_status(worker_node))
-		_starpu_sched_node_worker_set_changed_status(worker_node);
+	(void) worker_component;
+	struct _starpu_worker * w = _starpu_sched_component_worker_get_worker(worker_component);
+	_starpu_sched_component_lock_worker(w->workerid);
+	if(_starpu_sched_component_worker_is_reset_status(worker_component))
+		_starpu_sched_component_worker_set_changed_status(worker_component);
 
 	if(w->workerid == starpu_worker_get_id())
 	{
-		_starpu_sched_node_unlock_worker(w->workerid);
+		_starpu_sched_component_unlock_worker(w->workerid);
 		return;
 	}
-	if(_starpu_sched_node_worker_is_sleeping_status(worker_node))
+	if(_starpu_sched_component_worker_is_sleeping_status(worker_component))
 	{
 		starpu_pthread_mutex_t *sched_mutex;
 		starpu_pthread_cond_t *sched_cond;
 		starpu_worker_get_sched_condition(w->workerid, &sched_mutex, &sched_cond);
-		_starpu_sched_node_unlock_worker(w->workerid);
+		_starpu_sched_component_unlock_worker(w->workerid);
 		starpu_wakeup_worker(w->workerid, sched_cond, sched_mutex);
 	}
 	else
-		_starpu_sched_node_unlock_worker(w->workerid);
+		_starpu_sched_component_unlock_worker(w->workerid);
 }
 
-static void combined_worker_available(struct starpu_sched_node * node)
+static void combined_worker_can_pull(struct starpu_sched_component * component)
 {
-	(void) node;
-	STARPU_ASSERT(starpu_sched_node_is_combined_worker(node));
-	struct _starpu_worker_node_data * data = node->data;
+	(void) component;
+	STARPU_ASSERT(starpu_sched_component_is_combined_worker(component));
+	struct _starpu_worker_component_data * data = component->data;
 	int workerid = starpu_worker_get_id();
 	int i;
 	for(i = 0; i < data->combined_worker->worker_size; i++)
@@ -410,31 +410,31 @@ static void combined_worker_available(struct starpu_sched_node * node)
 		if(i == workerid)
 			continue;
 		int worker = data->combined_worker->combined_workerid[i];
-		_starpu_sched_node_lock_worker(worker);
-		if(_starpu_sched_node_worker_is_sleeping_status(node))
+		_starpu_sched_component_lock_worker(worker);
+		if(_starpu_sched_component_worker_is_sleeping_status(component))
 		{
 			starpu_pthread_mutex_t *sched_mutex;
 			starpu_pthread_cond_t *sched_cond;
 			starpu_worker_get_sched_condition(worker, &sched_mutex, &sched_cond);
 			starpu_wakeup_worker(worker, sched_cond, sched_mutex);
 		}
-		if(_starpu_sched_node_worker_is_reset_status(node))
-			_starpu_sched_node_worker_set_changed_status(node);
+		if(_starpu_sched_component_worker_is_reset_status(component))
+			_starpu_sched_component_worker_set_changed_status(component);
 
-		_starpu_sched_node_unlock_worker(worker);
+		_starpu_sched_component_unlock_worker(worker);
 	}
 }
 
-static int simple_worker_push_task(struct starpu_sched_node * node, struct starpu_task *task)
+static int simple_worker_push_task(struct starpu_sched_component * component, struct starpu_task *task)
 {
-	STARPU_ASSERT(starpu_sched_node_is_worker(node));
+	STARPU_ASSERT(starpu_sched_component_is_worker(component));
 	/*this function take the worker's mutex */
-	struct _starpu_worker_node_data * data = node->data;
+	struct _starpu_worker_component_data * data = component->data;
 	struct _starpu_task_grid * t = _starpu_task_grid_create();
 	t->task = task;
 	t->ntasks = 1;
 
-	task->workerid = starpu_bitmap_first(node->workers);
+	task->workerid = starpu_bitmap_first(component->workers);
 #if 1 /* dead lock problem? */
 	if (starpu_get_prefetch_flag())
 	{
@@ -445,13 +445,13 @@ static int simple_worker_push_task(struct starpu_sched_node * node, struct starp
 	STARPU_PTHREAD_MUTEX_LOCK(&data->list->mutex);
 	_starpu_worker_task_list_push(data->list, t);
 	STARPU_PTHREAD_MUTEX_UNLOCK(&data->list->mutex);
-	simple_worker_available(node);	
+	simple_worker_can_pull(component);	
 	return 0;
 }
 
-struct starpu_task * simple_worker_pop_task(struct starpu_sched_node *node)
+struct starpu_task * simple_worker_pop_task(struct starpu_sched_component *component)
 {
-	struct _starpu_worker_node_data * data = node->data;
+	struct _starpu_worker_component_data * data = component->data;
 	struct _starpu_worker_task_list * list = data->list;
 	STARPU_PTHREAD_MUTEX_LOCK(&list->mutex);
 	struct starpu_task * task =  _starpu_worker_task_list_pop(list);
@@ -463,34 +463,34 @@ struct starpu_task * simple_worker_pop_task(struct starpu_sched_node *node)
 	}
 	STARPU_PTHREAD_MUTEX_LOCK(&data->lock);
 	int i;
-	_starpu_sched_node_worker_reset_status(node);
-	for(i=0; i < node->nfathers; i++)
+	_starpu_sched_component_worker_reset_status(component);
+	for(i=0; i < component->nfathers; i++)
 	{
-		if(node->fathers[i] == NULL)
+		if(component->fathers[i] == NULL)
 			continue;
 		else
 		{
-			task = node->fathers[i]->pop_task(node->fathers[i]);
+			task = component->fathers[i]->pop_task(component->fathers[i]);
 			if(task)
 				break;
 		}
 	}
-	if((!task) && _starpu_sched_node_worker_is_changed_status(node))
+	if((!task) && _starpu_sched_component_worker_is_changed_status(component))
 	{
-		for(i=0; i < node->nfathers; i++)
+		for(i=0; i < component->nfathers; i++)
 		{
-			if(node->fathers[i] == NULL)
+			if(component->fathers[i] == NULL)
 				continue;
 			else
 			{
-				task = node->fathers[i]->pop_task(node->fathers[i]);
+				task = component->fathers[i]->pop_task(component->fathers[i]);
 				if(task)
 					break;
 			}
 		}
 		STARPU_ASSERT(task);
 	}
-	_starpu_sched_node_worker_set_sleep_status(node);
+	_starpu_sched_component_worker_set_sleep_status(component);
 	STARPU_PTHREAD_MUTEX_UNLOCK(&data->lock);
 	if(!task)
 		return NULL;
@@ -502,40 +502,40 @@ struct starpu_task * simple_worker_pop_task(struct starpu_sched_node *node)
 			starpu_push_task_end(task);
 			return task;
 		}
-		struct starpu_sched_node * combined_worker_node = starpu_sched_node_worker_get(workerid);
-		(void)combined_worker_node->push_task(combined_worker_node, task);
+		struct starpu_sched_component * combined_worker_component = starpu_sched_component_worker_get(workerid);
+		(void)combined_worker_component->push_task(combined_worker_component, task);
 		/* we have pushed a task in queue, so can make a recursive call */
-		return simple_worker_pop_task(node);
+		return simple_worker_pop_task(component);
 
 	}
 	if(task)
 		starpu_push_task_end(task);
 	return task;
 }
-void starpu_sched_node_worker_destroy(struct starpu_sched_node *node)
+void starpu_sched_component_worker_destroy(struct starpu_sched_component *component)
 {
-	struct _starpu_worker * worker = _starpu_sched_node_worker_get_worker(node);
+	struct _starpu_worker * worker = _starpu_sched_component_worker_get_worker(component);
 	unsigned id = worker->workerid;
-	assert(_worker_nodes[id] == node);
+	assert(_worker_components[id] == component);
 	int i;
 	for(i = 0; i < STARPU_NMAX_SCHED_CTXS ; i++)
-		if(node->fathers[i] != NULL)
-			return;//this node is shared between several contexts
-	starpu_sched_node_destroy(node);
-	_worker_nodes[id] = NULL;
+		if(component->fathers[i] != NULL)
+			return;//this component is shared between several contexts
+	starpu_sched_component_destroy(component);
+	_worker_components[id] = NULL;
 }
 
-void _starpu_sched_node_lock_all_workers(void)
+void _starpu_sched_component_lock_all_workers(void)
 {
 	unsigned i;
 	for(i = 0; i < starpu_worker_get_count(); i++)
-		_starpu_sched_node_lock_worker(i);
+		_starpu_sched_component_lock_worker(i);
 }
-void _starpu_sched_node_unlock_all_workers(void)
+void _starpu_sched_component_unlock_all_workers(void)
 {
 	unsigned i;
 	for(i = 0; i < starpu_worker_get_count(); i++)
-		_starpu_sched_node_unlock_worker(i);
+		_starpu_sched_component_unlock_worker(i);
 }
 
 
@@ -562,16 +562,16 @@ static double worker_estimated_finish_time(struct _starpu_worker * worker)
 	return sum + starpu_timing_now();
 }
 */
-static double combined_worker_estimated_end(struct starpu_sched_node * node)
+static double combined_worker_estimated_end(struct starpu_sched_component * component)
 {
-	STARPU_ASSERT(starpu_sched_node_is_combined_worker(node));
-	struct _starpu_worker_node_data * data = node->data;
+	STARPU_ASSERT(starpu_sched_component_is_combined_worker(component));
+	struct _starpu_worker_component_data * data = component->data;
 	struct _starpu_combined_worker * combined_worker = data->combined_worker;
 	double max = 0.0;
 	int i;
 	for(i = 0; i < combined_worker->worker_size; i++)
 	{
-		data = _worker_nodes[combined_worker->combined_workerid[i]]->data;
+		data = _worker_components[combined_worker->combined_workerid[i]]->data;
 		STARPU_PTHREAD_MUTEX_LOCK(&data->list->mutex);
 		double tmp = data->list->exp_end;
 		STARPU_PTHREAD_MUTEX_UNLOCK(&data->list->mutex);
@@ -579,9 +579,9 @@ static double combined_worker_estimated_end(struct starpu_sched_node * node)
 	}
 	return max;
 }
-static double simple_worker_estimated_end(struct starpu_sched_node * node)
+static double simple_worker_estimated_end(struct starpu_sched_component * component)
 {
-	struct _starpu_worker_node_data * data = node->data;
+	struct _starpu_worker_component_data * data = component->data;
 	STARPU_PTHREAD_MUTEX_LOCK(&data->list->mutex);
 	data->list->exp_start = STARPU_MAX(starpu_timing_now(), data->list->exp_start);
 	double tmp = data->list->exp_end = data->list->exp_start + data->list->exp_len;
@@ -591,9 +591,9 @@ static double simple_worker_estimated_end(struct starpu_sched_node * node)
 
 
 
-static double simple_worker_estimated_load(struct starpu_sched_node * node)
+static double simple_worker_estimated_load(struct starpu_sched_component * component)
 {
-	struct _starpu_worker * worker = _starpu_sched_node_worker_get_worker(node);
+	struct _starpu_worker * worker = _starpu_sched_component_worker_get_worker(component);
 	int nb_task = 0;
 	STARPU_PTHREAD_MUTEX_LOCK(&worker->mutex);
 	struct starpu_task_list list = worker->local_tasks;
@@ -603,37 +603,37 @@ static double simple_worker_estimated_load(struct starpu_sched_node * node)
 	    task = starpu_task_list_next(task))
 		nb_task++;
 	STARPU_PTHREAD_MUTEX_UNLOCK(&worker->mutex);
-	struct _starpu_worker_node_data * d = node->data;
+	struct _starpu_worker_component_data * d = component->data;
 	struct _starpu_worker_task_list * l = d->list;
 	int ntasks_in_fifo = l ? l->ntasks : 0;
 	return (double) (nb_task + ntasks_in_fifo)
 		/ starpu_worker_get_relative_speedup(
-				starpu_worker_get_perf_archtype(starpu_bitmap_first(node->workers)));
+				starpu_worker_get_perf_archtype(starpu_bitmap_first(component->workers)));
 }
 
-static double combined_worker_estimated_load(struct starpu_sched_node * node)
+static double combined_worker_estimated_load(struct starpu_sched_component * component)
 {
-	struct _starpu_worker_node_data * d = node->data;
+	struct _starpu_worker_component_data * d = component->data;
 	struct _starpu_combined_worker * c = d->combined_worker;
 	double load = 0;
 	int i;
 	for(i = 0; i < c->worker_size; i++)
 	{
-		struct starpu_sched_node * n = starpu_sched_node_worker_get(c->combined_workerid[i]);
+		struct starpu_sched_component * n = starpu_sched_component_worker_get(c->combined_workerid[i]);
 		load += n->estimated_load(n);
 	}
 	return load;
 }
 
-static int combined_worker_push_task(struct starpu_sched_node * node, struct starpu_task *task)
+static int combined_worker_push_task(struct starpu_sched_component * component, struct starpu_task *task)
 {
-	STARPU_ASSERT(starpu_sched_node_is_combined_worker(node));
-	struct _starpu_worker_node_data * data = node->data;
+	STARPU_ASSERT(starpu_sched_component_is_combined_worker(component));
+	struct _starpu_worker_component_data * data = component->data;
 	STARPU_ASSERT(data->combined_worker && !data->worker);
 	struct _starpu_combined_worker  * combined_worker = data->combined_worker;
 	STARPU_ASSERT(combined_worker->worker_size >= 1);
 	struct _starpu_task_grid * task_alias[combined_worker->worker_size];
-	starpu_parallel_task_barrier_init(task, starpu_bitmap_first(node->workers));
+	starpu_parallel_task_barrier_init(task, starpu_bitmap_first(component->workers));
 	task_alias[0] = _starpu_task_grid_create();
 	task_alias[0]->task = starpu_task_dup(task);
 	task_alias[0]->task->workerid = combined_worker->combined_workerid[0];
@@ -654,8 +654,8 @@ static int combined_worker_push_task(struct starpu_sched_node * node, struct sta
 	i = 0;
 	do
 	{
-		struct starpu_sched_node * worker_node = starpu_sched_node_worker_get(combined_worker->combined_workerid[i]);
-		struct _starpu_worker_node_data * worker_data = worker_node->data;
+		struct starpu_sched_component * worker_component = starpu_sched_component_worker_get(combined_worker->combined_workerid[i]);
+		struct _starpu_worker_component_data * worker_data = worker_component->data;
 		struct _starpu_worker_task_list * list = worker_data->list;
 		STARPU_PTHREAD_MUTEX_LOCK(&list->mutex);
 		if(mutex_to_unlock)
@@ -672,7 +672,7 @@ static int combined_worker_push_task(struct starpu_sched_node * node, struct sta
 	int workerid = starpu_worker_get_id();
 	if(-1 == workerid)
 	{
-		combined_worker_available(node);
+		combined_worker_can_pull(component);
 	}
 	else
 	{
@@ -684,11 +684,11 @@ static int combined_worker_push_task(struct starpu_sched_node * node, struct sta
 		/* wake up all other workers of combined worker */
 		for(i = 0; i < combined_worker->worker_size; i++)
 		{
-			struct starpu_sched_node * worker_node = starpu_sched_node_worker_get(combined_worker->combined_workerid[i]);
-			simple_worker_available(worker_node);
+			struct starpu_sched_component * worker_component = starpu_sched_component_worker_get(combined_worker->combined_workerid[i]);
+			simple_worker_can_pull(worker_component);
 		}
 
-		combined_worker_available(node);
+		combined_worker_can_pull(component);
 
 		STARPU_PTHREAD_MUTEX_LOCK(worker_sched_mutex);
 	}
@@ -696,146 +696,146 @@ static int combined_worker_push_task(struct starpu_sched_node * node, struct sta
 	return 0;
 }
 
-void _worker_node_deinit_data(struct starpu_sched_node * node)
+void _worker_component_deinit_data(struct starpu_sched_component * component)
 {
-	struct _starpu_worker_node_data * d = node->data;
+	struct _starpu_worker_component_data * d = component->data;
 	_starpu_worker_task_list_destroy(d->list);
-	if(starpu_sched_node_is_simple_worker(node))
+	if(starpu_sched_component_is_simple_worker(component))
 		STARPU_PTHREAD_MUTEX_DESTROY(&d->lock);
 	int i;
 	for(i = 0; i < STARPU_NMAXWORKERS; i++)
-		if(_worker_nodes[i] == node)
+		if(_worker_components[i] == component)
 		{
-			_worker_nodes[i] = NULL;
+			_worker_components[i] = NULL;
 			return;
 		}
 	free(d);
 }
 
-static struct starpu_sched_node * starpu_sched_node_worker_create(int workerid)
+static struct starpu_sched_component * starpu_sched_component_worker_create(int workerid)
 {
 	STARPU_ASSERT(0 <=  workerid && workerid < (int) starpu_worker_get_count());
 
-	if(_worker_nodes[workerid])
-		return _worker_nodes[workerid];
+	if(_worker_components[workerid])
+		return _worker_components[workerid];
 
 	struct _starpu_worker * worker = _starpu_get_worker_struct(workerid);
 	if(worker == NULL)
 		return NULL;
-	struct starpu_sched_node * node = starpu_sched_node_create();
-	struct _starpu_worker_node_data * data = malloc(sizeof(*data));
+	struct starpu_sched_component * component = starpu_sched_component_create();
+	struct _starpu_worker_component_data * data = malloc(sizeof(*data));
 	memset(data, 0, sizeof(*data));
 
 	data->worker = worker;
 	STARPU_PTHREAD_MUTEX_INIT(&data->lock,NULL);
-	data->status = NODE_STATUS_SLEEPING;
+	data->status = COMPONENT_STATUS_SLEEPING;
 	data->list = _starpu_worker_task_list_create();
-	node->data = data;
-
-	node->push_task = simple_worker_push_task;
-	node->pop_task = simple_worker_pop_task;
-	node->avail = simple_worker_available;
-	node->estimated_end = simple_worker_estimated_end;
-	node->estimated_load = simple_worker_estimated_load;
-	node->deinit_data = _worker_node_deinit_data;
-	starpu_bitmap_set(node->workers, workerid);
-	starpu_bitmap_or(node->workers_in_ctx, node->workers);
-	_worker_nodes[workerid] = node;
+	component->data = data;
+
+	component->push_task = simple_worker_push_task;
+	component->pop_task = simple_worker_pop_task;
+	component->can_pull = simple_worker_can_pull;
+	component->estimated_end = simple_worker_estimated_end;
+	component->estimated_load = simple_worker_estimated_load;
+	component->deinit_data = _worker_component_deinit_data;
+	starpu_bitmap_set(component->workers, workerid);
+	starpu_bitmap_or(component->workers_in_ctx, component->workers);
+	_worker_components[workerid] = component;
 
 #ifdef STARPU_HAVE_HWLOC
 	struct _starpu_machine_config *config = _starpu_get_machine_config();
 	struct _starpu_machine_topology *topology = &config->topology;
 	hwloc_obj_t obj = hwloc_get_obj_by_depth(topology->hwtopology, config->cpu_depth, worker->bindid);
 	STARPU_ASSERT(obj);
-	node->obj = obj;
+	component->obj = obj;
 #endif
 
-	return node;
+	return component;
 }
 
 
-static struct starpu_sched_node  * starpu_sched_node_combined_worker_create(int workerid)
+static struct starpu_sched_component  * starpu_sched_component_combined_worker_create(int workerid)
 {
 	STARPU_ASSERT(0 <= workerid && workerid <  STARPU_NMAXWORKERS);
 
-	if(_worker_nodes[workerid])
-		return _worker_nodes[workerid];
+	if(_worker_components[workerid])
+		return _worker_components[workerid];
 
 	struct _starpu_combined_worker * combined_worker = _starpu_get_combined_worker_struct(workerid);
 	if(combined_worker == NULL)
 		return NULL;
-	struct starpu_sched_node * node = starpu_sched_node_create();
-	struct _starpu_worker_node_data * data = malloc(sizeof(*data));
+	struct starpu_sched_component * component = starpu_sched_component_create();
+	struct _starpu_worker_component_data * data = malloc(sizeof(*data));
 	memset(data, 0, sizeof(*data));
 	data->combined_worker = combined_worker;
-	data->status = NODE_STATUS_SLEEPING;
-
-	node->data = data;
-	node->push_task = combined_worker_push_task;
-	node->pop_task = NULL;
-	node->estimated_end = combined_worker_estimated_end;
-	node->estimated_load = combined_worker_estimated_load;
-	node->avail = combined_worker_available;
-	node->deinit_data = _worker_node_deinit_data;
-	starpu_bitmap_set(node->workers, workerid);
-	starpu_bitmap_or(node->workers_in_ctx, node->workers);
-	_worker_nodes[workerid] = node;
+	data->status = COMPONENT_STATUS_SLEEPING;
+
+	component->data = data;
+	component->push_task = combined_worker_push_task;
+	component->pop_task = NULL;
+	component->estimated_end = combined_worker_estimated_end;
+	component->estimated_load = combined_worker_estimated_load;
+	component->can_pull = combined_worker_can_pull;
+	component->deinit_data = _worker_component_deinit_data;
+	starpu_bitmap_set(component->workers, workerid);
+	starpu_bitmap_or(component->workers_in_ctx, component->workers);
+	_worker_components[workerid] = component;
 
 #ifdef STARPU_HAVE_HWLOC
 	struct _starpu_machine_config *config = _starpu_get_machine_config();
 	struct _starpu_machine_topology *topology = &config->topology;
 	hwloc_obj_t obj = hwloc_get_obj_by_depth(topology->hwtopology, config->cpu_depth, combined_worker->combined_workerid[0]);
 	STARPU_ASSERT(obj);
-	node->obj = obj;
+	component->obj = obj;
 #endif
-	return node;
+	return component;
 }
 
-int starpu_sched_node_is_simple_worker(struct starpu_sched_node * node)
+int starpu_sched_component_is_simple_worker(struct starpu_sched_component * component)
 {
-	return node->push_task == simple_worker_push_task;
+	return component->push_task == simple_worker_push_task;
 }
-int starpu_sched_node_is_combined_worker(struct starpu_sched_node * node)
+int starpu_sched_component_is_combined_worker(struct starpu_sched_component * component)
 {
-	return node->push_task == combined_worker_push_task;
+	return component->push_task == combined_worker_push_task;
 }
 
-int starpu_sched_node_is_worker(struct starpu_sched_node * node)
+int starpu_sched_component_is_worker(struct starpu_sched_component * component)
 {
-	return starpu_sched_node_is_simple_worker(node)
-		|| starpu_sched_node_is_combined_worker(node);
+	return starpu_sched_component_is_simple_worker(component)
+		|| starpu_sched_component_is_combined_worker(component);
 }
 
 
 
 #ifndef STARPU_NO_ASSERT
-static int _worker_consistant(struct starpu_sched_node * node)
+static int _worker_consistant(struct starpu_sched_component * component)
 {
 	int is_a_worker = 0;
 	int i;
 	for(i = 0; i<STARPU_NMAXWORKERS; i++)
-		if(_worker_nodes[i] == node)
+		if(_worker_components[i] == component)
 			is_a_worker = 1;
 	if(!is_a_worker)
 		return 0;
-	struct _starpu_worker_node_data * data = node->data;
+	struct _starpu_worker_component_data * data = component->data;
 	if(data->worker)
 	{
 		int id = data->worker->workerid;
-		return  (_worker_nodes[id] == node)
-			&&  node->nchilds == 0;
+		return  (_worker_components[id] == component)
+			&&  component->nchildren == 0;
 	}
 	return 1;
 }
 #endif
 
-int starpu_sched_node_worker_get_workerid(struct starpu_sched_node * worker_node)
+int starpu_sched_component_worker_get_workerid(struct starpu_sched_component * worker_component)
 {
 #ifndef STARPU_NO_ASSERT
-	STARPU_ASSERT(_worker_consistant(worker_node));
+	STARPU_ASSERT(_worker_consistant(worker_component));
 #endif
-	STARPU_ASSERT(1 == starpu_bitmap_cardinal(worker_node->workers));
-	return starpu_bitmap_first(worker_node->workers);
+	STARPU_ASSERT(1 == starpu_bitmap_cardinal(worker_component->workers));
+	return starpu_bitmap_first(worker_component->workers);
 }
 
 
@@ -843,12 +843,12 @@ static struct _starpu_worker_task_list * _worker_get_list(void)
 {
 	int workerid = starpu_worker_get_id();
 	STARPU_ASSERT(0 <= workerid && workerid < (int) starpu_worker_get_count());
-	struct _starpu_worker_node_data * d = starpu_sched_node_worker_get(workerid)->data;
+	struct _starpu_worker_component_data * d = starpu_sched_component_worker_get(workerid)->data;
 	return d->list;
 }
 
 
-void starpu_sched_node_worker_pre_exec_hook(struct starpu_task * task)
+void starpu_sched_component_worker_pre_exec_hook(struct starpu_task * task)
 {
 	if(!isnan(task->predicted))
 	{
@@ -867,7 +867,7 @@ void starpu_sched_node_worker_pre_exec_hook(struct starpu_task * task)
 		STARPU_PTHREAD_MUTEX_UNLOCK(&list->mutex);
 	}
 }
-void starpu_sched_node_worker_post_exec_hook(struct starpu_task * task)
+void starpu_sched_component_worker_post_exec_hook(struct starpu_task * task)
 {
 	if(task->execute_on_a_specific_worker)
 		return;
@@ -880,15 +880,15 @@ void starpu_sched_node_worker_post_exec_hook(struct starpu_task * task)
 
 
 #if 0
-static void starpu_sched_node_worker_push_task_notify(struct starpu_task * task, int workerid, unsigned sched_ctx_id STARPU_ATTRIBUTE_UNUSED)
+static void starpu_sched_component_worker_push_task_notify(struct starpu_task * task, int workerid, unsigned sched_ctx_id STARPU_ATTRIBUTE_UNUSED)
 {
 
-	struct starpu_sched_node * worker_node = starpu_sched_node_worker_get(workerid);
+	struct starpu_sched_component * worker_component = starpu_sched_component_worker_get(workerid);
 	/* dont work with parallel tasks */
-	if(starpu_sched_node_is_combined_worker(worker_node))
+	if(starpu_sched_component_is_combined_worker(worker_component))
 	   return;
 
-	struct _starpu_worker_node_data * d = worker_node->data;
+	struct _starpu_worker_component_data * d = worker_component->data;
 	struct _starpu_worker_task_list * list = d->list;
 	/* Compute the expected penality */
 	enum starpu_perfmodel_archtype perf_arch = starpu_worker_get_perf_archtype(workerid);

+ 1 - 1
src/sched_policies/deque_queues.c

@@ -91,7 +91,7 @@ struct _starpu_job_list *_starpu_deque_pop_every_task(struct _starpu_deque_jobq
 {
 	struct _starpu_job_list *new_list, *old_list;
 
-	/* block until some task is available in that queue */
+	/* block until some task is pullable in that queue */
 	STARPU_PTHREAD_MUTEX_LOCK(sched_mutex);
 
 	if (deque_queue->njobs == 0)

+ 12 - 12
src/sched_policies/helper_mct.c

@@ -16,7 +16,7 @@
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
 
-#include <starpu_sched_node.h>
+#include <starpu_sched_component.h>
 #include "helper_mct.h"
 
 /* compute predicted_end by taking into account the case of the predicted transfer and the predicted_end overlap
@@ -56,21 +56,21 @@ double starpu_mct_compute_fitness(struct _starpu_mct_data * d, double exp_end, d
 		+ d->gamma * d->idle_power * (exp_end - max_exp_end);
 }
 
-int starpu_mct_compute_expected_times(struct starpu_sched_node *node, struct starpu_task *task,
+int starpu_mct_compute_expected_times(struct starpu_sched_component *component, struct starpu_task *task,
 		double *estimated_lengths, double *estimated_transfer_length, double *estimated_ends_with_task,
-		double *min_exp_end_with_task, double *max_exp_end_with_task, int *suitable_nodes)
+		double *min_exp_end_with_task, double *max_exp_end_with_task, int *suitable_components)
 {
-	int nsuitable_nodes = 0;
+	int nsuitable_components = 0;
 
 	int i;
-	for(i = 0; i < node->nchilds; i++)
+	for(i = 0; i < component->nchildren; i++)
 	{
-		struct starpu_sched_node * c = node->childs[i];
-		if(starpu_sched_node_execute_preds(c, task, estimated_lengths + i))
+		struct starpu_sched_component * c = component->children[i];
+		if(starpu_sched_component_execute_preds(c, task, estimated_lengths + i))
 		{
 			if(isnan(estimated_lengths[i]))
 				/* The perfmodel had been purged since the task was pushed
-				 * onto the mct node. */
+				 * onto the mct component. */
 				continue;
 
 			/* Estimated availability of worker */
@@ -78,7 +78,7 @@ int starpu_mct_compute_expected_times(struct starpu_sched_node *node, struct sta
 			double now = starpu_timing_now();
 			if (estimated_end < now)
 				estimated_end = now;
-			estimated_transfer_length[i] = starpu_sched_node_transfer_length(c, task);
+			estimated_transfer_length[i] = starpu_sched_component_transfer_length(c, task);
 			estimated_ends_with_task[i] = compute_expected_time(now,
 									    estimated_end,
 									    estimated_lengths[i],
@@ -87,16 +87,16 @@ int starpu_mct_compute_expected_times(struct starpu_sched_node *node, struct sta
 				*min_exp_end_with_task = estimated_ends_with_task[i];
 			if(estimated_ends_with_task[i] > *max_exp_end_with_task)
 				*max_exp_end_with_task = estimated_ends_with_task[i];
-			suitable_nodes[nsuitable_nodes++] = i;
+			suitable_components[nsuitable_components++] = i;
 		}
 	}
-	return nsuitable_nodes;
+	return nsuitable_components;
 }
 
 /* Alpha, Beta and Gamma are MCT-specific values, which allows the
  * user to set more precisely the weight of each computing value.
  * Beta, for example, controls the weight of communications between
- * memories for the computation of the best node to choose. 
+ * memories for the computation of the best component to choose. 
  */
 #define _STARPU_SCHED_ALPHA_DEFAULT 1.0
 #define _STARPU_SCHED_BETA_DEFAULT 1.0

+ 2 - 2
src/sched_policies/helper_mct.h

@@ -23,7 +23,7 @@ struct _starpu_mct_data
 };
 
 struct _starpu_mct_data *starpu_mct_init_parameters(struct starpu_mct_data *params);
-int starpu_mct_compute_expected_times(struct starpu_sched_node *node, struct starpu_task *task,
+int starpu_mct_compute_expected_times(struct starpu_sched_component *component, struct starpu_task *task,
 		double *estimated_lengths, double *estimated_transfer_length, double *estimated_ends_with_task,
-		double *min_exp_end_with_task, double *max_exp_end_with_task, int *suitable_nodes);
+		double *min_exp_end_with_task, double *max_exp_end_with_task, int *suitable_components);
 double starpu_mct_compute_fitness(struct _starpu_mct_data * d, double exp_end, double min_exp_end, double max_exp_end, double transfer_len, double local_power);

+ 18 - 18
src/sched_policies/hierarchical_heft.c

@@ -1,11 +1,11 @@
-#include <starpu_sched_node.h>
+#include <starpu_sched_component.h>
 #include <core/workers.h>
 
-static struct  starpu_sched_node_composed_recipe *  recipe_for_worker(enum starpu_worker_archtype a STARPU_ATTRIBUTE_UNUSED)
+static struct  starpu_sched_component_composed_recipe *  recipe_for_worker(enum starpu_worker_archtype a STARPU_ATTRIBUTE_UNUSED)
 {
-	struct starpu_sched_node_composed_recipe * r = starpu_sched_node_create_recipe();
-	starpu_sched_recipe_add_node(r, starpu_sched_node_best_implementation_create, NULL);
-	starpu_sched_recipe_add_node(r, starpu_sched_node_fifo_create, NULL);
+	struct starpu_sched_component_composed_recipe * r = starpu_sched_component_create_recipe();
+	starpu_sched_recipe_add_component(r, starpu_sched_component_best_implementation_create, NULL);
+	starpu_sched_recipe_add_component(r, starpu_sched_component_fifo_create, NULL);
 	return r;
 }
 
@@ -25,25 +25,25 @@ static void initialize_heft_center_policy(unsigned sched_ctx_id)
 		.beta = 2.0,
 		.gamma = 0.0,
 		.idle_power = 0.0,
-		.no_perf_model_node_create = starpu_sched_node_random_create,
+		.no_perf_model_component_create = starpu_sched_component_random_create,
 		.arg_no_perf_model = NULL,
-		.calibrating_node_create = starpu_sched_node_random_create,
-		.arg_calibrating_node = NULL,
+		.calibrating_component_create = starpu_sched_component_random_create,
+		.arg_calibrating_component = NULL,
 	};
-	struct starpu_sched_node_composed_recipe * r = starpu_sched_node_create_recipe();
-	starpu_sched_recipe_add_node(r,(struct starpu_sched_node * (*)(void*))starpu_sched_node_heft_create,&heft_data);
-	specs.hwloc_machine_composed_sched_node = r;
+	struct starpu_sched_component_composed_recipe * r = starpu_sched_component_create_recipe();
+	starpu_sched_recipe_add_component(r,(struct starpu_sched_component * (*)(void*))starpu_sched_component_heft_create,&heft_data);
+	specs.hwloc_machine_composed_sched_component = r;
 
-	r = starpu_sched_node_create_recipe();
-	starpu_sched_recipe_add_node(r, starpu_sched_node_best_implementation_create, NULL);
-	starpu_sched_recipe_add_node(r, starpu_sched_node_fifo_create ,NULL);
+	r = starpu_sched_component_create_recipe();
+	starpu_sched_recipe_add_component(r, starpu_sched_component_best_implementation_create, NULL);
+	starpu_sched_recipe_add_component(r, starpu_sched_component_fifo_create ,NULL);
 
-	specs.hwloc_node_composed_sched_node = r;
-	specs.worker_composed_sched_node = recipe_for_worker;
+	specs.hwloc_component_composed_sched_component = r;
+	specs.worker_composed_sched_component = recipe_for_worker;
 
-	struct starpu_sched_tree *t = starpu_sched_node_make_scheduler(sched_ctx_id, specs);
+	struct starpu_sched_tree *t = starpu_sched_component_make_scheduler(sched_ctx_id, specs);
 
-	starpu_destroy_composed_sched_node_recipe(specs.hwloc_machine_composed_sched_node);
+	starpu_destroy_composed_sched_component_recipe(specs.hwloc_machine_composed_sched_component);
 
 
 	starpu_sched_tree_update_workers(t);

+ 0 - 233
src/sched_policies/node_composed.c

@@ -1,233 +0,0 @@
-/* StarPU --- Runtime system for heterogeneous multicore architectures.
- *
- * Copyright (C) 2013  INRIA
- * Copyright (C) 2013  Simon Archipoff
- *
- * StarPU is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at
- * your option) any later version.
- *
- * StarPU is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * See the GNU Lesser General Public License in COPYING.LGPL for more details.
- */
-
-#include <starpu_sched_node.h>
-#include <common/list.h>
-
-
-/* a composed node is parametred by a list of pair
- * (create_node_function(arg), arg)
- */
-LIST_TYPE(fun_create_node,
-	  struct starpu_sched_node *(*create_node)(void * arg);
-	  void * arg;
-);
-
-
-struct starpu_sched_node_composed_recipe
-{
-	struct fun_create_node_list * list;
-};
-
-
-struct starpu_sched_node_composed_recipe * starpu_sched_node_create_recipe(void)
-{
-	struct starpu_sched_node_composed_recipe * recipe = malloc(sizeof(*recipe));
-	recipe->list = fun_create_node_list_new();
-	return recipe;
-}
-
-void starpu_sched_recipe_add_node(struct starpu_sched_node_composed_recipe * recipe,
-				  struct starpu_sched_node *(*create_node)(void * arg),
-				  void * arg)
-{
-	struct fun_create_node * e = fun_create_node_new();
-	e->create_node = create_node;
-	e->arg = arg;
-	fun_create_node_list_push_back(recipe->list, e);
-}
-struct starpu_sched_node_composed_recipe * starpu_sched_node_create_recipe_singleton(struct starpu_sched_node *(*create_node)(void * arg),
-										      void * arg)
-{
-	struct starpu_sched_node_composed_recipe * r = starpu_sched_node_create_recipe();
-	starpu_sched_recipe_add_node(r, create_node, arg);
-	return r;
-}
-void starpu_destroy_composed_sched_node_recipe(struct starpu_sched_node_composed_recipe * recipe)
-{
-	if(!recipe)
-		return;
-	while(!fun_create_node_list_empty(recipe->list))
-		fun_create_node_delete(fun_create_node_list_pop_back(recipe->list));
-	fun_create_node_list_delete(recipe->list);
-	free(recipe);
-}
-
-
-
-struct composed_node
-{
-	struct starpu_sched_node *top,*bottom;
-};
-
-/* this function actualy build the composed node data by changing the list of
- * (node_create_fun, arg_create_fun) into a tree where all nodes have 1 childs
- */
-struct composed_node create_composed_node(struct starpu_sched_node_composed_recipe * recipe
-#ifdef STARPU_HAVE_HWLOC
-					  ,hwloc_obj_t obj
-#endif
-	)
-{
-	struct composed_node c;
-	STARPU_ASSERT(recipe);
-
-	struct fun_create_node_list * list = recipe->list;
-	struct fun_create_node * i = fun_create_node_list_begin(list);
-	STARPU_ASSERT(i);
-	STARPU_ASSERT(i->create_node(i->arg));
-	c.top = c.bottom = i->create_node(i->arg);
-#ifdef STARPU_HAVE_HWLOC
-	c.top->obj = obj;
-#endif
-	for(i  = fun_create_node_list_next(i);
-	    i != fun_create_node_list_end(list);
-	    i  = fun_create_node_list_next(i))
-	{
-		STARPU_ASSERT(i->create_node(i->arg));
-		struct starpu_sched_node * node = i->create_node(i->arg);
-#ifdef STARPU_HAVE_HWLOC
-		node->obj = obj;
-#endif
-		c.bottom->add_child(c.bottom, node);
-
-		/* we want to be able to traverse scheduler bottom up for all sched ctxs
-		 * when a worker call pop()
-		 */
-		unsigned j;
-		for(j = 0; j < STARPU_NMAX_SCHED_CTXS; j++)
-			node->add_father(node, c.bottom);
-		c.bottom = node;
-	}
-	STARPU_ASSERT(!starpu_sched_node_is_worker(c.bottom));
-	return c;
-}
-
-
-static int composed_node_push_task(struct starpu_sched_node * node, struct starpu_task * task)
-{
-	struct composed_node *c = node->data;
-	return c->top->push_task(c->top,task);
-}
-struct starpu_task * composed_node_pop_task(struct starpu_sched_node *node)
-{
-	struct composed_node *c = node->data;
-	struct starpu_task * task = NULL;
-	
-	task = c->bottom->pop_task(c->bottom);
-	if(task)
-		return task;
-
-	int i;
-	for(i=0; i < node->nfathers; i++)
-	{
-		if(node->fathers[i] == NULL)
-			continue;
-		else
-		{
-			task = node->fathers[i]->pop_task(node->fathers[i]);
-			if(task)
-				break;
-		}
-	}
-	return task;
-}
-
-double composed_node_estimated_load(struct starpu_sched_node * node)
-{
-	struct composed_node * c = node->data;
-	return c->top->estimated_load(c->top);
-}
-
-static void composed_node_add_child(struct starpu_sched_node * node, struct starpu_sched_node * child)
-{
-	struct composed_node * c = node->data;
-	node->add_child(node, child);
-	c->bottom->add_child(c->bottom, child);
-}
-static void composed_node_remove_child(struct starpu_sched_node * node, struct starpu_sched_node * child)
-{
-	struct composed_node * c = node->data;
-	node->remove_child(node, child);
-	c->bottom->remove_child(c->bottom, child);
-}
-
-static void composed_node_notify_change_workers(struct starpu_sched_node * node)
-{
-	struct composed_node * c = node->data;
-	struct starpu_bitmap * workers = node->workers;
-	struct starpu_bitmap * workers_in_ctx = node->workers_in_ctx;
-	struct starpu_sched_node * n;
-	for(n = c->top; ;n = n->childs[0])
-	{
-		starpu_bitmap_unset_all(n->workers);
-		starpu_bitmap_or(n->workers, workers);
-
-		starpu_bitmap_unset_all(n->workers_in_ctx);
-		starpu_bitmap_or(n->workers_in_ctx, workers_in_ctx);
-
-		n->properties = node->properties;
-		if(n == c->bottom)
-			break;
-	}
-}
-
-void composed_node_deinit_data(struct starpu_sched_node * _node)
-{
-	struct composed_node *c = _node->data;
-	c->bottom->childs = NULL;
-	c->bottom->nchilds = 0;
-	struct starpu_sched_node * node = c->top;
-	struct starpu_sched_node * next = NULL;
-	do
-	{
-		node->workers = NULL;
-		next = node->childs ? node->childs[0] : NULL;
-		starpu_sched_node_destroy(node);
-	}while(next);
-	free(c);
-	_node->data = NULL;
-}
-
-struct starpu_sched_node * starpu_sched_node_composed_node_create(struct starpu_sched_node_composed_recipe * recipe)
-{
-	STARPU_ASSERT(!fun_create_node_list_empty(recipe->list));
-	struct fun_create_node_list * l = recipe->list;
-	if(l->_head == l->_tail)
-		return l->_head->create_node(l->_head->arg);
-	struct starpu_sched_node * node = starpu_sched_node_create();
-
-	struct composed_node * c = malloc(sizeof(struct composed_node));
-	*c = create_composed_node(recipe
-#ifdef STARPU_HAVE_HWLOC
-				  ,node->obj
-#endif
-);
-	c->bottom->nchilds = node->nchilds;
-	c->bottom->childs = node->childs;
-	c->bottom->nfathers = node->nfathers;
-	c->bottom->fathers = node->fathers;
-
-	node->data = c;
-	node->push_task = composed_node_push_task;
-	node->pop_task = composed_node_pop_task;
-	node->estimated_load = composed_node_estimated_load;
-	node->add_child = composed_node_add_child;
-	node->remove_child = composed_node_remove_child;
-	node->notify_change_workers = composed_node_notify_change_workers;
-	return node;
-}

+ 0 - 80
src/sched_policies/node_eager.c

@@ -1,80 +0,0 @@
-/* StarPU --- Runtime system for heterogeneous multicore architectures.
- *
- * Copyright (C) 2013  INRIA
- *
- * StarPU is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at
- * your option) any later version.
- *
- * StarPU is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * See the GNU Lesser General Public License in COPYING.LGPL for more details.
- */
-
-#include <starpu_sched_node.h>
-#include <starpu_scheduler.h>
-
-static int eager_push_task(struct starpu_sched_node * node, struct starpu_task * task)
-{
-	STARPU_ASSERT(node && task && starpu_sched_node_is_eager(node));
-	STARPU_ASSERT(starpu_sched_node_can_execute_task(node,task));
-	
-	int workerid;
-	for(workerid = starpu_bitmap_first(node->workers_in_ctx);
-	    workerid != -1;
-	    workerid = starpu_bitmap_next(node->workers_in_ctx, workerid))
-	{
-		int nimpl;
-		for(nimpl = 0; nimpl < STARPU_MAXIMPLEMENTATIONS; nimpl++)
-		{
-			if(starpu_worker_can_execute_task(workerid,task,nimpl)
-			   || starpu_combined_worker_can_execute_task(workerid, task, nimpl))
-			{
-				int i;
-				for (i = 0; i < node->nchilds; i++)
-				{
-					int idworker,ret;
-					for(idworker = starpu_bitmap_first(node->childs[i]->workers);
-						idworker != -1;
-						idworker = starpu_bitmap_next(node->childs[i]->workers, idworker))
-					{
-						if (idworker == workerid)
-						{
-							if(starpu_sched_node_is_worker(node->childs[i]))
-							{
-								node->childs[i]->avail(node->childs[i]);
-								return 1;
-							}
-							else
-							{
-								ret = node->childs[i]->push_task(node->childs[i],task);
-								if(!ret)
-								{
-									node->childs[i]->avail(node->childs[i]);
-									return ret;
-								}
-							}
-						}
-					}
-				}
-			}
-		}
-	}
-	return 1;
-}
-
-int starpu_sched_node_is_eager(struct starpu_sched_node * node)
-{
-	return node->push_task == eager_push_task;
-}
-
-struct starpu_sched_node * starpu_sched_node_eager_create(void * ARG STARPU_ATTRIBUTE_UNUSED)
-{
-	struct starpu_sched_node * node = starpu_sched_node_create();
-	node->push_task = eager_push_task;
-
-	return node;
-}

+ 0 - 111
src/sched_policies/node_perfmodel_select.c

@@ -1,111 +0,0 @@
-/* StarPU --- Runtime system for heterogeneous multicore architectures.
- *
- * Copyright (C) 2013  INRIA
- *
- * StarPU is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at
- * your option) any later version.
- *
- * StarPU is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * See the GNU Lesser General Public License in COPYING.LGPL for more details.
- */
-
-#include <starpu_sched_node.h>
-#include <starpu_scheduler.h>
-
-/* The decision node takes care of the scheduling of tasks which are not
- * calibrated, or tasks which don't have a performance model, because the scheduling
- * architecture of this scheduler for tasks with no performance model is exactly
- * the same as the tree-prio scheduler.
- * Tasks with a perfmodel are pushed to the perfmodel_node, which takes care of the
- * scheduling of those tasks on the correct worker_node.
- */
-
-struct _starpu_perfmodel_select_data
-{
-	struct starpu_sched_node * calibrator_node;
-	struct starpu_sched_node * no_perfmodel_node;
-	struct starpu_sched_node * perfmodel_node;
-};
-
-static int perfmodel_select_push_task(struct starpu_sched_node * node, struct starpu_task * task)
-{
-	STARPU_ASSERT(node && node->data && task && starpu_sched_node_is_perfmodel_select(node));
-	STARPU_ASSERT(starpu_sched_node_can_execute_task(node,task));
-
-	struct _starpu_perfmodel_select_data * data = node->data;
-	double length;
-	int can_execute = starpu_sched_node_execute_preds(node,task,&length);
-	
-	if(can_execute)
-	{
-		if(isnan(length))
-			return data->calibrator_node->push_task(data->calibrator_node,task);
-		if(_STARPU_IS_ZERO(length))
-			return data->no_perfmodel_node->push_task(data->no_perfmodel_node,task);
-		return data->perfmodel_node->push_task(data->perfmodel_node,task);
-	}
-	else
-		return 1;
-
-}
-
-int starpu_sched_node_is_perfmodel_select(struct starpu_sched_node * node)
-{
-	return node->push_task == perfmodel_select_push_task;
-}
-
-static void perfmodel_select_notify_change_in_workers(struct starpu_sched_node * node)
-{
-	STARPU_ASSERT(starpu_sched_node_is_perfmodel_select(node));
-	struct _starpu_perfmodel_select_data * data = node->data;
-
-	starpu_bitmap_unset_all(data->no_perfmodel_node->workers_in_ctx);
-	starpu_bitmap_unset_all(data->no_perfmodel_node->workers);
-	starpu_bitmap_or(data->no_perfmodel_node->workers_in_ctx, node->workers_in_ctx);
-	starpu_bitmap_or(data->no_perfmodel_node->workers, node->workers);
-	data->no_perfmodel_node->properties = node->properties;
-
-	starpu_bitmap_unset_all(data->perfmodel_node->workers_in_ctx);
-	starpu_bitmap_unset_all(data->perfmodel_node->workers);
-	starpu_bitmap_or(data->perfmodel_node->workers_in_ctx, node->workers_in_ctx);
-	starpu_bitmap_or(data->perfmodel_node->workers, node->workers);
-	data->perfmodel_node->properties = node->properties;
-
-	starpu_bitmap_unset_all(data->calibrator_node->workers_in_ctx);
-	starpu_bitmap_unset_all(data->calibrator_node->workers);
-	starpu_bitmap_or(data->calibrator_node->workers_in_ctx, node->workers_in_ctx);
-	starpu_bitmap_or(data->calibrator_node->workers, node->workers);
-	data->calibrator_node->properties = node->properties;
-}
-
-void perfmodel_select_node_deinit_data(struct starpu_sched_node * node)
-
-{
-	STARPU_ASSERT(node && node->data);
-	struct _starpu_perfmodel_select_data * d = node->data;
-	free(d);
-}
-
-struct starpu_sched_node * starpu_sched_node_perfmodel_select_create(struct starpu_perfmodel_select_data * params)
-{
-	STARPU_ASSERT(params);
-	STARPU_ASSERT(params->calibrator_node && params->no_perfmodel_node && params->perfmodel_node);
-	struct starpu_sched_node * node = starpu_sched_node_create();
-
-	struct _starpu_perfmodel_select_data * data = malloc(sizeof(*data));
-	data->calibrator_node = params->calibrator_node;
-	data->no_perfmodel_node = params->no_perfmodel_node;
-	data->perfmodel_node = params->perfmodel_node;
-	
-	node->data = data;
-	node->push_task = perfmodel_select_push_task;
-	node->deinit_data = perfmodel_select_node_deinit_data;
-	node->notify_change_workers = perfmodel_select_notify_change_in_workers;
-
-	return node;
-}

+ 0 - 578
src/sched_policies/node_sched.c

@@ -1,578 +0,0 @@
-/* StarPU --- Runtime system for heterogeneous multicore architectures.
- *
- * Copyright (C) 2013  INRIA
- * Copyright (C) 2013  Simon Archipoff
- *
- * StarPU is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at
- * your option) any later version.
- *
- * StarPU is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * See the GNU Lesser General Public License in COPYING.LGPL for more details.
- */
-
-#include <core/jobs.h>
-#include <core/workers.h>
-#include <starpu_sched_node.h>
-#include <starpu_thread_util.h>
-
-#include <float.h>
-
-#include "sched_node.h"
-
-/* default implementation for node->pop_task()
- * just perform a recursive call on father
- */
-static struct starpu_task * pop_task_node(struct starpu_sched_node * node)
-{
-	STARPU_ASSERT(node);
-	struct starpu_task * task = NULL;
-	int i;
-	for(i=0; i < node->nfathers; i++)
-	{
-		if(node->fathers[i] == NULL)
-			continue;
-		else
-		{
-			task = node->fathers[i]->pop_task(node->fathers[i]);
-			if(task)
-				break;
-		}
-	}
-	return task;
-}
-
-/******************************************************************************
- *          functions for struct starpu_sched_policy interface                *
- ******************************************************************************/
-int starpu_sched_tree_push_task(struct starpu_task * task)
-{
-	STARPU_ASSERT(task);
-	unsigned sched_ctx_id = task->sched_ctx;
-	struct starpu_sched_tree *tree = starpu_sched_ctx_get_policy_data(sched_ctx_id);
-	int workerid = starpu_worker_get_id();
-	/* application should take tree->lock to prevent concurent acces from hypervisor
-	 * worker take they own mutexes
-	 */
-	if(-1 == workerid)
-		STARPU_PTHREAD_MUTEX_LOCK(&tree->lock);
-	else
-		_starpu_sched_node_lock_worker(workerid);
-		
-	int ret_val = tree->root->push_task(tree->root,task);
-	if(-1 == workerid)
-		STARPU_PTHREAD_MUTEX_UNLOCK(&tree->lock);
-	else
-		_starpu_sched_node_unlock_worker(workerid);
-	return ret_val;
-}
-
-struct starpu_task * starpu_sched_tree_pop_task(unsigned sched_ctx STARPU_ATTRIBUTE_UNUSED)
-{
-	int workerid = starpu_worker_get_id();
-	struct starpu_sched_node * node = starpu_sched_node_worker_get(workerid);
-
-	/* _starpu_sched_node_lock_worker(workerid) is called by node->pop_task()
-	 */
-	struct starpu_task * task = node->pop_task(node);
-	return task;
-}
-
-void starpu_sched_tree_add_workers(unsigned sched_ctx_id, int *workerids, unsigned nworkers)
-{
-	STARPU_ASSERT(sched_ctx_id < STARPU_NMAX_SCHED_CTXS);
-	STARPU_ASSERT(workerids);
-	struct starpu_sched_tree * t = starpu_sched_ctx_get_policy_data(sched_ctx_id);
-
-	STARPU_PTHREAD_MUTEX_LOCK(&t->lock);
-	_starpu_sched_node_lock_all_workers();
-
-	unsigned i;
-	for(i = 0; i < nworkers; i++)
-		starpu_bitmap_set(t->workers, workerids[i]);
-
-	starpu_sched_tree_update_workers_in_ctx(t);
-
-	_starpu_sched_node_unlock_all_workers();
-	STARPU_PTHREAD_MUTEX_UNLOCK(&t->lock);
-}
-
-void starpu_sched_tree_remove_workers(unsigned sched_ctx_id, int *workerids, unsigned nworkers)
-{
-	STARPU_ASSERT(sched_ctx_id < STARPU_NMAX_SCHED_CTXS);
-	STARPU_ASSERT(workerids);
-	struct starpu_sched_tree * t = starpu_sched_ctx_get_policy_data(sched_ctx_id);
-
-	STARPU_PTHREAD_MUTEX_LOCK(&t->lock);
-	_starpu_sched_node_lock_all_workers();
-
-	unsigned i;
-	for(i = 0; i < nworkers; i++)
-		starpu_bitmap_unset(t->workers, workerids[i]);
-
-	starpu_sched_tree_update_workers_in_ctx(t);
-
-	_starpu_sched_node_unlock_all_workers();
-	STARPU_PTHREAD_MUTEX_UNLOCK(&t->lock);
-}
-
-void starpu_sched_node_destroy_rec(struct starpu_sched_node * node)
-{
-	if(node == NULL)
-		return;
-
-	int i;
-	if(node->nchilds > 0)
-	{
-		for(i=0; i < node->nchilds; i++)
-			starpu_sched_node_destroy_rec(node->childs[i]);
-	}
-
-	starpu_sched_node_destroy(node);
-}
-
-struct starpu_sched_tree * starpu_sched_tree_create(unsigned sched_ctx_id)
-{
-	STARPU_ASSERT(sched_ctx_id < STARPU_NMAX_SCHED_CTXS);
-	struct starpu_sched_tree * t = malloc(sizeof(*t));
-	memset(t, 0, sizeof(*t));
-	t->sched_ctx_id = sched_ctx_id;
-	t->workers = starpu_bitmap_create();
-	STARPU_PTHREAD_MUTEX_INIT(&t->lock,NULL);
-	return t;
-}
-
-void starpu_sched_tree_destroy(struct starpu_sched_tree * tree)
-{
-	STARPU_ASSERT(tree);
-	if(tree->root)
-		starpu_sched_node_destroy_rec(tree->root);
-	starpu_bitmap_destroy(tree->workers);
-	STARPU_PTHREAD_MUTEX_DESTROY(&tree->lock);
-	free(tree);
-}
-
-static void starpu_sched_node_add_child(struct starpu_sched_node* node, struct starpu_sched_node * child)
-{
-	STARPU_ASSERT(node && child);
-	STARPU_ASSERT(!starpu_sched_node_is_worker(node));
-	int i;
-	for(i = 0; i < node->nchilds; i++){
-		STARPU_ASSERT(node->childs[i] != node);
-		STARPU_ASSERT(node->childs[i] != NULL);
-	}
-
-	node->childs = realloc(node->childs, sizeof(struct starpu_sched_node *) * (node->nchilds + 1));
-	node->childs[node->nchilds] = child;
-	node->nchilds++;
-}
-
-static void starpu_sched_node_remove_child(struct starpu_sched_node * node, struct starpu_sched_node * child)
-{
-	STARPU_ASSERT(node && child);
-	STARPU_ASSERT(!starpu_sched_node_is_worker(node));
-	int pos;
-	for(pos = 0; pos < node->nchilds; pos++)
-		if(node->childs[pos] == child)
-			break;
-	STARPU_ASSERT(pos != node->nchilds);
-	node->childs[pos] = node->childs[--node->nchilds];
-}
-
-static void starpu_sched_node_add_father(struct starpu_sched_node* node, struct starpu_sched_node * father)
-{
-	STARPU_ASSERT(node && father);
-	int i;
-	for(i = 0; i < node->nfathers; i++){
-		STARPU_ASSERT(node->fathers[i] != node);
-		STARPU_ASSERT(node->fathers[i] != NULL);
-	}
-
-	node->fathers = realloc(node->fathers, sizeof(struct starpu_sched_node *) * (node->nfathers + 1));
-	node->fathers[node->nfathers] = father;
-	node->nfathers++;
-}
-
-static void starpu_sched_node_remove_father(struct starpu_sched_node * node, struct starpu_sched_node * father)
-{
-	STARPU_ASSERT(node && father);
-	int pos;
-	for(pos = 0; pos < node->nfathers; pos++)
-		if(node->fathers[pos] == father)
-			break;
-	STARPU_ASSERT(pos != node->nfathers);
-	node->fathers[pos] = node->fathers[--node->nfathers];
-}
-
-struct starpu_bitmap * _starpu_get_worker_mask(unsigned sched_ctx_id)
-{
-	STARPU_ASSERT(sched_ctx_id < STARPU_NMAX_SCHED_CTXS);
-	struct starpu_sched_tree * t = starpu_sched_ctx_get_policy_data(sched_ctx_id);
-	STARPU_ASSERT(t);
-	return t->workers;
-}
-
-static double estimated_load(struct starpu_sched_node * node)
-{
-	double sum = 0.0;
-	int i;
-	for( i = 0; i < node->nchilds; i++)
-	{
-		struct starpu_sched_node * c = node->childs[i];
-		sum += c->estimated_load(c);
-	}
-	return sum;
-}
-
-static double _starpu_sched_node_estimated_end_min(struct starpu_sched_node * node)
-{
-	STARPU_ASSERT(node);
-	double min = DBL_MAX;
-	int i;
-	for(i = 0; i < node->nchilds; i++)
-	{
-		double tmp = node->childs[i]->estimated_end(node->childs[i]);
-		if(tmp < min)
-			min = tmp;
-	}
-	return min;
-}
-
-/* this function find the best implementation or an implementation that need to be calibrated for a worker available
- * and set prediction in *length. nan if a implementation need to be calibrated, 0.0 if no perf model are available
- * return false if no worker on the node can execute that task
- */
-int starpu_sched_node_execute_preds(struct starpu_sched_node * node, struct starpu_task * task, double * length)
-{
-	STARPU_ASSERT(node && task);
-	int can_execute = 0;
-	starpu_task_bundle_t bundle = task->bundle;
-	double len = DBL_MAX;
-	
-
-	int workerid;
-	for(workerid = starpu_bitmap_first(node->workers_in_ctx);
-	    workerid != -1;
-	    workerid = starpu_bitmap_next(node->workers_in_ctx, workerid))
-	{
-		struct starpu_perfmodel_arch* archtype = starpu_worker_get_perf_archtype(workerid);
-		int nimpl;
-		for(nimpl = 0; nimpl < STARPU_MAXIMPLEMENTATIONS; nimpl++)
-		{
-			if(starpu_worker_can_execute_task(workerid,task,nimpl)
-			   || starpu_combined_worker_can_execute_task(workerid, task, nimpl))
-			{
-				double d;
-				can_execute = 1;
-				if(bundle)
-					d = starpu_task_bundle_expected_length(bundle, archtype, nimpl);
-				else
-					d = starpu_task_expected_length(task, archtype, nimpl);
-				if(isnan(d))
-				{
-					*length = d;
-					return can_execute;
-						
-				}
-				if(_STARPU_IS_ZERO(d) && !can_execute)
-				{
-					can_execute = 1;
-					continue;
-				}
-				if(d < len)
-				{
-					len = d;
-				}
-			}
-		}
-		if(STARPU_SCHED_NODE_IS_HOMOGENEOUS(node))
-			break;
-	}
-
-	if(len == DBL_MAX) /* we dont have perf model */
-		len = 0.0; 
-	if(length)
-		*length = len;
-	return can_execute;
-}
-
-/* very similar function that dont compute prediction */
-int starpu_sched_node_can_execute_task(struct starpu_sched_node * node, struct starpu_task * task)
-{
-	STARPU_ASSERT(task);
-	STARPU_ASSERT(node);
-	unsigned nimpl;
-	int worker;
-	for (nimpl = 0; nimpl < STARPU_MAXIMPLEMENTATIONS; nimpl++)
-		for(worker = starpu_bitmap_first(node->workers_in_ctx);
-		    -1 != worker;
-		    worker = starpu_bitmap_next(node->workers_in_ctx, worker))
-			if (starpu_worker_can_execute_task(worker, task, nimpl)
-			     || starpu_combined_worker_can_execute_task(worker, task, nimpl))
-			    return 1;
-	return 0;
-}
-
-/* compute the average of transfer length for tasks on all workers
- * maybe this should be optimised if all workers are under the same numa node
- */
-double starpu_sched_node_transfer_length(struct starpu_sched_node * node, struct starpu_task * task)
-{
-	STARPU_ASSERT(node && task);
-	int nworkers = starpu_bitmap_cardinal(node->workers_in_ctx);
-	double sum = 0.0;
-	int worker;
-	if(STARPU_SCHED_NODE_IS_SINGLE_MEMORY_NODE(node))
-	{
-		unsigned memory_node  = starpu_worker_get_memory_node(starpu_bitmap_first(node->workers_in_ctx));
-		if(task->bundle)
-			return starpu_task_bundle_expected_data_transfer_time(task->bundle,memory_node);
-		else
-			return starpu_task_expected_data_transfer_time(memory_node, task);
-	}
-
-	for(worker = starpu_bitmap_first(node->workers_in_ctx);
-	    worker != -1;
-	    worker = starpu_bitmap_next(node->workers_in_ctx, worker))
-	{
-		unsigned memory_node  = starpu_worker_get_memory_node(worker);
-		if(task->bundle)
-		{
-			sum += starpu_task_bundle_expected_data_transfer_time(task->bundle,memory_node);
-		}
-		else
-		{
-			sum += starpu_task_expected_data_transfer_time(memory_node, task);
-			/* sum += starpu_task_expected_conversion_time(task, starpu_worker_get_perf_archtype(worker), impl ?)
-			 * I dont know what to do as we dont know what implementation would be used here...
-			 */
-		}
-	}
-	return sum / nworkers;
-}
-
-/* This function can be called by nodes when they think that a prefetching request can be submitted.
- * For example, it is currently used by the MCT node to begin the prefetching on accelerators 
- * on which it pushed tasks as soon as possible.
- */
-void starpu_sched_node_prefetch_on_node(struct starpu_sched_node * node, struct starpu_task * task)
-{
-	if (starpu_get_prefetch_flag() && (!task->prefetched)
-		&& (node->properties >= STARPU_SCHED_NODE_SINGLE_MEMORY_NODE))
-	{
-		int worker = starpu_bitmap_first(node->workers_in_ctx);
-		unsigned memory_node = starpu_worker_get_memory_node(worker);
-		starpu_prefetch_task_input_on_node(task, memory_node);
-		task->prefetched = 1;
-	}
-}
-
-/* The default implementation of the room function is a recursive call to its fathers.
- * A personally-made room in a node (like in prio nodes) is necessary to catch
- * this recursive call somewhere, if the user wants to exploit it.
- */
-static int starpu_sched_node_room(struct starpu_sched_node * node)
-{
-	STARPU_ASSERT(node);
-	int ret = 0;
-	if(node->nfathers > 0)
-	{
-		int i;
-		for(i=0; i < node->nfathers; i++)
-		{
-			struct starpu_sched_node * father = node->fathers[i];
-			if(father != NULL)
-				ret = father->room(father);
-			if(ret)
-				break;
-		}
-	}
-	return ret;
-}
-
-/* An avail call will try to wake up one worker associated to the childs of the
- * node. It is currenly called by nodes which holds a queue (like fifo and prio
- * nodes) to signify its childs that a task has been pushed on its local queue.
- */
-static void starpu_sched_node_avail(struct starpu_sched_node * node)
-{
-	STARPU_ASSERT(node);
-	STARPU_ASSERT(!starpu_sched_node_is_worker(node));
-	int i;
-	for(i = 0; i < node->nchilds; i++)
-		node->childs[i]->avail(node->childs[i]);
-}
-
-/* Allows a worker to lock/unlock scheduling mutexes. Currently used in 
- * self-defined room calls to allow avail calls to take those mutexes while the 
- * current worker is pushing tasks on other workers (or itself). 
- */
-void _starpu_sched_node_lock_scheduling(void)
-{
-	int workerid = starpu_worker_get_id();
-	starpu_pthread_mutex_t *sched_mutex;
-	starpu_pthread_cond_t *sched_cond;
-	starpu_worker_get_sched_condition(workerid, &sched_mutex, &sched_cond);
-	_starpu_sched_node_lock_worker(workerid);	
-	STARPU_PTHREAD_MUTEX_LOCK(sched_mutex);
-}
-
-void _starpu_sched_node_unlock_scheduling(void)
-{
-	int workerid = starpu_worker_get_id();
-	starpu_pthread_mutex_t *sched_mutex;
-	starpu_pthread_cond_t *sched_cond;
-	starpu_worker_get_sched_condition(workerid, &sched_mutex, &sched_cond);
-	STARPU_PTHREAD_MUTEX_UNLOCK(sched_mutex);
-	_starpu_sched_node_unlock_worker(workerid);	
-}
-
-void take_node_and_does_nothing(struct starpu_sched_node * node STARPU_ATTRIBUTE_UNUSED)
-{
-}
-
-struct starpu_sched_node * starpu_sched_node_create(void)
-{
-	struct starpu_sched_node * node = malloc(sizeof(*node));
-	memset(node,0,sizeof(*node));
-	node->workers = starpu_bitmap_create();
-	node->workers_in_ctx = starpu_bitmap_create();
-	node->add_child = starpu_sched_node_add_child;
-	node->remove_child = starpu_sched_node_remove_child;
-	node->add_father = starpu_sched_node_add_father;
-	node->remove_father = starpu_sched_node_remove_father;
-	node->pop_task = pop_task_node;
-	node->room = starpu_sched_node_room;
-	node->avail = starpu_sched_node_avail;
-	node->estimated_load = estimated_load;
-	node->estimated_end = _starpu_sched_node_estimated_end_min;
-	node->deinit_data = take_node_and_does_nothing;
-	node->notify_change_workers = take_node_and_does_nothing;
-	return node;
-}
-
-/* remove all child
- * for all child of node, if child->fathers[x] == node, set child->fathers[x] to null 
- * call node->deinit_data
- */
-void starpu_sched_node_destroy(struct starpu_sched_node *node)
-{
-	STARPU_ASSERT(node);
-	if(starpu_sched_node_is_worker(node))
-		return;
-	int i,j;
-	for(i = 0; i < node->nchilds; i++)
-	{
-		struct starpu_sched_node * child = node->childs[i];
-		for(j = 0; j < child->nfathers; j++)
-			if(child->fathers[j] == node)
-				child->remove_father(child,node);
-
-	}
-	while(node->nchilds != 0)
-		node->remove_child(node, node->childs[0]);
-	for(i = 0; i < node->nfathers; i++)
-	{
-		struct starpu_sched_node * father = node->fathers[i];
-		for(j = 0; j < father->nchilds; j++)
-			if(father->childs[j] == node)
-				father->remove_child(father,node);
-
-	}
-	while(node->nfathers != 0)
-		node->remove_father(node, node->fathers[0]);
-	node->deinit_data(node);
-	free(node->childs);
-	free(node->fathers);
-	starpu_bitmap_destroy(node->workers);
-	starpu_bitmap_destroy(node->workers_in_ctx);
-	free(node);
-}
-
-static void set_properties(struct starpu_sched_node * node)
-{
-	STARPU_ASSERT(node);
-	node->properties = 0;
-
-	int worker = starpu_bitmap_first(node->workers_in_ctx);
-	if (worker == -1)
-		return;
-	uint32_t first_worker = _starpu_get_worker_struct(worker)->worker_mask;
-	unsigned first_memory_node = _starpu_get_worker_struct(worker)->memory_node;
-	int is_homogeneous = 1;
-	int is_all_same_node = 1;
-	for(;
-	    worker != -1;
-	    worker = starpu_bitmap_next(node->workers_in_ctx, worker))		
-	{
-		if(first_worker != _starpu_get_worker_struct(worker)->worker_mask)
-			is_homogeneous = 0;
-		if(first_memory_node != _starpu_get_worker_struct(worker)->memory_node)
-			is_all_same_node = 0;
-	}
-	
-
-	if(is_homogeneous)
-		node->properties |= STARPU_SCHED_NODE_HOMOGENEOUS;
-	if(is_all_same_node)
-		node->properties |= STARPU_SCHED_NODE_SINGLE_MEMORY_NODE;
-}
-
-
-/* recursively set the node->workers member of node's subtree
- */
-void _starpu_sched_node_update_workers(struct starpu_sched_node * node)
-{
-	STARPU_ASSERT(node);
-	if(starpu_sched_node_is_worker(node))
-		return;
-	starpu_bitmap_unset_all(node->workers);
-	int i;
-	for(i = 0; i < node->nchilds; i++)
-	{
-		_starpu_sched_node_update_workers(node->childs[i]);
-		starpu_bitmap_or(node->workers, node->childs[i]->workers);
-		node->notify_change_workers(node);
-	}
-}
-
-/* recursively set the node->workers_in_ctx in node's subtree
- */
-void _starpu_sched_node_update_workers_in_ctx(struct starpu_sched_node * node, unsigned sched_ctx_id)
-{
-	STARPU_ASSERT(node);
-	if(starpu_sched_node_is_worker(node))
-		return;
-	struct starpu_bitmap * workers_in_ctx = _starpu_get_worker_mask(sched_ctx_id);
-	starpu_bitmap_unset_and(node->workers_in_ctx,node->workers, workers_in_ctx);
-	int i,j;
-	for(i = 0; i < node->nchilds; i++)
-	{
-		struct starpu_sched_node * child = node->childs[i];
-		_starpu_sched_node_update_workers_in_ctx(child, sched_ctx_id);
-		for(j = 0; j < STARPU_NMAX_SCHED_CTXS; j++)
-			if(child->fathers[j] == node)
-			{
-				starpu_bitmap_or(node->workers_in_ctx, child->workers_in_ctx);
-				break;
-			}
-	}
-	set_properties(node);
-	node->notify_change_workers(node);
-}
-
-void starpu_sched_tree_update_workers_in_ctx(struct starpu_sched_tree * t)
-{
-	STARPU_ASSERT(t);
-	_starpu_sched_node_update_workers_in_ctx(t->root, t->sched_ctx_id);
-}
-
-void starpu_sched_tree_update_workers(struct starpu_sched_tree * t)
-{
-	STARPU_ASSERT(t);
-	_starpu_sched_node_update_workers(t->root);
-}

+ 11 - 11
src/sched_policies/sched_node.h

@@ -14,23 +14,23 @@
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
 
-#ifndef __SCHED_NODE_H__
-#define __SCHED_NODE_H__
+#ifndef __SCHED_COMPONENT_H__
+#define __SCHED_COMPONENT_H__
 
-#include <starpu_sched_node.h>
+#include <starpu_sched_component.h>
 
 
 /* lock and unlock drivers for modifying schedulers */
-void _starpu_sched_node_lock_all_workers(void);
-void _starpu_sched_node_unlock_all_workers(void);
-void _starpu_sched_node_lock_worker(int workerid);
-void _starpu_sched_node_unlock_worker(int workerid);
-void _starpu_sched_node_lock_scheduling(void);
-void _starpu_sched_node_unlock_scheduling(void);
+void _starpu_sched_component_lock_all_workers(void);
+void _starpu_sched_component_unlock_all_workers(void);
+void _starpu_sched_component_lock_worker(int workerid);
+void _starpu_sched_component_unlock_worker(int workerid);
+void _starpu_sched_component_lock_scheduling(void);
+void _starpu_sched_component_unlock_scheduling(void);
 
 
-struct _starpu_worker * _starpu_sched_node_worker_get_worker(struct starpu_sched_node *);
-struct _starpu_combined_worker * _starpu_sched_node_combined_worker_get_combined_worker(struct starpu_sched_node * worker_node);
+struct _starpu_worker * _starpu_sched_component_worker_get_worker(struct starpu_sched_component *);
+struct _starpu_combined_worker * _starpu_sched_component_combined_worker_get_combined_worker(struct starpu_sched_component * worker_component);
 
 struct starpu_bitmap * _starpu_get_worker_mask(unsigned sched_ctx_id);
 

+ 98 - 98
src/sched_policies/scheduler_maker.c

@@ -14,103 +14,103 @@
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
 
-#include <starpu_sched_node.h>
+#include <starpu_sched_component.h>
 #include <common/list.h>
 #include <core/workers.h>
 
-#include "sched_node.h"
+#include "sched_component.h"
 
 
 
 /* The scheduler is built by a recursive function called on the hwloc topology with a starpu_sched_specs structure,
- * each call return a set of starpu_sched_node, not a single one, because you may have a topology like that :
+ * each call return a set of starpu_sched_component, not a single one, because you may have a topology like that :
  * MACHINE -- MEMORY NODE -- SOCKET
  *                        \- SOCKET
- * and you have defined a node for MACHINE, and a node for SOCKET, but not for MEMORY NODE then the recursive call
- * on MEMORY NODE will return 2 starpu_sched_node for those 2 sockets
+ * and you have defined a component for MACHINE, and a component for SOCKET, but not for MEMORY NODE then the recursive call
+ * on MEMORY NODE will return 2 starpu_sched_component for those 2 sockets
  *
  *
  */
 
-struct sched_node_list
+struct sched_component_list
 {
-	struct starpu_sched_node ** arr;
+	struct starpu_sched_component ** arr;
 	unsigned size;
 };
 
-static void init_list(struct sched_node_list * list)
+static void init_list(struct sched_component_list * list)
 {
 	memset(list,0,sizeof(*list));
 }
-static void destroy_list(struct sched_node_list * list)
+static void destroy_list(struct sched_component_list * list)
 {
 	free(list->arr);
 }
-static void add_node(struct sched_node_list *list, struct starpu_sched_node * node)
+static void add_component(struct sched_component_list *list, struct starpu_sched_component * component)
 {
 	list->arr = realloc(list->arr,sizeof(*list->arr) * (list->size + 1));
-	list->arr[list->size] = node;
+	list->arr[list->size] = component;
 	list->size++;
 }
 /* this is the function that actualy built the scheduler, but without workers */
-static struct sched_node_list helper_make_scheduler(hwloc_obj_t obj, struct starpu_sched_specs specs, unsigned sched_ctx_id)
+static struct sched_component_list helper_make_scheduler(hwloc_obj_t obj, struct starpu_sched_specs specs, unsigned sched_ctx_id)
 {
 	STARPU_ASSERT(obj);
 
-	struct starpu_sched_node * node = NULL;
+	struct starpu_sched_component * component = NULL;
 
-	/*set nodes for this obj */
+	/*set components for this obj */
 #define CASE(ENUM,spec_member)						\
 		case ENUM:						\
 			if(specs.spec_member)				\
-				node = starpu_sched_node_composed_node_create(specs.spec_member); \
+				component = starpu_sched_component_composed_component_create(specs.spec_member); \
 			break
 	switch(obj->type)
 	{
-		CASE(HWLOC_OBJ_MACHINE,hwloc_machine_composed_sched_node);
-		CASE(HWLOC_OBJ_NODE,hwloc_node_composed_sched_node);
-		CASE(HWLOC_OBJ_SOCKET,hwloc_socket_composed_sched_node);
-		CASE(HWLOC_OBJ_CACHE,hwloc_cache_composed_sched_node);
+		CASE(HWLOC_OBJ_MACHINE,hwloc_machine_composed_sched_component);
+		CASE(HWLOC_OBJ_NODE,hwloc_component_composed_sched_component);
+		CASE(HWLOC_OBJ_SOCKET,hwloc_socket_composed_sched_component);
+		CASE(HWLOC_OBJ_CACHE,hwloc_cache_composed_sched_component);
 	default:
 		break;
 	}
 
-	struct sched_node_list l;
+	struct sched_component_list l;
 	init_list(&l);
 	unsigned i;
-	/* collect childs node's */
+	/* collect childs component's */
 	for(i = 0; i < obj->arity; i++)
 	{
-		struct sched_node_list lc = helper_make_scheduler(obj->children[i],specs, sched_ctx_id);
+		struct sched_component_list lc = helper_make_scheduler(obj->children[i],specs, sched_ctx_id);
 		unsigned j;
 		for(j = 0; j < lc.size; j++)
-			add_node(&l, lc.arr[j]);
+			add_component(&l, lc.arr[j]);
 		destroy_list(&lc);
 	}
-	if(!node)
+	if(!component)
 		return l;
 	for(i = 0; i < l.size; i++)
 	{
-		node->add_child(node, l.arr[i]);
-		starpu_sched_node_add_father(l.arr[i],node);
+		component->add_child(component, l.arr[i]);
+		starpu_sched_component_add_father(l.arr[i],component);
 	}
 	destroy_list(&l);
 	init_list(&l);
-	node->obj = obj;
-	add_node(&l, node);
+	component->obj = obj;
+	add_component(&l, component);
 	return l;
 }
-/* return the firt node in prefix order such as node->obj == obj, or NULL */
-struct starpu_sched_node * _find_sched_node_with_obj(struct starpu_sched_node * node, hwloc_obj_t obj)
+/* return the firt component in prefix order such as component->obj == obj, or NULL */
+struct starpu_sched_component * _find_sched_component_with_obj(struct starpu_sched_component * component, hwloc_obj_t obj)
 {
-	if(node == NULL)
+	if(component == NULL)
 		return NULL;
-	if(node->obj == obj)
-		return node;
+	if(component->obj == obj)
+		return component;
 	int i;
-	for(i = 0; i < node->nchilds; i++)
+	for(i = 0; i < component->nchildren; i++)
 	{
-		struct starpu_sched_node * tmp = _find_sched_node_with_obj(node->childs[i], obj);
+		struct starpu_sched_component * tmp = _find_sched_component_with_obj(component->children[i], obj);
 		if(tmp)
 			return tmp;
 	}
@@ -120,135 +120,135 @@ struct starpu_sched_node * _find_sched_node_with_obj(struct starpu_sched_node *
 /* return true if all workers in the tree have the same perf_arch as w_ref,
  * if there is no worker it return true
  */
-static int is_same_kind_of_all(struct starpu_sched_node * root, struct _starpu_worker * w_ref)
+static int is_same_kind_of_all(struct starpu_sched_component * root, struct _starpu_worker * w_ref)
 {
-	if(starpu_sched_node_is_worker(root))
+	if(starpu_sched_component_is_worker(root))
 	{
 		struct _starpu_worker * w = root->data;
 		return w->perf_arch.type == w_ref->perf_arch.type;
 	}
 	
 	int i;
-	for(i = 0;i < root->nchilds; i++)
-		if(!is_same_kind_of_all(root->childs[i], w_ref))
+	for(i = 0;i < root->nchildren; i++)
+		if(!is_same_kind_of_all(root->children[i], w_ref))
 			return 0;
 	return 1;
 }
 /* buggy function
- * return the starpu_sched_node linked to the supposed memory node of worker_node
+ * return the starpu_sched_component linked to the supposed memory component of worker_component
  */
-static struct starpu_sched_node * find_mem_node(struct starpu_sched_node * root, struct starpu_sched_node * worker_node)
+static struct starpu_sched_component * find_mem_component(struct starpu_sched_component * root, struct starpu_sched_component * worker_component)
 {
-	struct starpu_sched_node * node = worker_node;
-	while(node->obj->type != HWLOC_OBJ_NODE
-	      && node->obj->type != HWLOC_OBJ_MACHINE)
+	struct starpu_sched_component * component = worker_component;
+	while(component->obj->type != HWLOC_OBJ_NODE
+	      && component->obj->type != HWLOC_OBJ_MACHINE)
 	{
-		hwloc_obj_t tmp = node->obj;
+		hwloc_obj_t tmp = component->obj;
 		do
 		{
-			node = _find_sched_node_with_obj(root,tmp);
+			component = _find_sched_component_with_obj(root,tmp);
 			tmp = tmp->parent;
 		}
-		while(!node);
+		while(!component);
 		
 	}
-	return node;
+	return component;
 }
 
-static struct starpu_sched_node * where_should_we_plug_this(struct starpu_sched_node *root, struct starpu_sched_node * worker_node, struct starpu_sched_specs specs, unsigned sched_ctx_id)
+static struct starpu_sched_component * where_should_we_plug_this(struct starpu_sched_component *root, struct starpu_sched_component * worker_component, struct starpu_sched_specs specs, unsigned sched_ctx_id)
 {
-	struct starpu_sched_node * mem = find_mem_node(root ,worker_node);
+	struct starpu_sched_component * mem = find_mem_component(root ,worker_component);
 	if(specs.mix_heterogeneous_workers || mem->fathers[sched_ctx_id] == NULL)
 		return mem;
 	hwloc_obj_t obj = mem->obj;
-	struct starpu_sched_node * father = mem->fathers[sched_ctx_id];
+	struct starpu_sched_component * father = mem->fathers[sched_ctx_id];
 	int i;
-	for(i = 0; i < father->nchilds; i++)
+	for(i = 0; i < father->nchildren; i++)
 	{
-		if(father->childs[i]->obj == obj
-		   && is_same_kind_of_all(father->childs[i], worker_node->data))
-			return father->childs[i];
+		if(father->children[i]->obj == obj
+		   && is_same_kind_of_all(father->children[i], worker_component->data))
+			return father->children[i];
 	}
 	if(obj->type == HWLOC_OBJ_NODE)
 	{	
-		struct starpu_sched_node * node = starpu_sched_node_composed_node_create(specs.hwloc_node_composed_sched_node);
-		node->obj = obj;
-		father->add_child(father, node);
-		starpu_sched_node_add_father(node, father);
-		return node;
+		struct starpu_sched_component * component = starpu_sched_component_composed_component_create(specs.hwloc_component_composed_sched_component);
+		component->obj = obj;
+		father->add_child(father, component);
+		starpu_sched_component_add_father(component, father);
+		return component;
 	}
 	return father;
 }
 
-static void set_worker_leaf(struct starpu_sched_node * root, struct starpu_sched_node * worker_node, unsigned sched_ctx_id,
+static void set_worker_leaf(struct starpu_sched_component * root, struct starpu_sched_component * worker_component, unsigned sched_ctx_id,
 			    struct starpu_sched_specs specs)
 {
-	struct _starpu_worker * worker = worker_node->data;
-	struct starpu_sched_node * node = where_should_we_plug_this(root,worker_node,specs, sched_ctx_id);
-	struct starpu_sched_node_composed_recipe * recipe = specs.worker_composed_sched_node ?
-		specs.worker_composed_sched_node(worker->arch):NULL;
-	STARPU_ASSERT(node);
+	struct _starpu_worker * worker = worker_component->data;
+	struct starpu_sched_component * component = where_should_we_plug_this(root,worker_component,specs, sched_ctx_id);
+	struct starpu_sched_component_composed_recipe * recipe = specs.worker_composed_sched_component ?
+		specs.worker_composed_sched_component(worker->arch):NULL;
+	STARPU_ASSERT(component);
 	if(recipe)
 	{
-		struct starpu_sched_node * tmp = starpu_sched_node_composed_node_create(recipe);
+		struct starpu_sched_component * tmp = starpu_sched_component_composed_component_create(recipe);
 #ifdef STARPU_DEVEL
-#warning FIXME node->obj is set to worker_node->obj even for accelerators workers
+#warning FIXME component->obj is set to worker_component->obj even for accelerators workers
 #endif
-		tmp->obj = worker_node->obj;
-		starpu_sched_node_add_father(tmp, node);
-		node->add_child(node, tmp);
-		node = tmp;
+		tmp->obj = worker_component->obj;
+		starpu_sched_component_add_father(tmp, component);
+		component->add_child(component, tmp);
+		component = tmp;
 		
 	}
-	starpu_destroy_composed_sched_node_recipe(recipe);
-	starpu_sched_node_add_father(worker_node, node);
-	node->add_child(node, worker_node);
+	starpu_destroy_composed_sched_component_recipe(recipe);
+	starpu_sched_component_add_father(worker_component, component);
+	component->add_child(component, worker_component);
 }
 
 #ifdef STARPU_DEVEL
-static const char * name_hwloc_node(struct starpu_sched_node * node)
+static const char * name_hwloc_component(struct starpu_sched_component * component)
 {
-	return hwloc_obj_type_string(node->obj->type);
+	return hwloc_obj_type_string(component->obj->type);
 }
-static const char * name_sched_node(struct starpu_sched_node * node)
+static const char * name_sched_component(struct starpu_sched_component * component)
 {
-	if(starpu_sched_node_is_fifo(node))
-		return "fifo node";
-	if(starpu_sched_node_is_heft(node))
-		return "heft node";
-	if(starpu_sched_node_is_random(node))
-		return "random node";
-	if(starpu_sched_node_is_worker(node))
+	if(starpu_sched_component_is_fifo(component))
+		return "fifo component";
+	if(starpu_sched_component_is_heft(component))
+		return "heft component";
+	if(starpu_sched_component_is_random(component))
+		return "random component";
+	if(starpu_sched_component_is_worker(component))
 	{
-		struct _starpu_worker * w = _starpu_sched_node_worker_get_worker(node);
+		struct _starpu_worker * w = _starpu_sched_component_worker_get_worker(component);
 #define SIZE 256
 		static char output[SIZE];
-		snprintf(output, SIZE,"node worker %d %s",w->workerid,w->name);
+		snprintf(output, SIZE,"component worker %d %s",w->workerid,w->name);
 		return output;
 	}
-	if(starpu_sched_node_is_work_stealing(node))
-		return "work stealing node";
+	if(starpu_sched_component_is_work_stealing(component))
+		return "work stealing component";
 
 	return "unknown";
 }
-static void helper_display_scheduler(FILE* out, unsigned depth, struct starpu_sched_node * node)
+static void helper_display_scheduler(FILE* out, unsigned depth, struct starpu_sched_component * component)
 {
-	if(!node)
+	if(!component)
 		return;
-	fprintf(out,"%*s-> %s : %s\n", depth * 2 , "", name_sched_node(node), name_hwloc_node(node));
+	fprintf(out,"%*s-> %s : %s\n", depth * 2 , "", name_sched_component(component), name_hwloc_component(component));
 	int i;
-	for(i = 0; i < node->nchilds; i++)
-		helper_display_scheduler(out, depth + 1, node->childs[i]);
+	for(i = 0; i < component->nchildren; i++)
+		helper_display_scheduler(out, depth + 1, component->children[i]);
 }
 #endif //STARPU_DEVEL
-struct starpu_sched_tree * starpu_sched_node_make_scheduler(unsigned sched_ctx_id, struct starpu_sched_specs specs)
+struct starpu_sched_tree * starpu_sched_component_make_scheduler(unsigned sched_ctx_id, struct starpu_sched_specs specs)
 {
 	struct starpu_sched_tree * tree = starpu_sched_tree_create(sched_ctx_id);
 	
 	struct _starpu_machine_config *config = _starpu_get_machine_config();
 	hwloc_topology_t topology = config->topology.hwtopology;
 
-	struct sched_node_list list = helper_make_scheduler(hwloc_get_root_obj(topology), specs, sched_ctx_id);
+	struct sched_component_list list = helper_make_scheduler(hwloc_get_root_obj(topology), specs, sched_ctx_id);
 	STARPU_ASSERT(list.size == 1);
 
 	tree->root = list.arr[0];
@@ -258,9 +258,9 @@ struct starpu_sched_tree * starpu_sched_node_make_scheduler(unsigned sched_ctx_i
 	for(i = 0; i < starpu_worker_get_count(); i++)
 	{
 		struct _starpu_worker * worker = _starpu_get_worker_struct(i);
-		struct starpu_sched_node * worker_node = starpu_sched_node_worker_get(i);
+		struct starpu_sched_component * worker_component = starpu_sched_component_worker_get(i);
 		STARPU_ASSERT(worker);
-		set_worker_leaf(tree->root,worker_node, sched_ctx_id, specs);
+		set_worker_leaf(tree->root,worker_component, sched_ctx_id, specs);
 	}
 
 

+ 11 - 11
src/sched_policies/tree_eager.c

@@ -15,7 +15,7 @@
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
 
-#include <starpu_sched_node.h>
+#include <starpu_sched_component.h>
 #include <starpu_scheduler.h>
 
 static void initialize_eager_center_policy(unsigned sched_ctx_id)
@@ -24,19 +24,19 @@ static void initialize_eager_center_policy(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);
- 	t->root = starpu_sched_node_fifo_create(NULL);
-	struct starpu_sched_node * eager_node = starpu_sched_node_eager_create(NULL);
-	t->root->add_child(t->root, eager_node);
-	eager_node->add_father(eager_node, t->root);
+ 	t->root = starpu_sched_component_fifo_create(NULL);
+	struct starpu_sched_component * eager_component = starpu_sched_component_eager_create(NULL);
+	t->root->add_child(t->root, eager_component);
+	eager_component->add_father(eager_component, t->root);
 
 	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);
-		STARPU_ASSERT(worker_node);
+		struct starpu_sched_component * worker_component = starpu_sched_component_worker_get(i);
+		STARPU_ASSERT(worker_component);
 
-		eager_node->add_child(eager_node, worker_node);
-		worker_node->add_father(worker_node, eager_node);
+		eager_component->add_child(eager_component, worker_component);
+		worker_component->add_father(worker_component, eager_component);
 	}
 	starpu_sched_tree_update_workers(t);
 	starpu_sched_ctx_set_policy_data(sched_ctx_id, (void*)t);
@@ -57,8 +57,8 @@ struct starpu_sched_policy _starpu_sched_tree_eager_policy =
 	.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,
+	.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",
 	.policy_description = "eager tree policy"

+ 14 - 14
src/sched_policies/tree_eager_prefetching.c

@@ -15,7 +15,7 @@
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
 
-#include <starpu_sched_node.h>
+#include <starpu_sched_component.h>
 #include <starpu_scheduler.h>
 
 #define _STARPU_SCHED_NTASKS_THRESHOLD_DEFAULT 2
@@ -39,10 +39,10 @@ static void initialize_eager_prefetching_center_policy(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);
- 	t->root = starpu_sched_node_fifo_create(NULL);
-	struct starpu_sched_node * eager_node = starpu_sched_node_eager_create(NULL);
-	t->root->add_child(t->root, eager_node);
-	eager_node->add_father(eager_node, t->root);
+ 	t->root = starpu_sched_component_fifo_create(NULL);
+	struct starpu_sched_component * eager_component = starpu_sched_component_eager_create(NULL);
+	t->root->add_child(t->root, eager_component);
+	eager_component->add_father(eager_component, t->root);
 
 	struct starpu_fifo_data fifo_data =
 		{
@@ -53,15 +53,15 @@ static void initialize_eager_prefetching_center_policy(unsigned sched_ctx_id)
 	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);
-		STARPU_ASSERT(worker_node);
+		struct starpu_sched_component * worker_component = starpu_sched_component_worker_get(i);
+		STARPU_ASSERT(worker_component);
 
-		struct starpu_sched_node * fifo_node = starpu_sched_node_fifo_create(&fifo_data);
-		fifo_node->add_child(fifo_node, worker_node);
-		worker_node->add_father(worker_node, fifo_node);
+		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);
 
-		eager_node->add_child(eager_node, fifo_node);
-		fifo_node->add_father(fifo_node, eager_node);
+		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);
@@ -82,8 +82,8 @@ struct starpu_sched_policy _starpu_sched_tree_eager_prefetching_policy =
 	.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,
+	.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"

+ 50 - 50
src/sched_policies/tree_heft.c

@@ -16,11 +16,11 @@
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
 
-#include <starpu_sched_node.h>
+#include <starpu_sched_component.h>
 #include <starpu_scheduler.h>
 #include <float.h>
 
-/* The two thresolds concerns the prio nodes, which contains queues
+/* The two thresolds concerns the prio components, which contains queues
  * who can handle the priority of StarPU tasks. You can tune your
  * scheduling by benching those values and choose which one is the
  * best for your current application. 
@@ -49,55 +49,55 @@ static void initialize_heft_center_policy(unsigned sched_ctx_id)
 /* The scheduling strategy look like this :
  *
  *                                    |
- *                              window_node
+ *                              window_component
  *                                    |
- * perfmodel_node <--push-- perfmodel_select_node --push--> eager_node
+ * perfmodel_component <--push-- perfmodel_select_component --push--> eager_component
  *          |                                                    |
  *          |                                                    |
  *          >----------------------------------------------------<
  *                    |                                |
- *              best_impl_node                    best_impl_node
+ *              best_impl_component                    best_impl_component
  *                    |                                |
- *                prio_node                        prio_node
+ *                prio_component                        prio_component
  *                    |                                |
- *               worker_node                   worker_node
+ *               worker_component                   worker_component
  *
- * A window contain the tasks that failed to be pushed, so as when the prio_nodes reclaim
- * tasks by calling room to their father (classically, just after a successful pop have
- * been made by its associated worker_node), this call goes up to the window_node which
+ * A window contain the tasks that failed to be pushed, so as when the prio_components reclaim
+ * tasks by calling can_push to their father (classically, just after a successful pop have
+ * been made by its associated worker_component), this call goes up to the window_component which
  * pops a task from its local queue and try to schedule it by pushing it to the
- * decision_node. 
- * Finally, the task will be pushed to the prio_node which is the direct
- * father in the tree of the worker_node the task has been scheduled on. This
- * node will push the task on its local queue if no one of the two thresholds
+ * decision_component. 
+ * Finally, the task will be pushed to the prio_component which is the direct
+ * father in the tree of the worker_component the task has been scheduled on. This
+ * component will push the task on its local queue if no one of the two thresholds
  * have been reached for it, or send a push_error signal to its father.
  */
 	struct starpu_sched_tree * t = starpu_sched_tree_create(sched_ctx_id);
 
-	struct starpu_sched_node * window_node = starpu_sched_node_prio_create(NULL);
-	t->root = window_node;
+	struct starpu_sched_component * window_component = starpu_sched_component_prio_create(NULL);
+	t->root = window_component;
 
-	struct starpu_sched_node * perfmodel_node = starpu_sched_node_mct_create(NULL);
-	struct starpu_sched_node * no_perfmodel_node = starpu_sched_node_eager_create(NULL);
-	struct starpu_sched_node * calibrator_node = starpu_sched_node_eager_calibration_create(NULL);
+	struct starpu_sched_component * perfmodel_component = starpu_sched_component_mct_create(NULL);
+	struct starpu_sched_component * no_perfmodel_component = starpu_sched_component_eager_create(NULL);
+	struct starpu_sched_component * calibrator_component = starpu_sched_component_eager_calibration_create(NULL);
 	
 	struct starpu_perfmodel_select_data perfmodel_select_data =
 		{
-			.calibrator_node = calibrator_node,
-			.no_perfmodel_node = no_perfmodel_node,
-			.perfmodel_node = perfmodel_node,
+			.calibrator_component = calibrator_component,
+			.no_perfmodel_component = no_perfmodel_component,
+			.perfmodel_component = perfmodel_component,
 		};
 
-	struct starpu_sched_node * perfmodel_select_node = starpu_sched_node_perfmodel_select_create(&perfmodel_select_data);
-	window_node->add_child(window_node, perfmodel_select_node);
-	perfmodel_select_node->add_father(perfmodel_select_node, window_node);
+	struct starpu_sched_component * perfmodel_select_component = starpu_sched_component_perfmodel_select_create(&perfmodel_select_data);
+	window_component->add_child(window_component, perfmodel_select_component);
+	perfmodel_select_component->add_father(perfmodel_select_component, window_component);
 
-	perfmodel_select_node->add_child(perfmodel_select_node, calibrator_node);
-	calibrator_node->add_father(calibrator_node, perfmodel_select_node);
-	perfmodel_select_node->add_child(perfmodel_select_node, perfmodel_node);
-	perfmodel_node->add_father(perfmodel_node, perfmodel_select_node);
-	perfmodel_select_node->add_child(perfmodel_select_node, no_perfmodel_node);
-	no_perfmodel_node->add_father(no_perfmodel_node, perfmodel_select_node);
+	perfmodel_select_component->add_child(perfmodel_select_component, calibrator_component);
+	calibrator_component->add_father(calibrator_component, perfmodel_select_component);
+	perfmodel_select_component->add_child(perfmodel_select_component, perfmodel_component);
+	perfmodel_component->add_father(perfmodel_component, perfmodel_select_component);
+	perfmodel_select_component->add_child(perfmodel_select_component, no_perfmodel_component);
+	no_perfmodel_component->add_father(no_perfmodel_component, perfmodel_select_component);
 
 	struct starpu_prio_data prio_data =
 		{
@@ -108,23 +108,23 @@ static void initialize_heft_center_policy(unsigned sched_ctx_id)
 	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);
-		STARPU_ASSERT(worker_node);
-
-		struct starpu_sched_node * prio_node = starpu_sched_node_prio_create(&prio_data);
-		prio_node->add_child(prio_node, worker_node);
-		worker_node->add_father(worker_node, prio_node);
-
-		struct starpu_sched_node * impl_node = starpu_sched_node_best_implementation_create(NULL);
-		impl_node->add_child(impl_node, prio_node);
-		prio_node->add_father(prio_node, impl_node);
-
-		perfmodel_node->add_child(perfmodel_node, impl_node);
-		impl_node->add_father(impl_node, perfmodel_node);
-		no_perfmodel_node->add_child(no_perfmodel_node, impl_node);
-		impl_node->add_father(impl_node, no_perfmodel_node);
-		calibrator_node->add_child(calibrator_node, impl_node);
-		impl_node->add_father(impl_node, calibrator_node);
+		struct starpu_sched_component * worker_component = starpu_sched_component_worker_get(i);
+		STARPU_ASSERT(worker_component);
+
+		struct starpu_sched_component * prio_component = starpu_sched_component_prio_create(&prio_data);
+		prio_component->add_child(prio_component, worker_component);
+		worker_component->add_father(worker_component, prio_component);
+
+		struct starpu_sched_component * impl_component = starpu_sched_component_best_implementation_create(NULL);
+		impl_component->add_child(impl_component, prio_component);
+		prio_component->add_father(prio_component, impl_component);
+
+		perfmodel_component->add_child(perfmodel_component, impl_component);
+		impl_component->add_father(impl_component, perfmodel_component);
+		no_perfmodel_component->add_child(no_perfmodel_component, impl_component);
+		impl_component->add_father(impl_component, no_perfmodel_component);
+		calibrator_component->add_child(calibrator_component, impl_component);
+		impl_component->add_father(impl_component, calibrator_component);
 	}
 
 	starpu_sched_tree_update_workers(t);
@@ -146,8 +146,8 @@ struct starpu_sched_policy _starpu_sched_tree_heft_policy =
 	.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,
+	.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-heft",
 	.policy_description = "heft tree policy"

+ 38 - 38
src/sched_policies/tree_heft2.c

@@ -16,11 +16,11 @@
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
 
-#include <starpu_sched_node.h>
+#include <starpu_sched_component.h>
 #include <starpu_scheduler.h>
 #include <float.h>
 
-/* The two thresolds concerns the prio nodes, which contains queues
+/* The two thresolds concerns the prio components, which contains queues
  * who can handle the priority of StarPU tasks. You can tune your
  * scheduling by benching those values and choose which one is the
  * best for your current application. 
@@ -48,30 +48,30 @@ static void initialize_heft2_center_policy(unsigned sched_ctx_id)
 
 	struct starpu_sched_tree * t = starpu_sched_tree_create(sched_ctx_id);
 
-	struct starpu_sched_node * perfmodel_node = starpu_sched_node_heft_create(NULL);
-	struct starpu_sched_node * no_perfmodel_node = starpu_sched_node_eager_create(NULL);
-	struct starpu_sched_node * calibrator_node = starpu_sched_node_eager_create(NULL);
+	struct starpu_sched_component * perfmodel_component = starpu_sched_component_heft_create(NULL);
+	struct starpu_sched_component * no_perfmodel_component = starpu_sched_component_eager_create(NULL);
+	struct starpu_sched_component * calibrator_component = starpu_sched_component_eager_create(NULL);
 	
 	struct starpu_perfmodel_select_data perfmodel_select_data =
 		{
-			.calibrator_node = calibrator_node,
-			.no_perfmodel_node = no_perfmodel_node,
-			.perfmodel_node = perfmodel_node,
+			.calibrator_component = calibrator_component,
+			.no_perfmodel_component = no_perfmodel_component,
+			.perfmodel_component = perfmodel_component,
 		};
 
-	struct starpu_sched_node * window_node = starpu_sched_node_prio_create(NULL);
-	t->root = window_node;
+	struct starpu_sched_component * window_component = starpu_sched_component_prio_create(NULL);
+	t->root = window_component;
 
-	struct starpu_sched_node * perfmodel_select_node = starpu_sched_node_perfmodel_select_create(&perfmodel_select_data);
-	window_node->add_child(window_node, perfmodel_select_node);
-	perfmodel_select_node->add_father(perfmodel_select_node, window_node);
+	struct starpu_sched_component * perfmodel_select_component = starpu_sched_component_perfmodel_select_create(&perfmodel_select_data);
+	window_component->add_child(window_component, perfmodel_select_component);
+	perfmodel_select_component->add_father(perfmodel_select_component, window_component);
 
-	perfmodel_select_node->add_child(perfmodel_select_node, calibrator_node);
-	calibrator_node->add_father(calibrator_node, perfmodel_select_node);
-	perfmodel_select_node->add_child(perfmodel_select_node, perfmodel_node);
-	perfmodel_node->add_father(perfmodel_node, perfmodel_select_node);
-	perfmodel_select_node->add_child(perfmodel_select_node, no_perfmodel_node);
-	no_perfmodel_node->add_father(no_perfmodel_node, perfmodel_select_node);
+	perfmodel_select_component->add_child(perfmodel_select_component, calibrator_component);
+	calibrator_component->add_father(calibrator_component, perfmodel_select_component);
+	perfmodel_select_component->add_child(perfmodel_select_component, perfmodel_component);
+	perfmodel_component->add_father(perfmodel_component, perfmodel_select_component);
+	perfmodel_select_component->add_child(perfmodel_select_component, no_perfmodel_component);
+	no_perfmodel_component->add_father(no_perfmodel_component, perfmodel_select_component);
 
 	struct starpu_prio_data prio_data =
 		{
@@ -82,23 +82,23 @@ static void initialize_heft2_center_policy(unsigned sched_ctx_id)
 	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);
-		STARPU_ASSERT(worker_node);
-
-		struct starpu_sched_node * prio_node = starpu_sched_node_prio_create(&prio_data);
-		prio_node->add_child(prio_node, worker_node);
-		worker_node->add_father(worker_node, prio_node);
-
-		struct starpu_sched_node * impl_node = starpu_sched_node_best_implementation_create(NULL);
-		impl_node->add_child(impl_node, prio_node);
-		prio_node->add_father(prio_node, impl_node);
-
-		perfmodel_node->add_child(perfmodel_node, impl_node);
-		impl_node->add_father(impl_node, perfmodel_node);
-		no_perfmodel_node->add_child(no_perfmodel_node, impl_node);
-		impl_node->add_father(impl_node, no_perfmodel_node);
-		calibrator_node->add_child(calibrator_node, impl_node);
-		impl_node->add_father(impl_node, calibrator_node);
+		struct starpu_sched_component * worker_component = starpu_sched_component_worker_get(i);
+		STARPU_ASSERT(worker_component);
+
+		struct starpu_sched_component * prio_component = starpu_sched_component_prio_create(&prio_data);
+		prio_component->add_child(prio_component, worker_component);
+		worker_component->add_father(worker_component, prio_component);
+
+		struct starpu_sched_component * impl_component = starpu_sched_component_best_implementation_create(NULL);
+		impl_component->add_child(impl_component, prio_component);
+		prio_component->add_father(prio_component, impl_component);
+
+		perfmodel_component->add_child(perfmodel_component, impl_component);
+		impl_component->add_father(impl_component, perfmodel_component);
+		no_perfmodel_component->add_child(no_perfmodel_component, impl_component);
+		impl_component->add_father(impl_component, no_perfmodel_component);
+		calibrator_component->add_child(calibrator_component, impl_component);
+		impl_component->add_father(impl_component, calibrator_component);
 	}
 
 	starpu_sched_tree_update_workers(t);
@@ -120,8 +120,8 @@ struct starpu_sched_policy _starpu_sched_tree_heft2_policy =
 	.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,
+	.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-heft2",
 	.policy_description = "heft tree2 policy"

+ 11 - 11
src/sched_policies/tree_prio.c

@@ -14,26 +14,26 @@
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
 
-#include <starpu_sched_node.h>
+#include <starpu_sched_component.h>
 #include <starpu_scheduler.h>
 
 static void initialize_prio_center_policy(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);
- 	t->root = starpu_sched_node_prio_create(NULL);
-	struct starpu_sched_node * eager_node = starpu_sched_node_eager_create(NULL);
-	t->root->add_child(t->root, eager_node);
-	eager_node->add_father(eager_node, t->root);
+ 	t->root = starpu_sched_component_prio_create(NULL);
+	struct starpu_sched_component * eager_component = starpu_sched_component_eager_create(NULL);
+	t->root->add_child(t->root, eager_component);
+	eager_component->add_father(eager_component, t->root);
 
 	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);
-		STARPU_ASSERT(worker_node);
+		struct starpu_sched_component * worker_component = starpu_sched_component_worker_get(i);
+		STARPU_ASSERT(worker_component);
 
-		eager_node->add_child(eager_node, worker_node);
-		worker_node->add_father(worker_node, eager_node);
+		eager_component->add_child(eager_component, worker_component);
+		worker_component->add_father(worker_component, eager_component);
 	}
 	starpu_sched_tree_update_workers(t);
 	starpu_sched_ctx_set_policy_data(sched_ctx_id, (void*)t);
@@ -54,8 +54,8 @@ struct starpu_sched_policy _starpu_sched_tree_prio_policy =
 	.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,
+	.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-prio",
 	.policy_description = "prio tree policy"

+ 14 - 14
src/sched_policies/tree_prio_prefetching.c

@@ -14,7 +14,7 @@
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
 
-#include <starpu_sched_node.h>
+#include <starpu_sched_component.h>
 #include <starpu_scheduler.h>
 
 #define _STARPU_SCHED_NTASKS_THRESHOLD_DEFAULT 4
@@ -35,10 +35,10 @@ static void initialize_prio_prefetching_center_policy(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);
- 	t->root = starpu_sched_node_prio_create(NULL);
-	struct starpu_sched_node * eager_node = starpu_sched_node_eager_create(NULL);
-	t->root->add_child(t->root, eager_node);
-	eager_node->add_father(eager_node, t->root);
+ 	t->root = starpu_sched_component_prio_create(NULL);
+	struct starpu_sched_component * eager_component = starpu_sched_component_eager_create(NULL);
+	t->root->add_child(t->root, eager_component);
+	eager_component->add_father(eager_component, t->root);
 
 	struct starpu_prio_data prio_data =
 		{
@@ -49,15 +49,15 @@ static void initialize_prio_prefetching_center_policy(unsigned sched_ctx_id)
 	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);
-		STARPU_ASSERT(worker_node);
+		struct starpu_sched_component * worker_component = starpu_sched_component_worker_get(i);
+		STARPU_ASSERT(worker_component);
 
-		struct starpu_sched_node * prio_node = starpu_sched_node_prio_create(&prio_data);
-		prio_node->add_child(prio_node, worker_node);
-		worker_node->add_father(worker_node, prio_node);
+		struct starpu_sched_component * prio_component = starpu_sched_component_prio_create(&prio_data);
+		prio_component->add_child(prio_component, worker_component);
+		worker_component->add_father(worker_component, prio_component);
 
-		eager_node->add_child(eager_node, prio_node);
-		prio_node->add_father(prio_node, eager_node);
+		eager_component->add_child(eager_component, prio_component);
+		prio_component->add_father(prio_component, eager_component);
 	}
 	starpu_sched_tree_update_workers(t);
 	starpu_sched_ctx_set_policy_data(sched_ctx_id, (void*)t);
@@ -78,8 +78,8 @@ struct starpu_sched_policy _starpu_sched_tree_prio_prefetching_policy =
 	.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,
+	.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-prio-prefetching",
 	.policy_description = "prio prefetching tree policy"

+ 17 - 17
src/sched_policies/tree_random.c

@@ -15,7 +15,7 @@
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
 
-#include <starpu_sched_node.h>
+#include <starpu_sched_component.h>
 #include <starpu_scheduler.h>
 
 /* Random scheduler with a fifo queue for its scheduling window */
@@ -24,19 +24,19 @@ static void initialize_random_fifo_center_policy(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);
- 	t->root = starpu_sched_node_fifo_create(NULL);
-	struct starpu_sched_node * random_node = starpu_sched_node_random_create(NULL);
-	t->root->add_child(t->root, random_node);
-	random_node->add_father(random_node, t->root);
+ 	t->root = starpu_sched_component_fifo_create(NULL);
+	struct starpu_sched_component * random_component = starpu_sched_component_random_create(NULL);
+	t->root->add_child(t->root, random_component);
+	random_component->add_father(random_component, t->root);
 
 	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);
-		STARPU_ASSERT(worker_node);
+		struct starpu_sched_component * worker_component = starpu_sched_component_worker_get(i);
+		STARPU_ASSERT(worker_component);
 
-		random_node->add_child(random_node, worker_node);
-		worker_node->add_father(worker_node, random_node);
+		random_component->add_child(random_component, worker_component);
+		worker_component->add_father(worker_component, random_component);
 	}
 	starpu_sched_tree_update_workers(t);
 	starpu_sched_ctx_set_policy_data(sched_ctx_id, (void*)t);
@@ -70,19 +70,19 @@ static void initialize_random_prio_center_policy(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);
- 	t->root = starpu_sched_node_prio_create(NULL);
-	struct starpu_sched_node * random_node = starpu_sched_node_random_create(NULL);
-	t->root->add_child(t->root, random_node);
-	random_node->add_father(random_node, t->root);
+ 	t->root = starpu_sched_component_prio_create(NULL);
+	struct starpu_sched_component * random_component = starpu_sched_component_random_create(NULL);
+	t->root->add_child(t->root, random_component);
+	random_component->add_father(random_component, t->root);
 
 	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);
-		STARPU_ASSERT(worker_node);
+		struct starpu_sched_component * worker_component = starpu_sched_component_worker_get(i);
+		STARPU_ASSERT(worker_component);
 
-		random_node->add_child(random_node, worker_node);
-		worker_node->add_father(worker_node, random_node);
+		random_component->add_child(random_component, worker_component);
+		worker_component->add_father(worker_component, random_component);
 	}
 	starpu_sched_tree_update_workers(t);
 	starpu_sched_ctx_set_policy_data(sched_ctx_id, (void*)t);

+ 23 - 23
src/sched_policies/tree_random_prefetching.c

@@ -15,7 +15,7 @@
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
 
-#include <starpu_sched_node.h>
+#include <starpu_sched_component.h>
 #include <starpu_scheduler.h>
 
 #define _STARPU_SCHED_NTASKS_THRESHOLD_DEFAULT 2
@@ -38,10 +38,10 @@ static void initialize_random_fifo_prefetching_center_policy(unsigned sched_ctx_
 
 	starpu_sched_ctx_create_worker_collection(sched_ctx_id, STARPU_WORKER_LIST);
 	struct starpu_sched_tree *t = starpu_sched_tree_create(sched_ctx_id);
- 	t->root = starpu_sched_node_fifo_create(NULL);
-	struct starpu_sched_node * random_node = starpu_sched_node_random_create(NULL);
-	t->root->add_child(t->root, random_node);
-	random_node->add_father(random_node, t->root);
+ 	t->root = starpu_sched_component_fifo_create(NULL);
+	struct starpu_sched_component * random_component = starpu_sched_component_random_create(NULL);
+	t->root->add_child(t->root, random_component);
+	random_component->add_father(random_component, t->root);
 
 	struct starpu_fifo_data fifo_data =
 		{
@@ -52,15 +52,15 @@ static void initialize_random_fifo_prefetching_center_policy(unsigned sched_ctx_
 	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);
-		STARPU_ASSERT(worker_node);
+		struct starpu_sched_component * worker_component = starpu_sched_component_worker_get(i);
+		STARPU_ASSERT(worker_component);
 
-		struct starpu_sched_node * fifo_node = starpu_sched_node_fifo_create(&fifo_data);
-		fifo_node->add_child(fifo_node, worker_node);
-		worker_node->add_father(worker_node, fifo_node);
+		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);
 
-		random_node->add_child(random_node, fifo_node);
-		fifo_node->add_father(fifo_node, random_node);
+		random_component->add_child(random_component, fifo_component);
+		fifo_component->add_father(fifo_component, random_component);
 	}
 	starpu_sched_tree_update_workers(t);
 	starpu_sched_ctx_set_policy_data(sched_ctx_id, (void*)t);
@@ -105,10 +105,10 @@ static void initialize_random_prio_prefetching_center_policy(unsigned sched_ctx_
 
 	starpu_sched_ctx_create_worker_collection(sched_ctx_id, STARPU_WORKER_LIST);
 	struct starpu_sched_tree *t = starpu_sched_tree_create(sched_ctx_id);
- 	t->root = starpu_sched_node_prio_create(NULL);
-	struct starpu_sched_node * random_node = starpu_sched_node_random_create(NULL);
-	t->root->add_child(t->root, random_node);
-	random_node->add_father(random_node, t->root);
+ 	t->root = starpu_sched_component_prio_create(NULL);
+	struct starpu_sched_component * random_component = starpu_sched_component_random_create(NULL);
+	t->root->add_child(t->root, random_component);
+	random_component->add_father(random_component, t->root);
 
 	struct starpu_prio_data prio_data =
 		{
@@ -119,15 +119,15 @@ static void initialize_random_prio_prefetching_center_policy(unsigned sched_ctx_
 	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);
-		STARPU_ASSERT(worker_node);
+		struct starpu_sched_component * worker_component = starpu_sched_component_worker_get(i);
+		STARPU_ASSERT(worker_component);
 
-		struct starpu_sched_node * prio_node = starpu_sched_node_prio_create(&prio_data);
-		prio_node->add_child(prio_node, worker_node);
-		worker_node->add_father(worker_node, prio_node);
+		struct starpu_sched_component * prio_component = starpu_sched_component_prio_create(&prio_data);
+		prio_component->add_child(prio_component, worker_component);
+		worker_component->add_father(worker_component, prio_component);
 
-		random_node->add_child(random_node, prio_node);
-		prio_node->add_father(prio_node, random_node);
+		random_component->add_child(random_component, prio_component);
+		prio_component->add_father(prio_component, random_component);
 	}
 	starpu_sched_tree_update_workers(t);
 	starpu_sched_ctx_set_policy_data(sched_ctx_id, (void*)t);

+ 6 - 6
src/sched_policies/tree_ws.c

@@ -15,7 +15,7 @@
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
 
-#include <starpu_sched_node.h>
+#include <starpu_sched_component.h>
 #include <starpu_scheduler.h>
 
 
@@ -23,15 +23,15 @@ static void initialize_ws_center_policy(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);
- 	t->root = starpu_sched_node_work_stealing_create(NULL);
+ 	t->root = starpu_sched_component_work_stealing_create(NULL);
 	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);
-		STARPU_ASSERT(worker_node);
+		struct starpu_sched_component * worker_component = starpu_sched_component_worker_get(i);
+		STARPU_ASSERT(worker_component);
 
-		t->root->add_child(t->root, worker_node);
-		worker_node->add_father(worker_node, t->root);
+		t->root->add_child(t->root, worker_component);
+		worker_component->add_father(worker_component, t->root);
 	}
 	starpu_sched_tree_update_workers(t);
 	starpu_sched_ctx_set_policy_data(sched_ctx_id, (void*)t);