Преглед изворни кода

add some relax sections to graph_test_policy

Olivier Aumage пре 8 година
родитељ
комит
ae89e620f4
1 измењених фајлова са 7 додато и 3 уклоњено
  1. 7 3
      src/sched_policies/graph_test_policy.c

+ 7 - 3
src/sched_policies/graph_test_policy.c

@@ -149,7 +149,9 @@ static struct _starpu_prio_deque *select_prio(unsigned sched_ctx_id, struct _sta
 static void set_priority(void *_data, struct _starpu_graph_node *node)
 {
 	struct _starpu_graph_test_policy_data *data = _data;
+	_starpu_worker_relax_on();
 	STARPU_PTHREAD_MUTEX_LOCK(&node->mutex);
+	_starpu_worker_relax_off();
 	struct _starpu_job *job = node->job;
 	if (job)
 	{
@@ -165,7 +167,9 @@ static void do_schedule_graph_test_policy(unsigned sched_ctx_id)
 {
 	struct _starpu_graph_test_policy_data *data = (struct _starpu_graph_test_policy_data*)starpu_sched_ctx_get_policy_data(sched_ctx_id);
 
+	_starpu_worker_relax_on();
 	STARPU_PTHREAD_MUTEX_LOCK(&data->policy_mutex);
+	_starpu_worker_relax_off();
 	if (data->descendants)
 		_starpu_graph_compute_descendants();
 	else
@@ -201,9 +205,7 @@ static void do_schedule_graph_test_policy(unsigned sched_ctx_id)
 	{
 		/* Wake each worker */
 		unsigned worker = workers->get_next(workers, &it);
-		_starpu_worker_lock(worker);
-		starpu_wake_worker_locked(worker);
-		_starpu_worker_unlock(worker);
+		_starpu_wake_worker_relax(worker);
 	}
 #endif
 }
@@ -213,7 +215,9 @@ static int push_task_graph_test_policy(struct starpu_task *task)
 	unsigned sched_ctx_id = task->sched_ctx;
 	struct _starpu_graph_test_policy_data *data = (struct _starpu_graph_test_policy_data*)starpu_sched_ctx_get_policy_data(sched_ctx_id);
 
+	_starpu_worker_relax_on();
 	STARPU_PTHREAD_MUTEX_LOCK(&data->policy_mutex);
+	_starpu_worker_relax_off();
 	if (!data->computed)
 	{
 		/* Priorities are not computed, leave the task in the bag for now */