modular_heteroprio_heft.c 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2013-2021 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
  4. * Copyright (C) 2013 Simon Archipoff
  5. *
  6. * StarPU is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU Lesser General Public License as published by
  8. * the Free Software Foundation; either version 2.1 of the License, or (at
  9. * your option) any later version.
  10. *
  11. * StarPU is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. *
  15. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  16. */
  17. #include <starpu_sched_component.h>
  18. #include <starpu_scheduler.h>
  19. #include <float.h>
  20. #include <limits.h>
  21. static void initialize_heteroprio_heft_center_policy(unsigned sched_ctx_id)
  22. {
  23. struct starpu_sched_component_heteroprio_data heteroprio_data =
  24. {
  25. .mct = NULL,
  26. .batch = 1,
  27. };
  28. starpu_sched_component_initialize_simple_schedulers(sched_ctx_id, 2,
  29. (starpu_sched_component_create_t) starpu_sched_component_heteroprio_create, &heteroprio_data,
  30. STARPU_SCHED_SIMPLE_DECIDE_WORKERS |
  31. STARPU_SCHED_SIMPLE_FIFOS_BELOW |
  32. STARPU_SCHED_SIMPLE_FIFOS_BELOW_READY |
  33. STARPU_SCHED_SIMPLE_FIFOS_BELOW_EXP |
  34. STARPU_SCHED_SIMPLE_IMPL,
  35. (starpu_sched_component_create_t) starpu_sched_component_heft_create, NULL,
  36. STARPU_SCHED_SIMPLE_DECIDE_WORKERS |
  37. STARPU_SCHED_SIMPLE_FIFO_ABOVE |
  38. STARPU_SCHED_SIMPLE_FIFO_ABOVE_PRIO |
  39. STARPU_SCHED_SIMPLE_FIFOS_BELOW |
  40. STARPU_SCHED_SIMPLE_FIFOS_BELOW_PRIO |
  41. STARPU_SCHED_SIMPLE_FIFOS_BELOW_READY |
  42. STARPU_SCHED_SIMPLE_FIFOS_BELOW_EXP |
  43. STARPU_SCHED_SIMPLE_IMPL);
  44. }
  45. struct starpu_sched_policy _starpu_sched_modular_heteroprio_heft_policy =
  46. {
  47. .init_sched = initialize_heteroprio_heft_center_policy,
  48. .deinit_sched = starpu_sched_tree_deinitialize,
  49. .add_workers = starpu_sched_tree_add_workers,
  50. .remove_workers = starpu_sched_tree_remove_workers,
  51. .push_task = starpu_sched_tree_push_task,
  52. .pop_task = starpu_sched_tree_pop_task,
  53. .pre_exec_hook = starpu_sched_component_worker_pre_exec_hook,
  54. .post_exec_hook = starpu_sched_component_worker_post_exec_hook,
  55. .pop_every_task = NULL,
  56. .policy_name = "modular-heteroprio-heft",
  57. .policy_description = "heteroprio+heft modular policy",
  58. .worker_type = STARPU_WORKER_LIST,
  59. .prefetches = 1,
  60. };