modular_eager_prefetching.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2013-2015,2017 Inria
  4. * Copyright (C) 2014,2017 CNRS
  5. * Copyright (C) 2014,2016-2019 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_eager_prefetching_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_FIFOS_BELOW |
  27. STARPU_SCHED_SIMPLE_FIFOS_BELOW_READY |
  28. STARPU_SCHED_SIMPLE_IMPL, sched_ctx_id);
  29. }
  30. static void deinitialize_eager_prefetching_center_policy(unsigned sched_ctx_id)
  31. {
  32. struct starpu_sched_tree *tree = (struct starpu_sched_tree*)starpu_sched_ctx_get_policy_data(sched_ctx_id);
  33. starpu_sched_tree_destroy(tree);
  34. }
  35. struct starpu_sched_policy _starpu_sched_modular_eager_prefetching_policy =
  36. {
  37. .init_sched = initialize_eager_prefetching_center_policy,
  38. .deinit_sched = deinitialize_eager_prefetching_center_policy,
  39. .add_workers = starpu_sched_tree_add_workers,
  40. .remove_workers = starpu_sched_tree_remove_workers,
  41. .push_task = starpu_sched_tree_push_task,
  42. .pop_task = starpu_sched_tree_pop_task,
  43. .pre_exec_hook = starpu_sched_component_worker_pre_exec_hook,
  44. .post_exec_hook = starpu_sched_component_worker_post_exec_hook,
  45. .pop_every_task = NULL,
  46. .policy_name = "modular-eager-prefetching",
  47. .policy_description = "eager with prefetching modular policy",
  48. .worker_type = STARPU_WORKER_LIST,
  49. };