Browse Source

Fix browsing workers when several workers are bound to the same core

Samuel Thibault 8 years ago
parent
commit
bd988461ac
1 changed files with 21 additions and 4 deletions
  1. 21 4
      src/worker_collection/worker_tree.c

+ 21 - 4
src/worker_collection/worker_tree.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2013, 2016  Université de Bordeaux
+ * Copyright (C) 2013, 2016-2017  Université de Bordeaux
  * Copyright (C) 2012-2014, 2016, 2017  CNRS
  * Copyright (C) 2011-2013, 2017  INRIA
  *
@@ -182,6 +182,25 @@ static unsigned tree_has_next(struct starpu_worker_collection *workers, struct s
 		return 0;
 
 	struct starpu_tree *tree = (struct starpu_tree*)workers->collection_private;
+	int *workerids;
+	int nworkers;
+	int w;
+
+	if (it->value) {
+		struct starpu_tree *node = it->value;
+		/* Are there workers left to be processed in the current node? */
+		nworkers = starpu_bindid_get_workerids(node->id, &workerids);
+		for(w = 0; w < nworkers; w++)
+		{
+			if(!it->visited[workerids[w]] && workers->present[workerids[w]] )
+			{
+				/* Still some! */
+				it->possible_value = node;
+				return 1;
+			}
+		}
+	}
+
 	struct starpu_tree *neighbour = starpu_tree_get_neighbour(tree, (struct starpu_tree*)it->value, it->visited, workers->present);
 
 	if(!neighbour)
@@ -192,9 +211,7 @@ static unsigned tree_has_next(struct starpu_worker_collection *workers, struct s
 		return 0;
 	}
 	int id = -1;
-	int *workerids;
-	int nworkers = starpu_bindid_get_workerids(neighbour->id, &workerids);
-	int w;
+	nworkers = starpu_bindid_get_workerids(neighbour->id, &workerids);
 	for(w = 0; w < nworkers; w++)
 	{
 		if(!it->visited[workerids[w]] && workers->present[workerids[w]])