Переглянути джерело

src: fix code to allow to submit tasks to empty contexts

Nathalie Furmento 6 роки тому
батько
коміт
7bb3cd644b
2 змінених файлів з 11 додано та 4 видалено
  1. 7 2
      src/core/sched_ctx.c
  2. 4 2
      src/core/workers.c

+ 7 - 2
src/core/sched_ctx.c

@@ -1107,9 +1107,13 @@ static void _starpu_check_workers(int *workerids, int nworkers)
 /* ctx_mutex must be held when calling this function */
 static void fetch_tasks_from_empty_ctx_list(struct _starpu_sched_ctx *sched_ctx)
 {
-	while(!starpu_task_list_empty(&sched_ctx->empty_ctx_tasks))
+	struct starpu_task_list list;
+	starpu_task_list_move(&list, &sched_ctx->empty_ctx_tasks);
+
+	_starpu_sched_ctx_unlock_write(sched_ctx->id);
+	while(!starpu_task_list_empty(&list))
 	{
-		struct starpu_task *old_task = starpu_task_list_pop_back(&sched_ctx->empty_ctx_tasks);
+		struct starpu_task *old_task = starpu_task_list_pop_back(&list);
 		if(old_task == &stop_submission_task)
 			break;
 
@@ -1123,6 +1127,7 @@ static void fetch_tasks_from_empty_ctx_list(struct _starpu_sched_ctx *sched_ctx)
 		if (ret == -EAGAIN)
 			break;
 	}
+	_starpu_sched_ctx_lock_write(sched_ctx->id);
 }
 
 unsigned _starpu_can_push_task(struct _starpu_sched_ctx *sched_ctx, struct starpu_task *task)

+ 4 - 2
src/core/workers.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2010-2017                                Inria
  * Copyright (C) 2008-2018                                Université de Bordeaux
- * Copyright (C) 2010-2017                                CNRS
+ * Copyright (C) 2010-2018                                CNRS
  * Copyright (C) 2013                                     Thibaut Lambert
  * Copyright (C) 2011                                     Télécom-SudParis
  * Copyright (C) 2016                                     Uppsala University
@@ -1430,7 +1430,9 @@ int starpu_initialize(struct starpu_conf *user_conf, int *argc, char ***argv)
 	for (worker = 0; worker < _starpu_config.topology.nworkers; worker++)
 		_starpu_worker_init(&_starpu_config.workers[worker], &_starpu_config);
 
-	check_entire_platform = starpu_get_env_number("STARPU_CHECK_ENTIRE_PLATFORM");
+//FIXME: find out if the variable STARPU_CHECK_ENTIRE_PLATFORM is really needed, for now, just set 1 as a default value
+	check_entire_platform = 1;//starpu_get_env_number("STARPU_CHECK_ENTIRE_PLATFORM");
+
 	_starpu_config.disable_kernels = starpu_get_env_number("STARPU_DISABLE_KERNELS");
 	STARPU_PTHREAD_KEY_CREATE(&_starpu_worker_key, NULL);
 	STARPU_PTHREAD_KEY_CREATE(&_starpu_worker_set_key, NULL);