|
@@ -0,0 +1,91 @@
|
|
|
+/* StarPU --- Runtime system for heterogeneous multicore architectures.
|
|
|
+ *
|
|
|
+ * Copyright (C) 2013-2015,2017 Inria
|
|
|
+ * Copyright (C) 2017 CNRS
|
|
|
+ * Copyright (C) 2014,2017,2018-2019 Université de Bordeaux
|
|
|
+ * Copyright (C) 2013 Simon Archipoff
|
|
|
+ *
|
|
|
+ * 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
|
|
|
+ * the Free Software Foundation; either version 2.1 of the License, or (at
|
|
|
+ * your option) any later version.
|
|
|
+ *
|
|
|
+ * StarPU 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 <starpu_sched_component.h>
|
|
|
+#include <starpu_scheduler.h>
|
|
|
+#include <limits.h>
|
|
|
+
|
|
|
+/* Random scheduler with a fifo queue for its scheduling window */
|
|
|
+
|
|
|
+static void initialize_parallel_random_fifo_center_policy(unsigned sched_ctx_id)
|
|
|
+{
|
|
|
+ starpu_sched_component_initialize_simple_scheduler((starpu_sched_component_create_t) starpu_sched_component_random_create, NULL,
|
|
|
+ STARPU_SCHED_SIMPLE_DECIDE_WORKERS |
|
|
|
+ STARPU_SCHED_SIMPLE_COMBINED_WORKERS |
|
|
|
+ STARPU_SCHED_SIMPLE_FIFO_ABOVE |
|
|
|
+ STARPU_SCHED_SIMPLE_FIFOS_BELOW |
|
|
|
+ STARPU_SCHED_SIMPLE_IMPL, sched_ctx_id);
|
|
|
+}
|
|
|
+
|
|
|
+static void deinitialize_parallel_random_fifo_center_policy(unsigned sched_ctx_id)
|
|
|
+{
|
|
|
+ struct starpu_sched_tree *tree = (struct starpu_sched_tree*)starpu_sched_ctx_get_policy_data(sched_ctx_id);
|
|
|
+ starpu_sched_tree_destroy(tree);
|
|
|
+}
|
|
|
+
|
|
|
+struct starpu_sched_policy _starpu_sched_modular_parallel_random_policy =
|
|
|
+{
|
|
|
+ .init_sched = initialize_parallel_random_fifo_center_policy,
|
|
|
+ .deinit_sched = deinitialize_parallel_random_fifo_center_policy,
|
|
|
+ .add_workers = starpu_sched_tree_add_workers,
|
|
|
+ .remove_workers = starpu_sched_tree_remove_workers,
|
|
|
+ .push_task = starpu_sched_tree_push_task,
|
|
|
+ .pop_task = starpu_sched_tree_pop_task,
|
|
|
+ .pre_exec_hook = NULL,
|
|
|
+ .post_exec_hook = NULL,
|
|
|
+ .pop_every_task = NULL,
|
|
|
+ .policy_name = "modular-prandom",
|
|
|
+ .policy_description = "prandom modular policy",
|
|
|
+ .worker_type = STARPU_WORKER_LIST,
|
|
|
+};
|
|
|
+
|
|
|
+/* Random scheduler with a priority queue for its scheduling window */
|
|
|
+
|
|
|
+static void initialize_parallel_random_prio_center_policy(unsigned sched_ctx_id)
|
|
|
+{
|
|
|
+ starpu_sched_component_initialize_simple_scheduler((starpu_sched_component_create_t) starpu_sched_component_random_create, NULL,
|
|
|
+ STARPU_SCHED_SIMPLE_DECIDE_WORKERS |
|
|
|
+ STARPU_SCHED_SIMPLE_COMBINED_WORKERS |
|
|
|
+ STARPU_SCHED_SIMPLE_FIFO_ABOVE |
|
|
|
+ STARPU_SCHED_SIMPLE_FIFOS_BELOW |
|
|
|
+ STARPU_SCHED_SIMPLE_FIFOS_BELOW_PRIO |
|
|
|
+ STARPU_SCHED_SIMPLE_IMPL, sched_ctx_id);
|
|
|
+}
|
|
|
+
|
|
|
+static void deinitialize_parallel_random_prio_center_policy(unsigned sched_ctx_id)
|
|
|
+{
|
|
|
+ struct starpu_sched_tree *tree = (struct starpu_sched_tree*)starpu_sched_ctx_get_policy_data(sched_ctx_id);
|
|
|
+ starpu_sched_tree_destroy(tree);
|
|
|
+}
|
|
|
+
|
|
|
+struct starpu_sched_policy _starpu_sched_modular_parallel_random_prio_policy =
|
|
|
+{
|
|
|
+ .init_sched = initialize_parallel_random_prio_center_policy,
|
|
|
+ .deinit_sched = deinitialize_parallel_random_prio_center_policy,
|
|
|
+ .add_workers = starpu_sched_tree_add_workers,
|
|
|
+ .remove_workers = starpu_sched_tree_remove_workers,
|
|
|
+ .push_task = starpu_sched_tree_push_task,
|
|
|
+ .pop_task = starpu_sched_tree_pop_task,
|
|
|
+ .pre_exec_hook = NULL,
|
|
|
+ .post_exec_hook = NULL,
|
|
|
+ .pop_every_task = NULL,
|
|
|
+ .policy_name = "modular-prandom-prio",
|
|
|
+ .policy_description = "prandom-prio modular policy",
|
|
|
+ .worker_type = STARPU_WORKER_LIST,
|
|
|
+};
|