modular_prio.c 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2013-2015,2017 Inria
  4. * Copyright (C) 2017 CNRS
  5. * Copyright (C) 2014,2017-2018 Université de Bordeaux
  6. *
  7. * StarPU is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU Lesser General Public License as published by
  9. * the Free Software Foundation; either version 2.1 of the License, or (at
  10. * your option) any later version.
  11. *
  12. * StarPU is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. *
  16. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  17. */
  18. #include <starpu_sched_component.h>
  19. #include <starpu_scheduler.h>
  20. #include <limits.h>
  21. void starpu_initialize_prio_center_policy(unsigned sched_ctx_id)
  22. {
  23. starpu_sched_component_initialize_simple_scheduler((starpu_sched_component_create_t) starpu_sched_component_eager_create, NULL,
  24. STARPU_SCHED_SIMPLE_DECIDE_WORKERS |
  25. STARPU_SCHED_SIMPLE_FIFO_ABOVE |
  26. STARPU_SCHED_SIMPLE_FIFO_ABOVE_PRIO |
  27. STARPU_SCHED_SIMPLE_IMPL, sched_ctx_id);
  28. }
  29. static void deinitialize_prio_center_policy(unsigned sched_ctx_id)
  30. {
  31. struct starpu_sched_tree *tree = (struct starpu_sched_tree*)starpu_sched_ctx_get_policy_data(sched_ctx_id);
  32. starpu_sched_tree_destroy(tree);
  33. }
  34. struct starpu_sched_policy _starpu_sched_modular_prio_policy =
  35. {
  36. .init_sched = starpu_initialize_prio_center_policy,
  37. .deinit_sched = deinitialize_prio_center_policy,
  38. .add_workers = starpu_sched_tree_add_workers,
  39. .remove_workers = starpu_sched_tree_remove_workers,
  40. .push_task = starpu_sched_tree_push_task,
  41. .pop_task = starpu_sched_tree_pop_task,
  42. .pre_exec_hook = starpu_sched_component_worker_pre_exec_hook,
  43. .post_exec_hook = starpu_sched_component_worker_post_exec_hook,
  44. .pop_every_task = NULL,
  45. .policy_name = "modular-prio",
  46. .policy_description = "prio modular policy",
  47. .worker_type = STARPU_WORKER_LIST,
  48. };