sc_hypervisor_policy.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010-2012 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. #ifndef SCHED_CTX_HYPERVISOR_POLICY_H
  17. #define SCHED_CTX_HYPERVISOR_POLICY_H
  18. #include <sc_hypervisor.h>
  19. #ifdef __cplusplus
  20. extern "C"
  21. {
  22. #endif
  23. #define HYPERVISOR_REDIM_SAMPLE 0.02
  24. #define HYPERVISOR_START_REDIM_SAMPLE 0.1
  25. /* task wrapper linked list */
  26. struct sc_hypervisor_policy_task_pool
  27. {
  28. /* Which codelet has been executed */
  29. struct starpu_codelet *cl;
  30. /* Task footprint key */
  31. uint32_t footprint;
  32. /* Context the task belongs to */
  33. unsigned sched_ctx_id;
  34. /* Number of tasks of this kind */
  35. unsigned long n;
  36. /* Other task kinds */
  37. struct sc_hypervisor_policy_task_pool *next;
  38. };
  39. /* add task information to a task wrapper linked list */
  40. 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);
  41. /* remove task information from a task wrapper linked list */
  42. void sc_hypervisor_policy_remove_task_from_pool(struct starpu_task *task, uint32_t footprint, struct sc_hypervisor_policy_task_pool **task_pools);
  43. /* clone a task wrapper linked list */
  44. struct sc_hypervisor_policy_task_pool* sc_hypervisor_policy_clone_task_pool(struct sc_hypervisor_policy_task_pool *tp);
  45. /* find the context with the lowest priority in order to move some workers */
  46. unsigned sc_hypervisor_find_lowest_prio_sched_ctx(unsigned req_sched_ctx, int nworkers_to_move);
  47. /* find the first most idle workers of a context*/
  48. int* sc_hypervisor_get_idlest_workers(unsigned sched_ctx, int *nworkers, enum starpu_archtype arch);
  49. /* find the first most idle workers in a list */
  50. int* sc_hypervisor_get_idlest_workers_in_list(int *start, int *workers, int nall_workers, int *nworkers, enum starpu_archtype arch);
  51. /* find workers that can be moved from a context (if the constraints of min, max, etc allow this) */
  52. unsigned sc_hypervisor_get_movable_nworkers(struct sc_hypervisor_policy_config *config, unsigned sched_ctx, enum starpu_archtype arch);
  53. /* compute how many workers should be moved from this context */
  54. int sc_hypervisor_compute_nworkers_to_move(unsigned req_sched_ctx);
  55. /* check the policy's constraints in order to resize */
  56. unsigned sc_hypervisor_policy_resize(unsigned sender_sched_ctx, unsigned receiver_sched_ctx, unsigned force_resize, unsigned now);
  57. /* check the policy's constraints in order to resize and find a context willing the resources */
  58. unsigned sc_hypervisor_policy_resize_to_unknown_receiver(unsigned sender_sched_ctx, unsigned now);
  59. /* compute the velocity of a context */
  60. double sc_hypervisor_get_ctx_velocity(struct sc_hypervisor_wrapper* sc_w);
  61. /* get the time of execution of the slowest context */
  62. double sc_hypervisor_get_slowest_ctx_exec_time(void);
  63. /* get the time of execution of the fastest context */
  64. double sc_hypervisor_get_fastest_ctx_exec_time(void);
  65. /* compute the velocity of a workers in a context */
  66. double sc_hypervisor_get_velocity_per_worker(struct sc_hypervisor_wrapper *sc_w, unsigned worker);
  67. /* compute the velocity of a type of worker in a context */
  68. double sc_hypervisor_get_velocity_per_worker_type(struct sc_hypervisor_wrapper* sc_w, enum starpu_archtype arch);
  69. /* compute the velocity of a type of worker in a context depending on its history */
  70. double sc_hypervisor_get_ref_velocity_per_worker_type(struct sc_hypervisor_wrapper* sc_w, enum starpu_archtype arch);
  71. /* check if there are contexts a lot more delayed than others */
  72. int sc_hypervisor_has_velocity_gap_btw_ctxs(void);
  73. /* get the list of workers grouped by type */
  74. void sc_hypervisor_group_workers_by_type(int *workers, int nworkers, int ntypes_of_workers, int total_nw[ntypes_of_workers]);
  75. #ifdef __cplusplus
  76. }
  77. #endif
  78. #endif