Przeglądaj źródła

several bug fixes

Simon Archipoff 12 lat temu
rodzic
commit
97a8518793

+ 0 - 1
src/sched_policies/node_heft.c

@@ -226,7 +226,6 @@ static void destroy_no_model_node(struct _starpu_sched_node * heft_node)
 	struct _starpu_dmda_data * data = heft_node->data;
 	if(data->no_model_node)
 	{
-		data->no_model_node->deinit_data(data->no_model_node);
 		_starpu_sched_node_destroy(data->no_model_node);
 	}
 }

+ 1 - 4
src/sched_policies/node_sched.c

@@ -140,7 +140,6 @@ void _starpu_node_destroy_rec(struct _starpu_sched_node * node, unsigned sched_c
 			if(!shared)//if not shared we want to destroy it and his childs
 				PUSH(child);
 		}
-		n->deinit_data(n);
 		_starpu_sched_node_destroy(n);
 	}
 	free(stack);
@@ -345,9 +344,7 @@ struct _starpu_sched_node * _starpu_sched_node_create(void)
 }
 void _starpu_sched_node_destroy(struct _starpu_sched_node *node)
 {
-	if(_starpu_sched_node_is_worker(node))
-		return;
-
+	node->deinit_data(node);
 	int i,j;
 	for(i = 0; i < node->nchilds; i++)
 	{

+ 12 - 0
src/sched_policies/node_worker.c

@@ -166,6 +166,15 @@ static double estimated_load(struct _starpu_sched_node * node)
 		/ starpu_worker_get_relative_speedup(_starpu_bitmap_first(node->workers));
 }
 
+static void worker_deinit_data(struct _starpu_sched_node * node)
+{
+	int i;
+	for(i = 0; i < STARPU_NMAXWORKERS; i++)
+		if(_worker_nodes[i] == node)
+			break;
+	STARPU_ASSERT(i < STARPU_NMAXWORKERS);
+	_worker_nodes[i] = NULL;
+}
 
 
 static struct _starpu_sched_node  * _starpu_sched_node_worker_create(int workerid)
@@ -185,6 +194,7 @@ static struct _starpu_sched_node  * _starpu_sched_node_worker_create(int workeri
 	node->estimated_execute_preds = estimated_execute_preds;
 	node->estimated_load = estimated_load;
 	node->available = available;
+	node->deinit_data = worker_deinit_data;
 	node->workers = _starpu_bitmap_create();
 	_starpu_bitmap_set(node->workers, workerid);
 	_worker_nodes[workerid] = node;
@@ -209,6 +219,8 @@ int _starpu_sched_node_is_worker(struct _starpu_sched_node * node)
 		
 }
 
+
+
 #ifndef STARPU_NO_ASSERT
 static int _worker_consistant(struct _starpu_sched_node * node)
 {

+ 6 - 3
src/sched_policies/scheduler_maker.c

@@ -128,7 +128,7 @@ static void set_cpu_worker_leaf(struct _starpu_sched_node * root, struct _starpu
 static void set_other_worker_leaf(struct _starpu_sched_node * root, struct _starpu_sched_node * worker, unsigned sched_ctx_id,
 				  struct _starpu_composed_sched_node_recipe * device_composed_sched_node, int sched_have_numa_node)
 {
-	hwloc_obj_t obj = worker->data;
+	hwloc_obj_t obj = worker->obj;
 	while(obj)
 		if((sched_have_numa_node && obj->type == HWLOC_OBJ_NODE) || obj->type == HWLOC_OBJ_MACHINE)
 			break;
@@ -139,12 +139,15 @@ static void set_other_worker_leaf(struct _starpu_sched_node * root, struct _star
 	struct _starpu_sched_node * tmp = _find_sched_node_with_obj(root, obj);
 	if(tmp)
 	{
-		struct _starpu_sched_node * node = _starpu_sched_node_composed_node_create(device_composed_sched_node);
 #ifdef STARPU_DEVEL
 #warning FIXME node->obj is set to worker->obj even for accelerators workers
 #endif
+		struct _starpu_sched_node * node = _starpu_sched_node_composed_node_create(device_composed_sched_node);
 		node->obj = worker->obj;
-		node->fathers[sched_ctx_id] = tmp;
+		_starpu_sched_node_set_father(node, tmp, sched_ctx_id);
+		_starpu_sched_node_add_child(tmp, node);
+		
+		_starpu_sched_node_set_father(worker, node, sched_ctx_id);
 		_starpu_sched_node_add_child(node, worker);
 		return;
 	}