LLVM OpenMP* Runtime Library
kmp_ftn_entry.h
1 /*
2  * kmp_ftn_entry.h -- Fortran entry linkage support for OpenMP.
3  */
4 
5 //===----------------------------------------------------------------------===//
6 //
7 // The LLVM Compiler Infrastructure
8 //
9 // This file is dual licensed under the MIT and the University of Illinois Open
10 // Source Licenses. See LICENSE.txt for details.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef FTN_STDCALL
15 #error The support file kmp_ftn_entry.h should not be compiled by itself.
16 #endif
17 
18 #ifdef KMP_STUB
19 #include "kmp_stub.h"
20 #endif
21 
22 #include "kmp_i18n.h"
23 
24 #if OMPT_SUPPORT
25 #include "ompt-specific.h"
26 #endif
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif // __cplusplus
31 
32 /* For compatibility with the Gnu/MS Open MP codegen, omp_set_num_threads(),
33  * omp_set_nested(), and omp_set_dynamic() [in lowercase on MS, and w/o
34  * a trailing underscore on Linux* OS] take call by value integer arguments.
35  * + omp_set_max_active_levels()
36  * + omp_set_schedule()
37  *
38  * For backward compatibility with 9.1 and previous Intel compiler, these
39  * entry points take call by reference integer arguments. */
40 #ifdef KMP_GOMP_COMPAT
41 #if (KMP_FTN_ENTRIES == KMP_FTN_PLAIN) || (KMP_FTN_ENTRIES == KMP_FTN_UPPER)
42 #define PASS_ARGS_BY_VALUE 1
43 #endif
44 #endif
45 #if KMP_OS_WINDOWS
46 #if (KMP_FTN_ENTRIES == KMP_FTN_PLAIN) || (KMP_FTN_ENTRIES == KMP_FTN_APPEND)
47 #define PASS_ARGS_BY_VALUE 1
48 #endif
49 #endif
50 
51 // This macro helps to reduce code duplication.
52 #ifdef PASS_ARGS_BY_VALUE
53 #define KMP_DEREF
54 #else
55 #define KMP_DEREF *
56 #endif
57 
58 void FTN_STDCALL FTN_SET_STACKSIZE(int KMP_DEREF arg) {
59 #ifdef KMP_STUB
60  __kmps_set_stacksize(KMP_DEREF arg);
61 #else
62  // __kmp_aux_set_stacksize initializes the library if needed
63  __kmp_aux_set_stacksize((size_t)KMP_DEREF arg);
64 #endif
65 }
66 
67 void FTN_STDCALL FTN_SET_STACKSIZE_S(size_t KMP_DEREF arg) {
68 #ifdef KMP_STUB
69  __kmps_set_stacksize(KMP_DEREF arg);
70 #else
71  // __kmp_aux_set_stacksize initializes the library if needed
72  __kmp_aux_set_stacksize(KMP_DEREF arg);
73 #endif
74 }
75 
76 int FTN_STDCALL FTN_GET_STACKSIZE(void) {
77 #ifdef KMP_STUB
78  return __kmps_get_stacksize();
79 #else
80  if (!__kmp_init_serial) {
81  __kmp_serial_initialize();
82  }
83  return (int)__kmp_stksize;
84 #endif
85 }
86 
87 size_t FTN_STDCALL FTN_GET_STACKSIZE_S(void) {
88 #ifdef KMP_STUB
89  return __kmps_get_stacksize();
90 #else
91  if (!__kmp_init_serial) {
92  __kmp_serial_initialize();
93  }
94  return __kmp_stksize;
95 #endif
96 }
97 
98 void FTN_STDCALL FTN_SET_BLOCKTIME(int KMP_DEREF arg) {
99 #ifdef KMP_STUB
100  __kmps_set_blocktime(KMP_DEREF arg);
101 #else
102  int gtid, tid;
103  kmp_info_t *thread;
104 
105  gtid = __kmp_entry_gtid();
106  tid = __kmp_tid_from_gtid(gtid);
107  thread = __kmp_thread_from_gtid(gtid);
108 
109  __kmp_aux_set_blocktime(KMP_DEREF arg, thread, tid);
110 #endif
111 }
112 
113 int FTN_STDCALL FTN_GET_BLOCKTIME(void) {
114 #ifdef KMP_STUB
115  return __kmps_get_blocktime();
116 #else
117  int gtid, tid;
118  kmp_info_t *thread;
119  kmp_team_p *team;
120 
121  gtid = __kmp_entry_gtid();
122  tid = __kmp_tid_from_gtid(gtid);
123  thread = __kmp_thread_from_gtid(gtid);
124  team = __kmp_threads[gtid]->th.th_team;
125 
126  /* These must match the settings used in __kmp_wait_sleep() */
127  if (__kmp_dflt_blocktime == KMP_MAX_BLOCKTIME) {
128  KF_TRACE(10, ("kmp_get_blocktime: T#%d(%d:%d), blocktime=%d\n", gtid,
129  team->t.t_id, tid, KMP_MAX_BLOCKTIME));
130  return KMP_MAX_BLOCKTIME;
131  }
132 #ifdef KMP_ADJUST_BLOCKTIME
133  else if (__kmp_zero_bt && !get__bt_set(team, tid)) {
134  KF_TRACE(10, ("kmp_get_blocktime: T#%d(%d:%d), blocktime=%d\n", gtid,
135  team->t.t_id, tid, 0));
136  return 0;
137  }
138 #endif /* KMP_ADJUST_BLOCKTIME */
139  else {
140  KF_TRACE(10, ("kmp_get_blocktime: T#%d(%d:%d), blocktime=%d\n", gtid,
141  team->t.t_id, tid, get__blocktime(team, tid)));
142  return get__blocktime(team, tid);
143  }
144 #endif
145 }
146 
147 void FTN_STDCALL FTN_SET_LIBRARY_SERIAL(void) {
148 #ifdef KMP_STUB
149  __kmps_set_library(library_serial);
150 #else
151  // __kmp_user_set_library initializes the library if needed
152  __kmp_user_set_library(library_serial);
153 #endif
154 }
155 
156 void FTN_STDCALL FTN_SET_LIBRARY_TURNAROUND(void) {
157 #ifdef KMP_STUB
158  __kmps_set_library(library_turnaround);
159 #else
160  // __kmp_user_set_library initializes the library if needed
161  __kmp_user_set_library(library_turnaround);
162 #endif
163 }
164 
165 void FTN_STDCALL FTN_SET_LIBRARY_THROUGHPUT(void) {
166 #ifdef KMP_STUB
167  __kmps_set_library(library_throughput);
168 #else
169  // __kmp_user_set_library initializes the library if needed
170  __kmp_user_set_library(library_throughput);
171 #endif
172 }
173 
174 void FTN_STDCALL FTN_SET_LIBRARY(int KMP_DEREF arg) {
175 #ifdef KMP_STUB
176  __kmps_set_library(KMP_DEREF arg);
177 #else
178  enum library_type lib;
179  lib = (enum library_type)KMP_DEREF arg;
180  // __kmp_user_set_library initializes the library if needed
181  __kmp_user_set_library(lib);
182 #endif
183 }
184 
185 int FTN_STDCALL FTN_GET_LIBRARY(void) {
186 #ifdef KMP_STUB
187  return __kmps_get_library();
188 #else
189  if (!__kmp_init_serial) {
190  __kmp_serial_initialize();
191  }
192  return ((int)__kmp_library);
193 #endif
194 }
195 
196 void FTN_STDCALL FTN_SET_DISP_NUM_BUFFERS(int KMP_DEREF arg) {
197 #ifdef KMP_STUB
198  ; // empty routine
199 #else
200  // ignore after initialization because some teams have already
201  // allocated dispatch buffers
202  if (__kmp_init_serial == 0 && (KMP_DEREF arg) > 0)
203  __kmp_dispatch_num_buffers = KMP_DEREF arg;
204 #endif
205 }
206 
207 int FTN_STDCALL FTN_SET_AFFINITY(void **mask) {
208 #if defined(KMP_STUB) || !KMP_AFFINITY_SUPPORTED
209  return -1;
210 #else
211  if (!TCR_4(__kmp_init_middle)) {
212  __kmp_middle_initialize();
213  }
214  return __kmp_aux_set_affinity(mask);
215 #endif
216 }
217 
218 int FTN_STDCALL FTN_GET_AFFINITY(void **mask) {
219 #if defined(KMP_STUB) || !KMP_AFFINITY_SUPPORTED
220  return -1;
221 #else
222  if (!TCR_4(__kmp_init_middle)) {
223  __kmp_middle_initialize();
224  }
225  return __kmp_aux_get_affinity(mask);
226 #endif
227 }
228 
229 int FTN_STDCALL FTN_GET_AFFINITY_MAX_PROC(void) {
230 #if defined(KMP_STUB) || !KMP_AFFINITY_SUPPORTED
231  return 0;
232 #else
233  // We really only NEED serial initialization here.
234  if (!TCR_4(__kmp_init_middle)) {
235  __kmp_middle_initialize();
236  }
237  return __kmp_aux_get_affinity_max_proc();
238 #endif
239 }
240 
241 void FTN_STDCALL FTN_CREATE_AFFINITY_MASK(void **mask) {
242 #if defined(KMP_STUB) || !KMP_AFFINITY_SUPPORTED
243  *mask = NULL;
244 #else
245  // We really only NEED serial initialization here.
246  kmp_affin_mask_t *mask_internals;
247  if (!TCR_4(__kmp_init_middle)) {
248  __kmp_middle_initialize();
249  }
250  mask_internals = __kmp_affinity_dispatch->allocate_mask();
251  KMP_CPU_ZERO(mask_internals);
252  *mask = mask_internals;
253 #endif
254 }
255 
256 void FTN_STDCALL FTN_DESTROY_AFFINITY_MASK(void **mask) {
257 #if defined(KMP_STUB) || !KMP_AFFINITY_SUPPORTED
258 // Nothing
259 #else
260  // We really only NEED serial initialization here.
261  kmp_affin_mask_t *mask_internals;
262  if (!TCR_4(__kmp_init_middle)) {
263  __kmp_middle_initialize();
264  }
265  if (__kmp_env_consistency_check) {
266  if (*mask == NULL) {
267  KMP_FATAL(AffinityInvalidMask, "kmp_destroy_affinity_mask");
268  }
269  }
270  mask_internals = (kmp_affin_mask_t *)(*mask);
271  __kmp_affinity_dispatch->deallocate_mask(mask_internals);
272  *mask = NULL;
273 #endif
274 }
275 
276 int FTN_STDCALL FTN_SET_AFFINITY_MASK_PROC(int KMP_DEREF proc, void **mask) {
277 #if defined(KMP_STUB) || !KMP_AFFINITY_SUPPORTED
278  return -1;
279 #else
280  if (!TCR_4(__kmp_init_middle)) {
281  __kmp_middle_initialize();
282  }
283  return __kmp_aux_set_affinity_mask_proc(KMP_DEREF proc, mask);
284 #endif
285 }
286 
287 int FTN_STDCALL FTN_UNSET_AFFINITY_MASK_PROC(int KMP_DEREF proc, void **mask) {
288 #if defined(KMP_STUB) || !KMP_AFFINITY_SUPPORTED
289  return -1;
290 #else
291  if (!TCR_4(__kmp_init_middle)) {
292  __kmp_middle_initialize();
293  }
294  return __kmp_aux_unset_affinity_mask_proc(KMP_DEREF proc, mask);
295 #endif
296 }
297 
298 int FTN_STDCALL FTN_GET_AFFINITY_MASK_PROC(int KMP_DEREF proc, void **mask) {
299 #if defined(KMP_STUB) || !KMP_AFFINITY_SUPPORTED
300  return -1;
301 #else
302  if (!TCR_4(__kmp_init_middle)) {
303  __kmp_middle_initialize();
304  }
305  return __kmp_aux_get_affinity_mask_proc(KMP_DEREF proc, mask);
306 #endif
307 }
308 
309 /* ------------------------------------------------------------------------ */
310 
311 /* sets the requested number of threads for the next parallel region */
312 void FTN_STDCALL KMP_EXPAND_NAME(FTN_SET_NUM_THREADS)(int KMP_DEREF arg) {
313 #ifdef KMP_STUB
314 // Nothing.
315 #else
316  __kmp_set_num_threads(KMP_DEREF arg, __kmp_entry_gtid());
317 #endif
318 }
319 
320 /* returns the number of threads in current team */
321 int FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_NUM_THREADS)(void) {
322 #ifdef KMP_STUB
323  return 1;
324 #else
325  // __kmpc_bound_num_threads initializes the library if needed
326  return __kmpc_bound_num_threads(NULL);
327 #endif
328 }
329 
330 int FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_MAX_THREADS)(void) {
331 #ifdef KMP_STUB
332  return 1;
333 #else
334  int gtid;
335  kmp_info_t *thread;
336  if (!TCR_4(__kmp_init_middle)) {
337  __kmp_middle_initialize();
338  }
339  gtid = __kmp_entry_gtid();
340  thread = __kmp_threads[gtid];
341  // return thread -> th.th_team -> t.t_current_task[
342  // thread->th.th_info.ds.ds_tid ] -> icvs.nproc;
343  return thread->th.th_current_task->td_icvs.nproc;
344 #endif
345 }
346 
347 #if OMP_50_ENABLED
348 int FTN_STDCALL FTN_CONTROL_TOOL(int command, int modifier, void *arg) {
349 #if defined(KMP_STUB) || !OMPT_SUPPORT
350  return -2;
351 #else
352  OMPT_STORE_RETURN_ADDRESS(__kmp_entry_gtid());
353  if (!TCR_4(__kmp_init_middle)) {
354  return -2;
355  }
356  kmp_info_t *this_thr = __kmp_threads[__kmp_entry_gtid()];
357  ompt_task_info_t *parent_task_info = OMPT_CUR_TASK_INFO(this_thr);
358  parent_task_info->frame.enter_frame = OMPT_GET_FRAME_ADDRESS(1);
359  int ret = __kmp_control_tool(command, modifier, arg);
360  parent_task_info->frame.enter_frame = 0;
361  return ret;
362 #endif
363 }
364 #endif
365 
366 int FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_THREAD_NUM)(void) {
367 #ifdef KMP_STUB
368  return 0;
369 #else
370  int gtid;
371 
372 #if KMP_OS_DARWIN || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_HURD
373  gtid = __kmp_entry_gtid();
374 #elif KMP_OS_WINDOWS
375  if (!__kmp_init_parallel ||
376  (gtid = (int)((kmp_intptr_t)TlsGetValue(__kmp_gtid_threadprivate_key))) ==
377  0) {
378  // Either library isn't initialized or thread is not registered
379  // 0 is the correct TID in this case
380  return 0;
381  }
382  --gtid; // We keep (gtid+1) in TLS
383 #elif KMP_OS_LINUX
384 #ifdef KMP_TDATA_GTID
385  if (__kmp_gtid_mode >= 3) {
386  if ((gtid = __kmp_gtid) == KMP_GTID_DNE) {
387  return 0;
388  }
389  } else {
390 #endif
391  if (!__kmp_init_parallel ||
392  (gtid = (kmp_intptr_t)(
393  pthread_getspecific(__kmp_gtid_threadprivate_key))) == 0) {
394  return 0;
395  }
396  --gtid;
397 #ifdef KMP_TDATA_GTID
398  }
399 #endif
400 #else
401 #error Unknown or unsupported OS
402 #endif
403 
404  return __kmp_tid_from_gtid(gtid);
405 #endif
406 }
407 
408 int FTN_STDCALL FTN_GET_NUM_KNOWN_THREADS(void) {
409 #ifdef KMP_STUB
410  return 1;
411 #else
412  if (!__kmp_init_serial) {
413  __kmp_serial_initialize();
414  }
415  /* NOTE: this is not syncronized, so it can change at any moment */
416  /* NOTE: this number also includes threads preallocated in hot-teams */
417  return TCR_4(__kmp_nth);
418 #endif
419 }
420 
421 int FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_NUM_PROCS)(void) {
422 #ifdef KMP_STUB
423  return 1;
424 #else
425  if (!TCR_4(__kmp_init_middle)) {
426  __kmp_middle_initialize();
427  }
428  return __kmp_avail_proc;
429 #endif
430 }
431 
432 void FTN_STDCALL KMP_EXPAND_NAME(FTN_SET_NESTED)(int KMP_DEREF flag) {
433 #ifdef KMP_STUB
434  __kmps_set_nested(KMP_DEREF flag);
435 #else
436  kmp_info_t *thread;
437  /* For the thread-private internal controls implementation */
438  thread = __kmp_entry_thread();
439  __kmp_save_internal_controls(thread);
440  set__nested(thread, ((KMP_DEREF flag) ? TRUE : FALSE));
441 #endif
442 }
443 
444 int FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_NESTED)(void) {
445 #ifdef KMP_STUB
446  return __kmps_get_nested();
447 #else
448  kmp_info_t *thread;
449  thread = __kmp_entry_thread();
450  return get__nested(thread);
451 #endif
452 }
453 
454 void FTN_STDCALL KMP_EXPAND_NAME(FTN_SET_DYNAMIC)(int KMP_DEREF flag) {
455 #ifdef KMP_STUB
456  __kmps_set_dynamic(KMP_DEREF flag ? TRUE : FALSE);
457 #else
458  kmp_info_t *thread;
459  /* For the thread-private implementation of the internal controls */
460  thread = __kmp_entry_thread();
461  // !!! What if foreign thread calls it?
462  __kmp_save_internal_controls(thread);
463  set__dynamic(thread, KMP_DEREF flag ? TRUE : FALSE);
464 #endif
465 }
466 
467 int FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_DYNAMIC)(void) {
468 #ifdef KMP_STUB
469  return __kmps_get_dynamic();
470 #else
471  kmp_info_t *thread;
472  thread = __kmp_entry_thread();
473  return get__dynamic(thread);
474 #endif
475 }
476 
477 int FTN_STDCALL KMP_EXPAND_NAME(FTN_IN_PARALLEL)(void) {
478 #ifdef KMP_STUB
479  return 0;
480 #else
481  kmp_info_t *th = __kmp_entry_thread();
482 #if OMP_40_ENABLED
483  if (th->th.th_teams_microtask) {
484  // AC: r_in_parallel does not work inside teams construct where real
485  // parallel is inactive, but all threads have same root, so setting it in
486  // one team affects other teams.
487  // The solution is to use per-team nesting level
488  return (th->th.th_team->t.t_active_level ? 1 : 0);
489  } else
490 #endif /* OMP_40_ENABLED */
491  return (th->th.th_root->r.r_in_parallel ? FTN_TRUE : FTN_FALSE);
492 #endif
493 }
494 
495 void FTN_STDCALL KMP_EXPAND_NAME(FTN_SET_SCHEDULE)(kmp_sched_t KMP_DEREF kind,
496  int KMP_DEREF modifier) {
497 #ifdef KMP_STUB
498  __kmps_set_schedule(KMP_DEREF kind, KMP_DEREF modifier);
499 #else
500  /* TO DO: For the per-task implementation of the internal controls */
501  __kmp_set_schedule(__kmp_entry_gtid(), KMP_DEREF kind, KMP_DEREF modifier);
502 #endif
503 }
504 
505 void FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_SCHEDULE)(kmp_sched_t *kind,
506  int *modifier) {
507 #ifdef KMP_STUB
508  __kmps_get_schedule(kind, modifier);
509 #else
510  /* TO DO: For the per-task implementation of the internal controls */
511  __kmp_get_schedule(__kmp_entry_gtid(), kind, modifier);
512 #endif
513 }
514 
515 void FTN_STDCALL KMP_EXPAND_NAME(FTN_SET_MAX_ACTIVE_LEVELS)(int KMP_DEREF arg) {
516 #ifdef KMP_STUB
517 // Nothing.
518 #else
519  /* TO DO: We want per-task implementation of this internal control */
520  __kmp_set_max_active_levels(__kmp_entry_gtid(), KMP_DEREF arg);
521 #endif
522 }
523 
524 int FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_MAX_ACTIVE_LEVELS)(void) {
525 #ifdef KMP_STUB
526  return 0;
527 #else
528  /* TO DO: We want per-task implementation of this internal control */
529  return __kmp_get_max_active_levels(__kmp_entry_gtid());
530 #endif
531 }
532 
533 int FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_ACTIVE_LEVEL)(void) {
534 #ifdef KMP_STUB
535  return 0; // returns 0 if it is called from the sequential part of the program
536 #else
537  /* TO DO: For the per-task implementation of the internal controls */
538  return __kmp_entry_thread()->th.th_team->t.t_active_level;
539 #endif
540 }
541 
542 int FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_LEVEL)(void) {
543 #ifdef KMP_STUB
544  return 0; // returns 0 if it is called from the sequential part of the program
545 #else
546  /* TO DO: For the per-task implementation of the internal controls */
547  return __kmp_entry_thread()->th.th_team->t.t_level;
548 #endif
549 }
550 
551 int FTN_STDCALL
552  KMP_EXPAND_NAME(FTN_GET_ANCESTOR_THREAD_NUM)(int KMP_DEREF level) {
553 #ifdef KMP_STUB
554  return (KMP_DEREF level) ? (-1) : (0);
555 #else
556  return __kmp_get_ancestor_thread_num(__kmp_entry_gtid(), KMP_DEREF level);
557 #endif
558 }
559 
560 int FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_TEAM_SIZE)(int KMP_DEREF level) {
561 #ifdef KMP_STUB
562  return (KMP_DEREF level) ? (-1) : (1);
563 #else
564  return __kmp_get_team_size(__kmp_entry_gtid(), KMP_DEREF level);
565 #endif
566 }
567 
568 int FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_THREAD_LIMIT)(void) {
569 #ifdef KMP_STUB
570  return 1; // TO DO: clarify whether it returns 1 or 0?
571 #else
572  if (!__kmp_init_serial) {
573  __kmp_serial_initialize();
574  }
575  /* global ICV */
576  return __kmp_cg_max_nth;
577 #endif
578 }
579 
580 int FTN_STDCALL KMP_EXPAND_NAME(FTN_IN_FINAL)(void) {
581 #ifdef KMP_STUB
582  return 0; // TO DO: clarify whether it returns 1 or 0?
583 #else
584  if (!TCR_4(__kmp_init_parallel)) {
585  return 0;
586  }
587  return __kmp_entry_thread()->th.th_current_task->td_flags.final;
588 #endif
589 }
590 
591 #if OMP_40_ENABLED
592 
593 kmp_proc_bind_t FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_PROC_BIND)(void) {
594 #ifdef KMP_STUB
595  return __kmps_get_proc_bind();
596 #else
597  return get__proc_bind(__kmp_entry_thread());
598 #endif
599 }
600 
601 #if OMP_45_ENABLED
602 int FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_NUM_PLACES)(void) {
603 #if defined(KMP_STUB) || !KMP_AFFINITY_SUPPORTED
604  return 0;
605 #else
606  if (!TCR_4(__kmp_init_middle)) {
607  __kmp_middle_initialize();
608  }
609  if (!KMP_AFFINITY_CAPABLE())
610  return 0;
611  return __kmp_affinity_num_masks;
612 #endif
613 }
614 
615 int FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_PLACE_NUM_PROCS)(int place_num) {
616 #if defined(KMP_STUB) || !KMP_AFFINITY_SUPPORTED
617  return 0;
618 #else
619  int i;
620  int retval = 0;
621  if (!TCR_4(__kmp_init_middle)) {
622  __kmp_middle_initialize();
623  }
624  if (!KMP_AFFINITY_CAPABLE())
625  return 0;
626  if (place_num < 0 || place_num >= (int)__kmp_affinity_num_masks)
627  return 0;
628  kmp_affin_mask_t *mask = KMP_CPU_INDEX(__kmp_affinity_masks, place_num);
629  KMP_CPU_SET_ITERATE(i, mask) {
630  if ((!KMP_CPU_ISSET(i, __kmp_affin_fullMask)) ||
631  (!KMP_CPU_ISSET(i, mask))) {
632  continue;
633  }
634  ++retval;
635  }
636  return retval;
637 #endif
638 }
639 
640 void FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_PLACE_PROC_IDS)(int place_num,
641  int *ids) {
642 #if defined(KMP_STUB) || !KMP_AFFINITY_SUPPORTED
643 // Nothing.
644 #else
645  int i, j;
646  if (!TCR_4(__kmp_init_middle)) {
647  __kmp_middle_initialize();
648  }
649  if (!KMP_AFFINITY_CAPABLE())
650  return;
651  if (place_num < 0 || place_num >= (int)__kmp_affinity_num_masks)
652  return;
653  kmp_affin_mask_t *mask = KMP_CPU_INDEX(__kmp_affinity_masks, place_num);
654  j = 0;
655  KMP_CPU_SET_ITERATE(i, mask) {
656  if ((!KMP_CPU_ISSET(i, __kmp_affin_fullMask)) ||
657  (!KMP_CPU_ISSET(i, mask))) {
658  continue;
659  }
660  ids[j++] = i;
661  }
662 #endif
663 }
664 
665 int FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_PLACE_NUM)(void) {
666 #if defined(KMP_STUB) || !KMP_AFFINITY_SUPPORTED
667  return -1;
668 #else
669  int gtid;
670  kmp_info_t *thread;
671  if (!TCR_4(__kmp_init_middle)) {
672  __kmp_middle_initialize();
673  }
674  if (!KMP_AFFINITY_CAPABLE())
675  return -1;
676  gtid = __kmp_entry_gtid();
677  thread = __kmp_thread_from_gtid(gtid);
678  if (thread->th.th_current_place < 0)
679  return -1;
680  return thread->th.th_current_place;
681 #endif
682 }
683 
684 int FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_PARTITION_NUM_PLACES)(void) {
685 #if defined(KMP_STUB) || !KMP_AFFINITY_SUPPORTED
686  return 0;
687 #else
688  int gtid, num_places, first_place, last_place;
689  kmp_info_t *thread;
690  if (!TCR_4(__kmp_init_middle)) {
691  __kmp_middle_initialize();
692  }
693  if (!KMP_AFFINITY_CAPABLE())
694  return 0;
695  if (KMP_AFFINITY_NON_PROC_BIND) {
696  return 1;
697  }
698  gtid = __kmp_entry_gtid();
699  thread = __kmp_thread_from_gtid(gtid);
700  first_place = thread->th.th_first_place;
701  last_place = thread->th.th_last_place;
702  if (first_place < 0 || last_place < 0)
703  return 0;
704  if (first_place <= last_place)
705  num_places = last_place - first_place + 1;
706  else
707  num_places = __kmp_affinity_num_masks - first_place + last_place + 1;
708  return num_places;
709 #endif
710 }
711 
712 void
713  FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_PARTITION_PLACE_NUMS)(int *place_nums) {
714 #if defined(KMP_STUB) || !KMP_AFFINITY_SUPPORTED
715 // Nothing.
716 #else
717  int i, gtid, place_num, first_place, last_place, start, end;
718  kmp_info_t *thread;
719  if (!TCR_4(__kmp_init_middle)) {
720  __kmp_middle_initialize();
721  }
722  if (!KMP_AFFINITY_CAPABLE())
723  return;
724  gtid = __kmp_entry_gtid();
725  thread = __kmp_thread_from_gtid(gtid);
726  if (KMP_AFFINITY_NON_PROC_BIND) {
727  place_nums[0] = thread->th.th_current_place;
728  return;
729  }
730  first_place = thread->th.th_first_place;
731  last_place = thread->th.th_last_place;
732  if (first_place < 0 || last_place < 0)
733  return;
734  if (first_place <= last_place) {
735  start = first_place;
736  end = last_place;
737  } else {
738  start = last_place;
739  end = first_place;
740  }
741  for (i = 0, place_num = start; place_num <= end; ++place_num, ++i) {
742  place_nums[i] = place_num;
743  }
744 #endif
745 }
746 #endif
747 
748 int FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_NUM_TEAMS)(void) {
749 #ifdef KMP_STUB
750  return 1;
751 #else
752  kmp_info_t *thr = __kmp_entry_thread();
753  if (thr->th.th_teams_microtask) {
754  kmp_team_t *team = thr->th.th_team;
755  int tlevel = thr->th.th_teams_level;
756  int ii = team->t.t_level; // the level of the teams construct
757  int dd = team->t.t_serialized;
758  int level = tlevel + 1;
759  KMP_DEBUG_ASSERT(ii >= tlevel);
760  while (ii > level) {
761  for (dd = team->t.t_serialized; (dd > 0) && (ii > level); dd--, ii--) {
762  }
763  if (team->t.t_serialized && (!dd)) {
764  team = team->t.t_parent;
765  continue;
766  }
767  if (ii > level) {
768  team = team->t.t_parent;
769  ii--;
770  }
771  }
772  if (dd > 1) {
773  return 1; // teams region is serialized ( 1 team of 1 thread ).
774  } else {
775  return team->t.t_parent->t.t_nproc;
776  }
777  } else {
778  return 1;
779  }
780 #endif
781 }
782 
783 int FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_TEAM_NUM)(void) {
784 #ifdef KMP_STUB
785  return 0;
786 #else
787  kmp_info_t *thr = __kmp_entry_thread();
788  if (thr->th.th_teams_microtask) {
789  kmp_team_t *team = thr->th.th_team;
790  int tlevel = thr->th.th_teams_level; // the level of the teams construct
791  int ii = team->t.t_level;
792  int dd = team->t.t_serialized;
793  int level = tlevel + 1;
794  KMP_DEBUG_ASSERT(ii >= tlevel);
795  while (ii > level) {
796  for (dd = team->t.t_serialized; (dd > 0) && (ii > level); dd--, ii--) {
797  }
798  if (team->t.t_serialized && (!dd)) {
799  team = team->t.t_parent;
800  continue;
801  }
802  if (ii > level) {
803  team = team->t.t_parent;
804  ii--;
805  }
806  }
807  if (dd > 1) {
808  return 0; // teams region is serialized ( 1 team of 1 thread ).
809  } else {
810  return team->t.t_master_tid;
811  }
812  } else {
813  return 0;
814  }
815 #endif
816 }
817 
818 int FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_DEFAULT_DEVICE)(void) {
819 #if KMP_MIC || KMP_OS_DARWIN || defined(KMP_STUB)
820  return 0;
821 #else
822  return __kmp_entry_thread()->th.th_current_task->td_icvs.default_device;
823 #endif
824 }
825 
826 void FTN_STDCALL KMP_EXPAND_NAME(FTN_SET_DEFAULT_DEVICE)(int KMP_DEREF arg) {
827 #if KMP_MIC || KMP_OS_DARWIN || defined(KMP_STUB)
828 // Nothing.
829 #else
830  __kmp_entry_thread()->th.th_current_task->td_icvs.default_device =
831  KMP_DEREF arg;
832 #endif
833 }
834 
835 #if KMP_MIC || KMP_OS_DARWIN || defined(KMP_STUB)
836 
837 int FTN_STDCALL FTN_GET_NUM_DEVICES(void) { return 0; }
838 
839 #endif // KMP_MIC || KMP_OS_DARWIN || defined(KMP_STUB)
840 
841 #if !KMP_OS_LINUX
842 
843 int FTN_STDCALL KMP_EXPAND_NAME(FTN_IS_INITIAL_DEVICE)(void) { return 1; }
844 
845 #else
846 
847 // This internal function is used when the entry from the offload library
848 // is not found.
849 int _Offload_get_device_number(void) KMP_WEAK_ATTRIBUTE;
850 
851 int FTN_STDCALL KMP_EXPAND_NAME(FTN_IS_INITIAL_DEVICE)(void) {
852  if (_Offload_get_device_number) {
853  return _Offload_get_device_number() == -1;
854  } else {
855  return 1;
856  }
857 }
858 
859 #endif // ! KMP_OS_LINUX
860 
861 #endif // OMP_40_ENABLED
862 
863 #if OMP_45_ENABLED && defined(KMP_STUB)
864 // OpenMP 4.5 entries for stubs library
865 
866 int FTN_STDCALL FTN_GET_INITIAL_DEVICE(void) { return -1; }
867 
868 // As all *target* functions are C-only parameters always passed by value
869 void *FTN_STDCALL FTN_TARGET_ALLOC(size_t size, int device_num) { return 0; }
870 
871 void FTN_STDCALL FTN_TARGET_FREE(void *device_ptr, int device_num) {}
872 
873 int FTN_STDCALL FTN_TARGET_IS_PRESENT(void *ptr, int device_num) { return 0; }
874 
875 int FTN_STDCALL FTN_TARGET_MEMCPY(void *dst, void *src, size_t length,
876  size_t dst_offset, size_t src_offset,
877  int dst_device, int src_device) {
878  return -1;
879 }
880 
881 int FTN_STDCALL FTN_TARGET_MEMCPY_RECT(
882  void *dst, void *src, size_t element_size, int num_dims,
883  const size_t *volume, const size_t *dst_offsets, const size_t *src_offsets,
884  const size_t *dst_dimensions, const size_t *src_dimensions, int dst_device,
885  int src_device) {
886  return -1;
887 }
888 
889 int FTN_STDCALL FTN_TARGET_ASSOCIATE_PTR(void *host_ptr, void *device_ptr,
890  size_t size, size_t device_offset,
891  int device_num) {
892  return -1;
893 }
894 
895 int FTN_STDCALL FTN_TARGET_DISASSOCIATE_PTR(void *host_ptr, int device_num) {
896  return -1;
897 }
898 #endif // OMP_45_ENABLED && defined(KMP_STUB)
899 
900 #ifdef KMP_STUB
901 typedef enum { UNINIT = -1, UNLOCKED, LOCKED } kmp_stub_lock_t;
902 #endif /* KMP_STUB */
903 
904 #if KMP_USE_DYNAMIC_LOCK
905 void FTN_STDCALL FTN_INIT_LOCK_WITH_HINT(void **user_lock,
906  uintptr_t KMP_DEREF hint) {
907 #ifdef KMP_STUB
908  *((kmp_stub_lock_t *)user_lock) = UNLOCKED;
909 #else
910  int gtid = __kmp_entry_gtid();
911 #if OMPT_SUPPORT && OMPT_OPTIONAL
912  OMPT_STORE_RETURN_ADDRESS(gtid);
913 #endif
914  __kmpc_init_lock_with_hint(NULL, gtid, user_lock, KMP_DEREF hint);
915 #endif
916 }
917 
918 void FTN_STDCALL FTN_INIT_NEST_LOCK_WITH_HINT(void **user_lock,
919  uintptr_t KMP_DEREF hint) {
920 #ifdef KMP_STUB
921  *((kmp_stub_lock_t *)user_lock) = UNLOCKED;
922 #else
923  int gtid = __kmp_entry_gtid();
924 #if OMPT_SUPPORT && OMPT_OPTIONAL
925  OMPT_STORE_RETURN_ADDRESS(gtid);
926 #endif
927  __kmpc_init_nest_lock_with_hint(NULL, gtid, user_lock, KMP_DEREF hint);
928 #endif
929 }
930 #endif
931 
932 /* initialize the lock */
933 void FTN_STDCALL KMP_EXPAND_NAME(FTN_INIT_LOCK)(void **user_lock) {
934 #ifdef KMP_STUB
935  *((kmp_stub_lock_t *)user_lock) = UNLOCKED;
936 #else
937  int gtid = __kmp_entry_gtid();
938 #if OMPT_SUPPORT && OMPT_OPTIONAL
939  OMPT_STORE_RETURN_ADDRESS(gtid);
940 #endif
941  __kmpc_init_lock(NULL, gtid, user_lock);
942 #endif
943 }
944 
945 /* initialize the lock */
946 void FTN_STDCALL KMP_EXPAND_NAME(FTN_INIT_NEST_LOCK)(void **user_lock) {
947 #ifdef KMP_STUB
948  *((kmp_stub_lock_t *)user_lock) = UNLOCKED;
949 #else
950  int gtid = __kmp_entry_gtid();
951 #if OMPT_SUPPORT && OMPT_OPTIONAL
952  OMPT_STORE_RETURN_ADDRESS(gtid);
953 #endif
954  __kmpc_init_nest_lock(NULL, gtid, user_lock);
955 #endif
956 }
957 
958 void FTN_STDCALL KMP_EXPAND_NAME(FTN_DESTROY_LOCK)(void **user_lock) {
959 #ifdef KMP_STUB
960  *((kmp_stub_lock_t *)user_lock) = UNINIT;
961 #else
962  int gtid = __kmp_entry_gtid();
963 #if OMPT_SUPPORT && OMPT_OPTIONAL
964  OMPT_STORE_RETURN_ADDRESS(gtid);
965 #endif
966  __kmpc_destroy_lock(NULL, gtid, user_lock);
967 #endif
968 }
969 
970 void FTN_STDCALL KMP_EXPAND_NAME(FTN_DESTROY_NEST_LOCK)(void **user_lock) {
971 #ifdef KMP_STUB
972  *((kmp_stub_lock_t *)user_lock) = UNINIT;
973 #else
974  int gtid = __kmp_entry_gtid();
975 #if OMPT_SUPPORT && OMPT_OPTIONAL
976  OMPT_STORE_RETURN_ADDRESS(gtid);
977 #endif
978  __kmpc_destroy_nest_lock(NULL, gtid, user_lock);
979 #endif
980 }
981 
982 void FTN_STDCALL KMP_EXPAND_NAME(FTN_SET_LOCK)(void **user_lock) {
983 #ifdef KMP_STUB
984  if (*((kmp_stub_lock_t *)user_lock) == UNINIT) {
985  // TODO: Issue an error.
986  }
987  if (*((kmp_stub_lock_t *)user_lock) != UNLOCKED) {
988  // TODO: Issue an error.
989  }
990  *((kmp_stub_lock_t *)user_lock) = LOCKED;
991 #else
992  int gtid = __kmp_entry_gtid();
993 #if OMPT_SUPPORT && OMPT_OPTIONAL
994  OMPT_STORE_RETURN_ADDRESS(gtid);
995 #endif
996  __kmpc_set_lock(NULL, gtid, user_lock);
997 #endif
998 }
999 
1000 void FTN_STDCALL KMP_EXPAND_NAME(FTN_SET_NEST_LOCK)(void **user_lock) {
1001 #ifdef KMP_STUB
1002  if (*((kmp_stub_lock_t *)user_lock) == UNINIT) {
1003  // TODO: Issue an error.
1004  }
1005  (*((int *)user_lock))++;
1006 #else
1007  int gtid = __kmp_entry_gtid();
1008 #if OMPT_SUPPORT && OMPT_OPTIONAL
1009  OMPT_STORE_RETURN_ADDRESS(gtid);
1010 #endif
1011  __kmpc_set_nest_lock(NULL, gtid, user_lock);
1012 #endif
1013 }
1014 
1015 void FTN_STDCALL KMP_EXPAND_NAME(FTN_UNSET_LOCK)(void **user_lock) {
1016 #ifdef KMP_STUB
1017  if (*((kmp_stub_lock_t *)user_lock) == UNINIT) {
1018  // TODO: Issue an error.
1019  }
1020  if (*((kmp_stub_lock_t *)user_lock) == UNLOCKED) {
1021  // TODO: Issue an error.
1022  }
1023  *((kmp_stub_lock_t *)user_lock) = UNLOCKED;
1024 #else
1025  int gtid = __kmp_entry_gtid();
1026 #if OMPT_SUPPORT && OMPT_OPTIONAL
1027  OMPT_STORE_RETURN_ADDRESS(gtid);
1028 #endif
1029  __kmpc_unset_lock(NULL, gtid, user_lock);
1030 #endif
1031 }
1032 
1033 void FTN_STDCALL KMP_EXPAND_NAME(FTN_UNSET_NEST_LOCK)(void **user_lock) {
1034 #ifdef KMP_STUB
1035  if (*((kmp_stub_lock_t *)user_lock) == UNINIT) {
1036  // TODO: Issue an error.
1037  }
1038  if (*((kmp_stub_lock_t *)user_lock) == UNLOCKED) {
1039  // TODO: Issue an error.
1040  }
1041  (*((int *)user_lock))--;
1042 #else
1043  int gtid = __kmp_entry_gtid();
1044 #if OMPT_SUPPORT && OMPT_OPTIONAL
1045  OMPT_STORE_RETURN_ADDRESS(gtid);
1046 #endif
1047  __kmpc_unset_nest_lock(NULL, gtid, user_lock);
1048 #endif
1049 }
1050 
1051 int FTN_STDCALL KMP_EXPAND_NAME(FTN_TEST_LOCK)(void **user_lock) {
1052 #ifdef KMP_STUB
1053  if (*((kmp_stub_lock_t *)user_lock) == UNINIT) {
1054  // TODO: Issue an error.
1055  }
1056  if (*((kmp_stub_lock_t *)user_lock) == LOCKED) {
1057  return 0;
1058  }
1059  *((kmp_stub_lock_t *)user_lock) = LOCKED;
1060  return 1;
1061 #else
1062  int gtid = __kmp_entry_gtid();
1063 #if OMPT_SUPPORT && OMPT_OPTIONAL
1064  OMPT_STORE_RETURN_ADDRESS(gtid);
1065 #endif
1066  return __kmpc_test_lock(NULL, gtid, user_lock);
1067 #endif
1068 }
1069 
1070 int FTN_STDCALL KMP_EXPAND_NAME(FTN_TEST_NEST_LOCK)(void **user_lock) {
1071 #ifdef KMP_STUB
1072  if (*((kmp_stub_lock_t *)user_lock) == UNINIT) {
1073  // TODO: Issue an error.
1074  }
1075  return ++(*((int *)user_lock));
1076 #else
1077  int gtid = __kmp_entry_gtid();
1078 #if OMPT_SUPPORT && OMPT_OPTIONAL
1079  OMPT_STORE_RETURN_ADDRESS(gtid);
1080 #endif
1081  return __kmpc_test_nest_lock(NULL, gtid, user_lock);
1082 #endif
1083 }
1084 
1085 double FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_WTIME)(void) {
1086 #ifdef KMP_STUB
1087  return __kmps_get_wtime();
1088 #else
1089  double data;
1090 #if !KMP_OS_LINUX
1091  // We don't need library initialization to get the time on Linux* OS. The
1092  // routine can be used to measure library initialization time on Linux* OS now
1093  if (!__kmp_init_serial) {
1094  __kmp_serial_initialize();
1095  }
1096 #endif
1097  __kmp_elapsed(&data);
1098  return data;
1099 #endif
1100 }
1101 
1102 double FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_WTICK)(void) {
1103 #ifdef KMP_STUB
1104  return __kmps_get_wtick();
1105 #else
1106  double data;
1107  if (!__kmp_init_serial) {
1108  __kmp_serial_initialize();
1109  }
1110  __kmp_elapsed_tick(&data);
1111  return data;
1112 #endif
1113 }
1114 
1115 /* ------------------------------------------------------------------------ */
1116 
1117 void *FTN_STDCALL FTN_MALLOC(size_t KMP_DEREF size) {
1118  // kmpc_malloc initializes the library if needed
1119  return kmpc_malloc(KMP_DEREF size);
1120 }
1121 
1122 void *FTN_STDCALL FTN_ALIGNED_MALLOC(size_t KMP_DEREF size,
1123  size_t KMP_DEREF alignment) {
1124  // kmpc_aligned_malloc initializes the library if needed
1125  return kmpc_aligned_malloc(KMP_DEREF size, KMP_DEREF alignment);
1126 }
1127 
1128 void *FTN_STDCALL FTN_CALLOC(size_t KMP_DEREF nelem, size_t KMP_DEREF elsize) {
1129  // kmpc_calloc initializes the library if needed
1130  return kmpc_calloc(KMP_DEREF nelem, KMP_DEREF elsize);
1131 }
1132 
1133 void *FTN_STDCALL FTN_REALLOC(void *KMP_DEREF ptr, size_t KMP_DEREF size) {
1134  // kmpc_realloc initializes the library if needed
1135  return kmpc_realloc(KMP_DEREF ptr, KMP_DEREF size);
1136 }
1137 
1138 void FTN_STDCALL FTN_FREE(void *KMP_DEREF ptr) {
1139  // does nothing if the library is not initialized
1140  kmpc_free(KMP_DEREF ptr);
1141 }
1142 
1143 void FTN_STDCALL FTN_SET_WARNINGS_ON(void) {
1144 #ifndef KMP_STUB
1145  __kmp_generate_warnings = kmp_warnings_explicit;
1146 #endif
1147 }
1148 
1149 void FTN_STDCALL FTN_SET_WARNINGS_OFF(void) {
1150 #ifndef KMP_STUB
1151  __kmp_generate_warnings = FALSE;
1152 #endif
1153 }
1154 
1155 void FTN_STDCALL FTN_SET_DEFAULTS(char const *str
1156 #ifndef PASS_ARGS_BY_VALUE
1157  ,
1158  int len
1159 #endif
1160  ) {
1161 #ifndef KMP_STUB
1162 #ifdef PASS_ARGS_BY_VALUE
1163  int len = (int)KMP_STRLEN(str);
1164 #endif
1165  __kmp_aux_set_defaults(str, len);
1166 #endif
1167 }
1168 
1169 /* ------------------------------------------------------------------------ */
1170 
1171 #if OMP_40_ENABLED
1172 /* returns the status of cancellation */
1173 int FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_CANCELLATION)(void) {
1174 #ifdef KMP_STUB
1175  return 0 /* false */;
1176 #else
1177  // initialize the library if needed
1178  if (!__kmp_init_serial) {
1179  __kmp_serial_initialize();
1180  }
1181  return __kmp_omp_cancellation;
1182 #endif
1183 }
1184 
1185 int FTN_STDCALL FTN_GET_CANCELLATION_STATUS(int cancel_kind) {
1186 #ifdef KMP_STUB
1187  return 0 /* false */;
1188 #else
1189  return __kmp_get_cancellation_status(cancel_kind);
1190 #endif
1191 }
1192 
1193 #endif // OMP_40_ENABLED
1194 
1195 #if OMP_45_ENABLED
1196 /* returns the maximum allowed task priority */
1197 int FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_MAX_TASK_PRIORITY)(void) {
1198 #ifdef KMP_STUB
1199  return 0;
1200 #else
1201  if (!__kmp_init_serial) {
1202  __kmp_serial_initialize();
1203  }
1204  return __kmp_max_task_priority;
1205 #endif
1206 }
1207 #endif
1208 
1209 // GCC compatibility (versioned symbols)
1210 #ifdef KMP_USE_VERSION_SYMBOLS
1211 
1212 /* These following sections create versioned symbols for the
1213  omp_* routines. The KMP_VERSION_SYMBOL macro expands the API name and
1214  then maps it to a versioned symbol.
1215  libgomp ``versions'' its symbols (OMP_1.0, OMP_2.0, OMP_3.0, ...) while also
1216  retaining the default version which libomp uses: VERSION (defined in
1217  exports_so.txt). If you want to see the versioned symbols for libgomp.so.1
1218  then just type:
1219 
1220  objdump -T /path/to/libgomp.so.1 | grep omp_
1221 
1222  Example:
1223  Step 1) Create __kmp_api_omp_set_num_threads_10_alias which is alias of
1224  __kmp_api_omp_set_num_threads
1225  Step 2) Set __kmp_api_omp_set_num_threads_10_alias to version:
1226  omp_set_num_threads@OMP_1.0
1227  Step 2B) Set __kmp_api_omp_set_num_threads to default version:
1228  omp_set_num_threads@@VERSION
1229 */
1230 
1231 // OMP_1.0 versioned symbols
1232 KMP_VERSION_SYMBOL(FTN_SET_NUM_THREADS, 10, "OMP_1.0");
1233 KMP_VERSION_SYMBOL(FTN_GET_NUM_THREADS, 10, "OMP_1.0");
1234 KMP_VERSION_SYMBOL(FTN_GET_MAX_THREADS, 10, "OMP_1.0");
1235 KMP_VERSION_SYMBOL(FTN_GET_THREAD_NUM, 10, "OMP_1.0");
1236 KMP_VERSION_SYMBOL(FTN_GET_NUM_PROCS, 10, "OMP_1.0");
1237 KMP_VERSION_SYMBOL(FTN_IN_PARALLEL, 10, "OMP_1.0");
1238 KMP_VERSION_SYMBOL(FTN_SET_DYNAMIC, 10, "OMP_1.0");
1239 KMP_VERSION_SYMBOL(FTN_GET_DYNAMIC, 10, "OMP_1.0");
1240 KMP_VERSION_SYMBOL(FTN_SET_NESTED, 10, "OMP_1.0");
1241 KMP_VERSION_SYMBOL(FTN_GET_NESTED, 10, "OMP_1.0");
1242 KMP_VERSION_SYMBOL(FTN_INIT_LOCK, 10, "OMP_1.0");
1243 KMP_VERSION_SYMBOL(FTN_INIT_NEST_LOCK, 10, "OMP_1.0");
1244 KMP_VERSION_SYMBOL(FTN_DESTROY_LOCK, 10, "OMP_1.0");
1245 KMP_VERSION_SYMBOL(FTN_DESTROY_NEST_LOCK, 10, "OMP_1.0");
1246 KMP_VERSION_SYMBOL(FTN_SET_LOCK, 10, "OMP_1.0");
1247 KMP_VERSION_SYMBOL(FTN_SET_NEST_LOCK, 10, "OMP_1.0");
1248 KMP_VERSION_SYMBOL(FTN_UNSET_LOCK, 10, "OMP_1.0");
1249 KMP_VERSION_SYMBOL(FTN_UNSET_NEST_LOCK, 10, "OMP_1.0");
1250 KMP_VERSION_SYMBOL(FTN_TEST_LOCK, 10, "OMP_1.0");
1251 KMP_VERSION_SYMBOL(FTN_TEST_NEST_LOCK, 10, "OMP_1.0");
1252 
1253 // OMP_2.0 versioned symbols
1254 KMP_VERSION_SYMBOL(FTN_GET_WTICK, 20, "OMP_2.0");
1255 KMP_VERSION_SYMBOL(FTN_GET_WTIME, 20, "OMP_2.0");
1256 
1257 // OMP_3.0 versioned symbols
1258 KMP_VERSION_SYMBOL(FTN_SET_SCHEDULE, 30, "OMP_3.0");
1259 KMP_VERSION_SYMBOL(FTN_GET_SCHEDULE, 30, "OMP_3.0");
1260 KMP_VERSION_SYMBOL(FTN_GET_THREAD_LIMIT, 30, "OMP_3.0");
1261 KMP_VERSION_SYMBOL(FTN_SET_MAX_ACTIVE_LEVELS, 30, "OMP_3.0");
1262 KMP_VERSION_SYMBOL(FTN_GET_MAX_ACTIVE_LEVELS, 30, "OMP_3.0");
1263 KMP_VERSION_SYMBOL(FTN_GET_ANCESTOR_THREAD_NUM, 30, "OMP_3.0");
1264 KMP_VERSION_SYMBOL(FTN_GET_LEVEL, 30, "OMP_3.0");
1265 KMP_VERSION_SYMBOL(FTN_GET_TEAM_SIZE, 30, "OMP_3.0");
1266 KMP_VERSION_SYMBOL(FTN_GET_ACTIVE_LEVEL, 30, "OMP_3.0");
1267 
1268 // the lock routines have a 1.0 and 3.0 version
1269 KMP_VERSION_SYMBOL(FTN_INIT_LOCK, 30, "OMP_3.0");
1270 KMP_VERSION_SYMBOL(FTN_INIT_NEST_LOCK, 30, "OMP_3.0");
1271 KMP_VERSION_SYMBOL(FTN_DESTROY_LOCK, 30, "OMP_3.0");
1272 KMP_VERSION_SYMBOL(FTN_DESTROY_NEST_LOCK, 30, "OMP_3.0");
1273 KMP_VERSION_SYMBOL(FTN_SET_LOCK, 30, "OMP_3.0");
1274 KMP_VERSION_SYMBOL(FTN_SET_NEST_LOCK, 30, "OMP_3.0");
1275 KMP_VERSION_SYMBOL(FTN_UNSET_LOCK, 30, "OMP_3.0");
1276 KMP_VERSION_SYMBOL(FTN_UNSET_NEST_LOCK, 30, "OMP_3.0");
1277 KMP_VERSION_SYMBOL(FTN_TEST_LOCK, 30, "OMP_3.0");
1278 KMP_VERSION_SYMBOL(FTN_TEST_NEST_LOCK, 30, "OMP_3.0");
1279 
1280 // OMP_3.1 versioned symbol
1281 KMP_VERSION_SYMBOL(FTN_IN_FINAL, 31, "OMP_3.1");
1282 
1283 #if OMP_40_ENABLED
1284 // OMP_4.0 versioned symbols
1285 KMP_VERSION_SYMBOL(FTN_GET_PROC_BIND, 40, "OMP_4.0");
1286 KMP_VERSION_SYMBOL(FTN_GET_NUM_TEAMS, 40, "OMP_4.0");
1287 KMP_VERSION_SYMBOL(FTN_GET_TEAM_NUM, 40, "OMP_4.0");
1288 KMP_VERSION_SYMBOL(FTN_GET_CANCELLATION, 40, "OMP_4.0");
1289 KMP_VERSION_SYMBOL(FTN_GET_DEFAULT_DEVICE, 40, "OMP_4.0");
1290 KMP_VERSION_SYMBOL(FTN_SET_DEFAULT_DEVICE, 40, "OMP_4.0");
1291 KMP_VERSION_SYMBOL(FTN_IS_INITIAL_DEVICE, 40, "OMP_4.0");
1292 #endif /* OMP_40_ENABLED */
1293 
1294 #if OMP_45_ENABLED
1295 // OMP_4.5 versioned symbols
1296 KMP_VERSION_SYMBOL(FTN_GET_MAX_TASK_PRIORITY, 45, "OMP_4.5");
1297 KMP_VERSION_SYMBOL(FTN_GET_NUM_PLACES, 45, "OMP_4.5");
1298 KMP_VERSION_SYMBOL(FTN_GET_PLACE_NUM_PROCS, 45, "OMP_4.5");
1299 KMP_VERSION_SYMBOL(FTN_GET_PLACE_PROC_IDS, 45, "OMP_4.5");
1300 KMP_VERSION_SYMBOL(FTN_GET_PLACE_NUM, 45, "OMP_4.5");
1301 KMP_VERSION_SYMBOL(FTN_GET_PARTITION_NUM_PLACES, 45, "OMP_4.5");
1302 KMP_VERSION_SYMBOL(FTN_GET_PARTITION_PLACE_NUMS, 45, "OMP_4.5");
1303 #endif
1304 
1305 #if OMP_50_ENABLED
1306 // OMP_5.0 versioned symbols
1307 #endif
1308 
1309 #endif // KMP_USE_VERSION_SYMBOLS
1310 
1311 #ifdef __cplusplus
1312 } // extern "C"
1313 #endif // __cplusplus
1314 
1315 // end of file //
KMP_EXPORT kmp_int32 __kmpc_bound_num_threads(ident_t *)