G+Smo  25.01.0
Geometry + Simulation Modules
 
Loading...
Searching...
No Matches
gsOpenMP.h
Go to the documentation of this file.
1
14#pragma once
15
16#ifdef _OPENMP
17
18#if _OPENMP >= 202111
19#define GISMO_HAS_OPENMP_52 1
20#else
21#define GISMO_HAS_OPENMP_52 0
22#endif
23
24#if _OPENMP >= 202011
25#define GISMO_HAS_OPENMP_51 1
26#else
27#define GISMO_HAS_OPENMP_51 0
28#endif
29
30#if _OPENMP >= 201811
31#define GISMO_HAS_OPENMP_50 1
32#else
33#define GISMO_HAS_OPENMP_50 0
34#endif
35
36#if _OPENMP >= 201511
37#define GISMO_HAS_OPENMP_45 1
38#else
39#define GISMO_HAS_OPENMP_45 0
40#endif
41
42#if _OPENMP >= 201307
43#define GISMO_HAS_OPENMP_40 1
44#else
45#define GISMO_HAS_OPENMP_40 0
46#endif
47
48#if _OPENMP >= 201107
49#define GISMO_HAS_OPENMP_31 1
50#else
51#define GISMO_HAS_OPENMP_31 0
52#endif
53
54#if _OPENMP >= 200805
55#define GISMO_HAS_OPENMP_30 1
56#else
57#define GISMO_HAS_OPENMP_30 0
58#endif
59
60#if _OPENMP >= 200505
61#define GISMO_HAS_OPENMP_25 1
62#else
63#define GISMO_HAS_OPENMP_25 0
64#endif
65
66#include <omp.h>
67
68#else
69
70#define GISMO_HAS_OPENMP_52 0
71#define GISMO_HAS_OPENMP_51 0
72#define GISMO_HAS_OPENMP_50 0
73#define GISMO_HAS_OPENMP_45 0
74#define GISMO_HAS_OPENMP_40 0
75#define GISMO_HAS_OPENMP_31 0
76#define GISMO_HAS_OPENMP_30 0
77#define GISMO_HAS_OPENMP_25 0
78
80
81void GISMO_EXPORT omp_set_num_threads(int num_threads);
82
83int GISMO_EXPORT omp_get_num_threads(void);
84
85int GISMO_EXPORT omp_get_max_threads(void);
86
87int GISMO_EXPORT omp_get_thread_num(void);
88
89int GISMO_EXPORT omp_get_num_procs(void);
90
91int GISMO_EXPORT omp_in_parallel(void);
92
93void GISMO_EXPORT omp_set_dynamic(int dynamic_threads);
94
95int GISMO_EXPORT omp_get_dynamic(void);
96
97int GISMO_EXPORT omp_get_cancellation(void);
98
99void GISMO_EXPORT omp_set_nested(int nested);
100
101int GISMO_EXPORT omp_get_nested(void);
102
103typedef enum omp_sched_t {
104 omp_sched_static = 1,
105 omp_sched_dynamic = 2,
106 omp_sched_guided = 3,
107 omp_sched_auto = 4,
108 omp_sched_monotonic = 0x80000000
109} omp_sched_t;
110
111void GISMO_EXPORT omp_set_schedule(omp_sched_t kind, int chunk_size);
112
113void GISMO_EXPORT omp_get_schedule(omp_sched_t *kind, int *chunk_size);
114
115int GISMO_EXPORT omp_get_thread_limit(void);
116
117void GISMO_EXPORT omp_set_max_active_levels(int max_active_levels);
118
119int GISMO_EXPORT omp_get_max_active_levels(void);
120
121int GISMO_EXPORT omp_get_level(void);
122
123int GISMO_EXPORT omp_get_ancestor_thread_num(int level);
124
125int GISMO_EXPORT omp_get_team_size(int level);
126
127int GISMO_EXPORT omp_get_active_level(void);
128
129int GISMO_EXPORT omp_in_final(void);
130
131typedef enum omp_proc_bind_t {
132 omp_proc_bind_false = 0,
133 omp_proc_bind_true = 1,
134 omp_proc_bind_master = 2,
135 omp_proc_bind_close = 3,
136 omp_proc_bind_spread = 4
137} omp_proc_bind_t;
138
139omp_proc_bind_t omp_get_proc_bind(void);
140
141int GISMO_EXPORT omp_get_num_places(void);
142
143int GISMO_EXPORT omp_get_place_num_procs(int place_num);
144
145void GISMO_EXPORT omp_get_place_proc_ids(int place_num, int *ids);
146
147int GISMO_EXPORT omp_get_place_num(void);
148
149int GISMO_EXPORT omp_get_partition_num_places(void);
150
151void GISMO_EXPORT omp_get_partition_place_nums(int *place_nums);
152
153void GISMO_EXPORT omp_set_default_device(int device_num);
154
155int GISMO_EXPORT omp_get_default_device(void);
156
157int GISMO_EXPORT omp_get_num_devices(void);
158
159int GISMO_EXPORT omp_get_num_teams(void);
160
161int GISMO_EXPORT omp_get_team_num(void);
162
163int GISMO_EXPORT omp_is_initial_device(void);
164
165int GISMO_EXPORT omp_get_initial_device(void);
166
167int GISMO_EXPORT omp_get_max_task_priority(void);
168
169typedef struct omp_lock_t {
170 int lock;
171} omp_lock_t;
172
173enum { OMP_UNLOCKED = -1, OMP_INIT, OMP_LOCKED };
174
175void GISMO_EXPORT omp_init_lock(omp_lock_t *arg);
176
177typedef enum omp_sync_hint_t {
178 omp_sync_hint_none = 0,
179 omp_lock_hint_none = omp_sync_hint_none,
180 omp_sync_hint_uncontended = 1,
181 omp_lock_hint_uncontended = omp_sync_hint_uncontended,
182 omp_sync_hint_contended = (1<<1),
183 omp_lock_hint_contended = omp_sync_hint_contended,
184 omp_sync_hint_nonspeculative = (1<<2),
185 omp_lock_hint_nonspeculative = omp_sync_hint_nonspeculative,
186 omp_sync_hint_speculative = (1<<3),
187 omp_lock_hint_speculative = omp_sync_hint_speculative,
188 kmp_lock_hint_hle = (1<<16),
189 kmp_lock_hint_rtm = (1<<17),
190 kmp_lock_hint_adaptive = (1<<18)
191} omp_sync_hint_t;
192
193typedef omp_sync_hint_t omp_lock_hint_t;
194
195void GISMO_EXPORT omp_init_lock_with_hint(omp_lock_t *arg, omp_lock_hint_t hint);
196
197void GISMO_EXPORT omp_destroy_lock(omp_lock_t *arg);
198
199void GISMO_EXPORT omp_set_lock(omp_lock_t *arg);
200
201void GISMO_EXPORT omp_unset_lock(omp_lock_t *arg);
202
203int GISMO_EXPORT omp_test_lock(omp_lock_t *arg);
204
205typedef struct omp_nest_lock_t {
206 int owner;
207 int count;
208} omp_nest_lock_t;
209
210enum { OMP_NOOWNER = -1, OMP_MASTER = 0 };
211
212void GISMO_EXPORT omp_init_nest_lock(omp_nest_lock_t *arg);
213
214void GISMO_EXPORT omp_init_nest_lock_with_hint(omp_nest_lock_t *arg,
215 omp_lock_hint_t hint);
216
217void GISMO_EXPORT omp_destroy_nest_lock(omp_nest_lock_t *arg);
218
219void GISMO_EXPORT omp_set_nest_lock(omp_nest_lock_t *arg);
220
221void GISMO_EXPORT omp_unset_nest_lock(omp_nest_lock_t *arg);
222
223int GISMO_EXPORT omp_test_nest_lock(omp_nest_lock_t *arg);
224
225double omp_get_wtime(void);
226
227double omp_get_wtick(void);
228
229void * omp_target_alloc(size_t size, int device_num);
230
231void GISMO_EXPORT omp_target_free(void *device_ptr, int device_num);
232
233int GISMO_EXPORT omp_target_is_present(void *ptr, int device_num);
234
235int GISMO_EXPORT omp_target_memcpy(void *dst, void *src, size_t length,
236 size_t dst_offset, size_t src_offset,
237 int dst_device, int src_device);
238
239int GISMO_EXPORT omp_target_memcpy_rect(void *dst, void *src,
240 size_t element_size,
241 int num_dims,
242 const size_t *volume,
243 const size_t *dst_offsets,
244 const size_t *src_offsets,
245 const size_t *dst_dimensions,
246 const size_t *src_dimensions,
247 int dst_device_num, int src_device_num);
248
249int GISMO_EXPORT omp_target_associate_ptr(void *host_ptr, void *device_ptr,
250 size_t size, size_t device_offset,
251 int device_num);
252
253int GISMO_EXPORT omp_target_disassociate_ptr(void *ptr, int device_num);
254#endif // _OPENMP
Provides forward declarations of types and structs.