StarPU Handbook
sc_hypervisor_policy.h
Go to the documentation of this file.
1 /* StarPU --- Runtime system for heterogeneous multicore architectures.
2  *
3  * Copyright (C) 2010-2014 Inria
4  * Copyright (C) 2012,2013,2017,2019 CNRS
5  * Copyright (C) 2012,2013 Université de Bordeaux
6  *
7  * StarPU is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU Lesser General Public License as published by
9  * the Free Software Foundation; either version 2.1 of the License, or (at
10  * your option) any later version.
11  *
12  * StarPU is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15  *
16  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
17  */
18 
19 #ifndef SC_HYPERVISOR_POLICY_H
20 #define SC_HYPERVISOR_POLICY_H
21 
22 #include <sc_hypervisor.h>
23 
24 #ifdef __cplusplus
25 extern "C"
26 {
27 #endif
28 
34 #define HYPERVISOR_REDIM_SAMPLE 0.02
35 #define HYPERVISOR_START_REDIM_SAMPLE 0.1
36 #define SC_NOTHING 0
37 #define SC_IDLE 1
38 #define SC_SPEED 2
39 
41 {
42  unsigned ncpus;
43  unsigned ncuda;
44  unsigned nw;
45 };
46 
52 {
56  struct starpu_codelet *cl;
57 
61  uint32_t footprint;
62 
66  unsigned sched_ctx_id;
67 
71  unsigned long n;
72 
76  size_t data_size;
77 
82 };
83 
87 void sc_hypervisor_policy_add_task_to_pool(struct starpu_codelet *cl, unsigned sched_ctx, uint32_t footprint, struct sc_hypervisor_policy_task_pool **task_pools, size_t data_size);
88 
93 
98 
102 void sc_hypervisor_get_tasks_times(int nw, int nt, double times[nw][nt], int *workers, unsigned size_ctxs, struct sc_hypervisor_policy_task_pool *task_pools);
103 
107 unsigned sc_hypervisor_find_lowest_prio_sched_ctx(unsigned req_sched_ctx, int nworkers_to_move);
108 
112 int* sc_hypervisor_get_idlest_workers(unsigned sched_ctx, int *nworkers, enum starpu_worker_archtype arch);
113 
117 int* sc_hypervisor_get_idlest_workers_in_list(int *start, int *workers, int nall_workers, int *nworkers, enum starpu_worker_archtype arch);
118 
122 int sc_hypervisor_get_movable_nworkers(struct sc_hypervisor_policy_config *config, unsigned sched_ctx, enum starpu_worker_archtype arch);
123 
127 int sc_hypervisor_compute_nworkers_to_move(unsigned req_sched_ctx);
128 
132 unsigned sc_hypervisor_policy_resize(unsigned sender_sched_ctx, unsigned receiver_sched_ctx, unsigned force_resize, unsigned now);
133 
137 unsigned sc_hypervisor_policy_resize_to_unknown_receiver(unsigned sender_sched_ctx, unsigned now);
138 
143 
148 
153 
157 double sc_hypervisor_get_speed_per_worker(struct sc_hypervisor_wrapper *sc_w, unsigned worker);
158 
163 
168 
173 
178 
182 void sc_hypervisor_group_workers_by_type(struct types_of_workers *tw, int *total_nw);
183 
188 
193 
197 unsigned sc_hypervisor_criteria_fulfilled(unsigned sched_ctx, int worker);
198 
202 unsigned sc_hypervisor_check_idle(unsigned sched_ctx, int worker);
203 
207 unsigned sc_hypervisor_check_speed_gap_btw_ctxs(unsigned *sched_ctxs, int nsched_ctxs, int *workers, int nworkers);
208 
212 unsigned sc_hypervisor_check_speed_gap_btw_ctxs_on_level(int level, int *workers_in, int nworkers_in, unsigned father_sched_ctx_id, unsigned **sched_ctxs, int *nsched_ctxs);
213 
218 
222 struct types_of_workers* sc_hypervisor_get_types_of_workers(int *workers, unsigned nworkers);
223 
226 #ifdef __cplusplus
227 }
228 #endif
229 
230 #endif
struct starpu_codelet * cl
Definition: sc_hypervisor_policy.h:56
double sc_hypervisor_get_speed_per_worker_type(struct sc_hypervisor_wrapper *sc_w, enum starpu_worker_archtype arch)
Definition: starpu_task.h:250
unsigned sched_ctx_id
Definition: sc_hypervisor_policy.h:66
Definition: sc_hypervisor_policy.h:51
double sc_hypervisor_get_ctx_speed(struct sc_hypervisor_wrapper *sc_w)
void sc_hypervisor_policy_add_task_to_pool(struct starpu_codelet *cl, unsigned sched_ctx, uint32_t footprint, struct sc_hypervisor_policy_task_pool **task_pools, size_t data_size)
struct sc_hypervisor_policy_task_pool * next
Definition: sc_hypervisor_policy.h:81
starpu_worker_archtype
Definition: starpu_worker.h:61
unsigned sc_hypervisor_get_index_for_arch(enum starpu_worker_archtype arch, struct types_of_workers *tw)
int * sc_hypervisor_get_idlest_workers_in_list(int *start, int *workers, int nall_workers, int *nworkers, enum starpu_worker_archtype arch)
unsigned sc_hypervisor_policy_resize(unsigned sender_sched_ctx, unsigned receiver_sched_ctx, unsigned force_resize, unsigned now)
unsigned sc_hypervisor_find_lowest_prio_sched_ctx(unsigned req_sched_ctx, int nworkers_to_move)
struct types_of_workers * sc_hypervisor_get_types_of_workers(int *workers, unsigned nworkers)
size_t data_size
Definition: sc_hypervisor_policy.h:76
struct sc_hypervisor_policy_task_pool * sc_hypervisor_policy_clone_task_pool(struct sc_hypervisor_policy_task_pool *tp)
void sc_hypervisor_policy_remove_task_from_pool(struct starpu_task *task, uint32_t footprint, struct sc_hypervisor_policy_task_pool **task_pools)
Definition: starpu_task.h:548
void sc_hypervisor_group_workers_by_type(struct types_of_workers *tw, int *total_nw)
Definition: sc_hypervisor_monitoring.h:68
unsigned sc_hypervisor_policy_resize_to_unknown_receiver(unsigned sender_sched_ctx, unsigned now)
int * sc_hypervisor_get_idlest_workers(unsigned sched_ctx, int *nworkers, enum starpu_worker_archtype arch)
uint32_t footprint
Definition: sc_hypervisor_policy.h:61
unsigned long n
Definition: sc_hypervisor_policy.h:71
void sc_hypervisor_check_if_consider_max(struct types_of_workers *tw)
unsigned sc_hypervisor_check_speed_gap_btw_ctxs(unsigned *sched_ctxs, int nsched_ctxs, int *workers, int nworkers)
int sc_hypervisor_compute_nworkers_to_move(unsigned req_sched_ctx)
unsigned sc_hypervisor_check_idle(unsigned sched_ctx, int worker)
double sc_hypervisor_get_speed_per_worker(struct sc_hypervisor_wrapper *sc_w, unsigned worker)
unsigned sc_hypervisor_criteria_fulfilled(unsigned sched_ctx, int worker)
int sc_hypervisor_get_movable_nworkers(struct sc_hypervisor_policy_config *config, unsigned sched_ctx, enum starpu_worker_archtype arch)
void sc_hypervisor_get_tasks_times(int nw, int nt, double times[nw][nt], int *workers, unsigned size_ctxs, struct sc_hypervisor_policy_task_pool *task_pools)
double sc_hypervisor_get_avg_speed(enum starpu_worker_archtype arch)
Definition: sc_hypervisor_config.h:141
double sc_hypervisor_get_fastest_ctx_exec_time(void)
double sc_hypervisor_get_ref_speed_per_worker_type(struct sc_hypervisor_wrapper *sc_w, enum starpu_worker_archtype arch)
double sc_hypervisor_get_slowest_ctx_exec_time(void)
unsigned sc_hypervisor_get_resize_criteria()
unsigned sc_hypervisor_check_speed_gap_btw_ctxs_on_level(int level, int *workers_in, int nworkers_in, unsigned father_sched_ctx_id, unsigned **sched_ctxs, int *nsched_ctxs)
Definition: sc_hypervisor_policy.h:40
enum starpu_worker_archtype sc_hypervisor_get_arch_for_index(unsigned w, struct types_of_workers *tw)