starpu_scheduler.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2011-2013,2015-2017 Inria
  4. * Copyright (C) 2010-2018 Université de Bordeaux
  5. * Copyright (C) 2011-2013,2015,2017 CNRS
  6. * Copyright (C) 2013 Thibaut Lambert
  7. * Copyright (C) 2011 Télécom-SudParis
  8. * Copyright (C) 2016 Uppsala University
  9. *
  10. * StarPU is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU Lesser General Public License as published by
  12. * the Free Software Foundation; either version 2.1 of the License, or (at
  13. * your option) any later version.
  14. *
  15. * StarPU is distributed in the hope that it will be useful, but
  16. * WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  18. *
  19. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  20. */
  21. #ifndef __STARPU_SCHEDULER_H__
  22. #define __STARPU_SCHEDULER_H__
  23. #include <starpu.h>
  24. #ifdef __cplusplus
  25. extern "C"
  26. {
  27. #endif
  28. struct starpu_task;
  29. struct starpu_sched_policy
  30. {
  31. void (*init_sched)(unsigned sched_ctx_id);
  32. void (*deinit_sched)(unsigned sched_ctx_id);
  33. int (*push_task)(struct starpu_task *);
  34. double (*simulate_push_task)(struct starpu_task *);
  35. void (*push_task_notify)(struct starpu_task *, int workerid, int perf_workerid, unsigned sched_ctx_id);
  36. struct starpu_task *(*pop_task)(unsigned sched_ctx_id);
  37. struct starpu_task *(*pop_every_task)(unsigned sched_ctx_id);
  38. void (*submit_hook)(struct starpu_task *task);
  39. void (*pre_exec_hook)(struct starpu_task *, unsigned sched_ctx_id);
  40. void (*post_exec_hook)(struct starpu_task *, unsigned sched_ctx_id);
  41. void (*do_schedule)(unsigned sched_ctx_id);
  42. void (*add_workers)(unsigned sched_ctx_id, int *workerids, unsigned nworkers);
  43. void (*remove_workers)(unsigned sched_ctx_id, int *workerids, unsigned nworkers);
  44. const char *policy_name;
  45. const char *policy_description;
  46. enum starpu_worker_collection_type worker_type;
  47. };
  48. struct starpu_sched_policy **starpu_sched_get_predefined_policies();
  49. void starpu_worker_get_sched_condition(int workerid, starpu_pthread_mutex_t **sched_mutex, starpu_pthread_cond_t **sched_cond);
  50. unsigned long starpu_task_get_job_id(struct starpu_task *task);
  51. int starpu_wake_worker_no_relax(int workerid);
  52. int starpu_wake_worker_locked(int workerid);
  53. int starpu_wake_worker_relax_light(int workerid);
  54. int starpu_worker_can_execute_task(unsigned workerid, struct starpu_task *task, unsigned nimpl);
  55. int starpu_worker_can_execute_task_impl(unsigned workerid, struct starpu_task *task, unsigned *impl_mask);
  56. int starpu_worker_can_execute_task_first_impl(unsigned workerid, struct starpu_task *task, unsigned *nimpl);
  57. int starpu_push_local_task(int workerid, struct starpu_task *task, int back);
  58. int starpu_push_task_end(struct starpu_task *task);
  59. int starpu_combined_worker_assign_workerid(int nworkers, int workerid_array[]);
  60. int starpu_combined_worker_get_description(int workerid, int *worker_size, int **combined_workerid);
  61. int starpu_combined_worker_can_execute_task(unsigned workerid, struct starpu_task *task, unsigned nimpl);
  62. int starpu_get_prefetch_flag(void);
  63. int starpu_prefetch_task_input_on_node_prio(struct starpu_task *task, unsigned node, int prio);
  64. int starpu_prefetch_task_input_on_node(struct starpu_task *task, unsigned node);
  65. int starpu_idle_prefetch_task_input_on_node_prio(struct starpu_task *task, unsigned node, int prio);
  66. int starpu_idle_prefetch_task_input_on_node(struct starpu_task *task, unsigned node);
  67. int starpu_prefetch_task_input_for_prio(struct starpu_task *task, unsigned worker, int prio);
  68. int starpu_prefetch_task_input_for(struct starpu_task *task, unsigned worker);
  69. int starpu_idle_prefetch_task_input_for_prio(struct starpu_task *task, unsigned worker, int prio);
  70. int starpu_idle_prefetch_task_input_for(struct starpu_task *task, unsigned worker);
  71. uint32_t starpu_task_footprint(struct starpu_perfmodel *model, struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned nimpl);
  72. uint32_t starpu_task_data_footprint(struct starpu_task *task);
  73. double starpu_task_expected_length(struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned nimpl);
  74. double starpu_worker_get_relative_speedup(struct starpu_perfmodel_arch *perf_arch);
  75. double starpu_task_expected_data_transfer_time(unsigned memory_node, struct starpu_task *task);
  76. double starpu_task_expected_data_transfer_time_for(struct starpu_task *task, unsigned worker);
  77. double starpu_data_expected_transfer_time(starpu_data_handle_t handle, unsigned memory_node, enum starpu_data_access_mode mode);
  78. double starpu_task_expected_energy(struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned nimpl);
  79. double starpu_task_expected_conversion_time(struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned nimpl);
  80. double starpu_task_bundle_expected_length(starpu_task_bundle_t bundle, struct starpu_perfmodel_arch *arch, unsigned nimpl);
  81. double starpu_task_bundle_expected_data_transfer_time(starpu_task_bundle_t bundle, unsigned memory_node);
  82. double starpu_task_bundle_expected_energy(starpu_task_bundle_t bundle, struct starpu_perfmodel_arch *arch, unsigned nimpl);
  83. typedef void (*starpu_notify_ready_soon_func)(void *data, struct starpu_task *task, double delay);
  84. void starpu_task_notify_ready_soon_register(starpu_notify_ready_soon_func f, void *data);
  85. void starpu_sched_ctx_worker_shares_tasks_lists(int workerid, int sched_ctx_id);
  86. void starpu_sched_task_break(struct starpu_task *task);
  87. #ifdef __cplusplus
  88. }
  89. #endif
  90. #endif /* __STARPU_SCHEDULER_H__ */