Преглед на файлове

fix node_work_stealing to work with a single worker

Simon Archipoff преди 12 години
родител
ревизия
57380a011f
променени са 1 файла, в които са добавени 5 реда и са изтрити 3 реда
  1. 5 3
      src/sched_policies/node_work_stealing.c

+ 5 - 3
src/sched_policies/node_work_stealing.c

@@ -131,9 +131,10 @@ static int push_task(struct _starpu_sched_node * node, struct starpu_task * task
 	struct _starpu_work_stealing_data * wsd = node->data;
 	int ret = -1;
 	int start = wsd->last_push_child;
-	int i;
-	for(i = (start+1)%node->nchilds; i != start; i = (i+1)%node->nchilds)
+	int i = start;
+	do
 	{
+		i = (i+1)%node->nchilds;
 		struct _starpu_sched_node * child = node->childs[i];
 		if(_starpu_sched_node_can_execute_task(child,task))
 		{
@@ -141,7 +142,8 @@ static int push_task(struct _starpu_sched_node * node, struct starpu_task * task
 			break;
 		}
 	}
-	wsd->last_push_child = (wsd->last_push_child + 1) % node->nchilds;
+	while(i != start);
+	wsd->last_push_child = (start + 1) % node->nchilds;
 	node->childs[i]->available(node->childs[i]);
 	return ret;
 }