sched_ctx_hypervisor.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #include <starpu.h>
  2. #include <../common/config.h>
  3. #include <../common/htable32.h>
  4. #include <pthread.h>
  5. /* ioctl properties*/
  6. #define HYPERVISOR_MAX_IDLE -1
  7. #define HYPERVISOR_MIN_WORKING -2
  8. #define HYPERVISOR_PRIORITY -3
  9. #define HYPERVISOR_MIN_WORKERS -4
  10. #define HYPERVISOR_MAX_WORKERS -5
  11. #define HYPERVISOR_GRANULARITY -6
  12. #define HYPERVISOR_FIXED_WORKERS -7
  13. #define HYPERVISOR_MIN_TASKS -8
  14. #define HYPERVISOR_NEW_WORKERS_MAX_IDLE -9
  15. #define HYPERVISOR_TIME_TO_APPLY -10
  16. #define HYPERVISOR_EMPTY_CTX_MAX_IDLE -11
  17. struct sched_ctx_hypervisor_reply{
  18. int procs[STARPU_NMAXWORKERS];
  19. int nprocs;
  20. };
  21. pthread_mutex_t act_hypervisor_mutex;
  22. struct starpu_sched_ctx_hypervisor_criteria* sched_ctx_hypervisor_init(int type);
  23. void sched_ctx_hypervisor_shutdown(void);
  24. void sched_ctx_hypervisor_handle_ctx(unsigned sched_ctx);
  25. void sched_ctx_hypervisor_ignore_ctx(unsigned sched_ctx);
  26. unsigned sched_ctx_hypervisor_resize(unsigned sched_ctx, int task_tag);
  27. void sched_ctx_hypervisor_move_workers(unsigned sender_sched_ctx, unsigned receier_sched_ctx, int *workers_to_move, unsigned nworkers_to_movex);
  28. void sched_ctx_hypervisor_stop_resize(unsigned sched_ctx);
  29. void sched_ctx_hypervisor_start_resize(unsigned sched_ctx);
  30. void sched_ctx_hypervisor_set_config(unsigned sched_ctx, void *config);
  31. void* sched_ctx_hypervisor_get_config(unsigned sched_ctx);
  32. void sched_ctx_hypervisor_ioctl(unsigned sched_ctx, ...);
  33. void sched_ctx_hypervisor_steal_workers(unsigned sched_ctx, int *workers, int nworkers, int task_tag);
  34. int* sched_ctx_hypervisor_get_sched_ctxs();
  35. int sched_ctx_hypervisor_get_nsched_ctxs();
  36. double sched_ctx_hypervisor_get_debit(unsigned sched_ctx);
  37. /* hypervisor policies */
  38. #define SIMPLE_POLICY 1
  39. struct hypervisor_policy {
  40. void (*init)(void);
  41. void (*deinit)(void);
  42. void (*add_sched_ctx)(unsigned sched_ctx);
  43. void(*remove_sched_ctx)(unsigned sched_ctx);
  44. void* (*ioctl)(unsigned sched_ctx, va_list varg_list, unsigned later);
  45. void (*manage_idle_time)(unsigned req_sched_ctx, int worker, double idle_time);
  46. void (*manage_task_flux)(unsigned sched_ctx);
  47. unsigned (*resize)(unsigned sched_ctx, int *sched_ctxs, unsigned nsched_ctxs);
  48. void (*update_config)(void* old_config, void* new_config);
  49. };