omp.h.in 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. /* Copyright (C) 2005-2022 Free Software Foundation, Inc.
  2. Contributed by Richard Henderson <rth@redhat.com>.
  3. This file is part of the GNU Offloading and Multi Processing Library
  4. (libgomp).
  5. Libgomp is free software; you can redistribute it and/or modify it
  6. under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 3, or (at your option)
  8. any later version.
  9. Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  11. FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. more details.
  13. Under Section 7 of GPL version 3, you are granted additional
  14. permissions described in the GCC Runtime Library Exception, version
  15. 3.1, as published by the Free Software Foundation.
  16. You should have received a copy of the GNU General Public License and
  17. a copy of the GCC Runtime Library Exception along with this program;
  18. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  19. <http://www.gnu.org/licenses/>. */
  20. #ifndef _OMP_H
  21. #define _OMP_H 1
  22. #if defined(__GNUC__) && _OPENMP >= 201811
  23. # define __GOMP_DEPRECATED_5_0 __attribute__((__deprecated__))
  24. #else
  25. # define __GOMP_DEPRECATED_5_0
  26. #endif
  27. #if defined(__GNUC__) && _OPENMP >= 202011
  28. # define __GOMP_DEPRECATED_5_1 __attribute__((__deprecated__))
  29. #else
  30. # define __GOMP_DEPRECATED_5_1
  31. #endif
  32. #ifndef _LIBGOMP_OMP_LOCK_DEFINED
  33. #define _LIBGOMP_OMP_LOCK_DEFINED 1
  34. /* These two structures get edited by the libgomp build process to
  35. reflect the shape of the two types. Their internals are private
  36. to the library. */
  37. typedef struct
  38. {
  39. unsigned char _x[@OMP_LOCK_SIZE@]
  40. __attribute__((__aligned__(@OMP_LOCK_ALIGN@)));
  41. } omp_lock_t;
  42. typedef struct
  43. {
  44. unsigned char _x[@OMP_NEST_LOCK_SIZE@]
  45. __attribute__((__aligned__(@OMP_NEST_LOCK_ALIGN@)));
  46. } omp_nest_lock_t;
  47. #endif
  48. typedef enum omp_sched_t
  49. {
  50. omp_sched_static = 1,
  51. omp_sched_dynamic = 2,
  52. omp_sched_guided = 3,
  53. omp_sched_auto = 4,
  54. omp_sched_monotonic = 0x80000000U
  55. } omp_sched_t;
  56. typedef enum omp_proc_bind_t
  57. {
  58. omp_proc_bind_false = 0,
  59. omp_proc_bind_true = 1,
  60. omp_proc_bind_primary = 2,
  61. omp_proc_bind_master __GOMP_DEPRECATED_5_1
  62. = omp_proc_bind_primary,
  63. omp_proc_bind_close = 3,
  64. omp_proc_bind_spread = 4
  65. } omp_proc_bind_t;
  66. typedef enum omp_sync_hint_t
  67. {
  68. omp_sync_hint_none = 0,
  69. omp_lock_hint_none __GOMP_DEPRECATED_5_0 = omp_sync_hint_none,
  70. omp_sync_hint_uncontended = 1,
  71. omp_lock_hint_uncontended __GOMP_DEPRECATED_5_0 = omp_sync_hint_uncontended,
  72. omp_sync_hint_contended = 2,
  73. omp_lock_hint_contended __GOMP_DEPRECATED_5_0 = omp_sync_hint_contended,
  74. omp_sync_hint_nonspeculative = 4,
  75. omp_lock_hint_nonspeculative __GOMP_DEPRECATED_5_0
  76. = omp_sync_hint_nonspeculative,
  77. omp_sync_hint_speculative = 8,
  78. omp_lock_hint_speculative __GOMP_DEPRECATED_5_0 = omp_sync_hint_speculative
  79. } omp_sync_hint_t;
  80. typedef __GOMP_DEPRECATED_5_0 omp_sync_hint_t omp_lock_hint_t;
  81. typedef struct __attribute__((__aligned__ (sizeof (void *)))) omp_depend_t
  82. {
  83. char __omp_depend_t__[2 * sizeof (void *)];
  84. } omp_depend_t;
  85. typedef enum omp_pause_resource_t
  86. {
  87. omp_pause_soft = 1,
  88. omp_pause_hard = 2
  89. } omp_pause_resource_t;
  90. typedef __UINTPTR_TYPE__ omp_uintptr_t;
  91. #if __cplusplus >= 201103L
  92. # define __GOMP_UINTPTR_T_ENUM : omp_uintptr_t
  93. #else
  94. # define __GOMP_UINTPTR_T_ENUM
  95. #endif
  96. typedef enum omp_memspace_handle_t __GOMP_UINTPTR_T_ENUM
  97. {
  98. omp_default_mem_space = 0,
  99. omp_large_cap_mem_space = 1,
  100. omp_const_mem_space = 2,
  101. omp_high_bw_mem_space = 3,
  102. omp_low_lat_mem_space = 4,
  103. __omp_memspace_handle_t_max__ = __UINTPTR_MAX__
  104. } omp_memspace_handle_t;
  105. typedef enum omp_allocator_handle_t __GOMP_UINTPTR_T_ENUM
  106. {
  107. omp_null_allocator = 0,
  108. omp_default_mem_alloc = 1,
  109. omp_large_cap_mem_alloc = 2,
  110. omp_const_mem_alloc = 3,
  111. omp_high_bw_mem_alloc = 4,
  112. omp_low_lat_mem_alloc = 5,
  113. omp_cgroup_mem_alloc = 6,
  114. omp_pteam_mem_alloc = 7,
  115. omp_thread_mem_alloc = 8,
  116. __omp_allocator_handle_t_max__ = __UINTPTR_MAX__
  117. } omp_allocator_handle_t;
  118. typedef enum omp_alloctrait_key_t
  119. {
  120. omp_atk_sync_hint = 1,
  121. omp_atk_alignment = 2,
  122. omp_atk_access = 3,
  123. omp_atk_pool_size = 4,
  124. omp_atk_fallback = 5,
  125. omp_atk_fb_data = 6,
  126. omp_atk_pinned = 7,
  127. omp_atk_partition = 8
  128. } omp_alloctrait_key_t;
  129. typedef enum omp_alloctrait_value_t
  130. {
  131. omp_atv_default = (__UINTPTR_TYPE__) -1,
  132. omp_atv_false = 0,
  133. omp_atv_true = 1,
  134. omp_atv_contended = 3,
  135. omp_atv_uncontended = 4,
  136. omp_atv_serialized = 5,
  137. omp_atv_sequential __GOMP_DEPRECATED_5_1 = omp_atv_serialized,
  138. omp_atv_private = 6,
  139. omp_atv_all = 7,
  140. omp_atv_thread = 8,
  141. omp_atv_pteam = 9,
  142. omp_atv_cgroup = 10,
  143. omp_atv_default_mem_fb = 11,
  144. omp_atv_null_fb = 12,
  145. omp_atv_abort_fb = 13,
  146. omp_atv_allocator_fb = 14,
  147. omp_atv_environment = 15,
  148. omp_atv_nearest = 16,
  149. omp_atv_blocked = 17,
  150. omp_atv_interleaved = 18
  151. } omp_alloctrait_value_t;
  152. typedef struct omp_alloctrait_t
  153. {
  154. omp_alloctrait_key_t key;
  155. omp_uintptr_t value;
  156. } omp_alloctrait_t;
  157. typedef enum omp_event_handle_t __GOMP_UINTPTR_T_ENUM
  158. {
  159. __omp_event_handle_t_max__ = __UINTPTR_MAX__
  160. } omp_event_handle_t;
  161. #ifdef __cplusplus
  162. extern "C" {
  163. # define __GOMP_NOTHROW throw ()
  164. # define __GOMP_DEFAULT_NULL_ALLOCATOR = omp_null_allocator
  165. #else
  166. # define __GOMP_NOTHROW __attribute__((__nothrow__))
  167. # define __GOMP_DEFAULT_NULL_ALLOCATOR
  168. #endif
  169. extern void omp_set_num_threads (int) __GOMP_NOTHROW;
  170. extern int omp_get_num_threads (void) __GOMP_NOTHROW;
  171. extern int omp_get_max_threads (void) __GOMP_NOTHROW;
  172. extern int omp_get_thread_num (void) __GOMP_NOTHROW;
  173. extern int omp_get_num_procs (void) __GOMP_NOTHROW;
  174. extern int omp_in_parallel (void) __GOMP_NOTHROW;
  175. extern void omp_set_dynamic (int) __GOMP_NOTHROW;
  176. extern int omp_get_dynamic (void) __GOMP_NOTHROW;
  177. extern void omp_set_nested (int) __GOMP_NOTHROW __GOMP_DEPRECATED_5_0;
  178. extern int omp_get_nested (void) __GOMP_NOTHROW __GOMP_DEPRECATED_5_0;
  179. extern void omp_init_lock (omp_lock_t *) __GOMP_NOTHROW;
  180. extern void omp_init_lock_with_hint (omp_lock_t *, omp_sync_hint_t)
  181. __GOMP_NOTHROW;
  182. extern void omp_destroy_lock (omp_lock_t *) __GOMP_NOTHROW;
  183. extern void omp_set_lock (omp_lock_t *) __GOMP_NOTHROW;
  184. extern void omp_unset_lock (omp_lock_t *) __GOMP_NOTHROW;
  185. extern int omp_test_lock (omp_lock_t *) __GOMP_NOTHROW;
  186. extern void omp_init_nest_lock (omp_nest_lock_t *) __GOMP_NOTHROW;
  187. extern void omp_init_nest_lock_with_hint (omp_nest_lock_t *, omp_sync_hint_t)
  188. __GOMP_NOTHROW;
  189. extern void omp_destroy_nest_lock (omp_nest_lock_t *) __GOMP_NOTHROW;
  190. extern void omp_set_nest_lock (omp_nest_lock_t *) __GOMP_NOTHROW;
  191. extern void omp_unset_nest_lock (omp_nest_lock_t *) __GOMP_NOTHROW;
  192. extern int omp_test_nest_lock (omp_nest_lock_t *) __GOMP_NOTHROW;
  193. extern double omp_get_wtime (void) __GOMP_NOTHROW;
  194. extern double omp_get_wtick (void) __GOMP_NOTHROW;
  195. extern void omp_set_schedule (omp_sched_t, int) __GOMP_NOTHROW;
  196. extern void omp_get_schedule (omp_sched_t *, int *) __GOMP_NOTHROW;
  197. extern int omp_get_thread_limit (void) __GOMP_NOTHROW;
  198. extern void omp_set_max_active_levels (int) __GOMP_NOTHROW;
  199. extern int omp_get_max_active_levels (void) __GOMP_NOTHROW;
  200. extern int omp_get_supported_active_levels (void) __GOMP_NOTHROW;
  201. extern int omp_get_level (void) __GOMP_NOTHROW;
  202. extern int omp_get_ancestor_thread_num (int) __GOMP_NOTHROW;
  203. extern int omp_get_team_size (int) __GOMP_NOTHROW;
  204. extern int omp_get_active_level (void) __GOMP_NOTHROW;
  205. extern int omp_in_final (void) __GOMP_NOTHROW;
  206. extern int omp_get_cancellation (void) __GOMP_NOTHROW;
  207. extern omp_proc_bind_t omp_get_proc_bind (void) __GOMP_NOTHROW;
  208. extern int omp_get_num_places (void) __GOMP_NOTHROW;
  209. extern int omp_get_place_num_procs (int) __GOMP_NOTHROW;
  210. extern void omp_get_place_proc_ids (int, int *) __GOMP_NOTHROW;
  211. extern int omp_get_place_num (void) __GOMP_NOTHROW;
  212. extern int omp_get_partition_num_places (void) __GOMP_NOTHROW;
  213. extern void omp_get_partition_place_nums (int *) __GOMP_NOTHROW;
  214. extern void omp_set_default_device (int) __GOMP_NOTHROW;
  215. extern int omp_get_default_device (void) __GOMP_NOTHROW;
  216. extern int omp_get_num_devices (void) __GOMP_NOTHROW;
  217. extern int omp_get_device_num (void) __GOMP_NOTHROW;
  218. extern int omp_get_num_teams (void) __GOMP_NOTHROW;
  219. extern int omp_get_team_num (void) __GOMP_NOTHROW;
  220. extern int omp_is_initial_device (void) __GOMP_NOTHROW;
  221. extern int omp_get_initial_device (void) __GOMP_NOTHROW;
  222. extern int omp_get_max_task_priority (void) __GOMP_NOTHROW;
  223. extern void omp_fulfill_event (omp_event_handle_t) __GOMP_NOTHROW;
  224. extern void omp_set_num_teams (int) __GOMP_NOTHROW;
  225. extern int omp_get_max_teams (void) __GOMP_NOTHROW;
  226. extern void omp_set_teams_thread_limit (int) __GOMP_NOTHROW;
  227. extern int omp_get_teams_thread_limit (void) __GOMP_NOTHROW;
  228. extern void *omp_target_alloc (__SIZE_TYPE__, int) __GOMP_NOTHROW;
  229. extern void omp_target_free (void *, int) __GOMP_NOTHROW;
  230. extern int omp_target_is_present (const void *, int) __GOMP_NOTHROW;
  231. extern int omp_target_memcpy (void *, const void *, __SIZE_TYPE__,
  232. __SIZE_TYPE__, __SIZE_TYPE__, int, int)
  233. __GOMP_NOTHROW;
  234. extern int omp_target_memcpy_rect (void *, const void *, __SIZE_TYPE__, int,
  235. const __SIZE_TYPE__ *,
  236. const __SIZE_TYPE__ *,
  237. const __SIZE_TYPE__ *,
  238. const __SIZE_TYPE__ *,
  239. const __SIZE_TYPE__ *, int, int)
  240. __GOMP_NOTHROW;
  241. extern int omp_target_associate_ptr (const void *, const void *, __SIZE_TYPE__,
  242. __SIZE_TYPE__, int) __GOMP_NOTHROW;
  243. extern int omp_target_disassociate_ptr (const void *, int) __GOMP_NOTHROW;
  244. extern void omp_set_affinity_format (const char *) __GOMP_NOTHROW;
  245. extern __SIZE_TYPE__ omp_get_affinity_format (char *, __SIZE_TYPE__)
  246. __GOMP_NOTHROW;
  247. extern void omp_display_affinity (const char *) __GOMP_NOTHROW;
  248. extern __SIZE_TYPE__ omp_capture_affinity (char *, __SIZE_TYPE__, const char *)
  249. __GOMP_NOTHROW;
  250. extern int omp_pause_resource (omp_pause_resource_t, int) __GOMP_NOTHROW;
  251. extern int omp_pause_resource_all (omp_pause_resource_t) __GOMP_NOTHROW;
  252. extern omp_allocator_handle_t omp_init_allocator (omp_memspace_handle_t,
  253. int,
  254. const omp_alloctrait_t [])
  255. __GOMP_NOTHROW;
  256. extern void omp_destroy_allocator (omp_allocator_handle_t) __GOMP_NOTHROW;
  257. extern void omp_set_default_allocator (omp_allocator_handle_t) __GOMP_NOTHROW;
  258. extern omp_allocator_handle_t omp_get_default_allocator (void) __GOMP_NOTHROW;
  259. extern void omp_free (void *,
  260. omp_allocator_handle_t __GOMP_DEFAULT_NULL_ALLOCATOR)
  261. __GOMP_NOTHROW;
  262. extern void *omp_alloc (__SIZE_TYPE__,
  263. omp_allocator_handle_t __GOMP_DEFAULT_NULL_ALLOCATOR)
  264. __GOMP_NOTHROW __attribute__((__malloc__, __malloc__ (omp_free),
  265. __alloc_size__ (1)));
  266. extern void *omp_aligned_alloc (__SIZE_TYPE__, __SIZE_TYPE__,
  267. omp_allocator_handle_t
  268. __GOMP_DEFAULT_NULL_ALLOCATOR)
  269. __GOMP_NOTHROW __attribute__((__malloc__, __malloc__ (omp_free),
  270. __alloc_size__ (2), __alloc_align__ (1)));
  271. extern void *omp_calloc (__SIZE_TYPE__, __SIZE_TYPE__,
  272. omp_allocator_handle_t __GOMP_DEFAULT_NULL_ALLOCATOR)
  273. __GOMP_NOTHROW __attribute__((__malloc__, __malloc__ (omp_free),
  274. __alloc_size__ (1, 2)));
  275. extern void *omp_aligned_calloc (__SIZE_TYPE__, __SIZE_TYPE__, __SIZE_TYPE__,
  276. omp_allocator_handle_t
  277. __GOMP_DEFAULT_NULL_ALLOCATOR)
  278. __GOMP_NOTHROW __attribute__((__malloc__, __malloc__ (omp_free),
  279. __alloc_size__ (2, 3), __alloc_align__ (1)));
  280. extern void *omp_realloc (void *, __SIZE_TYPE__,
  281. omp_allocator_handle_t __GOMP_DEFAULT_NULL_ALLOCATOR,
  282. omp_allocator_handle_t __GOMP_DEFAULT_NULL_ALLOCATOR)
  283. __GOMP_NOTHROW __attribute__((__malloc__ (omp_free), __alloc_size__ (2)));
  284. extern void omp_display_env (int) __GOMP_NOTHROW;
  285. #ifdef __cplusplus
  286. }
  287. #endif
  288. #endif /* _OMP_H */