Browse Source

Expose starpu_wake_worker_relax_light to external schedulers

Samuel Thibault 7 years ago
parent
commit
4aacd5b527

+ 7 - 1
doc/doxygen/chapters/api/workers.doxy

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2011-2013,2017                           Inria
  * Copyright (C) 2010-2017                                CNRS
- * Copyright (C) 2009-2011,2014,2016                      Université de Bordeaux
+ * Copyright (C) 2009-2011,2014,2016, 2018                      Université de Bordeaux
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -345,6 +345,12 @@ if needed during the waiting process. Returns 1 if \p workerid has been woken
 up or its state_keep_awake flag has been set to 1, and 0 otherwise (if \p
 workerid was not in the STATE_SLEEPING or in the STATE_SCHEDULING).
 
+\fn int starpu_wake_worker_relax_light(int workerid)
+\ingroup API_Workers_Properties
+This is a light version of starpu_wake_worker_relax() which, when possible,
+speculatively sets keep_awake on the target worker without waiting that worker
+to enter the relaxed state.
+
 \fn hwloc_cpuset_t starpu_worker_get_hwloc_cpuset(int workerid)
 \ingroup API_Workers_Properties
 If StarPU was compiled with hwloc support, returns a duplicate of the

+ 1 - 1
src/core/workers.c

@@ -2496,7 +2496,7 @@ hwloc_cpuset_t starpu_worker_get_hwloc_cpuset(int workerid)
  * speculatively sets keep_awake on the target worker without waiting that
  * worker to enter the relaxed state.
  */
-int _starpu_wake_worker_relax_light(int workerid)
+int starpu_wake_worker_relax_light(int workerid)
 {
 	struct _starpu_worker *worker = _starpu_get_worker_struct(workerid);
 	STARPU_ASSERT(worker != NULL);

+ 1 - 1
src/core/workers.h

@@ -1171,7 +1171,7 @@ static inline int _starpu_wake_worker_relax(int workerid)
 	return ret;
 }
 
-int _starpu_wake_worker_relax_light(int workerid);
+int starpu_wake_worker_relax_light(int workerid);
 
 /* Allow a worker pulling a task it cannot execute to properly refuse it and
  * send it back to the scheduler.

+ 2 - 2
src/sched_policies/component_worker.c

@@ -400,7 +400,7 @@ static int simple_worker_can_pull(struct starpu_sched_component * worker_compone
 {
 	struct _starpu_worker * worker = _starpu_sched_component_worker_get_worker(worker_component);
 	int workerid = worker->workerid;
-	return _starpu_wake_worker_relax_light(workerid);
+	return starpu_wake_worker_relax_light(workerid);
 }
 
 static int simple_worker_push_task(struct starpu_sched_component * component, struct starpu_task *task)
@@ -610,7 +610,7 @@ static int combined_worker_can_pull(struct starpu_sched_component * component)
 	{
 		if((unsigned) i == workerid)
 			continue;
-		if (_starpu_wake_worker_relax_light(workerid))
+		if (starpu_wake_worker_relax_light(workerid))
 			return 1;
 	}
 	return 0;

+ 1 - 1
src/sched_policies/eager_central_policy.c

@@ -135,7 +135,7 @@ static int push_task_eager_policy(struct starpu_task *task)
 	{
 		unsigned worker = workers->get_next(workers, &it);
 		if (dowake[worker])
-			if (_starpu_wake_worker_relax_light(worker))
+			if (starpu_wake_worker_relax_light(worker))
 				break; // wake up a single worker
 	}
 #endif

+ 2 - 2
src/sched_policies/eager_central_priority_policy.c

@@ -145,7 +145,7 @@ static int _starpu_priority_push_task(struct starpu_task *task)
 	{
 		unsigned worker = workers->get_next(workers, &it);
 		if (dowake[worker])
-			if (_starpu_wake_worker_relax_light(worker))
+			if (starpu_wake_worker_relax_light(worker))
 				break; // wake up a single worker
 	}
 #endif
@@ -201,7 +201,7 @@ static struct starpu_task *_starpu_priority_pop_task(unsigned sched_ctx_id)
 #ifdef STARPU_NON_BLOCKING_DRIVERS
 				starpu_bitmap_unset(data->waiters, worker);
 #else
-				_starpu_wake_worker_relax_light(worker);
+				starpu_wake_worker_relax_light(worker);
 #endif
 			}
 		}

+ 2 - 2
src/sched_policies/graph_test_policy.c

@@ -223,7 +223,7 @@ static void do_schedule_graph_test_policy(unsigned sched_ctx_id)
 	{
 		/* Wake each worker */
 		unsigned worker = workers->get_next(workers, &it);
-		_starpu_wake_worker_relax_light(worker);
+		starpu_wake_worker_relax_light(worker);
 	}
 #endif
 }
@@ -303,7 +303,7 @@ static int push_task_graph_test_policy(struct starpu_task *task)
 		unsigned worker = workers->get_next(workers, &it);
 		if (dowake[worker])
 		{
-			if (_starpu_wake_worker_relax_light(worker))
+			if (starpu_wake_worker_relax_light(worker))
 				break; // wake up a single worker
 		}
 	}

+ 1 - 1
src/sched_policies/heteroprio.c

@@ -446,7 +446,7 @@ static int push_task_heteroprio_policy(struct starpu_task *task)
 	{
 		unsigned worker = workers->get_next(workers, &it);
 		if (dowake[worker])
-			if (_starpu_wake_worker_relax_light(worker))
+			if (starpu_wake_worker_relax_light(worker))
 				break; // wake up a single worker
 	}
 #endif

+ 2 - 2
src/sched_policies/parallel_eager.c

@@ -223,7 +223,7 @@ static int push_task_peager_policy(struct starpu_task *task)
 		if (starpu_worker_get_type(workerid) != STARPU_MIC_WORKER
 				&& starpu_worker_get_type(workerid) != STARPU_CPU_WORKER)
 		{
-			_starpu_wake_worker_relax_light(workerid);
+			starpu_wake_worker_relax_light(workerid);
 			continue;
 		}
 		if ((!is_parallel_task) /* This is not a parallel task, can wake any workerid */
@@ -231,7 +231,7 @@ static int push_task_peager_policy(struct starpu_task *task)
 				|| (common_data->max_combination_size[workerid] > 1) /* This is a combined workerid master and the task is parallel */
 		   )
 		{
-			_starpu_wake_worker_relax_light(workerid);
+			starpu_wake_worker_relax_light(workerid);
 		}
 	}
 #endif

+ 1 - 1
src/sched_policies/work_stealing_policy.c

@@ -669,7 +669,7 @@ int ws_push_task(struct starpu_task *task)
 
 	workers->init_iterator(workers, &it);
 	while(workers->has_next(workers, &it))
-		_starpu_wake_worker_relax_light(workers->get_next(workers, &it));
+		starpu_wake_worker_relax_light(workers->get_next(workers, &it));
 #endif
 	return 0;
 }