sched_policy.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010, 2012-2013, 2015-2017 Université de Bordeaux
  4. * Copyright (C) 2011 INRIA
  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. #ifndef __SCHED_POLICY_H__
  18. #define __SCHED_POLICY_H__
  19. #include <starpu.h>
  20. #include <signal.h>
  21. #include <core/workers.h>
  22. #include <core/sched_ctx.h>
  23. #include <starpu_scheduler.h>
  24. #include <core/simgrid.h>
  25. #define _STARPU_SCHED_BEGIN \
  26. _STARPU_TRACE_WORKER_SCHEDULING_PUSH; \
  27. _SIMGRID_TIMER_BEGIN
  28. #define _STARPU_SCHED_END \
  29. _SIMGRID_TIMER_END; \
  30. _STARPU_TRACE_WORKER_SCHEDULING_POP
  31. void _starpu_sched_init(void);
  32. struct starpu_machine_config;
  33. struct starpu_sched_policy *_starpu_get_sched_policy( struct _starpu_sched_ctx *sched_ctx);
  34. void _starpu_init_sched_policy(struct _starpu_machine_config *config,
  35. struct _starpu_sched_ctx *sched_ctx, struct starpu_sched_policy *policy);
  36. void _starpu_deinit_sched_policy(struct _starpu_sched_ctx *sched_ctx);
  37. struct starpu_sched_policy *_starpu_select_sched_policy(struct _starpu_machine_config *config, const char *required_policy);
  38. void _starpu_sched_task_submit(struct starpu_task *task);
  39. void _starpu_sched_do_schedule(unsigned sched_ctx_id);
  40. int _starpu_push_task(struct _starpu_job *task);
  41. int _starpu_repush_task(struct _starpu_job *task);
  42. /* actually pushes the tasks to the specific worker or to the scheduler */
  43. int _starpu_push_task_to_workers(struct starpu_task *task);
  44. /* pop a task that can be executed on the worker */
  45. struct starpu_task *_starpu_pop_task(struct _starpu_worker *worker);
  46. /* pop every task that can be executed on the worker */
  47. struct starpu_task *_starpu_pop_every_task(struct _starpu_sched_ctx *sched_ctx);
  48. void _starpu_sched_post_exec_hook(struct starpu_task *task);
  49. int _starpu_pop_task_end(struct starpu_task *task);
  50. void _starpu_wait_on_sched_event(void);
  51. struct starpu_task *_starpu_create_conversion_task(starpu_data_handle_t handle,
  52. unsigned int node) STARPU_ATTRIBUTE_MALLOC;
  53. struct starpu_task *_starpu_create_conversion_task_for_arch(starpu_data_handle_t handle,
  54. enum starpu_node_kind node_kind) STARPU_ATTRIBUTE_MALLOC;
  55. void _starpu_sched_pre_exec_hook(struct starpu_task *task);
  56. void _starpu_print_idle_time();
  57. /*
  58. * Predefined policies
  59. */
  60. extern struct starpu_sched_policy _starpu_sched_lws_policy;
  61. extern struct starpu_sched_policy _starpu_sched_ws_policy;
  62. extern struct starpu_sched_policy _starpu_sched_prio_policy;
  63. extern struct starpu_sched_policy _starpu_sched_random_policy;
  64. extern struct starpu_sched_policy _starpu_sched_dm_policy;
  65. extern struct starpu_sched_policy _starpu_sched_dmda_policy;
  66. extern struct starpu_sched_policy _starpu_sched_dmda_ready_policy;
  67. extern struct starpu_sched_policy _starpu_sched_dmda_sorted_policy;
  68. extern struct starpu_sched_policy _starpu_sched_dmda_sorted_decision_policy;
  69. extern struct starpu_sched_policy _starpu_sched_eager_policy;
  70. extern struct starpu_sched_policy _starpu_sched_parallel_heft_policy;
  71. extern struct starpu_sched_policy _starpu_sched_peager_policy;
  72. extern struct starpu_sched_policy _starpu_sched_heteroprio_policy;
  73. extern struct starpu_sched_policy _starpu_sched_modular_eager_policy;
  74. extern struct starpu_sched_policy _starpu_sched_modular_eager_prefetching_policy;
  75. extern struct starpu_sched_policy _starpu_sched_modular_prio_policy;
  76. extern struct starpu_sched_policy _starpu_sched_modular_prio_prefetching_policy;
  77. extern struct starpu_sched_policy _starpu_sched_modular_random_policy;
  78. extern struct starpu_sched_policy _starpu_sched_modular_random_prio_policy;
  79. extern struct starpu_sched_policy _starpu_sched_modular_random_prefetching_policy;
  80. extern struct starpu_sched_policy _starpu_sched_modular_random_prio_prefetching_policy;
  81. extern struct starpu_sched_policy _starpu_sched_modular_ws_policy;
  82. extern struct starpu_sched_policy _starpu_sched_modular_heft_policy;
  83. extern struct starpu_sched_policy _starpu_sched_modular_heft_prio_policy;
  84. extern struct starpu_sched_policy _starpu_sched_modular_heft2_policy;
  85. extern struct starpu_sched_policy _starpu_sched_graph_test_policy;
  86. extern long _starpu_task_break_on_push;
  87. extern long _starpu_task_break_on_pop;
  88. extern long _starpu_task_break_on_sched;
  89. #ifdef SIGTRAP
  90. #define _STARPU_TASK_BREAK_ON(task, what) do { \
  91. if (_starpu_get_job_associated_to_task(task)->job_id == (unsigned long) _starpu_task_break_on_##what) \
  92. raise(SIGTRAP); \
  93. } while(0)
  94. #else
  95. #define _STARPU_TASK_BREAK_ON(task, what) ((void) 0)
  96. #endif
  97. #endif // __SCHED_POLICY_H__