-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlibgomp.info
4574 lines (3556 loc) · 183 KB
/
libgomp.info
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
This is libgomp.info, produced by makeinfo version 4.13 from
/space/rguenther/gcc-7.2.0/gcc-7.2.0/libgomp/libgomp.texi.
Copyright (C) 2006-2017 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "Funding Free Software", the Front-Cover texts
being (a) (see below), and with the Back-Cover Texts being (b) (see
below). A copy of the license is included in the section entitled "GNU
Free Documentation License".
(a) The FSF's Front-Cover Text is:
A GNU Manual
(b) The FSF's Back-Cover Text is:
You have freedom to copy and modify this GNU Manual, like GNU
software. Copies published by the Free Software Foundation raise
funds for GNU development.
INFO-DIR-SECTION GNU Libraries
START-INFO-DIR-ENTRY
* libgomp: (libgomp). GNU Offloading and Multi Processing Runtime Library.
END-INFO-DIR-ENTRY
This manual documents libgomp, the GNU Offloading and Multi
Processing Runtime library. This is the GNU implementation of the
OpenMP and OpenACC APIs for parallel and accelerator programming in
C/C++ and Fortran.
Published by the Free Software Foundation 51 Franklin Street, Fifth
Floor Boston, MA 02110-1301 USA
Copyright (C) 2006-2017 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "Funding Free Software", the Front-Cover texts
being (a) (see below), and with the Back-Cover Texts being (b) (see
below). A copy of the license is included in the section entitled "GNU
Free Documentation License".
(a) The FSF's Front-Cover Text is:
A GNU Manual
(b) The FSF's Back-Cover Text is:
You have freedom to copy and modify this GNU Manual, like GNU
software. Copies published by the Free Software Foundation raise
funds for GNU development.
File: libgomp.info, Node: Top, Next: Enabling OpenMP, Up: (dir)
Introduction
************
This manual documents the usage of libgomp, the GNU Offloading and
Multi Processing Runtime Library. This includes the GNU implementation
of the OpenMP (http://www.openmp.org) Application Programming Interface
(API) for multi-platform shared-memory parallel programming in C/C++
and Fortran, and the GNU implementation of the OpenACC
(http://www.openacc.org/) Application Programming Interface (API) for
offloading of code to accelerator devices in C/C++ and Fortran.
Originally, libgomp implemented the GNU OpenMP Runtime Library.
Based on this, support for OpenACC and offloading (both OpenACC and
OpenMP 4's target construct) has been added later on, and the library's
name changed to GNU Offloading and Multi Processing Runtime Library.
* Menu:
* Enabling OpenMP:: How to enable OpenMP for your applications.
* Runtime Library Routines:: The OpenMP runtime application programming
interface.
* Environment Variables:: Influencing runtime behavior with environment
variables.
* Enabling OpenACC:: How to enable OpenACC for your
applications.
* OpenACC Runtime Library Routines:: The OpenACC runtime application
programming interface.
* OpenACC Environment Variables:: Influencing OpenACC runtime behavior with
environment variables.
* CUDA Streams Usage:: Notes on the implementation of
asynchronous operations.
* OpenACC Library Interoperability:: OpenACC library interoperability with the
NVIDIA CUBLAS library.
* The libgomp ABI:: Notes on the external ABI presented by libgomp.
* Reporting Bugs:: How to report bugs in the GNU Offloading and
Multi Processing Runtime Library.
* Copying:: GNU general public license says
how you can copy and share libgomp.
* GNU Free Documentation License::
How you can copy and share this manual.
* Funding:: How to help assure continued work for free
software.
* Library Index:: Index of this documentation.
File: libgomp.info, Node: Enabling OpenMP, Next: Runtime Library Routines, Prev: Top, Up: Top
1 Enabling OpenMP
*****************
To activate the OpenMP extensions for C/C++ and Fortran, the
compile-time flag `-fopenmp' must be specified. This enables the
OpenMP directive `#pragma omp' in C/C++ and `!$omp' directives in free
form, `c$omp', `*$omp' and `!$omp' directives in fixed form, `!$'
conditional compilation sentinels in free form and `c$', `*$' and `!$'
sentinels in fixed form, for Fortran. The flag also arranges for
automatic linking of the OpenMP runtime library (*note Runtime Library
Routines::).
A complete description of all OpenMP directives accepted may be
found in the OpenMP Application Program Interface
(http://www.openmp.org) manual, version 4.5.
File: libgomp.info, Node: Runtime Library Routines, Next: Environment Variables, Prev: Enabling OpenMP, Up: Top
2 Runtime Library Routines
**************************
The runtime routines described here are defined by Section 3 of the
OpenMP specification in version 4.5. The routines are structured in
following three parts:
* Menu:
Control threads, processors and the parallel environment. They have C
linkage, and do not throw exceptions.
* omp_get_active_level:: Number of active parallel regions
* omp_get_ancestor_thread_num:: Ancestor thread ID
* omp_get_cancellation:: Whether cancellation support is enabled
* omp_get_default_device:: Get the default device for target regions
* omp_get_dynamic:: Dynamic teams setting
* omp_get_level:: Number of parallel regions
* omp_get_max_active_levels:: Maximum number of active regions
* omp_get_max_task_priority:: Maximum task priority value that can be set
* omp_get_max_threads:: Maximum number of threads of parallel region
* omp_get_nested:: Nested parallel regions
* omp_get_num_devices:: Number of target devices
* omp_get_num_procs:: Number of processors online
* omp_get_num_teams:: Number of teams
* omp_get_num_threads:: Size of the active team
* omp_get_proc_bind:: Whether theads may be moved between CPUs
* omp_get_schedule:: Obtain the runtime scheduling method
* omp_get_team_num:: Get team number
* omp_get_team_size:: Number of threads in a team
* omp_get_thread_limit:: Maximum number of threads
* omp_get_thread_num:: Current thread ID
* omp_in_parallel:: Whether a parallel region is active
* omp_in_final:: Whether in final or included task region
* omp_is_initial_device:: Whether executing on the host device
* omp_set_default_device:: Set the default device for target regions
* omp_set_dynamic:: Enable/disable dynamic teams
* omp_set_max_active_levels:: Limits the number of active parallel regions
* omp_set_nested:: Enable/disable nested parallel regions
* omp_set_num_threads:: Set upper team size limit
* omp_set_schedule:: Set the runtime scheduling method
Initialize, set, test, unset and destroy simple and nested locks.
* omp_init_lock:: Initialize simple lock
* omp_set_lock:: Wait for and set simple lock
* omp_test_lock:: Test and set simple lock if available
* omp_unset_lock:: Unset simple lock
* omp_destroy_lock:: Destroy simple lock
* omp_init_nest_lock:: Initialize nested lock
* omp_set_nest_lock:: Wait for and set simple lock
* omp_test_nest_lock:: Test and set nested lock if available
* omp_unset_nest_lock:: Unset nested lock
* omp_destroy_nest_lock:: Destroy nested lock
Portable, thread-based, wall clock timer.
* omp_get_wtick:: Get timer precision.
* omp_get_wtime:: Elapsed wall clock time.
File: libgomp.info, Node: omp_get_active_level, Next: omp_get_ancestor_thread_num, Up: Runtime Library Routines
2.1 `omp_get_active_level' - Number of parallel regions
=======================================================
_Description_:
This function returns the nesting level for the active parallel
blocks, which enclose the calling call.
_C/C++_
_Prototype_: `int omp_get_active_level(void);'
_Fortran_:
_Interface_: `integer function omp_get_active_level()'
_See also_:
*note omp_get_level::, *note omp_get_max_active_levels::, *note
omp_set_max_active_levels::
_Reference_:
OpenMP specification v4.5 (http://www.openmp.org/), Section 3.2.20.
File: libgomp.info, Node: omp_get_ancestor_thread_num, Next: omp_get_cancellation, Prev: omp_get_active_level, Up: Runtime Library Routines
2.2 `omp_get_ancestor_thread_num' - Ancestor thread ID
======================================================
_Description_:
This function returns the thread identification number for the
given nesting level of the current thread. For values of LEVEL
outside zero to `omp_get_level' -1 is returned; if LEVEL is
`omp_get_level' the result is identical to `omp_get_thread_num'.
_C/C++_
_Prototype_: `int omp_get_ancestor_thread_num(int level);'
_Fortran_:
_Interface_: `integer function omp_get_ancestor_thread_num(level)'
`integer level'
_See also_:
*note omp_get_level::, *note omp_get_thread_num::, *note
omp_get_team_size::
_Reference_:
OpenMP specification v4.5 (http://www.openmp.org/), Section 3.2.18.
File: libgomp.info, Node: omp_get_cancellation, Next: omp_get_default_device, Prev: omp_get_ancestor_thread_num, Up: Runtime Library Routines
2.3 `omp_get_cancellation' - Whether cancellation support is enabled
====================================================================
_Description_:
This function returns `true' if cancellation is activated, `false'
otherwise. Here, `true' and `false' represent their
language-specific counterparts. Unless `OMP_CANCELLATION' is set
true, cancellations are deactivated.
_C/C++_:
_Prototype_: `int omp_get_cancellation(void);'
_Fortran_:
_Interface_: `logical function omp_get_cancellation()'
_See also_:
*note OMP_CANCELLATION::
_Reference_:
OpenMP specification v4.5 (http://www.openmp.org/), Section 3.2.9.
File: libgomp.info, Node: omp_get_default_device, Next: omp_get_dynamic, Prev: omp_get_cancellation, Up: Runtime Library Routines
2.4 `omp_get_default_device' - Get the default device for target regions
========================================================================
_Description_:
Get the default device for target regions without device clause.
_C/C++_:
_Prototype_: `int omp_get_default_device(void);'
_Fortran_:
_Interface_: `integer function omp_get_default_device()'
_See also_:
*note OMP_DEFAULT_DEVICE::, *note omp_set_default_device::
_Reference_:
OpenMP specification v4.5 (http://www.openmp.org/), Section 3.2.30.
File: libgomp.info, Node: omp_get_dynamic, Next: omp_get_level, Prev: omp_get_default_device, Up: Runtime Library Routines
2.5 `omp_get_dynamic' - Dynamic teams setting
=============================================
_Description_:
This function returns `true' if enabled, `false' otherwise. Here,
`true' and `false' represent their language-specific counterparts.
The dynamic team setting may be initialized at startup by the
`OMP_DYNAMIC' environment variable or at runtime using
`omp_set_dynamic'. If undefined, dynamic adjustment is disabled
by default.
_C/C++_:
_Prototype_: `int omp_get_dynamic(void);'
_Fortran_:
_Interface_: `logical function omp_get_dynamic()'
_See also_:
*note omp_set_dynamic::, *note OMP_DYNAMIC::
_Reference_:
OpenMP specification v4.5 (http://www.openmp.org/), Section 3.2.8.
File: libgomp.info, Node: omp_get_level, Next: omp_get_max_active_levels, Prev: omp_get_dynamic, Up: Runtime Library Routines
2.6 `omp_get_level' - Obtain the current nesting level
======================================================
_Description_:
This function returns the nesting level for the parallel blocks,
which enclose the calling call.
_C/C++_
_Prototype_: `int omp_get_level(void);'
_Fortran_:
_Interface_: `integer function omp_level()'
_See also_:
*note omp_get_active_level::
_Reference_:
OpenMP specification v4.5 (http://www.openmp.org/), Section 3.2.17.
File: libgomp.info, Node: omp_get_max_active_levels, Next: omp_get_max_task_priority, Prev: omp_get_level, Up: Runtime Library Routines
2.7 `omp_get_max_active_levels' - Maximum number of active regions
==================================================================
_Description_:
This function obtains the maximum allowed number of nested, active
parallel regions.
_C/C++_
_Prototype_: `int omp_get_max_active_levels(void);'
_Fortran_:
_Interface_: `integer function omp_get_max_active_levels()'
_See also_:
*note omp_set_max_active_levels::, *note omp_get_active_level::
_Reference_:
OpenMP specification v4.5 (http://www.openmp.org/), Section 3.2.16.
File: libgomp.info, Node: omp_get_max_task_priority, Next: omp_get_max_threads, Prev: omp_get_max_active_levels, Up: Runtime Library Routines
2.8 `omp_get_max_task_priority' - Maximum priority value
========================================================
that can be set for tasks.
_Description_:
This function obtains the maximum allowed priority number for
tasks.
_C/C++_
_Prototype_: `int omp_get_max_task_priority(void);'
_Fortran_:
_Interface_: `integer function omp_get_max_task_priority()'
_Reference_:
OpenMP specification v4.5 (http://www.openmp.org/), Section 3.2.29.
File: libgomp.info, Node: omp_get_max_threads, Next: omp_get_nested, Prev: omp_get_max_task_priority, Up: Runtime Library Routines
2.9 `omp_get_max_threads' - Maximum number of threads of parallel region
========================================================================
_Description_:
Return the maximum number of threads used for the current parallel
region that does not use the clause `num_threads'.
_C/C++_:
_Prototype_: `int omp_get_max_threads(void);'
_Fortran_:
_Interface_: `integer function omp_get_max_threads()'
_See also_:
*note omp_set_num_threads::, *note omp_set_dynamic::, *note
omp_get_thread_limit::
_Reference_:
OpenMP specification v4.5 (http://www.openmp.org/), Section 3.2.3.
File: libgomp.info, Node: omp_get_nested, Next: omp_get_num_devices, Prev: omp_get_max_threads, Up: Runtime Library Routines
2.10 `omp_get_nested' - Nested parallel regions
===============================================
_Description_:
This function returns `true' if nested parallel regions are
enabled, `false' otherwise. Here, `true' and `false' represent
their language-specific counterparts.
Nested parallel regions may be initialized at startup by the
`OMP_NESTED' environment variable or at runtime using
`omp_set_nested'. If undefined, nested parallel regions are
disabled by default.
_C/C++_:
_Prototype_: `int omp_get_nested(void);'
_Fortran_:
_Interface_: `logical function omp_get_nested()'
_See also_:
*note omp_set_nested::, *note OMP_NESTED::
_Reference_:
OpenMP specification v4.5 (http://www.openmp.org/), Section 3.2.11.
File: libgomp.info, Node: omp_get_num_devices, Next: omp_get_num_procs, Prev: omp_get_nested, Up: Runtime Library Routines
2.11 `omp_get_num_devices' - Number of target devices
=====================================================
_Description_:
Returns the number of target devices.
_C/C++_:
_Prototype_: `int omp_get_num_devices(void);'
_Fortran_:
_Interface_: `integer function omp_get_num_devices()'
_Reference_:
OpenMP specification v4.5 (http://www.openmp.org/), Section 3.2.31.
File: libgomp.info, Node: omp_get_num_procs, Next: omp_get_num_teams, Prev: omp_get_num_devices, Up: Runtime Library Routines
2.12 `omp_get_num_procs' - Number of processors online
======================================================
_Description_:
Returns the number of processors online on that device.
_C/C++_:
_Prototype_: `int omp_get_num_procs(void);'
_Fortran_:
_Interface_: `integer function omp_get_num_procs()'
_Reference_:
OpenMP specification v4.5 (http://www.openmp.org/), Section 3.2.5.
File: libgomp.info, Node: omp_get_num_teams, Next: omp_get_num_threads, Prev: omp_get_num_procs, Up: Runtime Library Routines
2.13 `omp_get_num_teams' - Number of teams
==========================================
_Description_:
Returns the number of teams in the current team region.
_C/C++_:
_Prototype_: `int omp_get_num_teams(void);'
_Fortran_:
_Interface_: `integer function omp_get_num_teams()'
_Reference_:
OpenMP specification v4.5 (http://www.openmp.org/), Section 3.2.32.
File: libgomp.info, Node: omp_get_num_threads, Next: omp_get_proc_bind, Prev: omp_get_num_teams, Up: Runtime Library Routines
2.14 `omp_get_num_threads' - Size of the active team
====================================================
_Description_:
Returns the number of threads in the current team. In a
sequential section of the program `omp_get_num_threads' returns 1.
The default team size may be initialized at startup by the
`OMP_NUM_THREADS' environment variable. At runtime, the size of
the current team may be set either by the `NUM_THREADS' clause or
by `omp_set_num_threads'. If none of the above were used to
define a specific value and `OMP_DYNAMIC' is disabled, one thread
per CPU online is used.
_C/C++_:
_Prototype_: `int omp_get_num_threads(void);'
_Fortran_:
_Interface_: `integer function omp_get_num_threads()'
_See also_:
*note omp_get_max_threads::, *note omp_set_num_threads::, *note
OMP_NUM_THREADS::
_Reference_:
OpenMP specification v4.5 (http://www.openmp.org/), Section 3.2.2.
File: libgomp.info, Node: omp_get_proc_bind, Next: omp_get_schedule, Prev: omp_get_num_threads, Up: Runtime Library Routines
2.15 `omp_get_proc_bind' - Whether theads may be moved between CPUs
===================================================================
_Description_:
This functions returns the currently active thread affinity
policy, which is set via `OMP_PROC_BIND'. Possible values are
`omp_proc_bind_false', `omp_proc_bind_true',
`omp_proc_bind_master', `omp_proc_bind_close' and
`omp_proc_bind_spread'.
_C/C++_:
_Prototype_: `omp_proc_bind_t omp_get_proc_bind(void);'
_Fortran_:
_Interface_: `integer(kind=omp_proc_bind_kind) function
omp_get_proc_bind()'
_See also_:
*note OMP_PROC_BIND::, *note OMP_PLACES::, *note
GOMP_CPU_AFFINITY::,
_Reference_:
OpenMP specification v4.5 (http://www.openmp.org/), Section 3.2.22.
File: libgomp.info, Node: omp_get_schedule, Next: omp_get_team_num, Prev: omp_get_proc_bind, Up: Runtime Library Routines
2.16 `omp_get_schedule' - Obtain the runtime scheduling method
==============================================================
_Description_:
Obtain the runtime scheduling method. The KIND argument will be
set to the value `omp_sched_static', `omp_sched_dynamic',
`omp_sched_guided' or `omp_sched_auto'. The second argument,
CHUNK_SIZE, is set to the chunk size.
_C/C++_
_Prototype_: `void omp_get_schedule(omp_sched_t *kind, int
*chunk_size);'
_Fortran_:
_Interface_: `subroutine omp_get_schedule(kind, chunk_size)'
`integer(kind=omp_sched_kind) kind'
`integer chunk_size'
_See also_:
*note omp_set_schedule::, *note OMP_SCHEDULE::
_Reference_:
OpenMP specification v4.5 (http://www.openmp.org/), Section 3.2.13.
File: libgomp.info, Node: omp_get_team_num, Next: omp_get_team_size, Prev: omp_get_schedule, Up: Runtime Library Routines
2.17 `omp_get_team_num' - Get team number
=========================================
_Description_:
Returns the team number of the calling thread.
_C/C++_:
_Prototype_: `int omp_get_team_num(void);'
_Fortran_:
_Interface_: `integer function omp_get_team_num()'
_Reference_:
OpenMP specification v4.5 (http://www.openmp.org/), Section 3.2.33.
File: libgomp.info, Node: omp_get_team_size, Next: omp_get_thread_limit, Prev: omp_get_team_num, Up: Runtime Library Routines
2.18 `omp_get_team_size' - Number of threads in a team
======================================================
_Description_:
This function returns the number of threads in a thread team to
which either the current thread or its ancestor belongs. For
values of LEVEL outside zero to `omp_get_level', -1 is returned;
if LEVEL is zero, 1 is returned, and for `omp_get_level', the
result is identical to `omp_get_num_threads'.
_C/C++_:
_Prototype_: `int omp_get_team_size(int level);'
_Fortran_:
_Interface_: `integer function omp_get_team_size(level)'
`integer level'
_See also_:
*note omp_get_num_threads::, *note omp_get_level::, *note
omp_get_ancestor_thread_num::
_Reference_:
OpenMP specification v4.5 (http://www.openmp.org/), Section 3.2.19.
File: libgomp.info, Node: omp_get_thread_limit, Next: omp_get_thread_num, Prev: omp_get_team_size, Up: Runtime Library Routines
2.19 `omp_get_thread_limit' - Maximum number of threads
=======================================================
_Description_:
Return the maximum number of threads of the program.
_C/C++_:
_Prototype_: `int omp_get_thread_limit(void);'
_Fortran_:
_Interface_: `integer function omp_get_thread_limit()'
_See also_:
*note omp_get_max_threads::, *note OMP_THREAD_LIMIT::
_Reference_:
OpenMP specification v4.5 (http://www.openmp.org/), Section 3.2.14.
File: libgomp.info, Node: omp_get_thread_num, Next: omp_in_parallel, Prev: omp_get_thread_limit, Up: Runtime Library Routines
2.20 `omp_get_thread_num' - Current thread ID
=============================================
_Description_:
Returns a unique thread identification number within the current
team. In a sequential parts of the program, `omp_get_thread_num'
always returns 0. In parallel regions the return value varies
from 0 to `omp_get_num_threads'-1 inclusive. The return value of
the master thread of a team is always 0.
_C/C++_:
_Prototype_: `int omp_get_thread_num(void);'
_Fortran_:
_Interface_: `integer function omp_get_thread_num()'
_See also_:
*note omp_get_num_threads::, *note omp_get_ancestor_thread_num::
_Reference_:
OpenMP specification v4.5 (http://www.openmp.org/), Section 3.2.4.
File: libgomp.info, Node: omp_in_parallel, Next: omp_in_final, Prev: omp_get_thread_num, Up: Runtime Library Routines
2.21 `omp_in_parallel' - Whether a parallel region is active
============================================================
_Description_:
This function returns `true' if currently running in parallel,
`false' otherwise. Here, `true' and `false' represent their
language-specific counterparts.
_C/C++_:
_Prototype_: `int omp_in_parallel(void);'
_Fortran_:
_Interface_: `logical function omp_in_parallel()'
_Reference_:
OpenMP specification v4.5 (http://www.openmp.org/), Section 3.2.6.
File: libgomp.info, Node: omp_in_final, Next: omp_is_initial_device, Prev: omp_in_parallel, Up: Runtime Library Routines
2.22 `omp_in_final' - Whether in final or included task region
==============================================================
_Description_:
This function returns `true' if currently running in a final or
included task region, `false' otherwise. Here, `true' and `false'
represent their language-specific counterparts.
_C/C++_:
_Prototype_: `int omp_in_final(void);'
_Fortran_:
_Interface_: `logical function omp_in_final()'
_Reference_:
OpenMP specification v4.5 (http://www.openmp.org/), Section 3.2.21.
File: libgomp.info, Node: omp_is_initial_device, Next: omp_set_default_device, Prev: omp_in_final, Up: Runtime Library Routines
2.23 `omp_is_initial_device' - Whether executing on the host device
===================================================================
_Description_:
This function returns `true' if currently running on the host
device, `false' otherwise. Here, `true' and `false' represent
their language-specific counterparts.
_C/C++_:
_Prototype_: `int omp_is_initial_device(void);'
_Fortran_:
_Interface_: `logical function omp_is_initial_device()'
_Reference_:
OpenMP specification v4.5 (http://www.openmp.org/), Section 3.2.34.
File: libgomp.info, Node: omp_set_default_device, Next: omp_set_dynamic, Prev: omp_is_initial_device, Up: Runtime Library Routines
2.24 `omp_set_default_device' - Set the default device for target regions
=========================================================================
_Description_:
Set the default device for target regions without device clause.
The argument shall be a nonnegative device number.
_C/C++_:
_Prototype_: `void omp_set_default_device(int device_num);'
_Fortran_:
_Interface_: `subroutine omp_set_default_device(device_num)'
`integer device_num'
_See also_:
*note OMP_DEFAULT_DEVICE::, *note omp_get_default_device::
_Reference_:
OpenMP specification v4.5 (http://www.openmp.org/), Section 3.2.29.
File: libgomp.info, Node: omp_set_dynamic, Next: omp_set_max_active_levels, Prev: omp_set_default_device, Up: Runtime Library Routines
2.25 `omp_set_dynamic' - Enable/disable dynamic teams
=====================================================
_Description_:
Enable or disable the dynamic adjustment of the number of threads
within a team. The function takes the language-specific equivalent
of `true' and `false', where `true' enables dynamic adjustment of
team sizes and `false' disables it.
_C/C++_:
_Prototype_: `void omp_set_dynamic(int dynamic_threads);'
_Fortran_:
_Interface_: `subroutine omp_set_dynamic(dynamic_threads)'
`logical, intent(in) :: dynamic_threads'
_See also_:
*note OMP_DYNAMIC::, *note omp_get_dynamic::
_Reference_:
OpenMP specification v4.5 (http://www.openmp.org/), Section 3.2.7.
File: libgomp.info, Node: omp_set_max_active_levels, Next: omp_set_nested, Prev: omp_set_dynamic, Up: Runtime Library Routines
2.26 `omp_set_max_active_levels' - Limits the number of active parallel regions
===============================================================================
_Description_:
This function limits the maximum allowed number of nested, active
parallel regions.
_C/C++_
_Prototype_: `void omp_set_max_active_levels(int max_levels);'
_Fortran_:
_Interface_: `subroutine omp_set_max_active_levels(max_levels)'
`integer max_levels'
_See also_:
*note omp_get_max_active_levels::, *note omp_get_active_level::
_Reference_:
OpenMP specification v4.5 (http://www.openmp.org/), Section 3.2.15.
File: libgomp.info, Node: omp_set_nested, Next: omp_set_num_threads, Prev: omp_set_max_active_levels, Up: Runtime Library Routines
2.27 `omp_set_nested' - Enable/disable nested parallel regions
==============================================================
_Description_:
Enable or disable nested parallel regions, i.e., whether team
members are allowed to create new teams. The function takes the
language-specific equivalent of `true' and `false', where `true'
enables dynamic adjustment of team sizes and `false' disables it.
_C/C++_:
_Prototype_: `void omp_set_nested(int nested);'
_Fortran_:
_Interface_: `subroutine omp_set_nested(nested)'
`logical, intent(in) :: nested'
_See also_:
*note OMP_NESTED::, *note omp_get_nested::
_Reference_:
OpenMP specification v4.5 (http://www.openmp.org/), Section 3.2.10.
File: libgomp.info, Node: omp_set_num_threads, Next: omp_set_schedule, Prev: omp_set_nested, Up: Runtime Library Routines
2.28 `omp_set_num_threads' - Set upper team size limit
======================================================
_Description_:
Specifies the number of threads used by default in subsequent
parallel sections, if those do not specify a `num_threads' clause.
The argument of `omp_set_num_threads' shall be a positive integer.
_C/C++_:
_Prototype_: `void omp_set_num_threads(int num_threads);'
_Fortran_:
_Interface_: `subroutine omp_set_num_threads(num_threads)'
`integer, intent(in) :: num_threads'
_See also_:
*note OMP_NUM_THREADS::, *note omp_get_num_threads::, *note
omp_get_max_threads::
_Reference_:
OpenMP specification v4.5 (http://www.openmp.org/), Section 3.2.1.
File: libgomp.info, Node: omp_set_schedule, Next: omp_init_lock, Prev: omp_set_num_threads, Up: Runtime Library Routines
2.29 `omp_set_schedule' - Set the runtime scheduling method
===========================================================
_Description_:
Sets the runtime scheduling method. The KIND argument can have the
value `omp_sched_static', `omp_sched_dynamic', `omp_sched_guided'
or `omp_sched_auto'. Except for `omp_sched_auto', the chunk size
is set to the value of CHUNK_SIZE if positive, or to the default
value if zero or negative. For `omp_sched_auto' the CHUNK_SIZE
argument is ignored.
_C/C++_
_Prototype_: `void omp_set_schedule(omp_sched_t kind, int
chunk_size);'
_Fortran_:
_Interface_: `subroutine omp_set_schedule(kind, chunk_size)'
`integer(kind=omp_sched_kind) kind'
`integer chunk_size'
_See also_:
*note omp_get_schedule:: *note OMP_SCHEDULE::
_Reference_:
OpenMP specification v4.5 (http://www.openmp.org/), Section 3.2.12.
File: libgomp.info, Node: omp_init_lock, Next: omp_set_lock, Prev: omp_set_schedule, Up: Runtime Library Routines
2.30 `omp_init_lock' - Initialize simple lock
=============================================
_Description_:
Initialize a simple lock. After initialization, the lock is in an
unlocked state.
_C/C++_:
_Prototype_: `void omp_init_lock(omp_lock_t *lock);'
_Fortran_:
_Interface_: `subroutine omp_init_lock(svar)'
`integer(omp_lock_kind), intent(out) :: svar'
_See also_:
*note omp_destroy_lock::
_Reference_:
OpenMP specification v4.5 (http://www.openmp.org/), Section 3.3.1.
File: libgomp.info, Node: omp_set_lock, Next: omp_test_lock, Prev: omp_init_lock, Up: Runtime Library Routines
2.31 `omp_set_lock' - Wait for and set simple lock
==================================================
_Description_:
Before setting a simple lock, the lock variable must be
initialized by `omp_init_lock'. The calling thread is blocked
until the lock is available. If the lock is already held by the
current thread, a deadlock occurs.
_C/C++_:
_Prototype_: `void omp_set_lock(omp_lock_t *lock);'
_Fortran_:
_Interface_: `subroutine omp_set_lock(svar)'
`integer(omp_lock_kind), intent(inout) :: svar'
_See also_:
*note omp_init_lock::, *note omp_test_lock::, *note
omp_unset_lock::
_Reference_:
OpenMP specification v4.5 (http://www.openmp.org/), Section 3.3.4.
File: libgomp.info, Node: omp_test_lock, Next: omp_unset_lock, Prev: omp_set_lock, Up: Runtime Library Routines
2.32 `omp_test_lock' - Test and set simple lock if available
============================================================
_Description_:
Before setting a simple lock, the lock variable must be
initialized by `omp_init_lock'. Contrary to `omp_set_lock',
`omp_test_lock' does not block if the lock is not available. This
function returns `true' upon success, `false' otherwise. Here,
`true' and `false' represent their language-specific counterparts.
_C/C++_:
_Prototype_: `int omp_test_lock(omp_lock_t *lock);'
_Fortran_:
_Interface_: `logical function omp_test_lock(svar)'
`integer(omp_lock_kind), intent(inout) :: svar'
_See also_:
*note omp_init_lock::, *note omp_set_lock::, *note omp_set_lock::
_Reference_:
OpenMP specification v4.5 (http://www.openmp.org/), Section 3.3.6.
File: libgomp.info, Node: omp_unset_lock, Next: omp_destroy_lock, Prev: omp_test_lock, Up: Runtime Library Routines
2.33 `omp_unset_lock' - Unset simple lock
=========================================
_Description_:
A simple lock about to be unset must have been locked by
`omp_set_lock' or `omp_test_lock' before. In addition, the lock
must be held by the thread calling `omp_unset_lock'. Then, the
lock becomes unlocked. If one or more threads attempted to set
the lock before, one of them is chosen to, again, set the lock to
itself.
_C/C++_:
_Prototype_: `void omp_unset_lock(omp_lock_t *lock);'
_Fortran_:
_Interface_: `subroutine omp_unset_lock(svar)'
`integer(omp_lock_kind), intent(inout) :: svar'
_See also_:
*note omp_set_lock::, *note omp_test_lock::
_Reference_:
OpenMP specification v4.5 (http://www.openmp.org/), Section 3.3.5.
File: libgomp.info, Node: omp_destroy_lock, Next: omp_init_nest_lock, Prev: omp_unset_lock, Up: Runtime Library Routines
2.34 `omp_destroy_lock' - Destroy simple lock
=============================================
_Description_:
Destroy a simple lock. In order to be destroyed, a simple lock
must be in the unlocked state.
_C/C++_:
_Prototype_: `void omp_destroy_lock(omp_lock_t *lock);'
_Fortran_:
_Interface_: `subroutine omp_destroy_lock(svar)'
`integer(omp_lock_kind), intent(inout) :: svar'
_See also_:
*note omp_init_lock::
_Reference_:
OpenMP specification v4.5 (http://www.openmp.org/), Section 3.3.3.
File: libgomp.info, Node: omp_init_nest_lock, Next: omp_set_nest_lock, Prev: omp_destroy_lock, Up: Runtime Library Routines
2.35 `omp_init_nest_lock' - Initialize nested lock
==================================================
_Description_:
Initialize a nested lock. After initialization, the lock is in an
unlocked state and the nesting count is set to zero.
_C/C++_:
_Prototype_: `void omp_init_nest_lock(omp_nest_lock_t *lock);'
_Fortran_:
_Interface_: `subroutine omp_init_nest_lock(nvar)'