Browse Source

move node_composed stuffs to public interface
documented it

Simon Archipoff 12 years ago
parent
commit
d75aeeabee

+ 32 - 7
doc/doxygen/chapters/api/modularized_scheduler.doxy

@@ -86,7 +86,7 @@ The actual scheduler
 
 \fn void starpu_sched_node_destroy(struct starpu_sched_node * node)
 \ingroup API_Modularized_Scheduler
-    	 free data allocated by starpu_sched_node_create and call node->deinit_data(node)
+	 free data allocated by starpu_sched_node_create and call node->deinit_data(node)
 	 set to null the member starpu_sched_node::fathers[sched_ctx_id] of all child if its equal to \p node
 
 \fn void starpu_sched_node_set_father(struct starpu_sched_node * node, struct starpu_sched_node * father_node, unsigned sched_ctx_id)
@@ -96,7 +96,7 @@ The actual scheduler
 \fn void starpu_sched_node_add_child(struct starpu_sched_node* node, struct starpu_sched_node * child)
 \ingroup API_Modularized_Scheduler
 	 add child to node->childs and increment nchilds as well.
-	 and dont modify child->fathers
+	 and do not modify child->fathers
 	 \p child must not be already in starpu_sched_node::childs of \p node
 
 \fn void starpu_sched_node_remove_child(struct starpu_sched_node * node, struct starpu_sched_node * child)
@@ -142,7 +142,7 @@ The actual scheduler
 \fn struct starpu_sched_node * starpu_sched_node_fifo_create(void * arg STARPU_ATTRIBUTE_UNUSED)
 \ingroup API_Modularized_Scheduler
 	 Return a struct starpu_sched_node with a fifo. A stable sort is performed according to tasks priorities.
-	 A push_task call on this node does not perform recursive calls, underlaying nodes will have to call pop_task to get it.
+	 A push_task call on this node does not perform recursive calls, underlying nodes will have to call pop_task to get it.
 	 starpu_sched_node::estimated_end function compute the estimated length by dividing the sequential length by the number of underlying workers. Do not take into account tasks that are currently executed.
 
 \fn int starpu_sched_node_is_fifo(struct starpu_sched_node * node)
@@ -164,7 +164,7 @@ The actual scheduler
 
 \fn struct starpu_sched_node * starpu_sched_node_random_create(void * arg STARPU_ATTRIBUTE_UNUSED)
 \ingroup API_Modularized_Scheduler
-	 create a node that perform a random scheduling. 
+	 create a node that perform a random scheduling
 
 \fn int starpu_sched_node_is_random(struct starpu_sched_node *);
 \ingroup API_Modularized_Scheduler
@@ -172,7 +172,7 @@ The actual scheduler
 
 \fn struct starpu_sched_node * starpu_sched_node_heft_create(struct starpu_heft_data * heft_data)
 \ingroup API_Modularized_Scheduler
-	 this node perform a heft scheduling using data provided by estimated_execute_preds, if no pred_model are available a random node is used to push tasks.
+	 this node perform a heft scheduling
 
 \fn int starpu_sched_node_is_heft(struct starpu_sched_node * node)
 \ingroup API_Modularized_Scheduler
@@ -182,7 +182,7 @@ The actual scheduler
 \ingroup API_Modularized_Scheduler
 starpu_sched_node_heft_create parameters
 \var starpu_heft_data::alpha
-	 coefficient applied to computation length 
+	 coefficient applied to computation length
 \var starpu_heft_data::beta
 	 coefficient applied to communication length
 \var starpu_heft_data::gamma
@@ -293,4 +293,29 @@ starpu_sched_node_heft_create parameters
 \ingroup API_Modularized_Scheduler
 	 return the position of set bit right after \p e in \p bitmap, -1 if none
 
-*/
+
+\struct starpu_sched_node_composed_recipe;
+\ingroup API_Modularized_Scheduler
+	parameters for starpu_sched_node_composed_node_create
+
+\fn struct starpu_sched_node_composed_recipe * starpu_sched_node_create_recipe(void)
+\ingroup API_Modularized_Scheduler
+	 return an empty recipe for a composed node, it should not be used without modification
+
+
+\fn struct starpu_sched_node_composed_recipe * starpu_sched_node_create_recipe_singleton(struct starpu_sched_node *(*create_node)(void * arg), void * arg)
+\ingroup API_Modularized_Scheduler
+	 return a recipe to build a composed node with a \p create_node
+
+\fn void starpu_sched_recipe_add_node(struct starpu_sched_node_composed_recipe * recipe, struct starpu_sched_node *(*create_node)(void * arg), void * arg)
+\ingroup API_Modularized_Scheduler
+	 add \p create_node under all previous nodes in recipe
+
+\fn void starpu_destroy_composed_sched_node_recipe(struct starpu_sched_node_composed_recipe *)
+\ingroup API_Modularized_Scheduler
+	 destroy composed_sched_node, this should be done after starpu_sched_node_composed_node_create was called
+
+\fn struct starpu_sched_node * starpu_sched_node_composed_node_create(struct starpu_sched_node_composed_recipe * recipe)
+\ingroup API_Modularized_Scheduler
+	 create a node that behave as all node of recipe where linked. Except that you cant use starpu_sched_node_is_foo function
+*/

+ 13 - 0
include/starpu_sched_node.h

@@ -232,4 +232,17 @@ int starpu_bitmap_last(struct starpu_bitmap *);
 int starpu_bitmap_next(struct starpu_bitmap *, int e);
 
 
+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);
+
 #endif

+ 4 - 4
src/sched_policies/hierarchical_heft.c

@@ -2,9 +2,9 @@
 #include <core/workers.h>
 #include "scheduler_maker.h"
 
-static struct  _starpu_composed_sched_node_recipe *  recipe_for_worker(enum starpu_worker_archtype a STARPU_ATTRIBUTE_UNUSED)
+static struct  starpu_sched_node_composed_recipe *  recipe_for_worker(enum starpu_worker_archtype a STARPU_ATTRIBUTE_UNUSED)
 {
-	struct _starpu_composed_sched_node_recipe * r = starpu_sched_node_create_recipe();
+	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);
 	return r;
@@ -31,7 +31,7 @@ static void initialize_heft_center_policy(unsigned sched_ctx_id)
 		.calibrating_node_create = starpu_sched_node_random_create,
 		.arg_calibrating_node = NULL,
 	};
-	struct _starpu_composed_sched_node_recipe * r = starpu_sched_node_create_recipe();
+	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;
 
@@ -44,7 +44,7 @@ static void initialize_heft_center_policy(unsigned sched_ctx_id)
 
 	struct starpu_sched_tree *t = _starpu_make_scheduler(sched_ctx_id, specs);
 
-	_starpu_destroy_composed_sched_node_recipe(specs.hwloc_machine_composed_sched_node);
+	starpu_destroy_composed_sched_node_recipe(specs.hwloc_machine_composed_sched_node);
 
 
 	starpu_sched_tree_update_workers(t);

+ 10 - 10
src/sched_policies/node_composed.c

@@ -11,20 +11,20 @@ LIST_TYPE(fun_create_node,
 );
 
 
-struct _starpu_composed_sched_node_recipe
+struct starpu_sched_node_composed_recipe
 {
 	struct fun_create_node_list * list;
 };
 
 
-struct _starpu_composed_sched_node_recipe * starpu_sched_node_create_recipe(void)
+struct starpu_sched_node_composed_recipe * starpu_sched_node_create_recipe(void)
 {
-	struct _starpu_composed_sched_node_recipe * recipe = malloc(sizeof(*recipe));
+	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_composed_sched_node_recipe * recipe,
+void starpu_sched_recipe_add_node(struct starpu_sched_node_composed_recipe * recipe,
 				  struct starpu_sched_node *(*create_node)(void * arg),
 				  void * arg)
 {
@@ -33,14 +33,14 @@ void starpu_sched_recipe_add_node(struct _starpu_composed_sched_node_recipe * re
 	e->arg = arg;
 	fun_create_node_list_push_back(recipe->list, e);
 }
-struct _starpu_composed_sched_node_recipe * starpu_sched_node_create_recipe_singleton(struct starpu_sched_node *(*create_node)(void * arg),
+struct starpu_sched_node_composed_recipe * starpu_sched_node_create_recipe_singleton(struct starpu_sched_node *(*create_node)(void * arg),
 										      void * arg)
 {
-	struct _starpu_composed_sched_node_recipe * r = starpu_sched_node_create_recipe();
+	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_composed_sched_node_recipe * recipe)
+void starpu_destroy_composed_sched_node_recipe(struct starpu_sched_node_composed_recipe * recipe)
 {
 	if(!recipe)
 		return;
@@ -60,11 +60,11 @@ struct composed_node
 /* 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_composed_sched_node_recipe * recipe
+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);
@@ -173,7 +173,7 @@ void composed_node_deinit_data(struct starpu_sched_node * _node)
 	_node->data = NULL;
 }
 
-struct starpu_sched_node * starpu_sched_node_composed_node_create(struct _starpu_composed_sched_node_recipe * recipe)
+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;

+ 0 - 17
src/sched_policies/node_composed.h

@@ -1,17 +0,0 @@
-#ifndef __NODE_COMPOSED_H__
-#define __NODE_COMPOSED_H__
-#include <starpu_sched_node.h>
-
-struct _starpu_composed_sched_node_recipe;
-
-//create empty recipe
-struct _starpu_composed_sched_node_recipe * starpu_sched_node_create_recipe(void);
-struct _starpu_composed_sched_node_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_composed_sched_node_recipe * recipe, struct starpu_sched_node *(*create_node)(void * arg), void * arg);
-
-void _starpu_destroy_composed_sched_node_recipe(struct _starpu_composed_sched_node_recipe *);
-
-struct starpu_sched_node * starpu_sched_node_composed_node_create(struct _starpu_composed_sched_node_recipe * recipe);
-#endif

+ 2 - 12
src/sched_policies/scheduler_maker.c

@@ -6,16 +6,6 @@
 #include <stdarg.h>
 #include <core/workers.h>
 
-static void set_all_data_to_null(struct starpu_sched_node * node)
-{
-	if(node)
-	{
-		node->data = NULL;
-		int i;
-		for(i = 0; i < node->nchilds; i++)
-			set_all_data_to_null(node->childs[i]);
-	}
-}
 
 struct sched_node_list
 {
@@ -165,7 +155,7 @@ static void set_worker_leaf(struct starpu_sched_node * root, struct starpu_sched
 {
 	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_composed_sched_node_recipe * recipe = specs.worker_composed_sched_node ?
+	struct starpu_sched_node_composed_recipe * recipe = specs.worker_composed_sched_node ?
 		specs.worker_composed_sched_node(worker->arch):NULL;
 	STARPU_ASSERT(node);
 	if(recipe)
@@ -180,7 +170,7 @@ static void set_worker_leaf(struct starpu_sched_node * root, struct starpu_sched
 		node = tmp;
 		
 	}
-	_starpu_destroy_composed_sched_node_recipe(recipe);
+	starpu_destroy_composed_sched_node_recipe(recipe);
 	starpu_sched_node_set_father(worker_node, node, sched_ctx_id);
 	node->add_child(node, worker_node);
 }

+ 7 - 7
src/sched_policies/scheduler_maker.h

@@ -12,15 +12,15 @@
 struct starpu_sched_specs
 {
 	//hw_loc_machine_composed_sched_node must be set as its the root of the topology
-	struct _starpu_composed_sched_node_recipe * hwloc_machine_composed_sched_node;
-	struct _starpu_composed_sched_node_recipe * hwloc_node_composed_sched_node;
-	struct _starpu_composed_sched_node_recipe * hwloc_socket_composed_sched_node;
-	struct _starpu_composed_sched_node_recipe * hwloc_cache_composed_sched_node;
+	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_composed_sched_node_recipe_t or NULL
-	 * the _starpu_composed_sched_node_recipe_t must not include the worker 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_composed_sched_node_recipe * (*worker_composed_sched_node)(enum starpu_worker_archtype);
+	struct starpu_sched_node_composed_recipe * (*worker_composed_sched_node)(enum starpu_worker_archtype);
 
 	/* this flag indicate if heterogenous workers should be brothers or cousins,
 	 * as exemple, if a gpu and a cpu should share or not there numa node