Browse Source

Remove now-unused push_prio_task scheduler method

Samuel Thibault 14 years ago
parent
commit
6beb9fe2f7

+ 2 - 3
examples/scheduler/dummy_sched.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010  Université de Bordeaux 1
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010-2011  Université de Bordeaux 1
+ * Copyright (C) 2010-2011  Centre National de la Recherche Scientifique
  *
  * 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
@@ -81,7 +81,6 @@ static struct starpu_sched_policy_s dummy_sched_policy = {
 	.init_sched = init_dummy_sched,
 	.deinit_sched = deinit_dummy_sched,
 	.push_task = push_task_dummy,
-	.push_prio_task = NULL,
 	.pop_task = pop_task_dummy,
 	.post_exec_hook = NULL,
 	.pop_every_task = NULL,

+ 0 - 3
include/starpu_scheduler.h

@@ -81,9 +81,6 @@ struct starpu_sched_policy_s {
 	 * scheduling strategy. */
 	void (*push_task_notify)(struct starpu_task *, int workerid);
 
-	/* Insert a priority task into the scheduler. */
-	int (*push_prio_task)(struct starpu_task *);
-
 	/* Get a task from the scheduler. The mutex associated to the worker is
 	 * already taken when this method is called. */
 	struct starpu_task *(*pop_task)(void);

+ 0 - 3
src/core/sched_policy.c

@@ -39,7 +39,6 @@ int starpu_get_prefetch_flag(void)
 
 extern struct starpu_sched_policy_s _starpu_sched_ws_policy;
 extern struct starpu_sched_policy_s _starpu_sched_prio_policy;
-extern struct starpu_sched_policy_s _starpu_sched_no_prio_policy;
 extern struct starpu_sched_policy_s _starpu_sched_random_policy;
 extern struct starpu_sched_policy_s _starpu_sched_dm_policy;
 extern struct starpu_sched_policy_s _starpu_sched_dmda_policy;
@@ -55,7 +54,6 @@ extern struct starpu_sched_policy_s heft_policy;
 static struct starpu_sched_policy_s *predefined_policies[NPREDEFINED_POLICIES] = {
 	&_starpu_sched_ws_policy,
 	&_starpu_sched_prio_policy,
-	&_starpu_sched_no_prio_policy,
 	&_starpu_sched_dm_policy,
 	&_starpu_sched_dmda_policy,
 	&heft_policy,
@@ -94,7 +92,6 @@ static void load_sched_policy(struct starpu_sched_policy_s *sched_policy)
 	policy.init_sched = sched_policy->init_sched;
 	policy.deinit_sched = sched_policy->deinit_sched;
 	policy.push_task = sched_policy->push_task;
-	policy.push_prio_task = sched_policy->push_prio_task;
 	policy.pop_task = sched_policy->pop_task;
         policy.post_exec_hook = sched_policy->post_exec_hook;
 	policy.pop_every_task = sched_policy->pop_every_task;

+ 7 - 32
src/sched_policies/deque_modeling_policy_data_aware.c

@@ -286,17 +286,12 @@ static int push_task_on_best_worker(struct starpu_task *task, int best_workerid,
 	if (starpu_get_prefetch_flag())
 		starpu_prefetch_task_input_on_node(task, memory_node);
 
-	switch (prio) {
-		case 1:
-			return _starpu_fifo_push_prio_task(queue_array[best_workerid],
-				&sched_mutex[best_workerid], &sched_cond[best_workerid], task);
-		case 2:
-			return _starpu_fifo_push_sorted_task(queue_array[best_workerid],
-				&sched_mutex[best_workerid], &sched_cond[best_workerid], task);
-		default:
-			return _starpu_fifo_push_task(queue_array[best_workerid],
-				&sched_mutex[best_workerid], &sched_cond[best_workerid], task);
-	}
+	if (prio)
+		return _starpu_fifo_push_sorted_task(queue_array[best_workerid],
+			&sched_mutex[best_workerid], &sched_cond[best_workerid], task);
+	else
+		return _starpu_fifo_push_task(queue_array[best_workerid],
+			&sched_mutex[best_workerid], &sched_cond[best_workerid], task);
 }
 
 static int _dm_push_task(struct starpu_task *task, unsigned prio)
@@ -530,32 +525,16 @@ static int _dmda_push_task(struct starpu_task *task, unsigned prio)
 
 static int dmda_push_sorted_task(struct starpu_task *task)
 {
-	return _dmda_push_task(task, 2);
-}
-
-static int dm_push_prio_task(struct starpu_task *task)
-{
-	return _dm_push_task(task, 1);
+	return _dmda_push_task(task, 1);
 }
 
 static int dm_push_task(struct starpu_task *task)
 {
-	if (task->priority > 0)
-		return _dm_push_task(task, 1);
-
 	return _dm_push_task(task, 0);
 }
 
-static int dmda_push_prio_task(struct starpu_task *task)
-{
-	return _dmda_push_task(task, 1);
-}
-
 static int dmda_push_task(struct starpu_task *task)
 {
-	if (task->priority > 0)
-		return _dmda_push_task(task, 1);
-
 	return _dmda_push_task(task, 0);
 }
 
@@ -617,7 +596,6 @@ struct starpu_sched_policy_s _starpu_sched_dm_policy = {
 	.init_sched = initialize_dmda_policy,
 	.deinit_sched = deinitialize_dmda_policy,
 	.push_task = dm_push_task, 
-	.push_prio_task = dm_push_prio_task,
 	.pop_task = dmda_pop_task,
 	.post_exec_hook = NULL,
 	.pop_every_task = dmda_pop_every_task,
@@ -629,7 +607,6 @@ struct starpu_sched_policy_s _starpu_sched_dmda_policy = {
 	.init_sched = initialize_dmda_policy,
 	.deinit_sched = deinitialize_dmda_policy,
 	.push_task = dmda_push_task, 
-	.push_prio_task = dmda_push_prio_task, 
 	.pop_task = dmda_pop_task,
 	.post_exec_hook = NULL,
 	.pop_every_task = dmda_pop_every_task,
@@ -641,7 +618,6 @@ struct starpu_sched_policy_s _starpu_sched_dmda_sorted_policy = {
 	.init_sched = initialize_dmda_sorted_policy,
 	.deinit_sched = deinitialize_dmda_policy,
 	.push_task = dmda_push_sorted_task, 
-	.push_prio_task = dmda_push_sorted_task, 
 	.pop_task = dmda_pop_ready_task,
 	.post_exec_hook = NULL,
 	.pop_every_task = dmda_pop_every_task,
@@ -653,7 +629,6 @@ struct starpu_sched_policy_s _starpu_sched_dmda_ready_policy = {
 	.init_sched = initialize_dmda_policy,
 	.deinit_sched = deinitialize_dmda_policy,
 	.push_task = dmda_push_task, 
-	.push_prio_task = dmda_push_prio_task, 
 	.pop_task = dmda_pop_ready_task,
 	.post_exec_hook = NULL,
 	.pop_every_task = dmda_pop_every_task,

+ 1 - 20
src/sched_policies/eager_central_policy.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010  Université de Bordeaux 1
+ * Copyright (C) 2010-2011  Université de Bordeaux 1
  * Copyright (C) 2010  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -57,11 +57,6 @@ static int push_task_eager_policy(struct starpu_task *task)
 	return _starpu_fifo_push_task(fifo, &sched_mutex, &sched_cond, task);
 }
 
-static int push_prio_task_eager_policy(struct starpu_task *task)
-{
-	return _starpu_fifo_push_prio_task(fifo, &sched_mutex, &sched_cond, task);
-}
-
 static struct starpu_task *pop_every_task_eager_policy(void)
 {
 	return _starpu_fifo_pop_every_task(fifo, &sched_mutex, starpu_worker_get_id());
@@ -76,23 +71,9 @@ struct starpu_sched_policy_s _starpu_sched_eager_policy = {
 	.init_sched = initialize_eager_center_policy,
 	.deinit_sched = deinitialize_eager_center_policy,
 	.push_task = push_task_eager_policy,
-	.push_prio_task = push_prio_task_eager_policy,
 	.pop_task = pop_task_eager_policy,
 	.post_exec_hook = NULL,
 	.pop_every_task = pop_every_task_eager_policy,
 	.policy_name = "eager",
 	.policy_description = "greedy policy"
 };
-
-struct starpu_sched_policy_s _starpu_sched_no_prio_policy = {
-	.init_sched = initialize_eager_center_policy,
-	.deinit_sched = deinitialize_eager_center_policy,
-	.push_task = push_task_eager_policy,
-	/* we use the same method in spite of the priority */
-	.push_prio_task = push_task_eager_policy,
-	.pop_task = pop_task_eager_policy,
-	.post_exec_hook = NULL,
-	.pop_every_task = pop_every_task_eager_policy,
-	.policy_name = "no-prio",
-	.policy_description = "eager without priority"
-};

+ 1 - 2
src/sched_policies/eager_central_priority_policy.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010  Université de Bordeaux 1
+ * Copyright (C) 2010-2011  Université de Bordeaux 1
  * Copyright (C) 2010  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -161,7 +161,6 @@ struct starpu_sched_policy_s _starpu_sched_prio_policy = {
 	.deinit_sched = deinitialize_eager_center_priority_policy,
 	/* we always use priorities in that policy */
 	.push_task = _starpu_priority_push_task,
-	.push_prio_task = _starpu_priority_push_task,
 	.pop_task = _starpu_priority_pop_task,
 	.post_exec_hook = NULL,
 	.pop_every_task = NULL,

+ 3 - 15
src/sched_policies/fifo_queues.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010  Université de Bordeaux 1
+ * Copyright (C) 2010-2011  Université de Bordeaux 1
  * Copyright (C) 2010  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -46,26 +46,14 @@ void _starpu_destroy_fifo(struct starpu_fifo_taskq_s *fifo)
 	free(fifo);
 }
 
-int _starpu_fifo_push_prio_task(struct starpu_fifo_taskq_s *fifo_queue, pthread_mutex_t *sched_mutex, pthread_cond_t *sched_cond, struct starpu_task *task)
-{
-	PTHREAD_MUTEX_LOCK(sched_mutex);
-
-	STARPU_TRACE_JOB_PUSH(task, 0);
-	starpu_task_list_push_back(&fifo_queue->taskq, task);
-	fifo_queue->ntasks++;
-	fifo_queue->nprocessed++;
-
-	PTHREAD_COND_SIGNAL(sched_cond);
-	PTHREAD_MUTEX_UNLOCK(sched_mutex);
-
-	return 0;
-}
+/* TODO: revert front/back? */
 
 int _starpu_fifo_push_task(struct starpu_fifo_taskq_s *fifo_queue, pthread_mutex_t *sched_mutex, pthread_cond_t *sched_cond, struct starpu_task *task)
 {
 	PTHREAD_MUTEX_LOCK(sched_mutex);
 
 	STARPU_TRACE_JOB_PUSH(task, 0);
+	/* TODO: if prio, put at back */
 	starpu_task_list_push_front(&fifo_queue->taskq, task);
 	fifo_queue->ntasks++;
 	fifo_queue->nprocessed++;

+ 0 - 1
src/sched_policies/fifo_queues.h

@@ -42,7 +42,6 @@ struct starpu_fifo_taskq_s*_starpu_create_fifo(void);
 void _starpu_destroy_fifo(struct starpu_fifo_taskq_s *fifo);
 
 int _starpu_fifo_push_task(struct starpu_fifo_taskq_s *fifo, pthread_mutex_t *sched_mutex, pthread_cond_t *sched_cond, struct starpu_task *task);
-int _starpu_fifo_push_prio_task(struct starpu_fifo_taskq_s *fifo, pthread_mutex_t *sched_mutex, pthread_cond_t *sched_cond, struct starpu_task *task);
 
 struct starpu_task *_starpu_fifo_pop_task(struct starpu_fifo_taskq_s *fifo, int workerid);
 struct starpu_task *_starpu_fifo_pop_every_task(struct starpu_fifo_taskq_s *fifo, pthread_mutex_t *sched_mutex, int workerid);

+ 0 - 6
src/sched_policies/heft.c

@@ -328,11 +328,6 @@ static int _heft_push_task(struct starpu_task *task, unsigned prio)
 	return push_task_on_best_worker(task, best, model_best, prio);
 }
 
-static int heft_push_prio_task(struct starpu_task *task)
-{
-	return _heft_push_task(task, 1);
-}
-
 static int heft_push_task(struct starpu_task *task)
 {
 	if (task->priority > 0)
@@ -356,7 +351,6 @@ struct starpu_sched_policy_s heft_policy = {
 	.init_sched = heft_init,
 	.deinit_sched = heft_deinit,
 	.push_task = heft_push_task, 
-	.push_prio_task = heft_push_prio_task, 
 	.push_task_notify = heft_push_task_notify,
 	.pop_task = NULL,
 	.pop_every_task = NULL,

+ 0 - 1
src/sched_policies/parallel_greedy.c

@@ -234,7 +234,6 @@ struct starpu_sched_policy_s _starpu_sched_pgreedy_policy = {
 	.init_sched = initialize_pgreedy_policy,
 	.deinit_sched = deinitialize_pgreedy_policy,
 	.push_task = push_task_pgreedy_policy,
-	.push_prio_task = push_task_pgreedy_policy,
 	.pop_task = pop_task_pgreedy_policy,
 	.post_exec_hook = NULL,
 	.pop_every_task = NULL,

+ 0 - 6
src/sched_policies/parallel_heft.c

@@ -342,11 +342,6 @@ static int _parallel_heft_push_task(struct starpu_task *task, unsigned prio)
 	return push_task_on_best_worker(task, best, best_exp_end, prio);
 }
 
-static int parallel_heft_push_prio_task(struct starpu_task *task)
-{
-	return _parallel_heft_push_task(task, 1);
-}
-
 static int parallel_heft_push_task(struct starpu_task *task)
 {
 	if (task->priority == STARPU_MAX_PRIO)
@@ -423,7 +418,6 @@ struct starpu_sched_policy_s _starpu_sched_parallel_heft_policy = {
 	.init_sched = initialize_parallel_heft_policy,
 	.deinit_sched = NULL,
 	.push_task = parallel_heft_push_task, 
-	.push_prio_task = parallel_heft_push_prio_task, 
 	.pop_task = NULL,
 	.post_exec_hook = parallel_heft_post_exec_hook,
 	.pop_every_task = NULL,

+ 2 - 8
src/sched_policies/random_policy.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010  Université de Bordeaux 1
+ * Copyright (C) 2010-2011  Université de Bordeaux 1
  * Copyright (C) 2010  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -62,14 +62,9 @@ static int _random_push_task(struct starpu_task *task, unsigned prio)
 	return starpu_push_local_task(selected, task, prio);
 }
 
-static int random_push_prio_task(struct starpu_task *task)
-{
-	return _random_push_task(task, 1);
-}
-
 static int random_push_task(struct starpu_task *task)
 {
-	return _random_push_task(task, 0);
+	return _random_push_task(task, !!task->priority);
 }
 
 static void initialize_random_policy(struct starpu_machine_topology_s *topology, 
@@ -93,7 +88,6 @@ struct starpu_sched_policy_s _starpu_sched_random_policy = {
 	.init_sched = initialize_random_policy,
 	.deinit_sched = NULL,
 	.push_task = random_push_task,
-	.push_prio_task = random_push_prio_task,
 	.pop_task = NULL,
 	.post_exec_hook = NULL,
 	.pop_every_task = NULL,

+ 5 - 16
src/sched_policies/stack_queues.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010  Université de Bordeaux 1
+ * Copyright (C) 2010-2011  Université de Bordeaux 1
  * Copyright (C) 2010  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -57,27 +57,16 @@ unsigned _starpu_get_stack_nprocessed(struct starpu_stack_jobq_s *stack_queue)
 	return stack_queue->nprocessed;
 }
 
-void _starpu_stack_push_prio_task(struct starpu_stack_jobq_s *stack_queue, pthread_mutex_t *sched_mutex, pthread_cond_t *sched_cond, starpu_job_t task)
-{
-	PTHREAD_MUTEX_LOCK(sched_mutex);
-	total_number_of_jobs++;
-
-	STARPU_TRACE_JOB_PUSH(task, 0);
-	starpu_job_list_push_back(stack_queue->jobq, task);
-	stack_queue->njobs++;
-	stack_queue->nprocessed++;
-
-	PTHREAD_COND_SIGNAL(sched_cond);
-	PTHREAD_MUTEX_UNLOCK(sched_mutex);
-}
-
 void _starpu_stack_push_task(struct starpu_stack_jobq_s *stack_queue, pthread_mutex_t *sched_mutex, pthread_cond_t *sched_cond, starpu_job_t task)
 {
 	PTHREAD_MUTEX_LOCK(sched_mutex);
 	total_number_of_jobs++;
 
 	STARPU_TRACE_JOB_PUSH(task, 0);
-	starpu_job_list_push_front(stack_queue->jobq, task);
+	if (task->task->priority)
+		starpu_job_list_push_back(stack_queue->jobq, task);
+	else
+		starpu_job_list_push_front(stack_queue->jobq, task);
 	stack_queue->njobs++;
 	stack_queue->nprocessed++;
 

+ 0 - 1
src/sched_policies/stack_queues.h

@@ -42,7 +42,6 @@ struct starpu_stack_jobq_s {
 struct starpu_stack_jobq_s *_starpu_create_stack(void);
 
 void _starpu_stack_push_task(struct starpu_stack_jobq_s *stack, pthread_mutex_t *sched_mutex, pthread_cond_t *sched_cond, starpu_job_t task);
-void _starpu_stack_push_prio_task(struct starpu_stack_jobq_s *stack, pthread_mutex_t *sched_mutex, pthread_cond_t *sched_cond, starpu_job_t task);
 
 starpu_job_t _starpu_stack_pop_task(struct starpu_stack_jobq_s *stack, pthread_mutex_t *sched_mutex, int workerid);
 

+ 1 - 2
src/sched_policies/work_stealing_policy.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010  Université de Bordeaux 1
+ * Copyright (C) 2010-2011  Université de Bordeaux 1
  * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -213,7 +213,6 @@ struct starpu_sched_policy_s _starpu_sched_ws_policy = {
 	.init_sched = initialize_ws_policy,
 	.deinit_sched = NULL,
 	.push_task = ws_push_task,
-	.push_prio_task = ws_push_task,
 	.pop_task = ws_pop_task,
 	.post_exec_hook = NULL,
 	.pop_every_task = NULL,