scheduling_contexts.doxy 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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:: int type
  51. The type of structure (currently STARPU_WORKER_LIST is the only one available)
  52. \var starpu_worker_collection:: unsigned (*has_next)(struct starpu_worker_collection *workers)
  53. Checks if there is a next worker
  54. \var starpu_worker_collection:: int (*get_next)(struct starpu_worker_collection *workers)
  55. Gets the next worker
  56. \var starpu_worker_collection:: int (*add)(struct starpu_worker_collection *workers, int worker)
  57. Adds a worker to the collection
  58. \var starpu_worker_collection:: int (*remove)(struct starpu_worker_collection *workers, int worker)
  59. Removes a worker from the collection
  60. \var starpu_worker_collection:: void* (*init)(struct starpu_worker_collection *workers)
  61. Initialize the collection
  62. \var starpu_worker_collection:: void (*deinit)(struct starpu_worker_collection *workers)
  63. Deinitialize the colection
  64. \var starpu_worker_collection:: void (*init_cursor)(struct starpu_worker_collection *workers) (optional)
  65. Initialize the cursor if there is one
  66. \var starpu_worker_collection:: void (*deinit_cursor)(struct starpu_worker_collection *workers) (optional)
  67. Deinitialize the cursor if there is one
  68. \fn struct starpu_worker_collection* starpu_sched_ctx_create_worker_collection(unsigned sched_ctx_id, int type)
  69. \ingroup Scheduling_Contexts
  70. Create a worker collection of the type indicated by the last parameterx
  71. for the context specified through the first parameter.
  72. \fn void starpu_sched_ctx_delete_worker_collection(unsigned sched_ctx_id)
  73. \ingroup Scheduling_Contexts
  74. Delete the worker collection of the specified scheduling context
  75. \fn struct starpu_worker_collection* starpu_sched_ctx_get_worker_collection(unsigned sched_ctx_id)
  76. \ingroup Scheduling_Contexts
  77. Return the worker collection managed by the indicated context
  78. \fn void starpu_sched_ctx_set_context(unsigned *sched_ctx_id)
  79. \ingroup Scheduling_Contexts
  80. Set the scheduling context the subsequent tasks will be submitted to
  81. \fn unsigned starpu_sched_ctx_get_context(void)
  82. \ingroup Scheduling_Contexts
  83. Return the scheduling context the tasks are currently submitted to
  84. \fn unsigned starpu_sched_ctx_get_nworkers(unsigned sched_ctx_id)
  85. \ingroup Scheduling_Contexts
  86. Return the number of workers managed by the specified contexts
  87. (Usually needed to verify if it manages any workers or if it should be
  88. blocked)
  89. \fn unsigned starpu_sched_ctx_get_nshared_workers(unsigned sched_ctx_id, unsigned sched_ctx_id2)
  90. \ingroup Scheduling_Contexts
  91. Return the number of workers shared by two contexts.
  92. \fn int starpu_sched_ctx_set_min_priority(unsigned sched_ctx_id, int min_prio)
  93. \ingroup Scheduling_Contexts
  94. Defines the minimum task priority level supported by the scheduling
  95. policy of the given scheduler context. The default minimum priority
  96. level is the same as the default priority level which is 0 by
  97. convention. The application may access that value by calling the
  98. starpu_sched_ctx_get_min_priority function. This function should only
  99. be called from the initialization method of the scheduling policy, and
  100. should not be used directly from the application.
  101. \fn int starpu_sched_ctx_set_max_priority(unsigned sched_ctx_id, int max_prio)
  102. \ingroup Scheduling_Contexts
  103. Defines the maximum priority level supported by the scheduling policy
  104. of the given scheduler context. The default maximum priority level is
  105. 1. The application may access that value by calling the
  106. starpu_sched_ctx_get_max_priority function. This function should only
  107. be called from the initialization method of the scheduling policy, and
  108. should not be used directly from the application.
  109. \fn int starpu_sched_ctx_get_min_priority(unsigned sched_ctx_id)
  110. \ingroup Scheduling_Contexts
  111. Returns the current minimum priority level supported by the scheduling
  112. policy of the given scheduler context.
  113. \fn int starpu_sched_ctx_get_max_priority(unsigned sched_ctx_id)
  114. \ingroup Scheduling_Contexts
  115. Returns the current maximum priority level supported by the scheduling
  116. policy of the given scheduler context.
  117. */