瀏覽代碼

fix exec_parallel code when called by the app thread

Andra Hugo 11 年之前
父節點
當前提交
1c2f50cec5
共有 2 個文件被更改,包括 6 次插入7 次删除
  1. 3 6
      src/core/sched_ctx.c
  2. 3 1
      src/core/workers.h

+ 3 - 6
src/core/sched_ctx.c

@@ -1678,7 +1678,7 @@ void starpu_sched_ctx_get_available_cpuids(unsigned sched_ctx_id, int **cpuids,
 	{
 		workerid = workers->get_next(workers, &it);
 		worker = _starpu_get_worker_struct(workerid);
-		if(worker->master == current_worker_id || workerid == current_worker_id)
+		if(worker->master == current_worker_id || workerid == current_worker_id || current_worker_id == -1)
 			(*cpuids)[w++] = starpu_worker_get_bindid(workerid);
 	}
 	*ncpuids = w;
@@ -1698,11 +1698,8 @@ int starpu_sched_ctx_book_workers_for_task(unsigned sched_ctx_id, int *workerids
 		if(current_worker_id == -1)
 		{
 			final_workerids[nfinal_workerids++] = workerids[w];
-			if(nfinal_workerids == nworkers - 1)
-			{
-				master = workerids[nfinal_workerids];
-				break;
-			}
+			if(nfinal_workerids == nworkers)
+				master = workerids[nfinal_workerids-1];
 		}
 		else
 		{

+ 3 - 1
src/core/workers.h

@@ -117,8 +117,10 @@ LIST_TYPE(_starpu_worker,
 
 	/* flag to know if sched_mutex is locked or not */
 	unsigned sched_mutex_locked;
-	
+
+	/* id of the master worker */
 	int master;
+
 #ifdef __GLIBC__
 	cpu_set_t cpu_set;
 #endif /* __GLIBC__ */