starpu_sched_ctx.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010 - 2012 INRIA
  4. *
  5. * StarPU is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU Lesser General Public License as published by
  7. * the Free Software Foundation; either version 2.1 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * StarPU is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. *
  14. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  15. */
  16. #ifndef __STARPU_SCHED_CTX_H__
  17. #define __STARPU_SCHED_CTX_H__
  18. #include <starpu.h>
  19. #ifdef __cplusplus
  20. extern "C"
  21. {
  22. #endif
  23. #define STARPU_SCHED_CTX_POLICY_NAME (1<<16)
  24. #define STARPU_SCHED_CTX_POLICY_STRUCT (2<<16)
  25. #define STARPU_SCHED_CTX_POLICY_MIN_PRIO (3<<16)
  26. #define STARPU_SCHED_CTX_POLICY_MAX_PRIO (4<<16)
  27. unsigned starpu_sched_ctx_create(int *workerids_ctx, int nworkers_ctx, const char *sched_ctx_name, ...);
  28. unsigned starpu_sched_ctx_create_inside_interval(const char *policy_name, const char *sched_name, int min_ncpus, int max_ncpus, int min_ngpus, int max_ngpus, unsigned allow_overlap);
  29. void starpu_sched_ctx_register_close_callback(unsigned sched_ctx_id, void (*close_callback)(unsigned sched_ctx_id, void* args), void *args);
  30. void starpu_sched_ctx_add_workers(int *workerids_ctx, int nworkers_ctx, unsigned sched_ctx_id);
  31. void starpu_sched_ctx_remove_workers(int *workerids_ctx, int nworkers_ctx, unsigned sched_ctx_id);
  32. void starpu_sched_ctx_delete(unsigned sched_ctx_id);
  33. void starpu_sched_ctx_set_inheritor(unsigned sched_ctx_id, unsigned inheritor);
  34. void starpu_sched_ctx_set_context(unsigned *sched_ctx_id);
  35. unsigned starpu_sched_ctx_get_context(void);
  36. void starpu_sched_ctx_stop_task_submission(void);
  37. void starpu_sched_ctx_finished_submit(unsigned sched_ctx_id);
  38. unsigned starpu_sched_ctx_get_workers_list(unsigned sched_ctx_id, int **workerids);
  39. unsigned starpu_sched_ctx_get_nworkers(unsigned sched_ctx_id);
  40. unsigned starpu_sched_ctx_get_nshared_workers(unsigned sched_ctx_id, unsigned sched_ctx_id2);
  41. unsigned starpu_sched_ctx_contains_worker(int workerid, unsigned sched_ctx_id);
  42. unsigned starpu_sched_ctx_contains_type_of_worker(enum starpu_worker_archtype arch, unsigned sched_ctx_id);
  43. unsigned starpu_sched_ctx_worker_get_id(unsigned sched_ctx_id);
  44. unsigned starpu_sched_ctx_overlapping_ctxs_on_worker(int workerid);
  45. int starpu_sched_get_min_priority(void);
  46. int starpu_sched_get_max_priority(void);
  47. int starpu_sched_set_min_priority(int min_prio);
  48. int starpu_sched_set_max_priority(int max_prio);
  49. int starpu_sched_ctx_get_min_priority(unsigned sched_ctx_id);
  50. int starpu_sched_ctx_get_max_priority(unsigned sched_ctx_id);
  51. int starpu_sched_ctx_set_min_priority(unsigned sched_ctx_id, int min_prio);
  52. int starpu_sched_ctx_set_max_priority(unsigned sched_ctx_id, int max_prio);
  53. int starpu_sched_ctx_min_priority_is_set(unsigned sched_ctx_id);
  54. int starpu_sched_ctx_max_priority_is_set(unsigned sched_ctx_id);
  55. #define STARPU_MIN_PRIO (starpu_sched_get_min_priority())
  56. #define STARPU_MAX_PRIO (starpu_sched_get_max_priority())
  57. #define STARPU_DEFAULT_PRIO 0
  58. struct starpu_worker_collection *starpu_sched_ctx_create_worker_collection(unsigned sched_ctx_id, enum starpu_worker_collection_type type);
  59. void starpu_sched_ctx_delete_worker_collection(unsigned sched_ctx_id);
  60. struct starpu_worker_collection *starpu_sched_ctx_get_worker_collection(unsigned sched_ctx_id);
  61. void starpu_sched_ctx_set_policy_data(unsigned sched_ctx_id, void *policy_data);
  62. void *starpu_sched_ctx_get_policy_data(unsigned sched_ctx_id);
  63. void *starpu_sched_ctx_exec_parallel_code(void* (*func)(void*), void *param, unsigned sched_ctx_id);
  64. int starpu_get_nready_tasks_of_sched_ctx(unsigned sched_ctx_id);
  65. double starpu_get_nready_flops_of_sched_ctx(unsigned sched_ctx_id);
  66. void starpu_sched_ctx_set_priority(int *workers, int nworkers, unsigned sched_ctx_id, unsigned priority);
  67. #ifdef STARPU_USE_SC_HYPERVISOR
  68. void starpu_sched_ctx_call_pushed_task_cb(int workerid, unsigned sched_ctx_id);
  69. #endif //STARPU_USE_SC_HYPERVISOR
  70. #ifdef __cplusplus
  71. }
  72. #endif
  73. #endif /* __STARPU_SCHED_CTX_H__ */