StarPU Handbook
sc_hypervisor.h
Go to the documentation of this file.
1 /* StarPU --- Runtime system for heterogeneous multicore architectures.
2  *
3  * Copyright (C) 2011-2020 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
4  *
5  * StarPU is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public License as published by
7  * the Free Software Foundation; either version 2.1 of the License, or (at
8  * your option) any later version.
9  *
10  * StarPU is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13  *
14  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
15  */
16 
17 #ifndef SC_HYPERVISOR_H
18 #define SC_HYPERVISOR_H
19 
20 #include <starpu.h>
22 #include <sc_hypervisor_config.h>
24 #include <math.h>
25 
26 #ifdef __cplusplus
27 extern "C"
28 {
29 #endif
30 
36 {
42  const char* name;
43 
47  unsigned custom;
48 
53  void (*size_ctxs)(unsigned *sched_ctxs, int nsched_ctxs , int *workers, int nworkers);
54 
58  void (*resize_ctxs)(unsigned *sched_ctxs, int nsched_ctxs , int *workers, int nworkers);
59 
64  void (*handle_idle_cycle)(unsigned sched_ctx, int worker);
65 
70  void (*handle_pushed_task)(unsigned sched_ctx, int worker);
71 
76  void (*handle_poped_task)(unsigned sched_ctx, int worker,struct starpu_task *task, uint32_t footprint);
77 
82  void (*handle_idle_end)(unsigned sched_ctx, int worker);
83 
88  void (*handle_post_exec_hook)(unsigned sched_ctx, int task_tag);
89 
94  void (*handle_submitted_job)(struct starpu_codelet *cl, unsigned sched_ctx, uint32_t footprint, size_t data_size);
95 
100  void (*end_ctx)(unsigned sched_ctx);
101 
106  void (*start_ctx)(unsigned sched_ctx);
107 
111  void (*init_worker)(int workerid, unsigned sched_ctx);
112 };
113 
145 extern starpu_pthread_mutex_t act_hypervisor_mutex;
146 
151 
160 
165 void sc_hypervisor_register_ctx(unsigned sched_ctx, double total_flops);
166 
171 void sc_hypervisor_unregister_ctx(unsigned sched_ctx);
172 
177 void sc_hypervisor_post_resize_request(unsigned sched_ctx, int task_tag);
178 
184 void sc_hypervisor_resize_ctxs(unsigned *sched_ctxs, int nsched_ctxs , int *workers, int nworkers);
185 
189 void sc_hypervisor_stop_resize(unsigned sched_ctx);
190 
194 void sc_hypervisor_start_resize(unsigned sched_ctx);
195 
200 
204 void sc_hypervisor_add_workers_to_sched_ctx(int* workers_to_add, unsigned nworkers_to_add, unsigned sched_ctx);
205 
209 void sc_hypervisor_remove_workers_from_sched_ctx(int* workers_to_remove, unsigned nworkers_to_remove, unsigned sched_ctx, unsigned now);
210 
214 void sc_hypervisor_move_workers(unsigned sender_sched_ctx, unsigned receiver_sched_ctx, int *workers_to_move, unsigned nworkers_to_move, unsigned now);
215 
220 void sc_hypervisor_size_ctxs(unsigned *sched_ctxs, int nsched_ctxs, int *workers, int nworkers);
221 
225 unsigned sc_hypervisor_get_size_req(unsigned **sched_ctxs, int* nsched_ctxs, int **workers, int *nworkers);
226 
230 void sc_hypervisor_save_size_req(unsigned *sched_ctxs, int nsched_ctxs, int *workers, int nworkers);
231 
236 
240 unsigned sc_hypervisor_can_resize(unsigned sched_ctx);
241 
246 void sc_hypervisor_set_type_of_task(struct starpu_codelet *cl, unsigned sched_ctx, uint32_t footprint, size_t data_size);
247 
252 void sc_hypervisor_update_diff_total_flops(unsigned sched_ctx, double diff_total_flops);
253 
258 void sc_hypervisor_update_diff_elapsed_flops(unsigned sched_ctx, double diff_task_flops);
259 
263 void sc_hypervisor_update_resize_interval(unsigned *sched_ctxs, int nsched_ctxs, int max_nworkers);
264 
269 void sc_hypervisor_get_ctxs_on_level(unsigned **sched_ctxs, int *nsched_ctxs, unsigned hierarchy_level, unsigned father_sched_ctx_id);
270 
275 
279 void sc_hypervisor_get_leaves(unsigned *sched_ctxs, int nsched_ctxs, unsigned *leaves, int *nleaves);
280 
285 
286 void sc_hypervisor_print_overhead();
287 
288 void sc_hypervisor_init_worker(int workerid, unsigned sched_ctx);
289 
292 #ifdef __cplusplus
293 }
294 #endif
295 
296 #endif
sc_hypervisor_get_size_req
unsigned sc_hypervisor_get_size_req(unsigned **sched_ctxs, int *nsched_ctxs, int **workers, int *nworkers)
sc_hypervisor_post_resize_request
void sc_hypervisor_post_resize_request(unsigned sched_ctx, int task_tag)
sc_hypervisor_unregister_ctx
void sc_hypervisor_unregister_ctx(unsigned sched_ctx)
sc_hypervisor_policy::start_ctx
void(* start_ctx)(unsigned sched_ctx)
Definition: sc_hypervisor.h:106
starpu_task::sched_ctx
unsigned sched_ctx
Definition: starpu_task.h:1065
sc_hypervisor_stop_resize
void sc_hypervisor_stop_resize(unsigned sched_ctx)
sc_hypervisor_set_type_of_task
void sc_hypervisor_set_type_of_task(struct starpu_codelet *cl, unsigned sched_ctx, uint32_t footprint, size_t data_size)
sc_hypervisor_policy::handle_idle_end
void(* handle_idle_end)(unsigned sched_ctx, int worker)
Definition: sc_hypervisor.h:82
sc_hypervisor_policy::name
const char * name
Definition: sc_hypervisor.h:42
sc_hypervisor_shutdown
void sc_hypervisor_shutdown(void)
sc_hypervisor_size_ctxs
void sc_hypervisor_size_ctxs(unsigned *sched_ctxs, int nsched_ctxs, int *workers, int nworkers)
sc_hypervisor_get_ctxs_on_level
void sc_hypervisor_get_ctxs_on_level(unsigned **sched_ctxs, int *nsched_ctxs, unsigned hierarchy_level, unsigned father_sched_ctx_id)
starpu_codelet
Definition: starpu_task.h:250
sc_hypervisor_policy::custom
unsigned custom
Definition: sc_hypervisor.h:47
sc_hypervisor_update_diff_total_flops
void sc_hypervisor_update_diff_total_flops(unsigned sched_ctx, double diff_total_flops)
sc_hypervisor_policy
Definition: sc_hypervisor.h:36
sc_hypervisor_get_nready_flops_of_all_sons_of_sched_ctx
double sc_hypervisor_get_nready_flops_of_all_sons_of_sched_ctx(unsigned sched_ctx)
sc_hypervisor_policy::resize_ctxs
void(* resize_ctxs)(unsigned *sched_ctxs, int nsched_ctxs, int *workers, int nworkers)
Definition: sc_hypervisor.h:58
act_hypervisor_mutex
starpu_pthread_mutex_t act_hypervisor_mutex
sc_hypervisor_move_workers
void sc_hypervisor_move_workers(unsigned sender_sched_ctx, unsigned receiver_sched_ctx, int *workers_to_move, unsigned nworkers_to_move, unsigned now)
sc_hypervisor_policy::handle_idle_cycle
void(* handle_idle_cycle)(unsigned sched_ctx, int worker)
Definition: sc_hypervisor.h:64
starpu.h
sc_hypervisor_policy::end_ctx
void(* end_ctx)(unsigned sched_ctx)
Definition: sc_hypervisor.h:100
starpu_task
Definition: starpu_task.h:553
sc_hypervisor_resize_ctxs
void sc_hypervisor_resize_ctxs(unsigned *sched_ctxs, int nsched_ctxs, int *workers, int nworkers)
sc_hypervisor_remove_workers_from_sched_ctx
void sc_hypervisor_remove_workers_from_sched_ctx(int *workers_to_remove, unsigned nworkers_to_remove, unsigned sched_ctx, unsigned now)
sc_hypervisor_config.h
sc_hypervisor_save_size_req
void sc_hypervisor_save_size_req(unsigned *sched_ctxs, int nsched_ctxs, int *workers, int nworkers)
sc_hypervisor_policy::handle_submitted_job
void(* handle_submitted_job)(struct starpu_codelet *cl, unsigned sched_ctx, uint32_t footprint, size_t data_size)
Definition: sc_hypervisor.h:94
sc_hypervisor_add_workers_to_sched_ctx
void sc_hypervisor_add_workers_to_sched_ctx(int *workers_to_add, unsigned nworkers_to_add, unsigned sched_ctx)
sc_hypervisor_policy::handle_pushed_task
void(* handle_pushed_task)(unsigned sched_ctx, int worker)
Definition: sc_hypervisor.h:70
sc_hypervisor_get_policy
const char * sc_hypervisor_get_policy()
sc_hypervisor_policy::size_ctxs
void(* size_ctxs)(unsigned *sched_ctxs, int nsched_ctxs, int *workers, int nworkers)
Definition: sc_hypervisor.h:53
sc_hypervisor_policy::handle_post_exec_hook
void(* handle_post_exec_hook)(unsigned sched_ctx, int task_tag)
Definition: sc_hypervisor.h:88
sc_hypervisor_get_nhierarchy_levels
unsigned sc_hypervisor_get_nhierarchy_levels(void)
sc_hypervisor_update_resize_interval
void sc_hypervisor_update_resize_interval(unsigned *sched_ctxs, int nsched_ctxs, int max_nworkers)
sc_hypervisor_init
void * sc_hypervisor_init(struct sc_hypervisor_policy *policy)
sc_hypervisor_update_diff_elapsed_flops
void sc_hypervisor_update_diff_elapsed_flops(unsigned sched_ctx, double diff_task_flops)
sc_hypervisor_register_ctx
void sc_hypervisor_register_ctx(unsigned sched_ctx, double total_flops)
sc_hypervisor_policy::handle_poped_task
void(* handle_poped_task)(unsigned sched_ctx, int worker, struct starpu_task *task, uint32_t footprint)
Definition: sc_hypervisor.h:76
sc_hypervisor_start_resize
void sc_hypervisor_start_resize(unsigned sched_ctx)
sc_hypervisor_get_leaves
void sc_hypervisor_get_leaves(unsigned *sched_ctxs, int nsched_ctxs, unsigned *leaves, int *nleaves)
sc_hypervisor_policy::init_worker
void(* init_worker)(int workerid, unsigned sched_ctx)
Definition: sc_hypervisor.h:111
sc_hypervisor_free_size_req
void sc_hypervisor_free_size_req(void)
starpu_sched_ctx_hypervisor.h
sc_hypervisor_monitoring.h
sc_hypervisor_can_resize
unsigned sc_hypervisor_can_resize(unsigned sched_ctx)