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