interoperability.doxy 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2018 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. /*! \defgroup API_Interop_Support Interoperability Support
  17. \brief This section describes the interface supplied by StarPU to interoperate with other runtime systems.
  18. \enum e_starpurm_drs_ret
  19. \ingroup API_Interop_Support
  20. StarPU Resource Manager return type.
  21. \var starpurm_drs_ret::starpurm_DRS_SUCCESS
  22. Dynamic resource sharing operation succeeded.
  23. \var starpurm_drs_ret::starpurm_DRS_DISABLD
  24. Dynamic resource sharing is disabled.
  25. \var starpurm_drs_ret::starpurm_DRS_PERM
  26. Dynamic resource sharing operation is not authorized or implemented.
  27. \var starpurm_drs_ret::starpurm_DRS_EINVAL
  28. Dynamic resource sharing operation has been called with one or more invalid parameters.
  29. @name Initialisation
  30. \ingroup API_Interop_Support
  31. \fn void starpurm_initialize(void)
  32. \ingroup API_Interop_Support
  33. Initialize StarPU and the StarPU-RM resource management module. The starpu_init() function should not have been called before the call to starpurm_initialize(). The starpurm_initialize() function will take care of this
  34. \fn void starpurm_shutdown(void)
  35. \ingroup API_Interop_Support
  36. Shutdown StarPU-RM and StarPU. The starpu_shutdown() function should not be called before. The starpurm_shutdown() function will take care of this.
  37. @name Spawn
  38. \ingroup API_Interop_Support
  39. \fn void starpurm_spawn_kernel_on_cpus(void *data, void(*f)(void *), void *args, hwloc_cpuset_t cpuset)
  40. \ingroup API_Interop_Support
  41. Allocate a temporary context spanning the units selected in the cpuset bitmap,
  42. set it as the default context for the current thread, and call user function \p f.
  43. Upon the return of user function \p f, the temporary context is freed and the previous
  44. default context for the current thread is restored.
  45. \fn void starpurm_spawn_kernel_on_cpus_callback(void *data, void(*f)(void *), void *args, hwloc_cpuset_t cpuset, void(*cb_f)(void *), void *cb_args)
  46. \ingroup API_Interop_Support
  47. Spawn a POSIX thread and returns immediately. The thread spawned will allocate
  48. a temporary context spanning the units selected in the cpuset bitmap, set it as
  49. the default context for the current thread, and call user function \p f. Upon
  50. the return of user function \p f, the temporary context will be freed and the
  51. previous default context for the current thread restored. A user specified callback \p cb_f
  52. will be called just before the termination of the thread.
  53. @name DynamicResourceSharing
  54. \ingroup API_Interop_Support
  55. \fn starpurm_drs_ret_t starpurm_set_drs_enable(starpurm_drs_desc_t *spd)
  56. \ingroup API_Interop_Support
  57. Turn-on dynamic resource sharing support.
  58. \fn starpurm_drs_ret_t starpurm_set_drs_disable(starpurm_drs_desc_t *spd)
  59. \ingroup API_Interop_Support
  60. Turn-off dynamic resource sharing support.
  61. \fn int starpurm_drs_enabled_p(void)
  62. \ingroup API_Interop_Support
  63. Return the state of the dynamic resource sharing support (\p =!0 enabled, \p =0 disabled).
  64. \fn starpurm_drs_ret_t starpurm_set_max_parallelism(starpurm_drs_desc_t *spd, int max)
  65. \ingroup API_Interop_Support
  66. Set the maximum number of CPU computing units available for StarPU computations
  67. to \p max. This number cannot exceed the maximum number of StarPU's CPU worker
  68. allocated at start-up time.
  69. \fn starpurm_drs_ret_t starpurm_assign_cpu_to_starpu(starpurm_drs_desc_t *spd, int cpuid)
  70. \ingroup API_Interop_Support
  71. Extend StarPU's default scheduling context to execute tasks on worker
  72. corresponding to logical unit \p cpuid. If StarPU does not have a worker
  73. thread initialized for logical unit \p cpuid, do nothing.
  74. \fn starpurm_drs_ret_t starpurm_assign_cpus_to_starpu(starpurm_drs_desc_t *spd, int ncpus)
  75. \ingroup API_Interop_Support
  76. Extend StarPU's default scheduling context to execute tasks on \p ncpus
  77. more workers, up to the number of StarPU worker threads initialized.
  78. \fn starpurm_drs_ret_t starpurm_assign_cpu_mask_to_starpu(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask)
  79. \ingroup API_Interop_Support
  80. Extend StarPU's default scheduling context to execute tasks on the
  81. additional logical units selected in \p mask. Logical units of \p mask for which no
  82. StarPU worker is initialized are silently ignored.
  83. \fn starpurm_drs_ret_t starpurm_assign_all_cpus_to_starpu(starpurm_drs_desc_t *spd)
  84. \ingroup API_Interop_Support
  85. Set StarPU's default scheduling context to execute tasks on all
  86. available logical units for which a StarPU worker has been initialized.
  87. \fn starpurm_drs_ret_t starpurm_withdraw_cpu_from_starpu(starpurm_drs_desc_t *spd, int cpuid)
  88. \ingroup API_Interop_Support
  89. Shrink StarPU's default scheduling context so as to not execute tasks on worker
  90. corresponding to logical unit \p cpuid. If StarPU does not have a worker
  91. thread initialized for logical unit \p cpuid, do nothing.
  92. \fn starpurm_drs_ret_t starpurm_withdraw_cpus_from_starpu(starpurm_drs_desc_t *spd, int ncpus)
  93. \ingroup API_Interop_Support
  94. Shrink StarPU's default scheduling context to execute tasks on \p ncpus
  95. less workers.
  96. \fn starpurm_drs_ret_t starpurm_withdraw_cpu_mask_from_starpu(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask)
  97. \ingroup API_Interop_Support
  98. Shrink StarPU's default scheduling context so as to not execute tasks on the
  99. logical units selected in \p mask. Logical units of \p mask for which no
  100. StarPU worker is initialized are silently ignored.
  101. \fn starpurm_drs_ret_t starpurm_withdraw_all_cpus_from_starpu(starpurm_drs_desc_t *spd)
  102. \ingroup API_Interop_Support
  103. Shrink StarPU's default scheduling context so as to remove all logical units.
  104. \fn starpurm_drs_ret_t starpurm_lend(starpurm_drs_desc_t *spd)
  105. \ingroup API_Interop_Support
  106. Synonym for starpurm_assign_all_cpus_to_starpu().
  107. \fn starpurm_drs_ret_t starpurm_lend_cpu(starpurm_drs_desc_t *spd, int cpuid)
  108. \ingroup API_Interop_Support
  109. Synonym for starpurm_assign_cpu_to_starpu().
  110. \fn starpurm_drs_ret_t starpurm_lend_cpus(starpurm_drs_desc_t *spd, int ncpus)
  111. \ingroup API_Interop_Support
  112. Synonym for starpurm_assign_cpus_to_starpu().
  113. \fn starpurm_drs_ret_t starpurm_lend_cpu_mask(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask)
  114. \ingroup API_Interop_Support
  115. Synonym for starpurm_assign_cpu_mask_to_starpu().
  116. \fn starpurm_drs_ret_t starpurm_reclaim(starpurm_drs_desc_t *spd)
  117. \ingroup API_Interop_Support
  118. Synonym for starpurm_withdraw_all_cpus_from_starpu().
  119. \fn starpurm_drs_ret_t starpurm_reclaim_cpu(starpurm_drs_desc_t *spd, int cpuid)
  120. \ingroup API_Interop_Support
  121. Synonym for starpurm_withdraw_cpu_from_starpu().
  122. \fn starpurm_drs_ret_t starpurm_reclaim_cpus(starpurm_drs_desc_t *spd, int ncpus)
  123. \ingroup API_Interop_Support
  124. Synonym for starpurm_withdraw_cpus_from_starpu().
  125. \fn starpurm_drs_ret_t starpurm_reclaim_cpu_mask(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask)
  126. \ingroup API_Interop_Support
  127. Synonym for starpurm_withdraw_cpu_mask_from_starpu().
  128. \fn starpurm_drs_ret_t starpurm_acquire(starpurm_drs_desc_t *spd)
  129. \ingroup API_Interop_Support
  130. Synonym for starpurm_withdraw_all_cpus_from_starpu().
  131. \fn starpurm_drs_ret_t starpurm_acquire_cpu(starpurm_drs_desc_t *spd, int cpuid)
  132. \ingroup API_Interop_Support
  133. Synonym for starpurm_withdraw_cpu_from_starpu().
  134. \fn starpurm_drs_ret_t starpurm_acquire_cpus(starpurm_drs_desc_t *spd, int ncpus)
  135. \ingroup API_Interop_Support
  136. Synonym for starpurm_withdraw_cpus_from_starpu().
  137. \fn starpurm_drs_ret_t starpurm_acquire_cpu_mask(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask)
  138. \ingroup API_Interop_Support
  139. Synonym for starpurm_withdraw_cpu_mask_from_starpu().
  140. \fn starpurm_drs_ret_t starpurm_return_all(starpurm_drs_desc_t *spd)
  141. \ingroup API_Interop_Support
  142. Synonym for starpurm_assign_all_cpus_to_starpu().
  143. \fn starpurm_drs_ret_t starpurm_return_cpu(starpurm_drs_desc_t *spd, int cpuid)
  144. \ingroup API_Interop_Support
  145. Synonym for starpurm_assign_cpu_to_starpu().
  146. @name Devices
  147. \ingroup API_Interop_Support
  148. \fn int starpurm_get_device_type_id(const char *type_str)
  149. \ingroup API_Interop_Support
  150. Return the device type ID constant associated to the device type name.
  151. Valid names for \p type_str are:
  152. - \c "cpu": regular CPU unit;
  153. - \c "opencl": OpenCL device unit;
  154. - \c "cuda": nVidia CUDA device unit;
  155. - \c "mic": Intel KNC type device unit.
  156. \fn const char *starpurm_get_device_type_name(int type_id)
  157. \ingroup API_Interop_Support
  158. Return the device type name associated to the device type ID constant.
  159. \fn int starpurm_get_nb_devices_by_type(int type_id)
  160. \ingroup API_Interop_Support
  161. Return the number of initialized StarPU worker for the device type \p type_id.
  162. \fn int starpurm_get_device_id(int type_id, int device_rank)
  163. \ingroup API_Interop_Support
  164. Return the unique ID assigned to the \p device_rank nth device of type
  165. \p type_id.
  166. \fn starpurm_drs_ret_t starpurm_assign_device_to_starpu(starpurm_drs_desc_t *spd, int type_id, int unit_rank)
  167. \ingroup API_Interop_Support
  168. Extend StarPU's default scheduling context to use \p unit_rank nth
  169. device of type \p type_id.
  170. \fn starpurm_drs_ret_t starpurm_assign_devices_to_starpu(starpurm_drs_desc_t *spd, int type_id, int ndevices)
  171. \ingroup API_Interop_Support
  172. Extend StarPU's default scheduling context to use \p ndevices more
  173. devices of type \p type_id, up to the number of StarPU workers
  174. initialized for such device type.
  175. \fn starpurm_drs_ret_t starpurm_assign_device_mask_to_starpu(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask)
  176. \ingroup API_Interop_Support
  177. Extend StarPU's default scheduling context to use additional devices as
  178. designated by their corresponding StarPU worker thread(s) CPU-set \p mask.
  179. \fn starpurm_drs_ret_t starpurm_assign_all_devices_to_starpu(starpurm_drs_desc_t *spd, int type_id)
  180. \ingroup API_Interop_Support
  181. Extend StarPU's default scheduling context to use all devices of type \p
  182. type_id for which it has a worker thread initialized.
  183. \fn starpurm_drs_ret_t starpurm_withdraw_device_from_starpu(starpurm_drs_desc_t *spd, int type_id, int unit_rank)
  184. \ingroup API_Interop_Support
  185. Shrink StarPU's default scheduling context to not use \p unit_rank nth
  186. device of type \p type_id.
  187. \fn starpurm_drs_ret_t starpurm_withdraw_devices_from_starpu(starpurm_drs_desc_t *spd, int type_id, int ndevices)
  188. \ingroup API_Interop_Support
  189. Shrink StarPU's default scheduling context to use \p ndevices less
  190. devices of type \p type_id.
  191. \fn starpurm_drs_ret_t starpurm_withdraw_device_mask_from_starpu(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask)
  192. \ingroup API_Interop_Support
  193. Shrink StarPU's default scheduling context to not use devices
  194. designated by their corresponding StarPU worker thread(s) CPU-set \p mask.
  195. \fn starpurm_drs_ret_t starpurm_withdraw_all_devices_from_starpu(starpurm_drs_desc_t *spd, int type_id)
  196. \ingroup API_Interop_Support
  197. Shrink StarPU's default scheduling context to use no devices of type \p
  198. type_id.
  199. \fn starpurm_drs_ret_t starpurm_lend_device(starpurm_drs_desc_t *spd, int type_id, int unit_rank)
  200. \ingroup API_Interop_Support
  201. Synonym for starpurm_assign_device_to_starpu().
  202. \fn starpurm_drs_ret_t starpurm_lend_devices(starpurm_drs_desc_t *spd, int type_id, int ndevices)
  203. \ingroup API_Interop_Support
  204. Synonym for starpurm_assign_devices_to_starpu().
  205. \fn starpurm_drs_ret_t starpurm_lend_device_mask(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask)
  206. \ingroup API_Interop_Support
  207. Synonym for starpurm_assign_device_mask_to_starpu().
  208. \fn starpurm_drs_ret_t starpurm_lend_all_devices(starpurm_drs_desc_t *spd, int type_id)
  209. \ingroup API_Interop_Support
  210. Synonym for starpurm_assign_all_devices_to_starpu().
  211. \fn starpurm_drs_ret_t starpurm_reclaim_device(starpurm_drs_desc_t *spd, int type_id, int unit_rank)
  212. \ingroup API_Interop_Support
  213. Synonym for starpurm_withdraw_device_from_starpu().
  214. \fn starpurm_drs_ret_t starpurm_reclaim_devices(starpurm_drs_desc_t *spd, int type_id, int ndevices)
  215. \ingroup API_Interop_Support
  216. Synonym for starpurm_withdraw_devices_from_starpu().
  217. \fn starpurm_drs_ret_t starpurm_reclaim_device_mask(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask)
  218. \ingroup API_Interop_Support
  219. Synonym for starpurm_withdraw_device_mask_from_starpu().
  220. \fn starpurm_drs_ret_t starpurm_reclaim_all_devices(starpurm_drs_desc_t *spd, int type_id)
  221. \ingroup API_Interop_Support
  222. Synonym for starpurm_withdraw_all_devices_from_starpu().
  223. \fn starpurm_drs_ret_t starpurm_acquire_device(starpurm_drs_desc_t *spd, int type_id, int unit_rank)
  224. \ingroup API_Interop_Support
  225. Synonym for starpurm_withdraw_device_from_starpu().
  226. \fn starpurm_drs_ret_t starpurm_acquire_devices(starpurm_drs_desc_t *spd, int type_id, int ndevices)
  227. \ingroup API_Interop_Support
  228. Synonym for starpurm_withdraw_devices_from_starpu().
  229. \fn starpurm_drs_ret_t starpurm_acquire_device_mask(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask)
  230. \ingroup API_Interop_Support
  231. Synonym for starpurm_withdraw_device_mask_from_starpu().
  232. \fn starpurm_drs_ret_t starpurm_acquire_all_devices(starpurm_drs_desc_t *spd, int type_id)
  233. \ingroup API_Interop_Support
  234. Synonym for starpurm_withdraw_all_devices_from_starpu().
  235. \fn starpurm_drs_ret_t starpurm_return_all_devices(starpurm_drs_desc_t *spd, int type_id)
  236. \ingroup API_Interop_Support
  237. Synonym for starpurm_assign_all_devices_to_starpu().
  238. \fn starpurm_drs_ret_t starpurm_return_device(starpurm_drs_desc_t *spd, int type_id, int unit_rank)
  239. \ingroup API_Interop_Support
  240. Synonym for starpurm_assign_device_to_starpu().
  241. @name CpusetsQueries
  242. \ingroup API_Interop_Support
  243. \fn hwloc_cpuset_t starpurm_get_device_worker_cpuset(int type_id, int unit_rank)
  244. \ingroup API_Interop_Support
  245. Return the CPU-set of the StarPU worker associated to the \p unit_rank
  246. nth unit of type \p type_id.
  247. \fn hwloc_cpuset_t starpurm_get_global_cpuset(void)
  248. \ingroup API_Interop_Support
  249. Return the cumulated CPU-set of all StarPU worker threads.
  250. \fn hwloc_cpuset_t starpurm_get_selected_cpuset(void)
  251. \ingroup API_Interop_Support
  252. Return the CPU-set of the StarPU worker threads currently selected in
  253. the default StarPU's scheduling context.
  254. \fn hwloc_cpuset_t starpurm_get_all_cpu_workers_cpuset(void)
  255. \ingroup API_Interop_Support
  256. Return the cumulated CPU-set of all CPU StarPU worker threads.
  257. \fn hwloc_cpuset_t starpurm_get_all_device_workers_cpuset(void)
  258. \ingroup API_Interop_Support
  259. Return the cumulated CPU-set of all "non-CPU" StarPU worker threads.
  260. \fn hwloc_cpuset_t starpurm_get_all_device_workers_cpuset_by_type(int typeid)
  261. \ingroup API_Interop_Support
  262. Return the cumulated CPU-set of all StarPU worker threads for devices of
  263. type \p typeid.
  264. */