sched_policy.h 5.1 KB

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