scheduling_contexts.doxy 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*
  2. * This file is part of the StarPU Handbook.
  3. * Copyright (C) 2009--2011 Universit@'e de Bordeaux 1
  4. * Copyright (C) 2010, 2011, 2012, 2013 Centre National de la Recherche Scientifique
  5. * Copyright (C) 2011, 2012 Institut National de Recherche en Informatique et Automatique
  6. * See the file version.doxy for copying conditions.
  7. */
  8. /*! \defgroup Scheduling_Contexts Scheduling Contexts
  9. \brief StarPU permits on one hand grouping workers in combined workers
  10. in order to execute a parallel task and on the other hand grouping
  11. tasks in bundles that will be executed by a single specified worker.
  12. In contrast when we group workers in scheduling contexts we submit
  13. starpu tasks to them and we schedule them with the policy assigned to
  14. the context. Scheduling contexts can be created, deleted and modified
  15. dynamically.
  16. \fn unsigned starpu_sched_ctx_create(const char *policy_name, int *workerids_ctx, int nworkers_ctx, const char *sched_ctx_name)
  17. \ingroup Scheduling_Contexts
  18. This function creates a scheduling context which uses the scheduling
  19. policy \p policy_name and assigns the workers in \p workerids_ctx to
  20. execute the tasks submitted to it.
  21. The return value represents the identifier of the context that has
  22. just been created. It will be further used to indicate the context the
  23. tasks will be submitted to. The return value should be at most
  24. STARPU_NMAX_SCHED_CTXS.
  25. \fn void starpu_sched_ctx_delete(unsigned sched_ctx_id)
  26. \ingroup Scheduling_Contexts
  27. Delete scheduling context \p sched_ctx_id and transfer remaining
  28. workers to the inheritor scheduling context.
  29. \fn void starpu_sched_ctx_add_workers(int *workerids_ctx, int nworkers_ctx, unsigned sched_ctx_id)
  30. \ingroup Scheduling_Contexts
  31. This function adds dynamically the workers in \p workerids_ctx to the
  32. context \p sched_ctx_id. The last argument cannot be greater than
  33. STARPU_NMAX_SCHED_CTXS.
  34. \fn void starpu_sched_ctx_remove_workers(int *workerids_ctx, int nworkers_ctx, unsigned sched_ctx_id)
  35. \ingroup Scheduling_Contexts
  36. This function removes the workers in \p workerids_ctx from the context
  37. \p sched_ctx_id. The last argument cannot be greater than
  38. STARPU_NMAX_SCHED_CTXS.
  39. \struct starpu_worker_collection
  40. \ingroup Scheduling_Contexts
  41. \brief A scheduling context manages a collection of workers that can
  42. be memorized using different data structures. Thus, a generic
  43. structure is available in order to simplify the choice of its type.
  44. Only the list data structure is available but further data
  45. structures(like tree) implementations are foreseen.
  46. \var starpu_worker_collection::workerids
  47. The workerids managed by the collection
  48. \var starpu_worker_collection::nworkers
  49. The number of workers in the collection
  50. \var starpu_worker_collection::type
  51. The type of structure (currently STARPU_WORKER_LIST is the only one available)
  52. \var starpu_worker_collection::has_next
  53. Checks if there is a next worker
  54. \var starpu_worker_collection::get_next
  55. Gets the next worker
  56. \var starpu_worker_collection::add
  57. Adds a worker to the collection
  58. \var starpu_worker_collection::remove
  59. Removes a worker from the collection
  60. \var starpu_worker_collection::init
  61. Initialize the collection
  62. \var starpu_worker_collection::deinit
  63. Deinitialize the colection
  64. \fn struct starpu_worker_collection* starpu_sched_ctx_create_worker_collection(unsigned sched_ctx_id, int type)
  65. \ingroup Scheduling_Contexts
  66. Create a worker collection of the type indicated by the last parameterx
  67. for the context specified through the first parameter.
  68. \fn void starpu_sched_ctx_delete_worker_collection(unsigned sched_ctx_id)
  69. \ingroup Scheduling_Contexts
  70. Delete the worker collection of the specified scheduling context
  71. \fn struct starpu_worker_collection* starpu_sched_ctx_get_worker_collection(unsigned sched_ctx_id)
  72. \ingroup Scheduling_Contexts
  73. Return the worker collection managed by the indicated context
  74. \fn void starpu_sched_ctx_set_context(unsigned *sched_ctx_id)
  75. \ingroup Scheduling_Contexts
  76. Set the scheduling context the subsequent tasks will be submitted to
  77. \fn unsigned starpu_sched_ctx_get_context(void)
  78. \ingroup Scheduling_Contexts
  79. Return the scheduling context the tasks are currently submitted to
  80. \fn unsigned starpu_sched_ctx_get_nworkers(unsigned sched_ctx_id)
  81. \ingroup Scheduling_Contexts
  82. Return the number of workers managed by the specified contexts
  83. (Usually needed to verify if it manages any workers or if it should be
  84. blocked)
  85. \fn unsigned starpu_sched_ctx_get_nshared_workers(unsigned sched_ctx_id, unsigned sched_ctx_id2)
  86. \ingroup Scheduling_Contexts
  87. Return the number of workers shared by two contexts.
  88. \fn int starpu_sched_ctx_set_min_priority(unsigned sched_ctx_id, int min_prio)
  89. \ingroup Scheduling_Contexts
  90. Defines the minimum task priority level supported by the scheduling
  91. policy of the given scheduler context. The default minimum priority
  92. level is the same as the default priority level which is 0 by
  93. convention. The application may access that value by calling the
  94. starpu_sched_ctx_get_min_priority function. This function should only
  95. be called from the initialization method of the scheduling policy, and
  96. should not be used directly from the application.
  97. \fn int starpu_sched_ctx_set_max_priority(unsigned sched_ctx_id, int max_prio)
  98. \ingroup Scheduling_Contexts
  99. Defines the maximum priority level supported by the scheduling policy
  100. of the given scheduler context. The default maximum priority level is
  101. 1. The application may access that value by calling the
  102. starpu_sched_ctx_get_max_priority function. This function should only
  103. be called from the initialization method of the scheduling policy, and
  104. should not be used directly from the application.
  105. \fn int starpu_sched_ctx_get_min_priority(unsigned sched_ctx_id)
  106. \ingroup Scheduling_Contexts
  107. Returns the current minimum priority level supported by the scheduling
  108. policy of the given scheduler context.
  109. \fn int starpu_sched_ctx_get_max_priority(unsigned sched_ctx_id)
  110. \ingroup Scheduling_Contexts
  111. Returns the current maximum priority level supported by the scheduling
  112. policy of the given scheduler context.
  113. */