modular_ws.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2013-2020 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. static void initialize_ws_center_policy(unsigned sched_ctx_id)
  20. {
  21. starpu_sched_component_initialize_simple_scheduler((starpu_sched_component_create_t) starpu_sched_component_work_stealing_create, NULL,
  22. STARPU_SCHED_SIMPLE_DECIDE_WORKERS |
  23. STARPU_SCHED_SIMPLE_WS_BELOW |
  24. STARPU_SCHED_SIMPLE_IMPL, sched_ctx_id);
  25. }
  26. static void deinitialize_ws_center_policy(unsigned sched_ctx_id)
  27. {
  28. struct starpu_sched_tree *t = (struct starpu_sched_tree*)starpu_sched_ctx_get_policy_data(sched_ctx_id);
  29. starpu_sched_tree_destroy(t);
  30. }
  31. struct starpu_sched_policy _starpu_sched_modular_ws_policy =
  32. {
  33. .init_sched = initialize_ws_center_policy,
  34. .deinit_sched = deinitialize_ws_center_policy,
  35. .add_workers = starpu_sched_tree_add_workers,
  36. .remove_workers = starpu_sched_tree_remove_workers,
  37. .push_task = starpu_sched_tree_work_stealing_push_task,
  38. .pop_task = starpu_sched_tree_pop_task,
  39. .pre_exec_hook = NULL,
  40. .post_exec_hook = NULL,
  41. .pop_every_task = NULL,
  42. .policy_name = "modular-ws",
  43. .policy_description = "work stealing modular policy",
  44. .worker_type = STARPU_WORKER_LIST,
  45. };