openmp_runtime_support.doxy 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765
  1. /*
  2. * This file is part of the StarPU Handbook.
  3. * Copyright (C) 2014 Inria
  4. * See the file version.doxy for copying conditions.
  5. */
  6. /*! \defgroup API_OpenMP_Runtime_Support OpenMP Runtime Support
  7. @name Initialisation
  8. \ingroup API_OpenMP_Runtime_Support
  9. \def STARPU_OPENMP
  10. \ingroup API_OpenMP_Runtime_Support
  11. This macro is defined when StarPU has been installed with OpenMP Runtime
  12. support. It should be used in your code to detect the availability of
  13. the runtime support for OpenMP.
  14. \fn int starpu_omp_init(void)
  15. \ingroup API_OpenMP_Runtime_Support
  16. Initializes StarPU and its OpenMP Runtime support.
  17. \fn int starpu_omp_shutdown(void)
  18. \ingroup API_OpenMP_Runtime_Support
  19. Shutdown StarPU and its OpenMP Runtime support.
  20. @name Parallel
  21. \anchor ORS_Parallel
  22. \ingroup API_OpenMP_Runtime_Support
  23. \fn void starpu_omp_parallel_region(const struct starpu_omp_parallel_region_attr *attr)
  24. \ingroup API_OpenMP_Runtime_Support
  25. Generates and launch an OpenMP parallel region and return after its
  26. completion. \p attr specifies the attributes for the generated parallel region.
  27. If this function is called from inside another, generating, parallel region, the
  28. generated parallel region is nested within the generating parallel region.
  29. This function can be used to implement <c>\#pragma omp parallel</c>.
  30. \fn void starpu_omp_master(void (*f)(void *arg), void *arg)
  31. \ingroup API_OpenMP_Runtime_Support
  32. Executes a function only on the master thread of the OpenMP
  33. parallel region it is called from. When called from a thread that is not the
  34. master of the parallel region it is called from, this function does nothing. \p
  35. f is the function to be called. \p arg is an argument passed to function \p f.
  36. This function can be used to implement <c>\#pragma omp master</c>.
  37. \fn int starpu_omp_master_inline(void)
  38. \ingroup API_OpenMP_Runtime_Support
  39. Determines whether the calling thread is the master of the OpenMP parallel region
  40. it is called from or not.
  41. This function can be used to implement <c>\#pragma omp master</c> without code
  42. outlining.
  43. \return <c>!0</c> if called by the region's master thread.
  44. \return <c>0</c> if not called by the region's master thread.
  45. @name Synchronization
  46. \anchor ORS_Synchronization
  47. \ingroup API_OpenMP_Runtime_Support
  48. \fn void starpu_omp_barrier(void)
  49. \ingroup API_OpenMP_Runtime_Support
  50. Waits until each participating thread of the innermost OpenMP parallel region
  51. has reached the barrier and each explicit OpenMP task bound to this region has
  52. completed its execution.
  53. This function can be used to implement <c>\#pragma omp barrier</c>.
  54. \fn void starpu_omp_critical(void (*f)(void *arg), void *arg, const char *name)
  55. \ingroup API_OpenMP_Runtime_Support
  56. Waits until no other thread is executing within the context of the selected
  57. critical section, then proceeds to the exclusive execution of a function within
  58. the critical section. \p f is the function to be executed in the critical
  59. section. \p arg is an argument passed to function \p f. \p name is the name of
  60. the selected critical section. If <c>name == NULL</c>, the selected critical
  61. section is the unique anonymous critical section.
  62. This function can be used to implement <c>\#pragma omp critical</c>.
  63. \fn void starpu_omp_critical_inline_begin(const char *name)
  64. \ingroup API_OpenMP_Runtime_Support
  65. Waits until execution can proceed exclusively within the context of the
  66. selected critical section. \p name is the name of the selected critical
  67. section. If <c>name == NULL</c>, the selected critical section is the unique
  68. anonymous critical section.
  69. This function together with #starpu_omp_critical_inline_end can be used to
  70. implement <c>\#pragma omp critical</c> without code outlining.
  71. \fn void starpu_omp_critical_inline_end(const char *name)
  72. \ingroup API_OpenMP_Runtime_Support
  73. Ends the exclusive execution within the context of the selected critical
  74. section. \p name is the name of the selected critical section. If
  75. <c>name==NULL</c>, the selected critical section is the unique anonymous
  76. critical section.
  77. This function together with #starpu_omp_critical_inline_begin can be used to
  78. implement <c>\#pragma omp critical</c> without code outlining.
  79. @name Worksharing
  80. \anchor ORS_Worksharing
  81. \ingroup API_OpenMP_Runtime_Support
  82. \fn void starpu_omp_single(void (*f)(void *arg), void *arg, int nowait)
  83. \ingroup API_OpenMP_Runtime_Support
  84. Ensures that a single participating thread of the innermost OpenMP parallel
  85. region executes a function. \p f is the function to be executed by a single
  86. thread. \p arg is an argument passed to function \p f. \p nowait is a flag
  87. indicating whether an implicit barrier is requested after the single section
  88. (<c>nowait==0</c>) or not (<c>nowait==!0</c>).
  89. This function can be used to implement <c>\#pragma omp single</c>.
  90. \fn int starpu_omp_single_inline(void)
  91. \ingroup API_OpenMP_Runtime_Support
  92. Decides whether the current thread is elected to run the following single
  93. section among the participating threads of the innermost OpenMP parallel
  94. region.
  95. This function can be used to implement <c>\#pragma omp single</c> without code
  96. outlining.
  97. \return <c>!0</c> if the calling thread has won the election.
  98. \return <c>0</c> if the calling thread has lost the election.
  99. \fn void starpu_omp_single_copyprivate(void (*f)(void *arg, void *data, unsigned long long data_size), void *arg, void *data, unsigned long long data_size)
  100. \ingroup API_OpenMP_Runtime_Support
  101. This function executes \p f on a single task of the current parallel region
  102. task, and then broadcast the contents of the memory block pointed by the
  103. copyprivate pointer \p data and of size \p data_size to the corresponding \p
  104. data pointed memory blocks of all the other participating region tasks. This
  105. function can be used to implement <c>\#pragma omp single</c> with a copyprivate
  106. clause.
  107. \sa starpu_omp_single_copyprivate_inline
  108. \sa starpu_omp_single_copyprivate_inline_begin
  109. \sa starpu_omp_single_copyprivate_inline_end
  110. \fn void *starpu_omp_single_copyprivate_inline_begin(void *data)
  111. \ingroup API_OpenMP_Runtime_Support
  112. This function elects one task among the tasks of the current parallel region
  113. task to execute the following single section, and then broadcast the
  114. copyprivate pointer \p data to all the other participating region tasks. This
  115. function can be used to implement <c>\#pragma omp single</c> with a copyprivate
  116. clause without code outlining.
  117. \sa starpu_omp_single_copyprivate_inline
  118. \sa starpu_omp_single_copyprivate_inline_end
  119. \fn void starpu_omp_single_copyprivate_inline_end(void)
  120. \ingroup API_OpenMP_Runtime_Support
  121. This function completes the execution of a single section and returns the
  122. broadcasted copyprivate pointer for tasks that lost the election and NULL for
  123. the task that won the election. This function can be used to implement
  124. <c>\#pragma omp single</c> with a copyprivate clause without code outlining.
  125. \return the copyprivate pointer for tasks that lost the election and therefore did not execute the code of the single section.
  126. \return NULL for the task that won the election and executed the code of the single section.
  127. \sa starpu_omp_single_copyprivate_inline
  128. \sa starpu_omp_single_copyprivate_inline_begin
  129. \fn void starpu_omp_for(void (*f)(unsigned long long _first_i, unsigned long long _nb_i, void *arg), void *arg, unsigned long long nb_iterations, unsigned long long chunk, int schedule, int ordered, int nowait)
  130. \ingroup API_OpenMP_Runtime_Support
  131. Executes a parallel loop together with the other threads participating to the
  132. innermost parallel region. \p f is the function to be executed iteratively. \p
  133. arg is an argument passed to function \p f. \p nb_iterations is the number of
  134. iterations to be performed by the parallel loop. \p chunk is the number of
  135. consecutive iterations that should be affected to the same thread when
  136. scheduling the loop workshares, it follows the semantics of the \c modifier
  137. argument in OpenMP <c>\#pragma omp for</c> specification. \p schedule is the
  138. scheduling mode according to the OpenMP specification. \p ordered is a flag
  139. indicating whether the loop region may contain an ordered section
  140. (<c>ordered==!0</c>) or not (<c>ordered==0</c>). \p nowait is a flag
  141. indicating whether an implicit barrier is requested after the for section
  142. (<c>nowait==0</c>) or not (<c>nowait==!0</c>).
  143. The function \p f will be called with arguments \p _first_i, the first iteration
  144. to perform, \p _nb_i, the number of consecutive iterations to perform before
  145. returning, \p arg, the free \p arg argument.
  146. This function can be used to implement <c>\#pragma omp for</c>.
  147. \fn int starpu_omp_for_inline_first(unsigned long long nb_iterations, unsigned long long chunk, int schedule, int ordered, unsigned long long *_first_i, unsigned long long *_nb_i)
  148. \ingroup API_OpenMP_Runtime_Support
  149. Decides whether the current thread should start to execute a parallel loop
  150. section. See #starpu_omp_for for the argument description.
  151. This function together with #starpu_omp_for_inline_next can be used to
  152. implement <c>\#pragma omp for</c> without code outlining.
  153. \return <c>!0</c> if the calling thread participates to the loop region and
  154. should execute a first chunk of iterations. In that case, \p *_first_i will be
  155. set to the first iteration of the chunk to perform and \p *_nb_i will be set to
  156. the number of iterations of the chunk to perform.
  157. \return <c>0</c> if the calling thread does not participate to the loop region
  158. because all the available iterations have been affected to the other threads of
  159. the parallel region.
  160. \sa starpu_omp_for
  161. \fn int starpu_omp_for_inline_next(unsigned long long nb_iterations, unsigned long long chunk, int schedule, int ordered, unsigned long long *_first_i, unsigned long long *_nb_i)
  162. \ingroup API_OpenMP_Runtime_Support
  163. Decides whether the current thread should continue to execute a parallel loop
  164. section. See #starpu_omp_for for the argument description.
  165. This function together with #starpu_omp_for_inline_first can be used to
  166. implement <c>\#pragma omp for</c> without code outlining.
  167. \return <c>!0</c> if the calling thread should execute a next chunk of
  168. iterations. In that case, \p *_first_i will be set to the first iteration of the
  169. chunk to perform and \p *_nb_i will be set to the number of iterations of the
  170. chunk to perform.
  171. \return <c>0</c> if the calling thread does not participate anymore to the loop
  172. region because all the available iterations have been affected to the other
  173. threads of the parallel region.
  174. \sa starpu_omp_for
  175. \fn void starpu_omp_for_alt(void (*f)(unsigned long long _begin_i, unsigned long long _end_i, void *arg), void *arg, unsigned long long nb_iterations, unsigned long long chunk, int schedule, int ordered, int nowait)
  176. \ingroup API_OpenMP_Runtime_Support
  177. Alternative implementation of a parallel loop. This function differs from
  178. #starpu_omp_for in the expected arguments of the loop function \c f.
  179. The function \p f will be called with arguments \p _begin_i, the first iteration
  180. to perform, \p _end_i, the first iteration not to perform before
  181. returning, \p arg, the free \p arg argument.
  182. This function can be used to implement <c>\#pragma omp for</c>.
  183. \sa starpu_omp_for
  184. \fn int starpu_omp_for_inline_first_alt(unsigned long long nb_iterations, unsigned long long chunk, int schedule, int ordered, unsigned long long *_begin_i, unsigned long long *_end_i)
  185. \ingroup API_OpenMP_Runtime_Support
  186. Inline version of the alternative implementation of a parallel loop.
  187. This function together with #starpu_omp_for_inline_next_alt can be used to
  188. implement <c>\#pragma omp for</c> without code outlining.
  189. \sa starpu_omp_for
  190. \sa starpu_omp_for_alt
  191. \sa starpu_omp_for_inline_first
  192. \fn int starpu_omp_for_inline_next_alt(unsigned long long nb_iterations, unsigned long long chunk, int schedule, int ordered, unsigned long long *_begin_i, unsigned long long *_end_i)
  193. \ingroup API_OpenMP_Runtime_Support
  194. Inline version of the alternative implementation of a parallel loop.
  195. This function together with #starpu_omp_for_inline_first_alt can be used to
  196. implement <c>\#pragma omp for</c> without code outlining.
  197. \sa starpu_omp_for
  198. \sa starpu_omp_for_alt
  199. \sa starpu_omp_for_inline_next
  200. \fn void starpu_omp_ordered(void (*f)(void *arg), void *arg)
  201. \ingroup API_OpenMP_Runtime_Support
  202. Ensures that a function is sequentially executed once for each iteration in
  203. order within a parallel loop, by the thread that own the iteration. \p f is the
  204. function to be executed by the thread that own the current iteration. \p arg is
  205. an argument passed to function \p f.
  206. This function can be used to implement <c>\#pragma omp ordered</c>.
  207. \fn void starpu_omp_ordered_inline_begin(void)
  208. \ingroup API_OpenMP_Runtime_Support
  209. Waits until all the iterations of a parallel loop below the iteration owned by
  210. the current thread have been executed.
  211. This function together with #starpu_omp_ordered_inline_end can be used to
  212. implement <c>\#pragma omp ordered</c> without code code outlining.
  213. \fn void starpu_omp_ordered_inline_end(void)
  214. \ingroup API_OpenMP_Runtime_Support
  215. Notifies that the ordered section for the current iteration has been completed.
  216. This function together with #starpu_omp_ordered_inline_begin can be used to
  217. implement <c>\#pragma omp ordered</c> without code code outlining.
  218. \fn void starpu_omp_sections(unsigned long long nb_sections, void (**section_f)(void *arg), void **section_arg, int nowait)
  219. \ingroup API_OpenMP_Runtime_Support
  220. Ensures that each function of a given array of functions is executed by one and
  221. only one thread. \p nb_sections is the number of functions in the array \p
  222. section_f. \p section_f is the array of functions to be executed as sections. \p
  223. section_arg is an array of arguments to be passed to the corresponding function.
  224. \p nowait is a flag indicating whether an implicit barrier is requested after
  225. the execution of all the sections (<c>nowait==0</c>) or not (<c>nowait==!0</c>).
  226. This function can be used to implement <c>\#pragma omp sections</c> and <c>\#pragma omp section</c>.
  227. \fn void starpu_omp_sections_combined(unsigned long long nb_sections, void (*section_f)(unsigned long long section_num, void *arg), void **section_arg, int nowait)
  228. \ingroup API_OpenMP_Runtime_Support
  229. Alternative implementation of sections. This function differs from
  230. #starpu_omp_sections in that all the sections are combined within a single
  231. function in this version. \p section_f is the function implementing the combined
  232. sections.
  233. The function \p section_f will be called with arguments \p section_num, the
  234. section number to be executed, \p arg, the entry of \p section_arg corresponding
  235. to this section.
  236. This function can be used to implement <c>\#pragma omp sections</c> and <c>\#pragma omp section</c>.
  237. \sa starpu_omp_sections
  238. @name Task
  239. \anchor ORS_Task
  240. \ingroup API_OpenMP_Runtime_Support
  241. \fn void starpu_omp_task_region(const struct starpu_omp_task_region_attr *attr)
  242. \ingroup API_OpenMP_Runtime_Support
  243. Generates an explicit child task. The execution of the generated task is
  244. asynchronous with respect to the calling code unless specified otherwise.
  245. \p attr specifies the attributes for the generated task region.
  246. This function can be used to implement <c>\#pragma omp task</c>.
  247. \fn void starpu_omp_taskwait(void)
  248. \ingroup API_OpenMP_Runtime_Support
  249. Waits for the completion of the tasks generated by the current task. This
  250. function does not wait for the descendants of the tasks generated by the current
  251. task.
  252. This function can be used to implement <c>\#pragma omp taskwait</c>.
  253. \fn void starpu_omp_taskgroup(void (*f)(void *arg), void *arg)
  254. \ingroup API_OpenMP_Runtime_Support
  255. Launches a function and wait for the completion of every descendant task
  256. generated during the execution of the function.
  257. This function can be used to implement <c>\#pragma omp taskgroup</c>.
  258. \sa starpu_omp_taskgroup_inline_begin
  259. \sa starpu_omp_taskgroup_inline_end
  260. \fn void starpu_omp_taskgroup_inline_begin(void)
  261. \ingroup API_OpenMP_Runtime_Support
  262. Launches a function and gets ready to wait for the completion of every descendant task
  263. generated during the dynamic scope of the taskgroup.
  264. This function can be used to implement <c>\#pragma omp taskgroup</c> without code outlining.
  265. \sa starpu_omp_taskgroup
  266. \sa starpu_omp_taskgroup_inline_end
  267. \fn void starpu_omp_taskgroup_inline_end(void)
  268. \ingroup API_OpenMP_Runtime_Support
  269. Waits for the completion of every descendant task
  270. generated during the dynamic scope of the taskgroup.
  271. This function can be used to implement <c>\#pragma omp taskgroup</c> without code outlining.
  272. \sa starpu_omp_taskgroup
  273. \sa starpu_omp_taskgroup_inline_begin
  274. @name API
  275. \anchor ORS_API
  276. \ingroup API_OpenMP_Runtime_Support
  277. \fn void starpu_omp_set_num_threads(int threads)
  278. \ingroup API_OpenMP_Runtime_Support
  279. This function sets ICVS nthreads_var for the parallel regions to be created
  280. with the current region.
  281. Note: The StarPU OpenMP runtime support currently ignores
  282. this setting for nested parallel regions.
  283. \sa starpu_omp_get_num_threads
  284. \sa starpu_omp_get_thread_num
  285. \sa starpu_omp_get_max_threads
  286. \sa starpu_omp_get_num_procs
  287. \fn int starpu_omp_get_num_threads()
  288. \ingroup API_OpenMP_Runtime_Support
  289. This function returns the number of threads of the current region.
  290. \return the number of threads of the current region.
  291. \sa starpu_omp_set_num_threads
  292. \sa starpu_omp_get_thread_num
  293. \sa starpu_omp_get_max_threads
  294. \sa starpu_omp_get_num_procs
  295. \fn int starpu_omp_get_thread_num()
  296. \ingroup API_OpenMP_Runtime_Support
  297. This function returns the rank of the current thread among the threads
  298. of the current region.
  299. \return the rank of the current thread in the current region.
  300. \sa starpu_omp_set_num_threads
  301. \sa starpu_omp_get_num_threads
  302. \sa starpu_omp_get_max_threads
  303. \sa starpu_omp_get_num_procs
  304. \fn int starpu_omp_get_max_threads()
  305. \ingroup API_OpenMP_Runtime_Support
  306. This function returns the maximum number of threads that can be used to
  307. create a region from the current region.
  308. \return the maximum number of threads that can be used to create a region from the current region.
  309. \sa starpu_omp_set_num_threads
  310. \sa starpu_omp_get_num_threads
  311. \sa starpu_omp_get_thread_num
  312. \sa starpu_omp_get_num_procs
  313. \fn int starpu_omp_get_num_procs (void)
  314. \ingroup API_OpenMP_Runtime_Support
  315. This function returns the number of StarPU CPU workers.
  316. \return the number of StarPU CPU workers.
  317. \sa starpu_omp_set_num_threads
  318. \sa starpu_omp_get_num_threads
  319. \sa starpu_omp_get_thread_num
  320. \sa starpu_omp_get_max_threads
  321. \fn int starpu_omp_in_parallel (void)
  322. \ingroup API_OpenMP_Runtime_Support
  323. This function returns whether it is called from the scope of a parallel region or not.
  324. \return <c>!0</c> if called from a parallel region scope.
  325. \return <c>0</c> otherwise.
  326. \fn void starpu_omp_set_dynamic (int dynamic_threads)
  327. \ingroup API_OpenMP_Runtime_Support
  328. This function enables (1) or disables (0) dynamically adjusting the number of parallel threads.
  329. Note: The StarPU OpenMP runtime support currently ignores the argument of this function.
  330. \sa starpu_omp_get_dynamic
  331. \fn int starpu_omp_get_dynamic (void)
  332. \ingroup API_OpenMP_Runtime_Support
  333. This function returns the state of dynamic thread number adjustment.
  334. \return <c>!0</c> if dynamic thread number adjustment is enabled.
  335. \return <c>0</c> otherwise.
  336. \sa starpu_omp_set_dynamic
  337. \fn void starpu_omp_set_nested (int nested)
  338. \ingroup API_OpenMP_Runtime_Support
  339. This function enables (1) or disables (0) nested parallel regions.
  340. Note: The StarPU OpenMP runtime support currently ignores the argument of this function.
  341. \sa starpu_omp_get_nested
  342. \sa starpu_omp_get_max_active_levels
  343. \sa starpu_omp_set_max_active_levels
  344. \sa starpu_omp_get_level
  345. \sa starpu_omp_get_active_level
  346. \fn int starpu_omp_get_nested (void)
  347. \ingroup API_OpenMP_Runtime_Support
  348. This function returns whether nested parallel sections are enabled or not.
  349. \return <c>!0</c> if nested parallel sections are enabled.
  350. \return <c>0</c> otherwise.
  351. \sa starpu_omp_set_nested
  352. \sa starpu_omp_get_max_active_levels
  353. \sa starpu_omp_set_max_active_levels
  354. \sa starpu_omp_get_level
  355. \sa starpu_omp_get_active_level
  356. \fn int starpu_omp_get_cancellation(void)
  357. \ingroup API_OpenMP_Runtime_Support
  358. This function returns the state of the cancel ICVS var.
  359. \fn void starpu_omp_set_schedule (enum starpu_omp_sched_value kind, int modifier)
  360. \ingroup API_OpenMP_Runtime_Support
  361. This function sets the default scheduling kind for upcoming loops within the
  362. current parallel section. \p kind is the scheduler kind, \p modifier
  363. complements the scheduler kind with informations such as the chunk size,
  364. in accordance with the OpenMP specification.
  365. \sa starpu_omp_get_schedule
  366. \fn void starpu_omp_get_schedule (enum starpu_omp_sched_value *kind, int *modifier)
  367. \ingroup API_OpenMP_Runtime_Support
  368. This function returns the current selected default loop scheduler.
  369. \return the kind and the modifier of the current default loop scheduler.
  370. \sa starpu_omp_set_schedule
  371. \fn int starpu_omp_get_thread_limit (void)
  372. \ingroup API_OpenMP_Runtime_Support
  373. This function returns the number of StarPU CPU workers.
  374. \return the number of StarPU CPU workers.
  375. \fn void starpu_omp_set_max_active_levels (int max_levels)
  376. \ingroup API_OpenMP_Runtime_Support
  377. This function sets the maximum number of allowed active parallel section levels.
  378. Note: The StarPU OpenMP runtime support currently ignores the argument of this function and assume \p max_levels equals <c>1</c> instead.
  379. \sa starpu_omp_set_nested
  380. \sa starpu_omp_get_nested
  381. \sa starpu_omp_get_max_active_levels
  382. \sa starpu_omp_get_level
  383. \sa starpu_omp_get_active_level
  384. \fn int starpu_omp_get_max_active_levels (void)
  385. \ingroup API_OpenMP_Runtime_Support
  386. This function returns the current maximum number of allowed active parallel section levels
  387. \return the current maximum number of allowed active parallel section levels.
  388. \sa starpu_omp_set_nested
  389. \sa starpu_omp_get_nested
  390. \sa starpu_omp_set_max_active_levels
  391. \sa starpu_omp_get_level
  392. \sa starpu_omp_get_active_level
  393. \fn int starpu_omp_get_level (void)
  394. \ingroup API_OpenMP_Runtime_Support
  395. This function returns the nesting level of the current parallel section.
  396. \return the nesting level of the current parallel section.
  397. \sa starpu_omp_set_nested
  398. \sa starpu_omp_get_nested
  399. \sa starpu_omp_get_max_active_levels
  400. \sa starpu_omp_set_max_active_levels
  401. \sa starpu_omp_get_active_level
  402. \fn int starpu_omp_get_ancestor_thread_num (int level)
  403. \ingroup API_OpenMP_Runtime_Support
  404. This function returns the number of the ancestor of the current parallel section.
  405. \return the number of the ancestor of the current parallel section.
  406. \fn int starpu_omp_get_team_size (int level)
  407. \ingroup API_OpenMP_Runtime_Support
  408. This function returns the size of the team of the current parallel section.
  409. \return the size of the team of the current parallel section.
  410. \fn int starpu_omp_get_active_level (void)
  411. \ingroup API_OpenMP_Runtime_Support
  412. This function returns the nestinglevel of the current innermost active parallel section.
  413. \return the nestinglevel of the current innermost active parallel section.
  414. \sa starpu_omp_set_nested
  415. \sa starpu_omp_get_nested
  416. \sa starpu_omp_get_max_active_levels
  417. \sa starpu_omp_set_max_active_levels
  418. \sa starpu_omp_get_level
  419. \fn int starpu_omp_in_final(void)
  420. \ingroup API_OpenMP_Runtime_Support
  421. This function checks whether the current task is final or not.
  422. \return <c>!0</c> if called from a final task.
  423. \return <c>0</c> otherwise.
  424. \fn enum starpu_omp_proc_bind_value starpu_omp_get_proc_bind(void)
  425. \ingroup API_OpenMP_Runtime_Support
  426. This function returns the proc_bind setting of the current parallel region.
  427. \return the proc_bind setting of the current parallel region.
  428. \fn void starpu_omp_set_default_device(int device_num)
  429. \ingroup API_OpenMP_Runtime_Support
  430. This function sets the number of the device to use as default.
  431. Note: The StarPU OpenMP runtime support currently ignores the argument of this function.
  432. \sa starpu_omp_get_default_device
  433. \sa starpu_omp_is_initial_device
  434. \fn int starpu_omp_get_default_device(void)
  435. \ingroup API_OpenMP_Runtime_Support
  436. This function returns the number of the device used as default.
  437. \return the number of the device used as default.
  438. \sa starpu_omp_set_default_device
  439. \sa starpu_omp_is_initial_device
  440. \fn int starpu_omp_get_num_devices(void)
  441. \ingroup API_OpenMP_Runtime_Support
  442. This function returns the number of the devices.
  443. \return the number of the devices.
  444. \fn int starpu_omp_get_num_teams(void)
  445. \ingroup API_OpenMP_Runtime_Support
  446. This function returns the number of teams in the current teams region.
  447. \return the number of teams in the current teams region.
  448. \sa starpu_omp_get_num_teams
  449. \fn int starpu_omp_get_team_num(void)
  450. \ingroup API_OpenMP_Runtime_Support
  451. This function returns the team number of the calling thread.
  452. \return the team number of the calling thread.
  453. \sa starpu_omp_get_num_teams
  454. \fn int starpu_omp_is_initial_device(void)
  455. \ingroup API_OpenMP_Runtime_Support
  456. This function checks whether the current device is the initial device or not.
  457. \return <c>!0</c> if called from the host device.
  458. \return <c>0</c> otherwise.
  459. \sa starpu_omp_set_default_device
  460. \sa starpu_omp_get_default_device
  461. \fn void starpu_omp_init_lock (starpu_omp_lock_t *lock)
  462. \ingroup API_OpenMP_Runtime_Support
  463. This function initializes an opaque lock object.
  464. \sa starpu_omp_destroy_lock
  465. \sa starpu_omp_set_lock
  466. \sa starpu_omp_unset_lock
  467. \sa starpu_omp_test_lock
  468. \fn void starpu_omp_destroy_lock (starpu_omp_lock_t *lock)
  469. \ingroup API_OpenMP_Runtime_Support
  470. This function destroys an opaque lock object.
  471. \sa starpu_omp_init_lock
  472. \sa starpu_omp_set_lock
  473. \sa starpu_omp_unset_lock
  474. \sa starpu_omp_test_lock
  475. \fn void starpu_omp_set_lock (starpu_omp_lock_t *lock)
  476. \ingroup API_OpenMP_Runtime_Support
  477. This function locks an opaque lock object. If the lock is already locked, the
  478. function will block until it succeeds in exclusively acquiring the lock.
  479. \sa starpu_omp_init_lock
  480. \sa starpu_omp_destroy_lock
  481. \sa starpu_omp_unset_lock
  482. \sa starpu_omp_test_lock
  483. \fn void starpu_omp_unset_lock (starpu_omp_lock_t *lock)
  484. \ingroup API_OpenMP_Runtime_Support
  485. This function unlocks a previously locked lock object. The behaviour of this
  486. function is unspecified if it is called on an unlocked lock object.
  487. \sa starpu_omp_init_lock
  488. \sa starpu_omp_destroy_lock
  489. \sa starpu_omp_set_lock
  490. \sa starpu_omp_test_lock
  491. \fn int starpu_omp_test_lock (starpu_omp_lock_t *lock)
  492. \ingroup API_OpenMP_Runtime_Support
  493. This function unblockingly attempts to lock a lock object and returns whether
  494. it succeeded or not.
  495. \return <c>!0</c> if the function succeeded in acquiring the lock.
  496. \return <c>0</c> if the lock was already locked.
  497. \sa starpu_omp_init_lock
  498. \sa starpu_omp_destroy_lock
  499. \sa starpu_omp_set_lock
  500. \sa starpu_omp_unset_lock
  501. \fn void starpu_omp_init_nest_lock (starpu_omp_nest_lock_t *lock)
  502. \ingroup API_OpenMP_Runtime_Support
  503. This function initializes an opaque lock object supporting nested locking operations.
  504. \sa starpu_omp_destroy_nest_lock
  505. \sa starpu_omp_set_nest_lock
  506. \sa starpu_omp_unset_nest_lock
  507. \sa starpu_omp_test_nest_lock
  508. \fn void starpu_omp_destroy_nest_lock (starpu_omp_nest_lock_t *lock)
  509. \ingroup API_OpenMP_Runtime_Support
  510. This function destroys an opaque lock object supporting nested locking operations.
  511. \sa starpu_omp_init_nest_lock
  512. \sa starpu_omp_set_nest_lock
  513. \sa starpu_omp_unset_nest_lock
  514. \sa starpu_omp_test_nest_lock
  515. \fn void starpu_omp_set_nest_lock (starpu_omp_nest_lock_t *lock)
  516. \ingroup API_OpenMP_Runtime_Support
  517. This function locks an opaque lock object supporting nested locking operations.
  518. If the lock is already locked by another task, the function will block until
  519. it succeeds in exclusively acquiring the lock. If the lock is already taken by
  520. the current task, the function will increase the nested locking level of the
  521. lock object.
  522. \sa starpu_omp_init_nest_lock
  523. \sa starpu_omp_destroy_nest_lock
  524. \sa starpu_omp_unset_nest_lock
  525. \sa starpu_omp_test_nest_lock
  526. \fn void starpu_omp_unset_nest_lock (starpu_omp_nest_lock_t *lock)
  527. \ingroup API_OpenMP_Runtime_Support
  528. This function unlocks a previously locked lock object supporting nested locking
  529. operations. If the lock has been locked multiple times in nested fashion, the
  530. nested locking level is decreased and the lock remains locked. Otherwise, if
  531. the lock has only been locked once, it becomes unlocked. The behaviour of this
  532. function is unspecified if it is called on an unlocked lock object. The
  533. behaviour of this function is unspecified if it is called from a different task
  534. than the one that locked the lock object.
  535. \sa starpu_omp_init_nest_lock
  536. \sa starpu_omp_destroy_nest_lock
  537. \sa starpu_omp_set_nest_lock
  538. \sa starpu_omp_test_nest_lock
  539. \fn int starpu_omp_test_nest_lock (starpu_omp_nest_lock_t *lock)
  540. \ingroup API_OpenMP_Runtime_Support
  541. This function unblocking attempts to lock an opaque lock object supporting
  542. nested locking operations and returns whether it succeeded or not. If the lock
  543. is already locked by another task, the function will return without having
  544. acquired the lock. If the lock is already taken by the current task, the
  545. function will increase the nested locking level of the lock object.
  546. \return <c>!0</c> if the function succeeded in acquiring the lock.
  547. \return <c>0</c> if the lock was already locked.
  548. \sa starpu_omp_init_nest_lock
  549. \sa starpu_omp_destroy_nest_lock
  550. \sa starpu_omp_set_nest_lock
  551. \sa starpu_omp_unset_nest_lock
  552. \fn void starpu_omp_atomic_fallback_inline_begin(void)
  553. \ingroup API_OpenMP_Runtime_Support
  554. This function implements the entry point of a fallback global atomic region. It
  555. blocks until it succeeds in acquiring exclusive access to the global atomic
  556. region.
  557. \sa starpu_omp_atomic_fallback_inline_end
  558. \fn void starpu_omp_atomic_fallback_inline_end(void)
  559. \ingroup API_OpenMP_Runtime_Support
  560. This function implements the exit point of a fallback global atomic region. It
  561. release the exclusive access to the global atomic region.
  562. \sa starpu_omp_atomic_fallback_inline_begin
  563. \fn double starpu_omp_get_wtime (void)
  564. \ingroup API_OpenMP_Runtime_Support
  565. This function returns the elapsed wallclock time in seconds.
  566. \return the elapsed wallclock time in seconds.
  567. \sa starpu_omp_get_wtick
  568. \fn double starpu_omp_get_wtick (void)
  569. \ingroup API_OpenMP_Runtime_Support
  570. This function returns the precision of the time used by \p starpu_omp_get_wtime.
  571. \return the precision of the time used by \p starpu_omp_get_wtime.
  572. \sa starpu_omp_get_wtime
  573. */