modular_ws.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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, 2018 Université de Bordeaux
  6. * Copyright (C) 2013 Simon Archipoff
  7. *
  8. * StarPU is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU Lesser General Public License as published by
  10. * the Free Software Foundation; either version 2.1 of the License, or (at
  11. * your option) any later version.
  12. *
  13. * StarPU is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  16. *
  17. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  18. */
  19. #include <starpu_sched_component.h>
  20. #include <starpu_scheduler.h>
  21. static void initialize_ws_center_policy(unsigned sched_ctx_id)
  22. {
  23. starpu_sched_component_initialize_simple_scheduler((starpu_sched_component_create_t) starpu_sched_component_work_stealing_create, NULL,
  24. STARPU_SCHED_SIMPLE_DECIDE_WORKERS |
  25. STARPU_SCHED_SIMPLE_WS_BELOW |
  26. STARPU_SCHED_SIMPLE_IMPL, sched_ctx_id);
  27. }
  28. static void deinitialize_ws_center_policy(unsigned sched_ctx_id)
  29. {
  30. struct starpu_sched_tree *t = (struct starpu_sched_tree*)starpu_sched_ctx_get_policy_data(sched_ctx_id);
  31. starpu_sched_tree_destroy(t);
  32. }
  33. struct starpu_sched_policy _starpu_sched_modular_ws_policy =
  34. {
  35. .init_sched = initialize_ws_center_policy,
  36. .deinit_sched = deinitialize_ws_center_policy,
  37. .add_workers = starpu_sched_tree_add_workers,
  38. .remove_workers = starpu_sched_tree_remove_workers,
  39. .push_task = starpu_sched_tree_work_stealing_push_task,
  40. .pop_task = starpu_sched_tree_pop_task,
  41. .pre_exec_hook = NULL,
  42. .post_exec_hook = NULL,
  43. .pop_every_task = NULL,
  44. .policy_name = "modular-ws",
  45. .policy_description = "work stealing modular policy",
  46. .worker_type = STARPU_WORKER_LIST,
  47. };