]> git.ipfire.org Git - thirdparty/gcc.git/blame - libgomp/omp.h.in
Update copyright years.
[thirdparty/gcc.git] / libgomp / omp.h.in
CommitLineData
99dee823 1/* Copyright (C) 2005-2021 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
953ff289
DN
35#ifndef _LIBGOMP_OMP_LOCK_DEFINED
36#define _LIBGOMP_OMP_LOCK_DEFINED 1
37/* These two structures get edited by the libgomp build process to
38 reflect the shape of the two types. Their internals are private
39 to the library. */
40
41typedef struct
42{
03b8fe49
PB
43 unsigned char _x[@OMP_LOCK_SIZE@]
44 __attribute__((__aligned__(@OMP_LOCK_ALIGN@)));
953ff289
DN
45} omp_lock_t;
46
47typedef struct
48{
03b8fe49
PB
49 unsigned char _x[@OMP_NEST_LOCK_SIZE@]
50 __attribute__((__aligned__(@OMP_NEST_LOCK_ALIGN@)));
953ff289
DN
51} omp_nest_lock_t;
52#endif
53
a68ab351
JJ
54typedef enum omp_sched_t
55{
56 omp_sched_static = 1,
57 omp_sched_dynamic = 2,
58 omp_sched_guided = 3,
28567c40
JJ
59 omp_sched_auto = 4,
60 omp_sched_monotonic = 0x80000000U
a68ab351
JJ
61} omp_sched_t;
62
acf0174b
JJ
63typedef enum omp_proc_bind_t
64{
65 omp_proc_bind_false = 0,
66 omp_proc_bind_true = 1,
67 omp_proc_bind_master = 2,
68 omp_proc_bind_close = 3,
69 omp_proc_bind_spread = 4
70} omp_proc_bind_t;
71
28567c40 72typedef enum omp_sync_hint_t
d9a6bd32 73{
28567c40 74 omp_sync_hint_none = 0,
10508db8 75 omp_lock_hint_none __GOMP_DEPRECATED_5_0 = omp_sync_hint_none,
28567c40 76 omp_sync_hint_uncontended = 1,
10508db8 77 omp_lock_hint_uncontended __GOMP_DEPRECATED_5_0 = omp_sync_hint_uncontended,
28567c40 78 omp_sync_hint_contended = 2,
10508db8 79 omp_lock_hint_contended __GOMP_DEPRECATED_5_0 = omp_sync_hint_contended,
28567c40 80 omp_sync_hint_nonspeculative = 4,
10508db8
KCY
81 omp_lock_hint_nonspeculative __GOMP_DEPRECATED_5_0
82 = omp_sync_hint_nonspeculative,
28567c40 83 omp_sync_hint_speculative = 8,
10508db8 84 omp_lock_hint_speculative __GOMP_DEPRECATED_5_0 = omp_sync_hint_speculative
28567c40
JJ
85} omp_sync_hint_t;
86
10508db8 87typedef __GOMP_DEPRECATED_5_0 omp_sync_hint_t omp_lock_hint_t;
28567c40
JJ
88
89typedef struct __attribute__((__aligned__ (sizeof (void *)))) omp_depend_t
90{
91 char __omp_depend_t__[2 * sizeof (void *)];
92} omp_depend_t;
93
94typedef enum omp_pause_resource_t
95{
96 omp_pause_soft = 1,
97 omp_pause_hard = 2
98} omp_pause_resource_t;
d9a6bd32 99
800bcc8c
JJ
100typedef __UINTPTR_TYPE__ omp_uintptr_t;
101
102#if __cplusplus >= 201103L
103# define __GOMP_UINTPTR_T_ENUM : omp_uintptr_t
104#else
105# define __GOMP_UINTPTR_T_ENUM
106#endif
107
108typedef enum omp_memspace_handle_t __GOMP_UINTPTR_T_ENUM
109{
110 omp_default_mem_space = 0,
111 omp_large_cap_mem_space = 1,
112 omp_const_mem_space = 2,
113 omp_high_bw_mem_space = 3,
114 omp_low_lat_mem_space = 4,
115 __omp_memspace_handle_t_max__ = __UINTPTR_MAX__
116} omp_memspace_handle_t;
117
118typedef enum omp_allocator_handle_t __GOMP_UINTPTR_T_ENUM
119{
120 omp_null_allocator = 0,
121 omp_default_mem_alloc = 1,
122 omp_large_cap_mem_alloc = 2,
123 omp_const_mem_alloc = 3,
124 omp_high_bw_mem_alloc = 4,
125 omp_low_lat_mem_alloc = 5,
126 omp_cgroup_mem_alloc = 6,
127 omp_pteam_mem_alloc = 7,
128 omp_thread_mem_alloc = 8,
129 __omp_allocator_handle_t_max__ = __UINTPTR_MAX__
130} omp_allocator_handle_t;
131
132typedef enum omp_alloctrait_key_t
133{
134 omp_atk_sync_hint = 1,
135 omp_atk_alignment = 2,
136 omp_atk_access = 3,
137 omp_atk_pool_size = 4,
138 omp_atk_fallback = 5,
139 omp_atk_fb_data = 6,
140 omp_atk_pinned = 7,
141 omp_atk_partition = 8
142} omp_alloctrait_key_t;
143
144typedef enum omp_alloctrait_value_t
145{
ea82325a 146 omp_atv_default = (__UINTPTR_TYPE__) -1,
800bcc8c
JJ
147 omp_atv_false = 0,
148 omp_atv_true = 1,
800bcc8c
JJ
149 omp_atv_contended = 3,
150 omp_atv_uncontended = 4,
ea82325a
JJ
151 omp_atv_serialized = 5,
152 omp_atv_sequential = omp_atv_serialized,
800bcc8c
JJ
153 omp_atv_private = 6,
154 omp_atv_all = 7,
155 omp_atv_thread = 8,
156 omp_atv_pteam = 9,
157 omp_atv_cgroup = 10,
158 omp_atv_default_mem_fb = 11,
159 omp_atv_null_fb = 12,
160 omp_atv_abort_fb = 13,
161 omp_atv_allocator_fb = 14,
162 omp_atv_environment = 15,
163 omp_atv_nearest = 16,
164 omp_atv_blocked = 17,
ea82325a 165 omp_atv_interleaved = 18
800bcc8c
JJ
166} omp_alloctrait_value_t;
167
168typedef struct omp_alloctrait_t
169{
170 omp_alloctrait_key_t key;
171 omp_uintptr_t value;
172} omp_alloctrait_t;
173
953ff289
DN
174#ifdef __cplusplus
175extern "C" {
2b4cf991 176# define __GOMP_NOTHROW throw ()
800bcc8c 177# define __GOMP_DEFAULT_NULL_ALLOCATOR = omp_null_allocator
2b4cf991
JJ
178#else
179# define __GOMP_NOTHROW __attribute__((__nothrow__))
800bcc8c 180# define __GOMP_DEFAULT_NULL_ALLOCATOR
953ff289
DN
181#endif
182
2b4cf991
JJ
183extern void omp_set_num_threads (int) __GOMP_NOTHROW;
184extern int omp_get_num_threads (void) __GOMP_NOTHROW;
185extern int omp_get_max_threads (void) __GOMP_NOTHROW;
186extern int omp_get_thread_num (void) __GOMP_NOTHROW;
187extern int omp_get_num_procs (void) __GOMP_NOTHROW;
953ff289 188
2b4cf991 189extern int omp_in_parallel (void) __GOMP_NOTHROW;
953ff289 190
2b4cf991
JJ
191extern void omp_set_dynamic (int) __GOMP_NOTHROW;
192extern int omp_get_dynamic (void) __GOMP_NOTHROW;
953ff289 193
10508db8
KCY
194extern void omp_set_nested (int) __GOMP_NOTHROW __GOMP_DEPRECATED_5_0;
195extern int omp_get_nested (void) __GOMP_NOTHROW __GOMP_DEPRECATED_5_0;
953ff289 196
2b4cf991 197extern void omp_init_lock (omp_lock_t *) __GOMP_NOTHROW;
28567c40 198extern void omp_init_lock_with_hint (omp_lock_t *, omp_sync_hint_t)
d9a6bd32 199 __GOMP_NOTHROW;
2b4cf991
JJ
200extern void omp_destroy_lock (omp_lock_t *) __GOMP_NOTHROW;
201extern void omp_set_lock (omp_lock_t *) __GOMP_NOTHROW;
202extern void omp_unset_lock (omp_lock_t *) __GOMP_NOTHROW;
203extern int omp_test_lock (omp_lock_t *) __GOMP_NOTHROW;
953ff289 204
2b4cf991 205extern void omp_init_nest_lock (omp_nest_lock_t *) __GOMP_NOTHROW;
28567c40 206extern void omp_init_nest_lock_with_hint (omp_nest_lock_t *, omp_sync_hint_t)
d9a6bd32 207 __GOMP_NOTHROW;
2b4cf991
JJ
208extern void omp_destroy_nest_lock (omp_nest_lock_t *) __GOMP_NOTHROW;
209extern void omp_set_nest_lock (omp_nest_lock_t *) __GOMP_NOTHROW;
210extern void omp_unset_nest_lock (omp_nest_lock_t *) __GOMP_NOTHROW;
211extern int omp_test_nest_lock (omp_nest_lock_t *) __GOMP_NOTHROW;
953ff289 212
2b4cf991
JJ
213extern double omp_get_wtime (void) __GOMP_NOTHROW;
214extern double omp_get_wtick (void) __GOMP_NOTHROW;
953ff289 215
acf0174b
JJ
216extern void omp_set_schedule (omp_sched_t, int) __GOMP_NOTHROW;
217extern void omp_get_schedule (omp_sched_t *, int *) __GOMP_NOTHROW;
218extern int omp_get_thread_limit (void) __GOMP_NOTHROW;
219extern void omp_set_max_active_levels (int) __GOMP_NOTHROW;
220extern int omp_get_max_active_levels (void) __GOMP_NOTHROW;
8949b985 221extern int omp_get_supported_active_levels (void) __GOMP_NOTHROW;
acf0174b
JJ
222extern int omp_get_level (void) __GOMP_NOTHROW;
223extern int omp_get_ancestor_thread_num (int) __GOMP_NOTHROW;
224extern int omp_get_team_size (int) __GOMP_NOTHROW;
225extern int omp_get_active_level (void) __GOMP_NOTHROW;
226
227extern int omp_in_final (void) __GOMP_NOTHROW;
228
229extern int omp_get_cancellation (void) __GOMP_NOTHROW;
230extern omp_proc_bind_t omp_get_proc_bind (void) __GOMP_NOTHROW;
d9a6bd32
JJ
231extern int omp_get_num_places (void) __GOMP_NOTHROW;
232extern int omp_get_place_num_procs (int) __GOMP_NOTHROW;
233extern void omp_get_place_proc_ids (int, int *) __GOMP_NOTHROW;
234extern int omp_get_place_num (void) __GOMP_NOTHROW;
235extern int omp_get_partition_num_places (void) __GOMP_NOTHROW;
236extern void omp_get_partition_place_nums (int *) __GOMP_NOTHROW;
acf0174b
JJ
237
238extern void omp_set_default_device (int) __GOMP_NOTHROW;
239extern int omp_get_default_device (void) __GOMP_NOTHROW;
240extern int omp_get_num_devices (void) __GOMP_NOTHROW;
241extern int omp_get_num_teams (void) __GOMP_NOTHROW;
242extern int omp_get_team_num (void) __GOMP_NOTHROW;
243
244extern int omp_is_initial_device (void) __GOMP_NOTHROW;
d9a6bd32
JJ
245extern int omp_get_initial_device (void) __GOMP_NOTHROW;
246extern int omp_get_max_task_priority (void) __GOMP_NOTHROW;
247
248extern void *omp_target_alloc (__SIZE_TYPE__, int) __GOMP_NOTHROW;
249extern void omp_target_free (void *, int) __GOMP_NOTHROW;
28567c40
JJ
250extern int omp_target_is_present (const void *, int) __GOMP_NOTHROW;
251extern int omp_target_memcpy (void *, const void *, __SIZE_TYPE__,
252 __SIZE_TYPE__, __SIZE_TYPE__, int, int)
253 __GOMP_NOTHROW;
254extern int omp_target_memcpy_rect (void *, const void *, __SIZE_TYPE__, int,
d9a6bd32
JJ
255 const __SIZE_TYPE__ *,
256 const __SIZE_TYPE__ *,
257 const __SIZE_TYPE__ *,
258 const __SIZE_TYPE__ *,
259 const __SIZE_TYPE__ *, int, int)
260 __GOMP_NOTHROW;
28567c40 261extern int omp_target_associate_ptr (const void *, const void *, __SIZE_TYPE__,
d9a6bd32 262 __SIZE_TYPE__, int) __GOMP_NOTHROW;
28567c40
JJ
263extern int omp_target_disassociate_ptr (const void *, int) __GOMP_NOTHROW;
264
265extern void omp_set_affinity_format (const char *) __GOMP_NOTHROW;
266extern __SIZE_TYPE__ omp_get_affinity_format (char *, __SIZE_TYPE__)
267 __GOMP_NOTHROW;
268extern void omp_display_affinity (const char *) __GOMP_NOTHROW;
269extern __SIZE_TYPE__ omp_capture_affinity (char *, __SIZE_TYPE__, const char *)
270 __GOMP_NOTHROW;
271
272extern int omp_pause_resource (omp_pause_resource_t, int) __GOMP_NOTHROW;
273extern int omp_pause_resource_all (omp_pause_resource_t) __GOMP_NOTHROW;
20906c66 274
800bcc8c
JJ
275extern omp_allocator_handle_t omp_init_allocator (omp_memspace_handle_t,
276 int,
277 const omp_alloctrait_t [])
278 __GOMP_NOTHROW;
279extern void omp_destroy_allocator (omp_allocator_handle_t) __GOMP_NOTHROW;
280extern void omp_set_default_allocator (omp_allocator_handle_t) __GOMP_NOTHROW;
281extern omp_allocator_handle_t omp_get_default_allocator (void) __GOMP_NOTHROW;
282extern void *omp_alloc (__SIZE_TYPE__,
283 omp_allocator_handle_t __GOMP_DEFAULT_NULL_ALLOCATOR)
6fcc3cac 284 __GOMP_NOTHROW __attribute__((__malloc__, __alloc_size__ (1)));
800bcc8c
JJ
285extern void omp_free (void *,
286 omp_allocator_handle_t __GOMP_DEFAULT_NULL_ALLOCATOR)
287 __GOMP_NOTHROW;
288
953ff289
DN
289#ifdef __cplusplus
290}
291#endif
292
71a81c21 293#endif /* _OMP_H */