sched_ctx_hypervisor.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2011 - 2013 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_H
  17. #define SCHED_CTX_HYPERVISOR_H
  18. #include <starpu.h>
  19. #include <sched_ctx_hypervisor_config.h>
  20. #include <sched_ctx_hypervisor_monitoring.h>
  21. #ifdef __cplusplus
  22. extern "C"
  23. {
  24. #endif
  25. starpu_pthread_mutex_t act_hypervisor_mutex;
  26. /* Forward declaration of an internal data structure
  27. * FIXME: Remove when no longer exposed. */
  28. struct resize_request_entry;
  29. struct sched_ctx_hypervisor_policy
  30. {
  31. const char* name;
  32. unsigned custom;
  33. void (*size_ctxs)(int *sched_ctxs, int nsched_ctxs , int *workers, int nworkers);
  34. void (*handle_idle_cycle)(unsigned sched_ctx, int worker);
  35. void (*handle_pushed_task)(unsigned sched_ctx, int worker);
  36. void (*handle_poped_task)(unsigned sched_ctx, int worker,struct starpu_task *task, uint32_t footprint);
  37. void (*handle_idle_end)(unsigned sched_ctx, int worker);
  38. void (*handle_post_exec_hook)(unsigned sched_ctx, int task_tag);
  39. void (*handle_submitted_job)(struct starpu_codelet *cl, unsigned sched_ctx, uint32_t footprint);
  40. void (*end_ctx)(unsigned sched_ctx);
  41. };
  42. struct starpu_sched_ctx_performance_counters *sched_ctx_hypervisor_init(struct sched_ctx_hypervisor_policy *policy);
  43. void sched_ctx_hypervisor_shutdown(void);
  44. void sched_ctx_hypervisor_register_ctx(unsigned sched_ctx, double total_flops);
  45. void sched_ctx_hypervisor_unregister_ctx(unsigned sched_ctx);
  46. void sched_ctx_hypervisor_resize(unsigned sched_ctx, int task_tag);
  47. void sched_ctx_hypervisor_move_workers(unsigned sender_sched_ctx, unsigned receiver_sched_ctx, int *workers_to_move, unsigned nworkers_to_move, unsigned now);
  48. void sched_ctx_hypervisor_stop_resize(unsigned sched_ctx);
  49. void sched_ctx_hypervisor_start_resize(unsigned sched_ctx);
  50. const char *sched_ctx_hypervisor_get_policy();
  51. void sched_ctx_hypervisor_add_workers_to_sched_ctx(int* workers_to_add, unsigned nworkers_to_add, unsigned sched_ctx);
  52. void sched_ctx_hypervisor_remove_workers_from_sched_ctx(int* workers_to_remove, unsigned nworkers_to_remove, unsigned sched_ctx, unsigned now);
  53. void sched_ctx_hypervisor_size_ctxs(int *sched_ctxs, int nsched_ctxs, int *workers, int nworkers);
  54. unsigned sched_ctx_hypervisor_get_size_req(int **sched_ctxs, int* nsched_ctxs, int **workers, int *nworkers);
  55. void sched_ctx_hypervisor_save_size_req(int *sched_ctxs, int nsched_ctxs, int *workers, int nworkers);
  56. void sched_ctx_hypervisor_free_size_req(void);
  57. unsigned sched_ctx_hypervisor_can_resize(unsigned sched_ctx);
  58. void sched_ctx_hypervisor_set_type_of_task(struct starpu_codelet *cl, unsigned sched_ctx, uint32_t footprint);
  59. #ifdef __cplusplus
  60. }
  61. #endif
  62. #endif