Browse Source

Factorize the no_prio_policy and the eager_central_policy policies as the
former is just a minor variation of the latter.

Cédric Augonnet 15 years ago
parent
commit
62a0f07a04

+ 0 - 2
src/Makefile.am

@@ -63,7 +63,6 @@ noinst_HEADERS = 						\
 	core/policies/random_policy.h				\
 	core/policies/eager_central_policy.h			\
 	core/policies/deque_modeling_policy.h			\
-	core/policies/no_prio_policy.h				\
 	core/policies/deque_modeling_policy_data_aware.h	\
 	core/policies/work_stealing_policy.h			\
 	core/mechanisms/priority_queues.h			\
@@ -137,7 +136,6 @@ libstarpu_la_SOURCES = 						\
 	core/perfmodel/perfmodel_bus.c				\
 	core/perfmodel/perfmodel.c				\
 	core/perfmodel/regression.c				\
-	core/policies/no_prio_policy.c				\
 	core/policies/eager_central_policy.c			\
 	core/policies/eager_central_priority_policy.c		\
 	core/policies/work_stealing_policy.c			\

+ 12 - 0
src/core/policies/eager_central_policy.c

@@ -80,3 +80,15 @@ struct starpu_sched_policy_s _starpu_sched_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,
+	.pop_every_task = pop_every_task_eager_policy,
+	.policy_name = "no-prio",
+	.policy_description = "eager without priority"
+};

+ 1 - 0
src/core/policies/eager_central_policy.h

@@ -21,5 +21,6 @@
 #include <core/mechanisms/fifo_queues.h>
 
 extern struct starpu_sched_policy_s _starpu_sched_eager_policy;
+extern struct starpu_sched_policy_s _starpu_sched_no_prio_policy;
 
 #endif // __EAGER_CENTRAL_POLICY_H__

+ 0 - 62
src/core/policies/no_prio_policy.c

@@ -1,62 +0,0 @@
-/*
- * StarPU
- * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * See the GNU Lesser General Public License in COPYING.LGPL for more details.
- */
-
-#include <core/policies/no_prio_policy.h>
-
-/*
- *	This is just the trivial policy where every worker use the same
- *	JOB QUEUE.
- */
-
-/* the former is the actual queue, the latter some container */
-static struct starpu_fifo_taskq_s *fifo;
-
-static pthread_cond_t sched_cond;
-static pthread_mutex_t sched_mutex;
-
-static void initialize_no_prio_policy(struct starpu_machine_topology_s *topology, 
-	   __attribute__ ((unused)) struct starpu_sched_policy_s *_policy) 
-{
-	/* there is only a single queue in that trivial design */
-	fifo = _starpu_create_fifo();
-
-	PTHREAD_MUTEX_INIT(&sched_mutex, NULL);
-	PTHREAD_COND_INIT(&sched_cond, NULL);
-
-	unsigned workerid;
-	for (workerid = 0; workerid < topology->nworkers; workerid++)
-		starpu_worker_set_sched_condition(workerid, &sched_cond, &sched_mutex);
-}
-
-static int push_task_no_prio_policy(struct starpu_task *task)
-{
-        return _starpu_fifo_push_task(fifo, &sched_mutex, &sched_cond, task);
-}
-
-static struct starpu_task *pop_task_no_prio_policy(void)
-{
-	return _starpu_fifo_pop_task(fifo);
-}
-
-struct starpu_sched_policy_s _starpu_sched_no_prio_policy = {
-	.init_sched = initialize_no_prio_policy,
-	.deinit_sched = NULL,
-	.push_task = push_task_no_prio_policy,
-	.push_prio_task = push_task_no_prio_policy,
-	.pop_task = pop_task_no_prio_policy,
-	.policy_name = "no-prio",
-	.policy_description = "eager without priority"
-};

+ 0 - 25
src/core/policies/no_prio_policy.h

@@ -1,25 +0,0 @@
-/*
- * StarPU
- * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * See the GNU Lesser General Public License in COPYING.LGPL for more details.
- */
-
-#ifndef __NO_PRIO_POLICY_H__
-#define __NO_PRIO_POLICY_H__
-
-#include <core/workers.h>
-#include <core/mechanisms/fifo_queues.h>
-
-extern struct starpu_sched_policy_s _starpu_sched_no_prio_policy;
-
-#endif // __NO_PRIO_POLICY_H__

+ 0 - 1
src/core/policies/sched_policy.c

@@ -20,7 +20,6 @@
 #include <common/config.h>
 #include <common/utils.h>
 #include <core/policies/sched_policy.h>
-#include <core/policies/no_prio_policy.h>
 #include <core/policies/eager_central_policy.h>
 #include <core/policies/eager_central_priority_policy.h>
 #include <core/policies/work_stealing_policy.h>