StarPU Internal Handbook

sched_policy.h
Go to the documentation of this file.
1/* StarPU --- Runtime system for heterogeneous multicore architectures.
2 *
3 * Copyright (C) 2008-2021 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
4 * Copyright (C) 2013 Simon Archipoff
5 *
6 * StarPU is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation; either version 2.1 of the License, or (at
9 * your option) any later version.
10 *
11 * StarPU is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 *
15 * See the GNU Lesser General Public License in COPYING.LGPL for more details.
16 */
17
18#ifndef __SCHED_POLICY_H__
19#define __SCHED_POLICY_H__
20
23#include <starpu.h>
24#include <signal.h>
25#include <core/workers.h>
26#include <core/sched_ctx.h>
27#include <starpu_scheduler.h>
28
29#include <core/simgrid.h>
30
31#define _STARPU_SCHED_BEGIN \
32 _STARPU_TRACE_WORKER_SCHEDULING_PUSH; \
33 _SIMGRID_TIMER_BEGIN(_starpu_simgrid_sched_cost())
34#define _STARPU_SCHED_END \
35 _SIMGRID_TIMER_END; \
36 _STARPU_TRACE_WORKER_SCHEDULING_POP
37
38 void _starpu_sched_init(void);
39
40 struct starpu_machine_config;
41 struct starpu_sched_policy *_starpu_get_sched_policy( struct _starpu_sched_ctx *sched_ctx);
42
43 void _starpu_init_sched_policy(struct _starpu_machine_config *config,
44 struct _starpu_sched_ctx *sched_ctx, struct starpu_sched_policy *policy);
45
46 void _starpu_deinit_sched_policy(struct _starpu_sched_ctx *sched_ctx);
47
48 struct starpu_sched_policy *_starpu_select_sched_policy(struct _starpu_machine_config *config, const char *required_policy);
49
50 void _starpu_sched_task_submit(struct starpu_task *task);
51 void _starpu_sched_do_schedule(unsigned sched_ctx_id);
52
53 int _starpu_push_task(struct _starpu_job *task);
54 int _starpu_repush_task(struct _starpu_job *task);
55
57 int _starpu_push_task_to_workers(struct starpu_task *task);
58
60 struct starpu_task *_starpu_pop_task(struct _starpu_worker *worker);
62 struct starpu_task *_starpu_pop_every_task(struct _starpu_sched_ctx *sched_ctx);
63 void _starpu_sched_post_exec_hook(struct starpu_task *task);
64 int _starpu_pop_task_end(struct starpu_task *task);
65
66 void _starpu_wait_on_sched_event(void);
67
68 struct starpu_task *_starpu_create_conversion_task(starpu_data_handle_t handle,
69 unsigned int node) STARPU_ATTRIBUTE_MALLOC;
70
71 struct starpu_task *_starpu_create_conversion_task_for_arch(starpu_data_handle_t handle,
72 enum starpu_node_kind node_kind) STARPU_ATTRIBUTE_MALLOC;
73
74 void _starpu_sched_pre_exec_hook(struct starpu_task *task);
75
76 void _starpu_print_idle_time();
77/*
78 * Predefined policies
79 */
80 extern struct starpu_sched_policy _starpu_sched_lws_policy;
81 extern struct starpu_sched_policy _starpu_sched_ws_policy;
82 extern struct starpu_sched_policy _starpu_sched_prio_policy;
83 extern struct starpu_sched_policy _starpu_sched_random_policy;
84 extern struct starpu_sched_policy _starpu_sched_dm_policy;
85 extern struct starpu_sched_policy _starpu_sched_dmda_policy;
86 extern struct starpu_sched_policy _starpu_sched_dmda_prio_policy;
87 extern struct starpu_sched_policy _starpu_sched_dmda_ready_policy;
88 extern struct starpu_sched_policy _starpu_sched_dmda_sorted_policy;
89 extern struct starpu_sched_policy _starpu_sched_dmda_sorted_decision_policy;
90 extern struct starpu_sched_policy _starpu_sched_eager_policy;
91 extern struct starpu_sched_policy _starpu_sched_parallel_heft_policy;
92 extern struct starpu_sched_policy _starpu_sched_peager_policy;
93 extern struct starpu_sched_policy _starpu_sched_heteroprio_policy;
94 extern struct starpu_sched_policy _starpu_sched_modular_eager_policy;
95 extern struct starpu_sched_policy _starpu_sched_modular_eager_prefetching_policy;
96 extern struct starpu_sched_policy _starpu_sched_modular_eager_prio_policy;
97 extern struct starpu_sched_policy _starpu_sched_modular_gemm_policy;
98 extern struct starpu_sched_policy _starpu_sched_modular_prio_policy;
99 extern struct starpu_sched_policy _starpu_sched_modular_prio_prefetching_policy;
100 extern struct starpu_sched_policy _starpu_sched_modular_random_policy;
101 extern struct starpu_sched_policy _starpu_sched_modular_random_prio_policy;
102 extern struct starpu_sched_policy _starpu_sched_modular_random_prefetching_policy;
103 extern struct starpu_sched_policy _starpu_sched_modular_random_prio_prefetching_policy;
104 extern struct starpu_sched_policy _starpu_sched_modular_parallel_random_policy;
105 extern struct starpu_sched_policy _starpu_sched_modular_parallel_random_prio_policy;
106 extern struct starpu_sched_policy _starpu_sched_modular_ws_policy;
107 extern struct starpu_sched_policy _starpu_sched_modular_heft_policy;
108 extern struct starpu_sched_policy _starpu_sched_modular_heft_prio_policy;
109 extern struct starpu_sched_policy _starpu_sched_modular_heft2_policy;
110 extern struct starpu_sched_policy _starpu_sched_modular_heteroprio_policy;
111 extern struct starpu_sched_policy _starpu_sched_modular_heteroprio_heft_policy;
112 extern struct starpu_sched_policy _starpu_sched_modular_parallel_heft_policy;
113 extern struct starpu_sched_policy _starpu_sched_graph_test_policy;
114 extern struct starpu_sched_policy _starpu_sched_tree_heft_hierarchical_policy;
115
116 extern long _starpu_task_break_on_push;
117 extern long _starpu_task_break_on_sched;
118 extern long _starpu_task_break_on_pop;
119 extern long _starpu_task_break_on_exec;
120
121#ifdef SIGTRAP
122#define _STARPU_TASK_BREAK_ON(task, what) do { \
123 if (_starpu_get_job_associated_to_task(task)->job_id == (unsigned long) _starpu_task_break_on_##what) \
124 raise(SIGTRAP); \
125} while(0)
126#else
127#define _STARPU_TASK_BREAK_ON(task, what) ((void) 0)
128#endif
129
130#endif // __SCHED_POLICY_H__
sched_ctx.h
_starpu_pop_every_task
struct starpu_task * _starpu_pop_every_task(struct _starpu_sched_ctx *sched_ctx)
_starpu_push_task_to_workers
int _starpu_push_task_to_workers(struct starpu_task *task)
_starpu_pop_task
struct starpu_task * _starpu_pop_task(struct _starpu_worker *worker)
simgrid.h
_starpu_job
Definition: jobs.h:79
_starpu_machine_config
Definition: workers.h:352
_starpu_sched_ctx
Definition: sched_ctx.h:46
_starpu_worker
Definition: workers.h:70