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