workers.doxy 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. /*
  2. * This file is part of the StarPU Handbook.
  3. * Copyright (C) 2009--2011 Universit@'e de Bordeaux
  4. * Copyright (C) 2010, 2011, 2012, 2013, 2014, 2016, 2017 CNRS
  5. * Copyright (C) 2011, 2012, 2017 INRIA
  6. * See the file version.doxy for copying conditions.
  7. */
  8. /*! \defgroup API_Workers_Properties Workers’ Properties
  9. \def STARPU_NMAXWORKERS
  10. \ingroup API_Workers_Properties
  11. Define the maximum number of workers managed by StarPU.
  12. \def STARPU_MAXCPUS
  13. \ingroup API_Workers_Properties
  14. Define the maximum number of CPU workers managed by StarPU. The default value can be modified at
  15. configure by using the option \ref enable-maxcpus "--enable-maxcpus".
  16. \def STARPU_MAXNODES
  17. \ingroup API_Workers_Properties
  18. Define the maximum number of memory nodes managed by StarPU. The default value can be modified at
  19. configure by using the option \ref enable-maxnodes "--enable-maxnodes". Reducing it allows to
  20. considerably reduce memory used by StarPU data structures.
  21. \enum starpu_node_kind
  22. \ingroup API_Workers_Properties
  23. TODO
  24. \var starpu_node_kind::STARPU_UNUSED
  25. \ingroup API_Workers_Properties
  26. TODO
  27. \ingroup API_Workers_Properties
  28. \var starpu_node_kind::STARPU_CPU_RAM
  29. \ingroup API_Workers_Properties
  30. TODO
  31. \var starpu_node_kind::STARPU_CUDA_RAM
  32. \ingroup API_Workers_Properties
  33. TODO
  34. \var starpu_node_kind::STARPU_OPENCL_RAM
  35. \ingroup API_Workers_Properties
  36. TODO
  37. \var starpu_node_kind::STARPU_DISK_RAM
  38. \ingroup API_Workers_Properties
  39. TODO
  40. \var starpu_node_kind::STARPU_MIC_RAM
  41. \ingroup API_Workers_Properties
  42. TODO
  43. \var starpu_node_kind::STARPU_SCC_RAM
  44. \ingroup API_Workers_Properties
  45. This node kind is not used anymore, but implementations in interfaces
  46. will be useful for MPI.
  47. \var starpu_node_kind::STARPU_SCC_SHM
  48. \ingroup API_Workers_Properties
  49. TODO
  50. \var starpu_node_kind::STARPU_MPI_MS_RAM
  51. \ingroup API_Workers_Properties
  52. TODO
  53. \enum starpu_worker_archtype
  54. \ingroup API_Workers_Properties
  55. Worker Architecture Type
  56. \var starpu_worker_archtype::STARPU_ANY_WORKER
  57. \ingroup API_Workers_Properties
  58. any worker, used in the hypervisor
  59. \var starpu_worker_archtype::STARPU_CPU_WORKER
  60. \ingroup API_Workers_Properties
  61. CPU core
  62. \var starpu_worker_archtype::STARPU_CUDA_WORKER
  63. \ingroup API_Workers_Properties
  64. NVIDIA CUDA device
  65. \var starpu_worker_archtype::STARPU_OPENCL_WORKER
  66. \ingroup API_Workers_Properties
  67. OpenCL device
  68. \var starpu_worker_archtype::STARPU_MIC_WORKER
  69. \ingroup API_Workers_Properties
  70. Intel MIC device
  71. \var starpu_worker_archtype::STARPU_SCC_WORKER
  72. \ingroup API_Workers_Properties
  73. Intel SCC device
  74. \var starpu_worker_archtype::STARPU_MPI_MS_WORKER
  75. \ingroup API_Workers_Properties
  76. MPI Slave device
  77. \struct starpu_worker_collection
  78. \ingroup API_Workers_Properties
  79. A scheduling context manages a collection of workers that can
  80. be memorized using different data structures. Thus, a generic
  81. structure is available in order to simplify the choice of its type.
  82. Only the list data structure is available but further data
  83. structures(like tree) implementations are foreseen.
  84. \var void *starpu_worker_collection::workerids
  85. The workerids managed by the collection
  86. \var unsigned starpu_worker_collection::nworkers
  87. The number of workers in the collection
  88. \var enum starpu_worker_collection_type starpu_worker_collection::type
  89. The type of structure (currently ::STARPU_WORKER_LIST is the only one available)
  90. \var unsigned (*starpu_worker_collection::has_next)(struct starpu_worker_collection *workers, struct starpu_sched_ctx_iterator *it)
  91. Checks if there is another element in collection
  92. \var int (*starpu_worker_collection::get_next)(struct starpu_worker_collection *workers, struct starpu_sched_ctx_iterator *it)
  93. return the next element in the collection
  94. \var int (*starpu_worker_collection::add)(struct starpu_worker_collection *workers, int worker)
  95. add a new element in the collection
  96. \var int (*starpu_worker_collection::remove)(struct starpu_worker_collection *workers, int worker)
  97. remove an element from the collection
  98. \var void (*starpu_worker_collection::init)(struct starpu_worker_collection *workers)
  99. Initialize the collection
  100. \var void (*starpu_worker_collection::deinit)(struct starpu_worker_collection *workers)
  101. Deinitialize the colection
  102. \var void (*starpu_worker_collection::init_iterator)(struct starpu_worker_collection *workers, struct starpu_sched_ctx_iterator *it)
  103. Initialize the cursor if there is one
  104. \enum starpu_worker_collection_type
  105. \ingroup API_Workers_Properties
  106. Types of structures the worker collection can implement
  107. \var starpu_worker_collection_type::STARPU_WORKER_LIST
  108. \ingroup API_Workers_Properties
  109. The collection is an array
  110. \struct starpu_sched_ctx_iterator
  111. \ingroup API_Workers_Properties
  112. Structure needed to iterate on the collection
  113. \var int starpu_sched_ctx_iterator::cursor
  114. The index of the current worker in the collection, needed when iterating on
  115. the collection.
  116. \fn unsigned starpu_worker_get_count(void)
  117. \ingroup API_Workers_Properties
  118. This function returns the number of workers (i.e. processing
  119. units executing StarPU tasks). The returned value should be at most
  120. \ref STARPU_NMAXWORKERS.
  121. \fn int starpu_worker_get_count_by_type(enum starpu_worker_archtype type)
  122. \ingroup API_Workers_Properties
  123. Returns the number of workers of the given type. A positive (or
  124. NULL) value is returned in case of success, -EINVAL indicates that the
  125. type is not valid otherwise.
  126. \fn unsigned starpu_cpu_worker_get_count(void)
  127. \ingroup API_Workers_Properties
  128. This function returns the number of CPUs controlled by StarPU. The
  129. returned value should be at most \ref STARPU_MAXCPUS.
  130. \fn unsigned starpu_cuda_worker_get_count(void)
  131. \ingroup API_Workers_Properties
  132. This function returns the number of CUDA devices controlled by
  133. StarPU. The returned value should be at most \ref STARPU_MAXCUDADEVS.
  134. \fn unsigned starpu_mic_worker_get_count(void)
  135. \ingroup API_Workers_Properties
  136. This function returns the number of MIC workers controlled by StarPU.
  137. \fn unsigned starpu_mic_device_get_count(void)
  138. \ingroup API_Workers_Properties
  139. This function returns the number of MIC devices controlled by StarPU.
  140. The returned value should be at most \ref STARPU_MAXMICDEVS.
  141. \fn unsigned starpu_mpi_ms_worker_get_count(void)
  142. \ingroup API_Workers_Properties
  143. This function returns the number of MPI Master Slave workers controlled by StarPU.
  144. \fn unsigned starpu_scc_worker_get_count(void)
  145. \ingroup API_Workers_Properties
  146. This function returns the number of SCC devices controlled by StarPU.
  147. The returned value should be at most \ref STARPU_MAXSCCDEVS.
  148. \fn unsigned starpu_opencl_worker_get_count(void)
  149. \ingroup API_Workers_Properties
  150. This function returns the number of OpenCL devices controlled by
  151. StarPU. The returned value should be at most \ref STARPU_MAXOPENCLDEVS.
  152. \fn int starpu_worker_get_id(void)
  153. \ingroup API_Workers_Properties
  154. This function returns the identifier of the current worker, i.e
  155. the one associated to the calling thread. The returned value is either
  156. -1 if the current context is not a StarPU worker (i.e. when called
  157. from the application outside a task or a callback), or an integer
  158. between 0 and starpu_worker_get_count() - 1.
  159. \fn unsigned starpu_worker_get_id_check(void)
  160. \ingroup API_Workers_Properties
  161. This is the same as starpu_worker_get_id, but aborts when called from outside a
  162. worker (i.e. when starpu_worker_get_id() would return -1).
  163. \fn unsigned starpu_worker_get_ids_by_type(enum starpu_worker_archtype type, int *workerids, unsigned maxsize)
  164. \ingroup API_Workers_Properties
  165. This function gets the list of identifiers of workers with the
  166. given type. It fills the array \p workerids with the identifiers of the
  167. workers that have the type indicated in the first argument. The
  168. argument \p maxsize indicates the size of the array \p workerids. The returned
  169. value gives the number of identifiers that were put in the array.
  170. -ERANGE is returned is \p maxsize is lower than the number of workers
  171. with the appropriate type: in that case, the array is filled with the
  172. \p maxsize first elements. To avoid such overflows, the value of maxsize
  173. can be chosen by the means of the function
  174. starpu_worker_get_count_by_type(), or by passing a value greater or
  175. equal to \ref STARPU_NMAXWORKERS.
  176. \fn int starpu_worker_get_by_type(enum starpu_worker_archtype type, int num)
  177. \ingroup API_Workers_Properties
  178. This returns the identifier of the num-th worker that has the
  179. specified type type. If there are no such worker, -1 is returned.
  180. \fn int starpu_worker_get_by_devid(enum starpu_worker_archtype type, int devid)
  181. \ingroup API_Workers_Properties
  182. This returns the identifier of the worker that has the specified type
  183. \p type and device id \p devid (which may not be the n-th, if some
  184. devices are skipped for instance). If there are no such worker, -1 is returned.
  185. \fn int starpu_worker_get_devid(int id)
  186. \ingroup API_Workers_Properties
  187. This function returns the device id of the given worker. The
  188. worker should be identified with the value returned by the
  189. starpu_worker_get_id() function. In the case of a CUDA worker, this
  190. device identifier is the logical device identifier exposed by CUDA
  191. (used by the function cudaGetDevice() for instance). The device
  192. identifier of a CPU worker is the logical identifier of the core on
  193. which the worker was bound; this identifier is either provided by the
  194. OS or by the library <c>hwloc</c> in case it is available.
  195. \fn enum starpu_worker_archtype starpu_worker_get_type(int id)
  196. \ingroup API_Workers_Properties
  197. This function returns the type of processing unit associated to
  198. a worker. The worker identifier is a value returned by the function
  199. starpu_worker_get_id()). The returned value indicates the
  200. architecture of the worker: ::STARPU_CPU_WORKER for a CPU core,
  201. ::STARPU_CUDA_WORKER for a CUDA device, and ::STARPU_OPENCL_WORKER for a
  202. OpenCL device. The value returned for an invalid identifier is
  203. unspecified.
  204. \fn void starpu_worker_get_name(int id, char *dst, size_t maxlen)
  205. \ingroup API_Workers_Properties
  206. This function allows to get the name of a given worker. StarPU
  207. associates a unique human readable string to each processing unit.
  208. This function copies at most the maxlen first bytes of the unique
  209. string associated to a worker identified by its identifier id into the
  210. dst buffer. The caller is responsible for ensuring that \p dst is a
  211. valid pointer to a buffer of \p maxlen bytes at least. Calling this
  212. function on an invalid identifier results in an unspecified behaviour.
  213. \fn unsigned starpu_worker_get_memory_node(unsigned workerid)
  214. \ingroup API_Workers_Properties
  215. This function returns the identifier of the memory node
  216. associated to the worker identified by \p workerid.
  217. \fn enum starpu_node_kind starpu_node_get_kind(unsigned node)
  218. \ingroup API_Workers_Properties
  219. Returns the type of the given node as defined by
  220. ::starpu_node_kind. For example, when defining a new data interface,
  221. this function should be used in the allocation function to determine
  222. on which device the memory needs to be allocated.
  223. \fn char *starpu_worker_get_type_as_string(enum starpu_worker_archtype type)
  224. \ingroup API_Workers_Properties
  225. Returns the given worker type as a string.
  226. */