123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- #ifndef SC_HYPERVISOR_H
- #define SC_HYPERVISOR_H
- #include <starpu.h>
- #include <starpu_sched_ctx_hypervisor.h>
- #include <sc_hypervisor_config.h>
- #include <sc_hypervisor_monitoring.h>
- #include <math.h>
- #ifdef __cplusplus
- extern "C"
- {
- #endif
- starpu_pthread_mutex_t act_hypervisor_mutex;
- struct sc_hypervisor_policy
- {
-
- const char* name;
-
- unsigned custom;
-
- void (*size_ctxs)(unsigned *sched_ctxs, int nsched_ctxs , int *workers, int nworkers);
-
- void (*resize_ctxs)(unsigned *sched_ctxs, int nsched_ctxs , int *workers, int nworkers);
-
- void (*handle_idle_cycle)(unsigned sched_ctx, int worker);
-
- void (*handle_pushed_task)(unsigned sched_ctx, int worker);
-
- void (*handle_poped_task)(unsigned sched_ctx, int worker,struct starpu_task *task, uint32_t footprint);
-
- void (*handle_idle_end)(unsigned sched_ctx, int worker);
-
- void (*handle_post_exec_hook)(unsigned sched_ctx, int task_tag);
-
- void (*handle_submitted_job)(struct starpu_codelet *cl, unsigned sched_ctx, uint32_t footprint, size_t data_size);
-
-
- void (*end_ctx)(unsigned sched_ctx);
-
- void (*start_ctx)(unsigned sched_ctx);
-
-
- void (*init_worker)(int workerid, unsigned sched_ctx);
- };
- void* sc_hypervisor_init(struct sc_hypervisor_policy *policy);
- void sc_hypervisor_shutdown(void);
- void sc_hypervisor_register_ctx(unsigned sched_ctx, double total_flops);
- void sc_hypervisor_unregister_ctx(unsigned sched_ctx);
- void sc_hypervisor_post_resize_request(unsigned sched_ctx, int task_tag);
- void sc_hypervisor_resize_ctxs(unsigned *sched_ctxs, int nsched_ctxs , int *workers, int nworkers);
- void sc_hypervisor_stop_resize(unsigned sched_ctx);
- void sc_hypervisor_start_resize(unsigned sched_ctx);
- const char *sc_hypervisor_get_policy();
- void sc_hypervisor_add_workers_to_sched_ctx(int* workers_to_add, unsigned nworkers_to_add, unsigned sched_ctx);
- void sc_hypervisor_remove_workers_from_sched_ctx(int* workers_to_remove, unsigned nworkers_to_remove, unsigned sched_ctx, unsigned now);
- void sc_hypervisor_move_workers(unsigned sender_sched_ctx, unsigned receiver_sched_ctx, int *workers_to_move, unsigned nworkers_to_move, unsigned now);
- void sc_hypervisor_size_ctxs(unsigned *sched_ctxs, int nsched_ctxs, int *workers, int nworkers);
- unsigned sc_hypervisor_get_size_req(unsigned **sched_ctxs, int* nsched_ctxs, int **workers, int *nworkers);
- void sc_hypervisor_save_size_req(unsigned *sched_ctxs, int nsched_ctxs, int *workers, int nworkers);
- void sc_hypervisor_free_size_req(void);
- unsigned sc_hypervisor_can_resize(unsigned sched_ctx);
- void sc_hypervisor_set_type_of_task(struct starpu_codelet *cl, unsigned sched_ctx, uint32_t footprint, size_t data_size);
- void sc_hypervisor_update_diff_total_flops(unsigned sched_ctx, double diff_total_flops);
- void sc_hypervisor_update_diff_elapsed_flops(unsigned sched_ctx, double diff_task_flops);
- void sc_hypervisor_update_resize_interval(unsigned *sched_ctxs, int nsched_ctxs, int max_nworkers);
- void sc_hypervisor_get_ctxs_on_level(unsigned **sched_ctxs, int *nsched_ctxs, unsigned hierarchy_level, unsigned father_sched_ctx_id);
- unsigned sc_hypervisor_get_nhierarchy_levels(void);
- void sc_hypervisor_get_leaves(unsigned *sched_ctxs, int nsched_ctxs, unsigned *leaves, int *nleaves);
- double sc_hypervisor_get_nready_flops_of_all_sons_of_sched_ctx(unsigned sched_ctx);
- void sc_hypervisor_print_overhead();
- void sc_hypervisor_init_worker(int workerid, unsigned sched_ctx);
- #ifdef __cplusplus
- }
- #endif
- #endif
|