workers.doxy 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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 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. \enum starpu_node_kind
  13. \ingroup API_Workers_Properties
  14. TODO
  15. \var starpu_node_kind::STARPU_UNUSED
  16. \ingroup API_Workers_Properties
  17. TODO
  18. \ingroup API_Workers_Properties
  19. \var starpu_node_kind::STARPU_CPU_RAM
  20. \ingroup API_Workers_Properties
  21. TODO
  22. \var starpu_node_kind::STARPU_CUDA_RAM
  23. \ingroup API_Workers_Properties
  24. TODO
  25. \var starpu_node_kind::STARPU_OPENCL_RAM
  26. \ingroup API_Workers_Properties
  27. TODO
  28. \var starpu_node_kind::STARPU_MIC_RAM
  29. \ingroup API_Workers_Properties
  30. TODO
  31. \var starpu_node_kind::STARPU_SCC_RAM
  32. \ingroup API_Workers_Properties
  33. This node kind is not used anymore, but implementations in interfaces
  34. will be useful for MPI.
  35. \var starpu_node_kind::STARPU_SCC_SHM
  36. \ingroup API_Workers_Properties
  37. TODO
  38. \enum starpu_worker_archtype
  39. \ingroup API_Workers_Properties
  40. Worker Architecture Type
  41. \var starpu_worker_archtype::STARPU_ANY_WORKER
  42. \ingroup API_Workers_Properties
  43. any worker, used in the hypervisor
  44. \var starpu_worker_archtype::STARPU_CPU_WORKER
  45. \ingroup API_Workers_Properties
  46. CPU core
  47. \var starpu_worker_archtype::STARPU_CUDA_WORKER
  48. \ingroup API_Workers_Properties
  49. NVIDIA CUDA device
  50. \var starpu_worker_archtype::STARPU_OPENCL_WORKER
  51. \ingroup API_Workers_Properties
  52. OpenCL device
  53. \var starpu_worker_archtype::STARPU_MIC_WORKER
  54. \ingroup API_Workers_Properties
  55. Intel MIC device
  56. \var starpu_worker_archtype::STARPU_SCC_WORKER
  57. \ingroup API_Workers_Properties
  58. Intel SCC device
  59. \fn unsigned starpu_worker_get_count(void)
  60. \ingroup API_Workers_Properties
  61. This function returns the number of workers (i.e. processing
  62. units executing StarPU tasks). The returned value should be at most
  63. \ref STARPU_NMAXWORKERS.
  64. \fn int starpu_worker_get_count_by_type(enum starpu_worker_archtype type)
  65. \ingroup API_Workers_Properties
  66. Returns the number of workers of the given type. A positive (or
  67. NULL) value is returned in case of success, -EINVAL indicates that the
  68. type is not valid otherwise.
  69. \fn unsigned starpu_cpu_worker_get_count(void)
  70. \ingroup API_Workers_Properties
  71. This function returns the number of CPUs controlled by StarPU. The
  72. returned value should be at most \ref STARPU_MAXCPUS.
  73. \fn unsigned starpu_cuda_worker_get_count(void)
  74. \ingroup API_Workers_Properties
  75. This function returns the number of CUDA devices controlled by
  76. StarPU. The returned value should be at most \ref STARPU_MAXCUDADEVS.
  77. \fn unsigned starpu_mic_worker_get_count(void)
  78. \ingroup API_Workers_Properties
  79. This function returns the number of MIC workers controlled by StarPU.
  80. \fn unsigned starpu_mic_device_get_count(void)
  81. \ingroup API_Workers_Properties
  82. This function returns the number of MIC devices controlled by StarPU.
  83. The returned value should be at most \ref STARPU_MAXMICDEVS.
  84. \fn unsigned starpu_scc_worker_get_count(void)
  85. \ingroup API_Workers_Properties
  86. This function returns the number of SCC devices controlled by StarPU.
  87. The returned value should be at most \ref STARPU_MAXSCCDEVS.
  88. \fn unsigned starpu_opencl_worker_get_count(void)
  89. \ingroup API_Workers_Properties
  90. This function returns the number of OpenCL devices controlled by
  91. StarPU. The returned value should be at most \ref STARPU_MAXOPENCLDEVS.
  92. \fn int starpu_worker_get_id(void)
  93. \ingroup API_Workers_Properties
  94. This function returns the identifier of the current worker, i.e
  95. the one associated to the calling thread. The returned value is either
  96. -1 if the current context is not a StarPU worker (i.e. when called
  97. from the application outside a task or a callback), or an integer
  98. between 0 and starpu_worker_get_count() - 1.
  99. \fn int starpu_worker_get_ids_by_type(enum starpu_worker_archtype type, int *workerids, int maxsize)
  100. \ingroup API_Workers_Properties
  101. This function gets the list of identifiers of workers with the
  102. given type. It fills the array \p workerids with the identifiers of the
  103. workers that have the type indicated in the first argument. The
  104. argument \p maxsize indicates the size of the array \p workerids. The returned
  105. value gives the number of identifiers that were put in the array.
  106. -ERANGE is returned is \p maxsize is lower than the number of workers
  107. with the appropriate type: in that case, the array is filled with the
  108. \p maxsize first elements. To avoid such overflows, the value of maxsize
  109. can be chosen by the means of the function
  110. starpu_worker_get_count_by_type(), or by passing a value greater or
  111. equal to \ref STARPU_NMAXWORKERS.
  112. \fn int starpu_worker_get_by_type(enum starpu_worker_archtype type, int num)
  113. \ingroup API_Workers_Properties
  114. This returns the identifier of the num-th worker that has the
  115. specified type type. If there are no such worker, -1 is returned.
  116. \fn int starpu_worker_get_by_devid(enum starpu_worker_archtype type, int devid)
  117. \ingroup API_Workers_Properties
  118. This returns the identifier of the worker that has the specified type
  119. \p type and device id \p devid (which may not be the n-th, if some
  120. devices are skipped for instance). If there are no such worker, -1 is returned.
  121. \fn int starpu_worker_get_devid(int id)
  122. \ingroup API_Workers_Properties
  123. This function returns the device id of the given worker. The
  124. worker should be identified with the value returned by the
  125. starpu_worker_get_id() function. In the case of a CUDA worker, this
  126. device identifier is the logical device identifier exposed by CUDA
  127. (used by the function cudaGetDevice() for instance). The device
  128. identifier of a CPU worker is the logical identifier of the core on
  129. which the worker was bound; this identifier is either provided by the
  130. OS or by the library <c>hwloc</c> in case it is available.
  131. \fn enum starpu_worker_archtype starpu_worker_get_type(int id)
  132. \ingroup API_Workers_Properties
  133. This function returns the type of processing unit associated to
  134. a worker. The worker identifier is a value returned by the function
  135. starpu_worker_get_id()). The returned value indicates the
  136. architecture of the worker: ::STARPU_CPU_WORKER for a CPU core,
  137. ::STARPU_CUDA_WORKER for a CUDA device, and ::STARPU_OPENCL_WORKER for a
  138. OpenCL device. The value returned for an invalid identifier is
  139. unspecified.
  140. \fn void starpu_worker_get_name(int id, char *dst, size_t maxlen)
  141. \ingroup API_Workers_Properties
  142. This function allows to get the name of a given worker. StarPU
  143. associates a unique human readable string to each processing unit.
  144. This function copies at most the maxlen first bytes of the unique
  145. string associated to a worker identified by its identifier id into the
  146. dst buffer. The caller is responsible for ensuring that \p dst is a
  147. valid pointer to a buffer of \p maxlen bytes at least. Calling this
  148. function on an invalid identifier results in an unspecified behaviour.
  149. \fn unsigned starpu_worker_get_memory_node(unsigned workerid)
  150. \ingroup API_Workers_Properties
  151. This function returns the identifier of the memory node
  152. associated to the worker identified by \p workerid.
  153. \fn enum starpu_node_kind starpu_node_get_kind(unsigned node)
  154. \ingroup API_Workers_Properties
  155. Returns the type of the given node as defined by
  156. ::starpu_node_kind. For example, when defining a new data interface,
  157. this function should be used in the allocation function to determine
  158. on which device the memory needs to be allocated.
  159. */