]> git.ipfire.org Git - thirdparty/gcc.git/blame - libgomp/libgomp.texi
libstdc++: Define noop coroutine details private and inline [PR 95917]
[thirdparty/gcc.git] / libgomp / libgomp.texi
CommitLineData
3721b9e1
DF
1\input texinfo @c -*-texinfo-*-
2
3@c %**start of header
4@setfilename libgomp.info
5@settitle GNU libgomp
6@c %**end of header
7
8
9@copying
7e7065b9 10Copyright @copyright{} 2006-2020 Free Software Foundation, Inc.
3721b9e1
DF
11
12Permission is granted to copy, distribute and/or modify this document
07a67d6a 13under the terms of the GNU Free Documentation License, Version 1.3 or
3721b9e1 14any later version published by the Free Software Foundation; with the
70b1e376 15Invariant Sections being ``Funding Free Software'', the Front-Cover
3721b9e1
DF
16texts being (a) (see below), and with the Back-Cover Texts being (b)
17(see below). A copy of the license is included in the section entitled
18``GNU Free Documentation License''.
19
20(a) The FSF's Front-Cover Text is:
21
22 A GNU Manual
23
24(b) The FSF's Back-Cover Text is:
25
26 You have freedom to copy and modify this GNU Manual, like GNU
27 software. Copies published by the Free Software Foundation raise
28 funds for GNU development.
29@end copying
30
31@ifinfo
32@dircategory GNU Libraries
33@direntry
f1f3453e 34* libgomp: (libgomp). GNU Offloading and Multi Processing Runtime Library.
3721b9e1
DF
35@end direntry
36
f1f3453e 37This manual documents libgomp, the GNU Offloading and Multi Processing
41dbbb37
TS
38Runtime library. This is the GNU implementation of the OpenMP and
39OpenACC APIs for parallel and accelerator programming in C/C++ and
40Fortran.
3721b9e1
DF
41
42Published by the Free Software Foundation
4351 Franklin Street, Fifth Floor
44Boston, MA 02110-1301 USA
45
46@insertcopying
47@end ifinfo
48
49
50@setchapternewpage odd
51
52@titlepage
f1f3453e 53@title GNU Offloading and Multi Processing Runtime Library
41dbbb37 54@subtitle The GNU OpenMP and OpenACC Implementation
3721b9e1
DF
55@page
56@vskip 0pt plus 1filll
57@comment For the @value{version-GCC} Version*
58@sp 1
59Published by the Free Software Foundation @*
6051 Franklin Street, Fifth Floor@*
61Boston, MA 02110-1301, USA@*
62@sp 1
63@insertcopying
64@end titlepage
65
66@summarycontents
67@contents
68@page
69
70
71@node Top
72@top Introduction
73@cindex Introduction
74
f1f3453e 75This manual documents the usage of libgomp, the GNU Offloading and
41dbbb37 76Multi Processing Runtime Library. This includes the GNU
1a6d1d24 77implementation of the @uref{https://www.openmp.org, OpenMP} Application
41dbbb37
TS
78Programming Interface (API) for multi-platform shared-memory parallel
79programming in C/C++ and Fortran, and the GNU implementation of the
9651fbaf 80@uref{https://www.openacc.org, OpenACC} Application Programming
41dbbb37
TS
81Interface (API) for offloading of code to accelerator devices in C/C++
82and Fortran.
3721b9e1 83
41dbbb37
TS
84Originally, libgomp implemented the GNU OpenMP Runtime Library. Based
85on this, support for OpenACC and offloading (both OpenACC and OpenMP
864's target construct) has been added later on, and the library's name
87changed to GNU Offloading and Multi Processing Runtime Library.
f1f3453e 88
3721b9e1
DF
89
90
91@comment
92@comment When you add a new menu item, please keep the right hand
93@comment aligned to the same column. Do not use tabs. This provides
94@comment better formatting.
95@comment
96@menu
97* Enabling OpenMP:: How to enable OpenMP for your applications.
4102bda6
TS
98* OpenMP Runtime Library Routines: Runtime Library Routines.
99 The OpenMP runtime application programming
3721b9e1 100 interface.
4102bda6
TS
101* OpenMP Environment Variables: Environment Variables.
102 Influencing OpenMP runtime behavior with
103 environment variables.
cdf6119d
JN
104* Enabling OpenACC:: How to enable OpenACC for your
105 applications.
106* OpenACC Runtime Library Routines:: The OpenACC runtime application
107 programming interface.
108* OpenACC Environment Variables:: Influencing OpenACC runtime behavior with
109 environment variables.
110* CUDA Streams Usage:: Notes on the implementation of
111 asynchronous operations.
112* OpenACC Library Interoperability:: OpenACC library interoperability with the
113 NVIDIA CUBLAS library.
5fae049d 114* OpenACC Profiling Interface::
3721b9e1 115* The libgomp ABI:: Notes on the external ABI presented by libgomp.
f1f3453e
TS
116* Reporting Bugs:: How to report bugs in the GNU Offloading and
117 Multi Processing Runtime Library.
3721b9e1
DF
118* Copying:: GNU general public license says
119 how you can copy and share libgomp.
120* GNU Free Documentation License::
121 How you can copy and share this manual.
122* Funding:: How to help assure continued work for free
123 software.
3d3949df 124* Library Index:: Index of this documentation.
3721b9e1
DF
125@end menu
126
127
128@c ---------------------------------------------------------------------
129@c Enabling OpenMP
130@c ---------------------------------------------------------------------
131
132@node Enabling OpenMP
133@chapter Enabling OpenMP
134
135To activate the OpenMP extensions for C/C++ and Fortran, the compile-time
83fd6c5b 136flag @command{-fopenmp} must be specified. This enables the OpenMP directive
3721b9e1
DF
137@code{#pragma omp} in C/C++ and @code{!$omp} directives in free form,
138@code{c$omp}, @code{*$omp} and @code{!$omp} directives in fixed form,
139@code{!$} conditional compilation sentinels in free form and @code{c$},
83fd6c5b 140@code{*$} and @code{!$} sentinels in fixed form, for Fortran. The flag also
3721b9e1
DF
141arranges for automatic linking of the OpenMP runtime library
142(@ref{Runtime Library Routines}).
143
144A complete description of all OpenMP directives accepted may be found in
1a6d1d24 145the @uref{https://www.openmp.org, OpenMP Application Program Interface} manual,
00b9bd52 146version 4.5.
3721b9e1
DF
147
148
149@c ---------------------------------------------------------------------
4102bda6 150@c OpenMP Runtime Library Routines
3721b9e1
DF
151@c ---------------------------------------------------------------------
152
153@node Runtime Library Routines
4102bda6 154@chapter OpenMP Runtime Library Routines
3721b9e1 155
83fd6c5b 156The runtime routines described here are defined by Section 3 of the OpenMP
00b9bd52 157specification in version 4.5. The routines are structured in following
5c6ed53a 158three parts:
3721b9e1 159
72832460 160@menu
83fd6c5b
TB
161Control threads, processors and the parallel environment. They have C
162linkage, and do not throw exceptions.
f5745bed 163
5c6ed53a
TB
164* omp_get_active_level:: Number of active parallel regions
165* omp_get_ancestor_thread_num:: Ancestor thread ID
83fd6c5b
TB
166* omp_get_cancellation:: Whether cancellation support is enabled
167* omp_get_default_device:: Get the default device for target regions
5c6ed53a
TB
168* omp_get_dynamic:: Dynamic teams setting
169* omp_get_level:: Number of parallel regions
445567b2 170* omp_get_max_active_levels:: Current maximum number of active regions
d9a6bd32 171* omp_get_max_task_priority:: Maximum task priority value that can be set
6a2ba183 172* omp_get_max_threads:: Maximum number of threads of parallel region
5c6ed53a 173* omp_get_nested:: Nested parallel regions
83fd6c5b 174* omp_get_num_devices:: Number of target devices
5c6ed53a 175* omp_get_num_procs:: Number of processors online
83fd6c5b 176* omp_get_num_teams:: Number of teams
5c6ed53a 177* omp_get_num_threads:: Size of the active team
83fd6c5b 178* omp_get_proc_bind:: Whether theads may be moved between CPUs
5c6ed53a 179* omp_get_schedule:: Obtain the runtime scheduling method
445567b2 180* omp_get_supported_active_levels:: Maximum number of active regions supported
83fd6c5b 181* omp_get_team_num:: Get team number
5c6ed53a 182* omp_get_team_size:: Number of threads in a team
6a2ba183 183* omp_get_thread_limit:: Maximum number of threads
5c6ed53a
TB
184* omp_get_thread_num:: Current thread ID
185* omp_in_parallel:: Whether a parallel region is active
20906c66 186* omp_in_final:: Whether in final or included task region
83fd6c5b
TB
187* omp_is_initial_device:: Whether executing on the host device
188* omp_set_default_device:: Set the default device for target regions
5c6ed53a
TB
189* omp_set_dynamic:: Enable/disable dynamic teams
190* omp_set_max_active_levels:: Limits the number of active parallel regions
191* omp_set_nested:: Enable/disable nested parallel regions
192* omp_set_num_threads:: Set upper team size limit
193* omp_set_schedule:: Set the runtime scheduling method
3721b9e1
DF
194
195Initialize, set, test, unset and destroy simple and nested locks.
196
3721b9e1
DF
197* omp_init_lock:: Initialize simple lock
198* omp_set_lock:: Wait for and set simple lock
199* omp_test_lock:: Test and set simple lock if available
200* omp_unset_lock:: Unset simple lock
201* omp_destroy_lock:: Destroy simple lock
202* omp_init_nest_lock:: Initialize nested lock
203* omp_set_nest_lock:: Wait for and set simple lock
204* omp_test_nest_lock:: Test and set nested lock if available
205* omp_unset_nest_lock:: Unset nested lock
206* omp_destroy_nest_lock:: Destroy nested lock
3721b9e1
DF
207
208Portable, thread-based, wall clock timer.
209
3721b9e1
DF
210* omp_get_wtick:: Get timer precision.
211* omp_get_wtime:: Elapsed wall clock time.
212@end menu
213
5c6ed53a
TB
214
215
216@node omp_get_active_level
217@section @code{omp_get_active_level} -- Number of parallel regions
218@table @asis
219@item @emph{Description}:
220This function returns the nesting level for the active parallel blocks,
221which enclose the calling call.
222
223@item @emph{C/C++}
224@multitable @columnfractions .20 .80
6a2ba183 225@item @emph{Prototype}: @tab @code{int omp_get_active_level(void);}
5c6ed53a
TB
226@end multitable
227
228@item @emph{Fortran}:
229@multitable @columnfractions .20 .80
acb5c916 230@item @emph{Interface}: @tab @code{integer function omp_get_active_level()}
5c6ed53a
TB
231@end multitable
232
233@item @emph{See also}:
234@ref{omp_get_level}, @ref{omp_get_max_active_levels}, @ref{omp_set_max_active_levels}
235
236@item @emph{Reference}:
1a6d1d24 237@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.20.
5c6ed53a
TB
238@end table
239
240
241
242@node omp_get_ancestor_thread_num
243@section @code{omp_get_ancestor_thread_num} -- Ancestor thread ID
244@table @asis
245@item @emph{Description}:
246This function returns the thread identification number for the given
83fd6c5b 247nesting level of the current thread. For values of @var{level} outside
5c6ed53a
TB
248zero to @code{omp_get_level} -1 is returned; if @var{level} is
249@code{omp_get_level} the result is identical to @code{omp_get_thread_num}.
250
251@item @emph{C/C++}
252@multitable @columnfractions .20 .80
253@item @emph{Prototype}: @tab @code{int omp_get_ancestor_thread_num(int level);}
254@end multitable
255
256@item @emph{Fortran}:
257@multitable @columnfractions .20 .80
acb5c916 258@item @emph{Interface}: @tab @code{integer function omp_get_ancestor_thread_num(level)}
5c6ed53a
TB
259@item @tab @code{integer level}
260@end multitable
261
262@item @emph{See also}:
263@ref{omp_get_level}, @ref{omp_get_thread_num}, @ref{omp_get_team_size}
264
265@item @emph{Reference}:
1a6d1d24 266@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.18.
83fd6c5b
TB
267@end table
268
269
270
271@node omp_get_cancellation
272@section @code{omp_get_cancellation} -- Whether cancellation support is enabled
273@table @asis
274@item @emph{Description}:
275This function returns @code{true} if cancellation is activated, @code{false}
276otherwise. Here, @code{true} and @code{false} represent their language-specific
277counterparts. Unless @env{OMP_CANCELLATION} is set true, cancellations are
278deactivated.
279
280@item @emph{C/C++}:
281@multitable @columnfractions .20 .80
282@item @emph{Prototype}: @tab @code{int omp_get_cancellation(void);}
283@end multitable
284
285@item @emph{Fortran}:
286@multitable @columnfractions .20 .80
287@item @emph{Interface}: @tab @code{logical function omp_get_cancellation()}
288@end multitable
289
290@item @emph{See also}:
291@ref{OMP_CANCELLATION}
292
293@item @emph{Reference}:
1a6d1d24 294@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.9.
83fd6c5b
TB
295@end table
296
297
298
299@node omp_get_default_device
300@section @code{omp_get_default_device} -- Get the default device for target regions
301@table @asis
302@item @emph{Description}:
303Get the default device for target regions without device clause.
304
305@item @emph{C/C++}:
306@multitable @columnfractions .20 .80
307@item @emph{Prototype}: @tab @code{int omp_get_default_device(void);}
308@end multitable
309
310@item @emph{Fortran}:
311@multitable @columnfractions .20 .80
312@item @emph{Interface}: @tab @code{integer function omp_get_default_device()}
313@end multitable
314
315@item @emph{See also}:
316@ref{OMP_DEFAULT_DEVICE}, @ref{omp_set_default_device}
317
318@item @emph{Reference}:
1a6d1d24 319@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.30.
5c6ed53a
TB
320@end table
321
322
323
3721b9e1
DF
324@node omp_get_dynamic
325@section @code{omp_get_dynamic} -- Dynamic teams setting
326@table @asis
327@item @emph{Description}:
328This function returns @code{true} if enabled, @code{false} otherwise.
329Here, @code{true} and @code{false} represent their language-specific
330counterparts.
331
14734fc7 332The dynamic team setting may be initialized at startup by the
83fd6c5b
TB
333@env{OMP_DYNAMIC} environment variable or at runtime using
334@code{omp_set_dynamic}. If undefined, dynamic adjustment is
14734fc7
DF
335disabled by default.
336
3721b9e1
DF
337@item @emph{C/C++}:
338@multitable @columnfractions .20 .80
6a2ba183 339@item @emph{Prototype}: @tab @code{int omp_get_dynamic(void);}
3721b9e1
DF
340@end multitable
341
342@item @emph{Fortran}:
343@multitable @columnfractions .20 .80
344@item @emph{Interface}: @tab @code{logical function omp_get_dynamic()}
345@end multitable
346
347@item @emph{See also}:
14734fc7 348@ref{omp_set_dynamic}, @ref{OMP_DYNAMIC}
3721b9e1
DF
349
350@item @emph{Reference}:
1a6d1d24 351@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.8.
5c6ed53a
TB
352@end table
353
354
355
356@node omp_get_level
357@section @code{omp_get_level} -- Obtain the current nesting level
358@table @asis
359@item @emph{Description}:
360This function returns the nesting level for the parallel blocks,
361which enclose the calling call.
362
363@item @emph{C/C++}
364@multitable @columnfractions .20 .80
6a2ba183 365@item @emph{Prototype}: @tab @code{int omp_get_level(void);}
5c6ed53a
TB
366@end multitable
367
368@item @emph{Fortran}:
369@multitable @columnfractions .20 .80
acb5c916 370@item @emph{Interface}: @tab @code{integer function omp_level()}
5c6ed53a
TB
371@end multitable
372
373@item @emph{See also}:
374@ref{omp_get_active_level}
375
376@item @emph{Reference}:
1a6d1d24 377@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.17.
5c6ed53a
TB
378@end table
379
380
381
382@node omp_get_max_active_levels
445567b2 383@section @code{omp_get_max_active_levels} -- Current maximum number of active regions
5c6ed53a
TB
384@table @asis
385@item @emph{Description}:
6a2ba183 386This function obtains the maximum allowed number of nested, active parallel regions.
5c6ed53a
TB
387
388@item @emph{C/C++}
389@multitable @columnfractions .20 .80
6a2ba183 390@item @emph{Prototype}: @tab @code{int omp_get_max_active_levels(void);}
5c6ed53a
TB
391@end multitable
392
393@item @emph{Fortran}:
394@multitable @columnfractions .20 .80
acb5c916 395@item @emph{Interface}: @tab @code{integer function omp_get_max_active_levels()}
5c6ed53a
TB
396@end multitable
397
398@item @emph{See also}:
399@ref{omp_set_max_active_levels}, @ref{omp_get_active_level}
400
401@item @emph{Reference}:
1a6d1d24 402@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.16.
3721b9e1
DF
403@end table
404
405
d9a6bd32
JJ
406@node omp_get_max_task_priority
407@section @code{omp_get_max_task_priority} -- Maximum priority value
408that can be set for tasks.
409@table @asis
410@item @emph{Description}:
411This function obtains the maximum allowed priority number for tasks.
412
413@item @emph{C/C++}
414@multitable @columnfractions .20 .80
415@item @emph{Prototype}: @tab @code{int omp_get_max_task_priority(void);}
416@end multitable
417
418@item @emph{Fortran}:
419@multitable @columnfractions .20 .80
420@item @emph{Interface}: @tab @code{integer function omp_get_max_task_priority()}
421@end multitable
422
423@item @emph{Reference}:
1a6d1d24 424@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.29.
d9a6bd32
JJ
425@end table
426
3721b9e1
DF
427
428@node omp_get_max_threads
6a2ba183 429@section @code{omp_get_max_threads} -- Maximum number of threads of parallel region
3721b9e1
DF
430@table @asis
431@item @emph{Description}:
6a2ba183 432Return the maximum number of threads used for the current parallel region
5c6ed53a 433that does not use the clause @code{num_threads}.
3721b9e1
DF
434
435@item @emph{C/C++}:
436@multitable @columnfractions .20 .80
6a2ba183 437@item @emph{Prototype}: @tab @code{int omp_get_max_threads(void);}
3721b9e1
DF
438@end multitable
439
440@item @emph{Fortran}:
441@multitable @columnfractions .20 .80
442@item @emph{Interface}: @tab @code{integer function omp_get_max_threads()}
443@end multitable
444
445@item @emph{See also}:
5c6ed53a 446@ref{omp_set_num_threads}, @ref{omp_set_dynamic}, @ref{omp_get_thread_limit}
3721b9e1
DF
447
448@item @emph{Reference}:
1a6d1d24 449@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.3.
3721b9e1
DF
450@end table
451
452
453
454@node omp_get_nested
455@section @code{omp_get_nested} -- Nested parallel regions
456@table @asis
457@item @emph{Description}:
458This function returns @code{true} if nested parallel regions are
83fd6c5b 459enabled, @code{false} otherwise. Here, @code{true} and @code{false}
3721b9e1
DF
460represent their language-specific counterparts.
461
14734fc7 462Nested parallel regions may be initialized at startup by the
83fd6c5b
TB
463@env{OMP_NESTED} environment variable or at runtime using
464@code{omp_set_nested}. If undefined, nested parallel regions are
14734fc7
DF
465disabled by default.
466
3721b9e1
DF
467@item @emph{C/C++}:
468@multitable @columnfractions .20 .80
6a2ba183 469@item @emph{Prototype}: @tab @code{int omp_get_nested(void);}
3721b9e1
DF
470@end multitable
471
472@item @emph{Fortran}:
473@multitable @columnfractions .20 .80
87350d4a 474@item @emph{Interface}: @tab @code{logical function omp_get_nested()}
3721b9e1
DF
475@end multitable
476
477@item @emph{See also}:
14734fc7 478@ref{omp_set_nested}, @ref{OMP_NESTED}
3721b9e1
DF
479
480@item @emph{Reference}:
1a6d1d24 481@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.11.
83fd6c5b
TB
482@end table
483
484
485
486@node omp_get_num_devices
487@section @code{omp_get_num_devices} -- Number of target devices
488@table @asis
489@item @emph{Description}:
490Returns the number of target devices.
491
492@item @emph{C/C++}:
493@multitable @columnfractions .20 .80
494@item @emph{Prototype}: @tab @code{int omp_get_num_devices(void);}
495@end multitable
496
497@item @emph{Fortran}:
498@multitable @columnfractions .20 .80
499@item @emph{Interface}: @tab @code{integer function omp_get_num_devices()}
500@end multitable
501
502@item @emph{Reference}:
1a6d1d24 503@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.31.
3721b9e1
DF
504@end table
505
506
507
508@node omp_get_num_procs
509@section @code{omp_get_num_procs} -- Number of processors online
510@table @asis
511@item @emph{Description}:
83fd6c5b 512Returns the number of processors online on that device.
3721b9e1
DF
513
514@item @emph{C/C++}:
515@multitable @columnfractions .20 .80
6a2ba183 516@item @emph{Prototype}: @tab @code{int omp_get_num_procs(void);}
3721b9e1
DF
517@end multitable
518
519@item @emph{Fortran}:
520@multitable @columnfractions .20 .80
521@item @emph{Interface}: @tab @code{integer function omp_get_num_procs()}
522@end multitable
523
524@item @emph{Reference}:
1a6d1d24 525@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.5.
83fd6c5b
TB
526@end table
527
528
529
530@node omp_get_num_teams
531@section @code{omp_get_num_teams} -- Number of teams
532@table @asis
533@item @emph{Description}:
534Returns the number of teams in the current team region.
535
536@item @emph{C/C++}:
537@multitable @columnfractions .20 .80
538@item @emph{Prototype}: @tab @code{int omp_get_num_teams(void);}
539@end multitable
540
541@item @emph{Fortran}:
542@multitable @columnfractions .20 .80
543@item @emph{Interface}: @tab @code{integer function omp_get_num_teams()}
544@end multitable
545
546@item @emph{Reference}:
1a6d1d24 547@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.32.
3721b9e1
DF
548@end table
549
550
551
552@node omp_get_num_threads
553@section @code{omp_get_num_threads} -- Size of the active team
554@table @asis
555@item @emph{Description}:
83fd6c5b 556Returns the number of threads in the current team. In a sequential section of
3721b9e1
DF
557the program @code{omp_get_num_threads} returns 1.
558
14734fc7 559The default team size may be initialized at startup by the
83fd6c5b 560@env{OMP_NUM_THREADS} environment variable. At runtime, the size
14734fc7 561of the current team may be set either by the @code{NUM_THREADS}
83fd6c5b
TB
562clause or by @code{omp_set_num_threads}. If none of the above were
563used to define a specific value and @env{OMP_DYNAMIC} is disabled,
14734fc7
DF
564one thread per CPU online is used.
565
3721b9e1
DF
566@item @emph{C/C++}:
567@multitable @columnfractions .20 .80
6a2ba183 568@item @emph{Prototype}: @tab @code{int omp_get_num_threads(void);}
3721b9e1
DF
569@end multitable
570
571@item @emph{Fortran}:
572@multitable @columnfractions .20 .80
573@item @emph{Interface}: @tab @code{integer function omp_get_num_threads()}
574@end multitable
575
576@item @emph{See also}:
577@ref{omp_get_max_threads}, @ref{omp_set_num_threads}, @ref{OMP_NUM_THREADS}
578
579@item @emph{Reference}:
1a6d1d24 580@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.2.
83fd6c5b
TB
581@end table
582
583
584
585@node omp_get_proc_bind
586@section @code{omp_get_proc_bind} -- Whether theads may be moved between CPUs
587@table @asis
588@item @emph{Description}:
589This functions returns the currently active thread affinity policy, which is
590set via @env{OMP_PROC_BIND}. Possible values are @code{omp_proc_bind_false},
591@code{omp_proc_bind_true}, @code{omp_proc_bind_master},
592@code{omp_proc_bind_close} and @code{omp_proc_bind_spread}.
593
594@item @emph{C/C++}:
595@multitable @columnfractions .20 .80
596@item @emph{Prototype}: @tab @code{omp_proc_bind_t omp_get_proc_bind(void);}
597@end multitable
598
599@item @emph{Fortran}:
600@multitable @columnfractions .20 .80
601@item @emph{Interface}: @tab @code{integer(kind=omp_proc_bind_kind) function omp_get_proc_bind()}
602@end multitable
603
604@item @emph{See also}:
605@ref{OMP_PROC_BIND}, @ref{OMP_PLACES}, @ref{GOMP_CPU_AFFINITY},
606
607@item @emph{Reference}:
1a6d1d24 608@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.22.
5c6ed53a
TB
609@end table
610
611
612
613@node omp_get_schedule
614@section @code{omp_get_schedule} -- Obtain the runtime scheduling method
615@table @asis
616@item @emph{Description}:
83fd6c5b 617Obtain the runtime scheduling method. The @var{kind} argument will be
5c6ed53a 618set to the value @code{omp_sched_static}, @code{omp_sched_dynamic},
83fd6c5b 619@code{omp_sched_guided} or @code{omp_sched_auto}. The second argument,
d9a6bd32 620@var{chunk_size}, is set to the chunk size.
5c6ed53a
TB
621
622@item @emph{C/C++}
623@multitable @columnfractions .20 .80
d9a6bd32 624@item @emph{Prototype}: @tab @code{void omp_get_schedule(omp_sched_t *kind, int *chunk_size);}
5c6ed53a
TB
625@end multitable
626
627@item @emph{Fortran}:
628@multitable @columnfractions .20 .80
d9a6bd32 629@item @emph{Interface}: @tab @code{subroutine omp_get_schedule(kind, chunk_size)}
5c6ed53a 630@item @tab @code{integer(kind=omp_sched_kind) kind}
d9a6bd32 631@item @tab @code{integer chunk_size}
5c6ed53a
TB
632@end multitable
633
634@item @emph{See also}:
635@ref{omp_set_schedule}, @ref{OMP_SCHEDULE}
636
637@item @emph{Reference}:
1a6d1d24 638@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.13.
83fd6c5b
TB
639@end table
640
641
8949b985
KCY
642@node omp_get_supported_active_levels
643@section @code{omp_get_supported_active_levels} -- Maximum number of active regions supported
644@table @asis
645@item @emph{Description}:
646This function returns the maximum number of nested, active parallel regions
647supported by this implementation.
648
649@item @emph{C/C++}
650@multitable @columnfractions .20 .80
651@item @emph{Prototype}: @tab @code{int omp_get_supported_active_levels(void);}
652@end multitable
653
654@item @emph{Fortran}:
655@multitable @columnfractions .20 .80
656@item @emph{Interface}: @tab @code{integer function omp_get_supported_active_levels()}
657@end multitable
658
659@item @emph{See also}:
660@ref{omp_get_max_active_levels}, @ref{omp_set_max_active_levels}
661
662@item @emph{Reference}:
663@uref{https://www.openmp.org, OpenMP specification v5.0}, Section 3.2.15.
664@end table
665
666
83fd6c5b
TB
667
668@node omp_get_team_num
669@section @code{omp_get_team_num} -- Get team number
670@table @asis
671@item @emph{Description}:
672Returns the team number of the calling thread.
673
674@item @emph{C/C++}:
675@multitable @columnfractions .20 .80
676@item @emph{Prototype}: @tab @code{int omp_get_team_num(void);}
677@end multitable
678
679@item @emph{Fortran}:
680@multitable @columnfractions .20 .80
681@item @emph{Interface}: @tab @code{integer function omp_get_team_num()}
682@end multitable
683
684@item @emph{Reference}:
1a6d1d24 685@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.33.
5c6ed53a
TB
686@end table
687
688
689
690@node omp_get_team_size
691@section @code{omp_get_team_size} -- Number of threads in a team
692@table @asis
693@item @emph{Description}:
694This function returns the number of threads in a thread team to which
83fd6c5b 695either the current thread or its ancestor belongs. For values of @var{level}
6a2ba183
AH
696outside zero to @code{omp_get_level}, -1 is returned; if @var{level} is zero,
6971 is returned, and for @code{omp_get_level}, the result is identical
5c6ed53a
TB
698to @code{omp_get_num_threads}.
699
700@item @emph{C/C++}:
701@multitable @columnfractions .20 .80
6a2ba183 702@item @emph{Prototype}: @tab @code{int omp_get_team_size(int level);}
5c6ed53a
TB
703@end multitable
704
705@item @emph{Fortran}:
706@multitable @columnfractions .20 .80
707@item @emph{Interface}: @tab @code{integer function omp_get_team_size(level)}
708@item @tab @code{integer level}
709@end multitable
710
711@item @emph{See also}:
712@ref{omp_get_num_threads}, @ref{omp_get_level}, @ref{omp_get_ancestor_thread_num}
713
714@item @emph{Reference}:
1a6d1d24 715@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.19.
5c6ed53a
TB
716@end table
717
718
719
720@node omp_get_thread_limit
6a2ba183 721@section @code{omp_get_thread_limit} -- Maximum number of threads
5c6ed53a
TB
722@table @asis
723@item @emph{Description}:
6a2ba183 724Return the maximum number of threads of the program.
5c6ed53a
TB
725
726@item @emph{C/C++}:
727@multitable @columnfractions .20 .80
6a2ba183 728@item @emph{Prototype}: @tab @code{int omp_get_thread_limit(void);}
5c6ed53a
TB
729@end multitable
730
731@item @emph{Fortran}:
732@multitable @columnfractions .20 .80
733@item @emph{Interface}: @tab @code{integer function omp_get_thread_limit()}
734@end multitable
735
736@item @emph{See also}:
737@ref{omp_get_max_threads}, @ref{OMP_THREAD_LIMIT}
738
739@item @emph{Reference}:
1a6d1d24 740@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.14.
3721b9e1
DF
741@end table
742
743
744
83fd6c5b 745@node omp_get_thread_num
3721b9e1
DF
746@section @code{omp_get_thread_num} -- Current thread ID
747@table @asis
748@item @emph{Description}:
6a2ba183 749Returns a unique thread identification number within the current team.
5c6ed53a 750In a sequential parts of the program, @code{omp_get_thread_num}
83fd6c5b
TB
751always returns 0. In parallel regions the return value varies
752from 0 to @code{omp_get_num_threads}-1 inclusive. The return
3721b9e1
DF
753value of the master thread of a team is always 0.
754
755@item @emph{C/C++}:
756@multitable @columnfractions .20 .80
6a2ba183 757@item @emph{Prototype}: @tab @code{int omp_get_thread_num(void);}
3721b9e1
DF
758@end multitable
759
760@item @emph{Fortran}:
761@multitable @columnfractions .20 .80
762@item @emph{Interface}: @tab @code{integer function omp_get_thread_num()}
763@end multitable
764
765@item @emph{See also}:
5c6ed53a 766@ref{omp_get_num_threads}, @ref{omp_get_ancestor_thread_num}
3721b9e1
DF
767
768@item @emph{Reference}:
1a6d1d24 769@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.4.
3721b9e1
DF
770@end table
771
772
773
774@node omp_in_parallel
775@section @code{omp_in_parallel} -- Whether a parallel region is active
776@table @asis
777@item @emph{Description}:
83fd6c5b
TB
778This function returns @code{true} if currently running in parallel,
779@code{false} otherwise. Here, @code{true} and @code{false} represent
3721b9e1
DF
780their language-specific counterparts.
781
782@item @emph{C/C++}:
783@multitable @columnfractions .20 .80
6a2ba183 784@item @emph{Prototype}: @tab @code{int omp_in_parallel(void);}
3721b9e1
DF
785@end multitable
786
787@item @emph{Fortran}:
788@multitable @columnfractions .20 .80
789@item @emph{Interface}: @tab @code{logical function omp_in_parallel()}
790@end multitable
791
792@item @emph{Reference}:
1a6d1d24 793@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.6.
20906c66
JJ
794@end table
795
796
797@node omp_in_final
798@section @code{omp_in_final} -- Whether in final or included task region
799@table @asis
800@item @emph{Description}:
801This function returns @code{true} if currently running in a final
83fd6c5b 802or included task region, @code{false} otherwise. Here, @code{true}
20906c66
JJ
803and @code{false} represent their language-specific counterparts.
804
805@item @emph{C/C++}:
806@multitable @columnfractions .20 .80
807@item @emph{Prototype}: @tab @code{int omp_in_final(void);}
808@end multitable
809
810@item @emph{Fortran}:
811@multitable @columnfractions .20 .80
812@item @emph{Interface}: @tab @code{logical function omp_in_final()}
813@end multitable
814
815@item @emph{Reference}:
1a6d1d24 816@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.21.
3721b9e1
DF
817@end table
818
819
83fd6c5b
TB
820
821@node omp_is_initial_device
822@section @code{omp_is_initial_device} -- Whether executing on the host device
823@table @asis
824@item @emph{Description}:
825This function returns @code{true} if currently running on the host device,
826@code{false} otherwise. Here, @code{true} and @code{false} represent
827their language-specific counterparts.
828
829@item @emph{C/C++}:
830@multitable @columnfractions .20 .80
831@item @emph{Prototype}: @tab @code{int omp_is_initial_device(void);}
832@end multitable
833
834@item @emph{Fortran}:
835@multitable @columnfractions .20 .80
836@item @emph{Interface}: @tab @code{logical function omp_is_initial_device()}
837@end multitable
838
839@item @emph{Reference}:
1a6d1d24 840@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.34.
83fd6c5b
TB
841@end table
842
843
844
845@node omp_set_default_device
846@section @code{omp_set_default_device} -- Set the default device for target regions
847@table @asis
848@item @emph{Description}:
849Set the default device for target regions without device clause. The argument
850shall be a nonnegative device number.
851
852@item @emph{C/C++}:
853@multitable @columnfractions .20 .80
854@item @emph{Prototype}: @tab @code{void omp_set_default_device(int device_num);}
855@end multitable
856
857@item @emph{Fortran}:
858@multitable @columnfractions .20 .80
859@item @emph{Interface}: @tab @code{subroutine omp_set_default_device(device_num)}
860@item @tab @code{integer device_num}
861@end multitable
862
863@item @emph{See also}:
864@ref{OMP_DEFAULT_DEVICE}, @ref{omp_get_default_device}
865
866@item @emph{Reference}:
1a6d1d24 867@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.29.
83fd6c5b
TB
868@end table
869
870
871
3721b9e1
DF
872@node omp_set_dynamic
873@section @code{omp_set_dynamic} -- Enable/disable dynamic teams
874@table @asis
875@item @emph{Description}:
876Enable or disable the dynamic adjustment of the number of threads
83fd6c5b 877within a team. The function takes the language-specific equivalent
3721b9e1
DF
878of @code{true} and @code{false}, where @code{true} enables dynamic
879adjustment of team sizes and @code{false} disables it.
880
881@item @emph{C/C++}:
882@multitable @columnfractions .20 .80
4fed6b25 883@item @emph{Prototype}: @tab @code{void omp_set_dynamic(int dynamic_threads);}
3721b9e1
DF
884@end multitable
885
886@item @emph{Fortran}:
887@multitable @columnfractions .20 .80
4fed6b25
TB
888@item @emph{Interface}: @tab @code{subroutine omp_set_dynamic(dynamic_threads)}
889@item @tab @code{logical, intent(in) :: dynamic_threads}
3721b9e1
DF
890@end multitable
891
892@item @emph{See also}:
893@ref{OMP_DYNAMIC}, @ref{omp_get_dynamic}
894
895@item @emph{Reference}:
1a6d1d24 896@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.7.
5c6ed53a
TB
897@end table
898
899
900
901@node omp_set_max_active_levels
902@section @code{omp_set_max_active_levels} -- Limits the number of active parallel regions
903@table @asis
904@item @emph{Description}:
6a2ba183 905This function limits the maximum allowed number of nested, active
8949b985
KCY
906parallel regions. @var{max_levels} must be less or equal to
907the value returned by @code{omp_get_supported_active_levels}.
5c6ed53a
TB
908
909@item @emph{C/C++}
910@multitable @columnfractions .20 .80
6a2ba183 911@item @emph{Prototype}: @tab @code{void omp_set_max_active_levels(int max_levels);}
5c6ed53a
TB
912@end multitable
913
914@item @emph{Fortran}:
915@multitable @columnfractions .20 .80
6a2ba183 916@item @emph{Interface}: @tab @code{subroutine omp_set_max_active_levels(max_levels)}
5c6ed53a
TB
917@item @tab @code{integer max_levels}
918@end multitable
919
920@item @emph{See also}:
8949b985
KCY
921@ref{omp_get_max_active_levels}, @ref{omp_get_active_level},
922@ref{omp_get_supported_active_levels}
5c6ed53a
TB
923
924@item @emph{Reference}:
1a6d1d24 925@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.15.
3721b9e1
DF
926@end table
927
928
929
930@node omp_set_nested
931@section @code{omp_set_nested} -- Enable/disable nested parallel regions
932@table @asis
933@item @emph{Description}:
f1b0882e 934Enable or disable nested parallel regions, i.e., whether team members
83fd6c5b 935are allowed to create new teams. The function takes the language-specific
3721b9e1
DF
936equivalent of @code{true} and @code{false}, where @code{true} enables
937dynamic adjustment of team sizes and @code{false} disables it.
938
939@item @emph{C/C++}:
940@multitable @columnfractions .20 .80
4fed6b25 941@item @emph{Prototype}: @tab @code{void omp_set_nested(int nested);}
3721b9e1
DF
942@end multitable
943
944@item @emph{Fortran}:
945@multitable @columnfractions .20 .80
4fed6b25
TB
946@item @emph{Interface}: @tab @code{subroutine omp_set_nested(nested)}
947@item @tab @code{logical, intent(in) :: nested}
3721b9e1
DF
948@end multitable
949
950@item @emph{See also}:
951@ref{OMP_NESTED}, @ref{omp_get_nested}
952
953@item @emph{Reference}:
1a6d1d24 954@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.10.
3721b9e1
DF
955@end table
956
957
958
959@node omp_set_num_threads
960@section @code{omp_set_num_threads} -- Set upper team size limit
961@table @asis
962@item @emph{Description}:
963Specifies the number of threads used by default in subsequent parallel
83fd6c5b
TB
964sections, if those do not specify a @code{num_threads} clause. The
965argument of @code{omp_set_num_threads} shall be a positive integer.
3721b9e1 966
3721b9e1
DF
967@item @emph{C/C++}:
968@multitable @columnfractions .20 .80
4fed6b25 969@item @emph{Prototype}: @tab @code{void omp_set_num_threads(int num_threads);}
3721b9e1
DF
970@end multitable
971
972@item @emph{Fortran}:
973@multitable @columnfractions .20 .80
4fed6b25
TB
974@item @emph{Interface}: @tab @code{subroutine omp_set_num_threads(num_threads)}
975@item @tab @code{integer, intent(in) :: num_threads}
3721b9e1
DF
976@end multitable
977
978@item @emph{See also}:
979@ref{OMP_NUM_THREADS}, @ref{omp_get_num_threads}, @ref{omp_get_max_threads}
980
981@item @emph{Reference}:
1a6d1d24 982@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.1.
5c6ed53a
TB
983@end table
984
985
986
987@node omp_set_schedule
988@section @code{omp_set_schedule} -- Set the runtime scheduling method
989@table @asis
990@item @emph{Description}:
83fd6c5b 991Sets the runtime scheduling method. The @var{kind} argument can have the
5c6ed53a 992value @code{omp_sched_static}, @code{omp_sched_dynamic},
83fd6c5b 993@code{omp_sched_guided} or @code{omp_sched_auto}. Except for
5c6ed53a 994@code{omp_sched_auto}, the chunk size is set to the value of
d9a6bd32
JJ
995@var{chunk_size} if positive, or to the default value if zero or negative.
996For @code{omp_sched_auto} the @var{chunk_size} argument is ignored.
5c6ed53a
TB
997
998@item @emph{C/C++}
999@multitable @columnfractions .20 .80
d9a6bd32 1000@item @emph{Prototype}: @tab @code{void omp_set_schedule(omp_sched_t kind, int chunk_size);}
5c6ed53a
TB
1001@end multitable
1002
1003@item @emph{Fortran}:
1004@multitable @columnfractions .20 .80
d9a6bd32 1005@item @emph{Interface}: @tab @code{subroutine omp_set_schedule(kind, chunk_size)}
5c6ed53a 1006@item @tab @code{integer(kind=omp_sched_kind) kind}
d9a6bd32 1007@item @tab @code{integer chunk_size}
5c6ed53a
TB
1008@end multitable
1009
1010@item @emph{See also}:
1011@ref{omp_get_schedule}
1012@ref{OMP_SCHEDULE}
1013
1014@item @emph{Reference}:
1a6d1d24 1015@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.12.
3721b9e1
DF
1016@end table
1017
1018
1019
1020@node omp_init_lock
1021@section @code{omp_init_lock} -- Initialize simple lock
1022@table @asis
1023@item @emph{Description}:
83fd6c5b 1024Initialize a simple lock. After initialization, the lock is in
3721b9e1
DF
1025an unlocked state.
1026
1027@item @emph{C/C++}:
1028@multitable @columnfractions .20 .80
1029@item @emph{Prototype}: @tab @code{void omp_init_lock(omp_lock_t *lock);}
1030@end multitable
1031
1032@item @emph{Fortran}:
1033@multitable @columnfractions .20 .80
4fed6b25
TB
1034@item @emph{Interface}: @tab @code{subroutine omp_init_lock(svar)}
1035@item @tab @code{integer(omp_lock_kind), intent(out) :: svar}
3721b9e1
DF
1036@end multitable
1037
1038@item @emph{See also}:
1039@ref{omp_destroy_lock}
1040
1041@item @emph{Reference}:
1a6d1d24 1042@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.1.
3721b9e1
DF
1043@end table
1044
1045
1046
1047@node omp_set_lock
1048@section @code{omp_set_lock} -- Wait for and set simple lock
1049@table @asis
1050@item @emph{Description}:
1051Before setting a simple lock, the lock variable must be initialized by
83fd6c5b
TB
1052@code{omp_init_lock}. The calling thread is blocked until the lock
1053is available. If the lock is already held by the current thread,
3721b9e1
DF
1054a deadlock occurs.
1055
1056@item @emph{C/C++}:
1057@multitable @columnfractions .20 .80
1058@item @emph{Prototype}: @tab @code{void omp_set_lock(omp_lock_t *lock);}
1059@end multitable
1060
1061@item @emph{Fortran}:
1062@multitable @columnfractions .20 .80
4fed6b25
TB
1063@item @emph{Interface}: @tab @code{subroutine omp_set_lock(svar)}
1064@item @tab @code{integer(omp_lock_kind), intent(inout) :: svar}
3721b9e1
DF
1065@end multitable
1066
1067@item @emph{See also}:
1068@ref{omp_init_lock}, @ref{omp_test_lock}, @ref{omp_unset_lock}
1069
1070@item @emph{Reference}:
1a6d1d24 1071@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.4.
3721b9e1
DF
1072@end table
1073
1074
1075
1076@node omp_test_lock
1077@section @code{omp_test_lock} -- Test and set simple lock if available
1078@table @asis
1079@item @emph{Description}:
1080Before setting a simple lock, the lock variable must be initialized by
83fd6c5b
TB
1081@code{omp_init_lock}. Contrary to @code{omp_set_lock}, @code{omp_test_lock}
1082does not block if the lock is not available. This function returns
1083@code{true} upon success, @code{false} otherwise. Here, @code{true} and
3721b9e1
DF
1084@code{false} represent their language-specific counterparts.
1085
1086@item @emph{C/C++}:
1087@multitable @columnfractions .20 .80
1088@item @emph{Prototype}: @tab @code{int omp_test_lock(omp_lock_t *lock);}
1089@end multitable
1090
1091@item @emph{Fortran}:
1092@multitable @columnfractions .20 .80
4fed6b25
TB
1093@item @emph{Interface}: @tab @code{logical function omp_test_lock(svar)}
1094@item @tab @code{integer(omp_lock_kind), intent(inout) :: svar}
3721b9e1
DF
1095@end multitable
1096
1097@item @emph{See also}:
1098@ref{omp_init_lock}, @ref{omp_set_lock}, @ref{omp_set_lock}
1099
1100@item @emph{Reference}:
1a6d1d24 1101@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.6.
3721b9e1
DF
1102@end table
1103
1104
1105
1106@node omp_unset_lock
1107@section @code{omp_unset_lock} -- Unset simple lock
1108@table @asis
1109@item @emph{Description}:
1110A simple lock about to be unset must have been locked by @code{omp_set_lock}
83fd6c5b
TB
1111or @code{omp_test_lock} before. In addition, the lock must be held by the
1112thread calling @code{omp_unset_lock}. Then, the lock becomes unlocked. If one
1113or more threads attempted to set the lock before, one of them is chosen to,
20906c66 1114again, set the lock to itself.
3721b9e1
DF
1115
1116@item @emph{C/C++}:
1117@multitable @columnfractions .20 .80
1118@item @emph{Prototype}: @tab @code{void omp_unset_lock(omp_lock_t *lock);}
1119@end multitable
1120
1121@item @emph{Fortran}:
1122@multitable @columnfractions .20 .80
4fed6b25
TB
1123@item @emph{Interface}: @tab @code{subroutine omp_unset_lock(svar)}
1124@item @tab @code{integer(omp_lock_kind), intent(inout) :: svar}
3721b9e1
DF
1125@end multitable
1126
1127@item @emph{See also}:
1128@ref{omp_set_lock}, @ref{omp_test_lock}
1129
1130@item @emph{Reference}:
1a6d1d24 1131@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.5.
3721b9e1
DF
1132@end table
1133
1134
1135
1136@node omp_destroy_lock
1137@section @code{omp_destroy_lock} -- Destroy simple lock
1138@table @asis
1139@item @emph{Description}:
83fd6c5b 1140Destroy a simple lock. In order to be destroyed, a simple lock must be
3721b9e1
DF
1141in the unlocked state.
1142
1143@item @emph{C/C++}:
1144@multitable @columnfractions .20 .80
6a2ba183 1145@item @emph{Prototype}: @tab @code{void omp_destroy_lock(omp_lock_t *lock);}
3721b9e1
DF
1146@end multitable
1147
1148@item @emph{Fortran}:
1149@multitable @columnfractions .20 .80
4fed6b25
TB
1150@item @emph{Interface}: @tab @code{subroutine omp_destroy_lock(svar)}
1151@item @tab @code{integer(omp_lock_kind), intent(inout) :: svar}
3721b9e1
DF
1152@end multitable
1153
1154@item @emph{See also}:
1155@ref{omp_init_lock}
1156
1157@item @emph{Reference}:
1a6d1d24 1158@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.3.
3721b9e1
DF
1159@end table
1160
1161
1162
1163@node omp_init_nest_lock
1164@section @code{omp_init_nest_lock} -- Initialize nested lock
1165@table @asis
1166@item @emph{Description}:
83fd6c5b 1167Initialize a nested lock. After initialization, the lock is in
3721b9e1
DF
1168an unlocked state and the nesting count is set to zero.
1169
1170@item @emph{C/C++}:
1171@multitable @columnfractions .20 .80
1172@item @emph{Prototype}: @tab @code{void omp_init_nest_lock(omp_nest_lock_t *lock);}
1173@end multitable
1174
1175@item @emph{Fortran}:
1176@multitable @columnfractions .20 .80
4fed6b25
TB
1177@item @emph{Interface}: @tab @code{subroutine omp_init_nest_lock(nvar)}
1178@item @tab @code{integer(omp_nest_lock_kind), intent(out) :: nvar}
3721b9e1
DF
1179@end multitable
1180
1181@item @emph{See also}:
1182@ref{omp_destroy_nest_lock}
1183
1184@item @emph{Reference}:
1a6d1d24 1185@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.1.
3721b9e1
DF
1186@end table
1187
1188
1189@node omp_set_nest_lock
6a2ba183 1190@section @code{omp_set_nest_lock} -- Wait for and set nested lock
3721b9e1
DF
1191@table @asis
1192@item @emph{Description}:
1193Before setting a nested lock, the lock variable must be initialized by
83fd6c5b
TB
1194@code{omp_init_nest_lock}. The calling thread is blocked until the lock
1195is available. If the lock is already held by the current thread, the
20906c66 1196nesting count for the lock is incremented.
3721b9e1
DF
1197
1198@item @emph{C/C++}:
1199@multitable @columnfractions .20 .80
1200@item @emph{Prototype}: @tab @code{void omp_set_nest_lock(omp_nest_lock_t *lock);}
1201@end multitable
1202
1203@item @emph{Fortran}:
1204@multitable @columnfractions .20 .80
4fed6b25
TB
1205@item @emph{Interface}: @tab @code{subroutine omp_set_nest_lock(nvar)}
1206@item @tab @code{integer(omp_nest_lock_kind), intent(inout) :: nvar}
3721b9e1
DF
1207@end multitable
1208
1209@item @emph{See also}:
1210@ref{omp_init_nest_lock}, @ref{omp_unset_nest_lock}
1211
1212@item @emph{Reference}:
1a6d1d24 1213@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.4.
3721b9e1
DF
1214@end table
1215
1216
1217
1218@node omp_test_nest_lock
1219@section @code{omp_test_nest_lock} -- Test and set nested lock if available
1220@table @asis
1221@item @emph{Description}:
1222Before setting a nested lock, the lock variable must be initialized by
83fd6c5b 1223@code{omp_init_nest_lock}. Contrary to @code{omp_set_nest_lock},
3721b9e1
DF
1224@code{omp_test_nest_lock} does not block if the lock is not available.
1225If the lock is already held by the current thread, the new nesting count
83fd6c5b 1226is returned. Otherwise, the return value equals zero.
3721b9e1
DF
1227
1228@item @emph{C/C++}:
1229@multitable @columnfractions .20 .80
1230@item @emph{Prototype}: @tab @code{int omp_test_nest_lock(omp_nest_lock_t *lock);}
1231@end multitable
1232
1233@item @emph{Fortran}:
1234@multitable @columnfractions .20 .80
4fed6b25
TB
1235@item @emph{Interface}: @tab @code{logical function omp_test_nest_lock(nvar)}
1236@item @tab @code{integer(omp_nest_lock_kind), intent(inout) :: nvar}
3721b9e1
DF
1237@end multitable
1238
1239
1240@item @emph{See also}:
1241@ref{omp_init_lock}, @ref{omp_set_lock}, @ref{omp_set_lock}
1242
1243@item @emph{Reference}:
1a6d1d24 1244@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.6.
3721b9e1
DF
1245@end table
1246
1247
1248
1249@node omp_unset_nest_lock
1250@section @code{omp_unset_nest_lock} -- Unset nested lock
1251@table @asis
1252@item @emph{Description}:
1253A nested lock about to be unset must have been locked by @code{omp_set_nested_lock}
83fd6c5b
TB
1254or @code{omp_test_nested_lock} before. In addition, the lock must be held by the
1255thread calling @code{omp_unset_nested_lock}. If the nesting count drops to zero, the
1256lock becomes unlocked. If one ore more threads attempted to set the lock before,
20906c66 1257one of them is chosen to, again, set the lock to itself.
3721b9e1
DF
1258
1259@item @emph{C/C++}:
1260@multitable @columnfractions .20 .80
1261@item @emph{Prototype}: @tab @code{void omp_unset_nest_lock(omp_nest_lock_t *lock);}
1262@end multitable
1263
1264@item @emph{Fortran}:
1265@multitable @columnfractions .20 .80
4fed6b25
TB
1266@item @emph{Interface}: @tab @code{subroutine omp_unset_nest_lock(nvar)}
1267@item @tab @code{integer(omp_nest_lock_kind), intent(inout) :: nvar}
3721b9e1
DF
1268@end multitable
1269
1270@item @emph{See also}:
1271@ref{omp_set_nest_lock}
1272
1273@item @emph{Reference}:
1a6d1d24 1274@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.5.
3721b9e1
DF
1275@end table
1276
1277
1278
1279@node omp_destroy_nest_lock
1280@section @code{omp_destroy_nest_lock} -- Destroy nested lock
1281@table @asis
1282@item @emph{Description}:
83fd6c5b 1283Destroy a nested lock. In order to be destroyed, a nested lock must be
3721b9e1
DF
1284in the unlocked state and its nesting count must equal zero.
1285
1286@item @emph{C/C++}:
1287@multitable @columnfractions .20 .80
1288@item @emph{Prototype}: @tab @code{void omp_destroy_nest_lock(omp_nest_lock_t *);}
1289@end multitable
1290
1291@item @emph{Fortran}:
1292@multitable @columnfractions .20 .80
4fed6b25
TB
1293@item @emph{Interface}: @tab @code{subroutine omp_destroy_nest_lock(nvar)}
1294@item @tab @code{integer(omp_nest_lock_kind), intent(inout) :: nvar}
3721b9e1
DF
1295@end multitable
1296
1297@item @emph{See also}:
1298@ref{omp_init_lock}
1299
1300@item @emph{Reference}:
1a6d1d24 1301@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.3.
3721b9e1
DF
1302@end table
1303
1304
1305
1306@node omp_get_wtick
1307@section @code{omp_get_wtick} -- Get timer precision
1308@table @asis
1309@item @emph{Description}:
f1b0882e 1310Gets the timer precision, i.e., the number of seconds between two
3721b9e1
DF
1311successive clock ticks.
1312
1313@item @emph{C/C++}:
1314@multitable @columnfractions .20 .80
6a2ba183 1315@item @emph{Prototype}: @tab @code{double omp_get_wtick(void);}
3721b9e1
DF
1316@end multitable
1317
1318@item @emph{Fortran}:
1319@multitable @columnfractions .20 .80
1320@item @emph{Interface}: @tab @code{double precision function omp_get_wtick()}
1321@end multitable
1322
1323@item @emph{See also}:
1324@ref{omp_get_wtime}
1325
1326@item @emph{Reference}:
1a6d1d24 1327@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.4.2.
3721b9e1
DF
1328@end table
1329
1330
1331
1332@node omp_get_wtime
1333@section @code{omp_get_wtime} -- Elapsed wall clock time
1334@table @asis
1335@item @emph{Description}:
83fd6c5b 1336Elapsed wall clock time in seconds. The time is measured per thread, no
6a2ba183 1337guarantee can be made that two distinct threads measure the same time.
21e1e594
JJ
1338Time is measured from some "time in the past", which is an arbitrary time
1339guaranteed not to change during the execution of the program.
3721b9e1
DF
1340
1341@item @emph{C/C++}:
1342@multitable @columnfractions .20 .80
6a2ba183 1343@item @emph{Prototype}: @tab @code{double omp_get_wtime(void);}
3721b9e1
DF
1344@end multitable
1345
1346@item @emph{Fortran}:
1347@multitable @columnfractions .20 .80
1348@item @emph{Interface}: @tab @code{double precision function omp_get_wtime()}
1349@end multitable
1350
1351@item @emph{See also}:
1352@ref{omp_get_wtick}
1353
1354@item @emph{Reference}:
1a6d1d24 1355@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.4.1.
3721b9e1
DF
1356@end table
1357
1358
1359
1360@c ---------------------------------------------------------------------
4102bda6 1361@c OpenMP Environment Variables
3721b9e1
DF
1362@c ---------------------------------------------------------------------
1363
1364@node Environment Variables
4102bda6 1365@chapter OpenMP Environment Variables
3721b9e1 1366
acf0174b 1367The environment variables which beginning with @env{OMP_} are defined by
00b9bd52 1368section 4 of the OpenMP specification in version 4.5, while those
acf0174b 1369beginning with @env{GOMP_} are GNU extensions.
3721b9e1
DF
1370
1371@menu
06441dd5
SH
1372* OMP_CANCELLATION:: Set whether cancellation is activated
1373* OMP_DISPLAY_ENV:: Show OpenMP version and environment variables
1374* OMP_DEFAULT_DEVICE:: Set the device used in target regions
1375* OMP_DYNAMIC:: Dynamic adjustment of threads
1376* OMP_MAX_ACTIVE_LEVELS:: Set the maximum number of nested parallel regions
d9a6bd32 1377* OMP_MAX_TASK_PRIORITY:: Set the maximum task priority value
06441dd5
SH
1378* OMP_NESTED:: Nested parallel regions
1379* OMP_NUM_THREADS:: Specifies the number of threads to use
1380* OMP_PROC_BIND:: Whether theads may be moved between CPUs
1381* OMP_PLACES:: Specifies on which CPUs the theads should be placed
1382* OMP_STACKSIZE:: Set default thread stack size
1383* OMP_SCHEDULE:: How threads are scheduled
1384* OMP_THREAD_LIMIT:: Set the maximum number of threads
1385* OMP_WAIT_POLICY:: How waiting threads are handled
1386* GOMP_CPU_AFFINITY:: Bind threads to specific CPUs
1387* GOMP_DEBUG:: Enable debugging output
1388* GOMP_STACKSIZE:: Set default thread stack size
1389* GOMP_SPINCOUNT:: Set the busy-wait spin count
1390* GOMP_RTEMS_THREAD_POOLS:: Set the RTEMS specific thread pools
3721b9e1
DF
1391@end menu
1392
1393
83fd6c5b
TB
1394@node OMP_CANCELLATION
1395@section @env{OMP_CANCELLATION} -- Set whether cancellation is activated
1396@cindex Environment Variable
1397@table @asis
1398@item @emph{Description}:
1399If set to @code{TRUE}, the cancellation is activated. If set to @code{FALSE} or
1400if unset, cancellation is disabled and the @code{cancel} construct is ignored.
1401
1402@item @emph{See also}:
1403@ref{omp_get_cancellation}
1404
1405@item @emph{Reference}:
1a6d1d24 1406@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.11
83fd6c5b
TB
1407@end table
1408
1409
1410
1411@node OMP_DISPLAY_ENV
1412@section @env{OMP_DISPLAY_ENV} -- Show OpenMP version and environment variables
1413@cindex Environment Variable
1414@table @asis
1415@item @emph{Description}:
1416If set to @code{TRUE}, the OpenMP version number and the values
1417associated with the OpenMP environment variables are printed to @code{stderr}.
1418If set to @code{VERBOSE}, it additionally shows the value of the environment
1419variables which are GNU extensions. If undefined or set to @code{FALSE},
1420this information will not be shown.
1421
1422
1423@item @emph{Reference}:
1a6d1d24 1424@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.12
83fd6c5b
TB
1425@end table
1426
1427
1428
1429@node OMP_DEFAULT_DEVICE
1430@section @env{OMP_DEFAULT_DEVICE} -- Set the device used in target regions
1431@cindex Environment Variable
1432@table @asis
1433@item @emph{Description}:
1434Set to choose the device which is used in a @code{target} region, unless the
1435value is overridden by @code{omp_set_default_device} or by a @code{device}
1436clause. The value shall be the nonnegative device number. If no device with
1437the given device number exists, the code is executed on the host. If unset,
1438device number 0 will be used.
1439
1440
1441@item @emph{See also}:
1442@ref{omp_get_default_device}, @ref{omp_set_default_device},
1443
1444@item @emph{Reference}:
1a6d1d24 1445@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.13
83fd6c5b
TB
1446@end table
1447
1448
1449
3721b9e1
DF
1450@node OMP_DYNAMIC
1451@section @env{OMP_DYNAMIC} -- Dynamic adjustment of threads
1452@cindex Environment Variable
1453@table @asis
1454@item @emph{Description}:
1455Enable or disable the dynamic adjustment of the number of threads
83fd6c5b
TB
1456within a team. The value of this environment variable shall be
1457@code{TRUE} or @code{FALSE}. If undefined, dynamic adjustment is
7c2b7f45 1458disabled by default.
3721b9e1
DF
1459
1460@item @emph{See also}:
1461@ref{omp_set_dynamic}
1462
1463@item @emph{Reference}:
1a6d1d24 1464@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.3
5c6ed53a
TB
1465@end table
1466
1467
1468
1469@node OMP_MAX_ACTIVE_LEVELS
6a2ba183 1470@section @env{OMP_MAX_ACTIVE_LEVELS} -- Set the maximum number of nested parallel regions
5c6ed53a
TB
1471@cindex Environment Variable
1472@table @asis
1473@item @emph{Description}:
6a2ba183 1474Specifies the initial value for the maximum number of nested parallel
83fd6c5b 1475regions. The value of this variable shall be a positive integer.
5c6ed53a
TB
1476If undefined, the number of active levels is unlimited.
1477
1478@item @emph{See also}:
1479@ref{omp_set_max_active_levels}
1480
1481@item @emph{Reference}:
1a6d1d24 1482@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.9
3721b9e1
DF
1483@end table
1484
1485
1486
d9a6bd32
JJ
1487@node OMP_MAX_TASK_PRIORITY
1488@section @env{OMP_MAX_TASK_PRIORITY} -- Set the maximum priority
1489number that can be set for a task.
1490@cindex Environment Variable
1491@table @asis
1492@item @emph{Description}:
1493Specifies the initial value for the maximum priority value that can be
1494set for a task. The value of this variable shall be a non-negative
1495integer, and zero is allowed. If undefined, the default priority is
14960.
1497
1498@item @emph{See also}:
1499@ref{omp_get_max_task_priority}
1500
1501@item @emph{Reference}:
1a6d1d24 1502@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.14
d9a6bd32
JJ
1503@end table
1504
1505
1506
3721b9e1
DF
1507@node OMP_NESTED
1508@section @env{OMP_NESTED} -- Nested parallel regions
1509@cindex Environment Variable
14734fc7 1510@cindex Implementation specific setting
3721b9e1
DF
1511@table @asis
1512@item @emph{Description}:
f1b0882e 1513Enable or disable nested parallel regions, i.e., whether team members
83fd6c5b
TB
1514are allowed to create new teams. The value of this environment variable
1515shall be @code{TRUE} or @code{FALSE}. If undefined, nested parallel
7c2b7f45 1516regions are disabled by default.
3721b9e1
DF
1517
1518@item @emph{See also}:
1519@ref{omp_set_nested}
1520
1521@item @emph{Reference}:
1a6d1d24 1522@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.6
3721b9e1
DF
1523@end table
1524
1525
1526
1527@node OMP_NUM_THREADS
1528@section @env{OMP_NUM_THREADS} -- Specifies the number of threads to use
1529@cindex Environment Variable
14734fc7 1530@cindex Implementation specific setting
3721b9e1
DF
1531@table @asis
1532@item @emph{Description}:
83fd6c5b 1533Specifies the default number of threads to use in parallel regions. The
20906c66
JJ
1534value of this variable shall be a comma-separated list of positive integers;
1535the value specified the number of threads to use for the corresponding nested
83fd6c5b 1536level. If undefined one thread per CPU is used.
3721b9e1
DF
1537
1538@item @emph{See also}:
1539@ref{omp_set_num_threads}
1540
1541@item @emph{Reference}:
1a6d1d24 1542@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.2
83fd6c5b
TB
1543@end table
1544
1545
1546
72832460
UB
1547@node OMP_PROC_BIND
1548@section @env{OMP_PROC_BIND} -- Whether theads may be moved between CPUs
1549@cindex Environment Variable
1550@table @asis
1551@item @emph{Description}:
1552Specifies whether threads may be moved between processors. If set to
1553@code{TRUE}, OpenMP theads should not be moved; if set to @code{FALSE}
1554they may be moved. Alternatively, a comma separated list with the
1555values @code{MASTER}, @code{CLOSE} and @code{SPREAD} can be used to specify
1556the thread affinity policy for the corresponding nesting level. With
1557@code{MASTER} the worker threads are in the same place partition as the
1558master thread. With @code{CLOSE} those are kept close to the master thread
1559in contiguous place partitions. And with @code{SPREAD} a sparse distribution
1560across the place partitions is used.
1561
1562When undefined, @env{OMP_PROC_BIND} defaults to @code{TRUE} when
1563@env{OMP_PLACES} or @env{GOMP_CPU_AFFINITY} is set and @code{FALSE} otherwise.
1564
1565@item @emph{See also}:
1566@ref{OMP_PLACES}, @ref{GOMP_CPU_AFFINITY}, @ref{omp_get_proc_bind}
1567
1568@item @emph{Reference}:
1a6d1d24 1569@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.4
72832460
UB
1570@end table
1571
1572
1573
83fd6c5b
TB
1574@node OMP_PLACES
1575@section @env{OMP_PLACES} -- Specifies on which CPUs the theads should be placed
1576@cindex Environment Variable
1577@table @asis
1578@item @emph{Description}:
1579The thread placement can be either specified using an abstract name or by an
1580explicit list of the places. The abstract names @code{threads}, @code{cores}
1581and @code{sockets} can be optionally followed by a positive number in
1582parentheses, which denotes the how many places shall be created. With
1583@code{threads} each place corresponds to a single hardware thread; @code{cores}
1584to a single core with the corresponding number of hardware threads; and with
1585@code{sockets} the place corresponds to a single socket. The resulting
1586placement can be shown by setting the @env{OMP_DISPLAY_ENV} environment
1587variable.
1588
1589Alternatively, the placement can be specified explicitly as comma-separated
1590list of places. A place is specified by set of nonnegative numbers in curly
1591braces, denoting the denoting the hardware threads. The hardware threads
1592belonging to a place can either be specified as comma-separated list of
1593nonnegative thread numbers or using an interval. Multiple places can also be
1594either specified by a comma-separated list of places or by an interval. To
1595specify an interval, a colon followed by the count is placed after after
1596the hardware thread number or the place. Optionally, the length can be
1597followed by a colon and the stride number -- otherwise a unit stride is
1598assumed. For instance, the following specifies the same places list:
1599@code{"@{0,1,2@}, @{3,4,6@}, @{7,8,9@}, @{10,11,12@}"};
1600@code{"@{0:3@}, @{3:3@}, @{7:3@}, @{10:3@}"}; and @code{"@{0:2@}:4:3"}.
1601
1602If @env{OMP_PLACES} and @env{GOMP_CPU_AFFINITY} are unset and
1603@env{OMP_PROC_BIND} is either unset or @code{false}, threads may be moved
1604between CPUs following no placement policy.
1605
1606@item @emph{See also}:
1607@ref{OMP_PROC_BIND}, @ref{GOMP_CPU_AFFINITY}, @ref{omp_get_proc_bind},
1608@ref{OMP_DISPLAY_ENV}
1609
1610@item @emph{Reference}:
1a6d1d24 1611@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.5
83fd6c5b
TB
1612@end table
1613
1614
1615
72832460
UB
1616@node OMP_STACKSIZE
1617@section @env{OMP_STACKSIZE} -- Set default thread stack size
83fd6c5b
TB
1618@cindex Environment Variable
1619@table @asis
1620@item @emph{Description}:
72832460
UB
1621Set the default thread stack size in kilobytes, unless the number
1622is suffixed by @code{B}, @code{K}, @code{M} or @code{G}, in which
1623case the size is, respectively, in bytes, kilobytes, megabytes
1624or gigabytes. This is different from @code{pthread_attr_setstacksize}
1625which gets the number of bytes as an argument. If the stack size cannot
1626be set due to system constraints, an error is reported and the initial
1627stack size is left unchanged. If undefined, the stack size is system
1628dependent.
83fd6c5b 1629
72832460 1630@item @emph{Reference}:
1a6d1d24 1631@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.7
3721b9e1
DF
1632@end table
1633
1634
1635
1636@node OMP_SCHEDULE
1637@section @env{OMP_SCHEDULE} -- How threads are scheduled
1638@cindex Environment Variable
14734fc7 1639@cindex Implementation specific setting
3721b9e1
DF
1640@table @asis
1641@item @emph{Description}:
1642Allows to specify @code{schedule type} and @code{chunk size}.
1643The value of the variable shall have the form: @code{type[,chunk]} where
5c6ed53a 1644@code{type} is one of @code{static}, @code{dynamic}, @code{guided} or @code{auto}
83fd6c5b 1645The optional @code{chunk} size shall be a positive integer. If undefined,
7c2b7f45 1646dynamic scheduling and a chunk size of 1 is used.
3721b9e1 1647
5c6ed53a
TB
1648@item @emph{See also}:
1649@ref{omp_set_schedule}
1650
1651@item @emph{Reference}:
1a6d1d24 1652@uref{https://www.openmp.org, OpenMP specification v4.5}, Sections 2.7.1.1 and 4.1
5c6ed53a
TB
1653@end table
1654
1655
1656
5c6ed53a 1657@node OMP_THREAD_LIMIT
6a2ba183 1658@section @env{OMP_THREAD_LIMIT} -- Set the maximum number of threads
5c6ed53a
TB
1659@cindex Environment Variable
1660@table @asis
1661@item @emph{Description}:
83fd6c5b
TB
1662Specifies the number of threads to use for the whole program. The
1663value of this variable shall be a positive integer. If undefined,
5c6ed53a
TB
1664the number of threads is not limited.
1665
1666@item @emph{See also}:
83fd6c5b 1667@ref{OMP_NUM_THREADS}, @ref{omp_get_thread_limit}
5c6ed53a
TB
1668
1669@item @emph{Reference}:
1a6d1d24 1670@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.10
5c6ed53a
TB
1671@end table
1672
1673
1674
1675@node OMP_WAIT_POLICY
1676@section @env{OMP_WAIT_POLICY} -- How waiting threads are handled
1677@cindex Environment Variable
1678@table @asis
1679@item @emph{Description}:
83fd6c5b 1680Specifies whether waiting threads should be active or passive. If
5c6ed53a
TB
1681the value is @code{PASSIVE}, waiting threads should not consume CPU
1682power while waiting; while the value is @code{ACTIVE} specifies that
83fd6c5b 1683they should. If undefined, threads wait actively for a short time
acf0174b
JJ
1684before waiting passively.
1685
1686@item @emph{See also}:
1687@ref{GOMP_SPINCOUNT}
5c6ed53a
TB
1688
1689@item @emph{Reference}:
1a6d1d24 1690@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.8
3721b9e1
DF
1691@end table
1692
1693
1694
1695@node GOMP_CPU_AFFINITY
1696@section @env{GOMP_CPU_AFFINITY} -- Bind threads to specific CPUs
1697@cindex Environment Variable
1698@table @asis
1699@item @emph{Description}:
83fd6c5b
TB
1700Binds threads to specific CPUs. The variable should contain a space-separated
1701or comma-separated list of CPUs. This list may contain different kinds of
06785a48 1702entries: either single CPU numbers in any order, a range of CPUs (M-N)
83fd6c5b 1703or a range with some stride (M-N:S). CPU numbers are zero based. For example,
06785a48
DF
1704@code{GOMP_CPU_AFFINITY="0 3 1-2 4-15:2"} will bind the initial thread
1705to CPU 0, the second to CPU 3, the third to CPU 1, the fourth to
1706CPU 2, the fifth to CPU 4, the sixth through tenth to CPUs 6, 8, 10, 12,
1707and 14 respectively and then start assigning back from the beginning of
6a2ba183 1708the list. @code{GOMP_CPU_AFFINITY=0} binds all threads to CPU 0.
06785a48 1709
f1f3453e 1710There is no libgomp library routine to determine whether a CPU affinity
83fd6c5b 1711specification is in effect. As a workaround, language-specific library
06785a48
DF
1712functions, e.g., @code{getenv} in C or @code{GET_ENVIRONMENT_VARIABLE} in
1713Fortran, may be used to query the setting of the @code{GOMP_CPU_AFFINITY}
83fd6c5b 1714environment variable. A defined CPU affinity on startup cannot be changed
06785a48
DF
1715or disabled during the runtime of the application.
1716
83fd6c5b
TB
1717If both @env{GOMP_CPU_AFFINITY} and @env{OMP_PROC_BIND} are set,
1718@env{OMP_PROC_BIND} has a higher precedence. If neither has been set and
1719@env{OMP_PROC_BIND} is unset, or when @env{OMP_PROC_BIND} is set to
1720@code{FALSE}, the host system will handle the assignment of threads to CPUs.
20906c66
JJ
1721
1722@item @emph{See also}:
83fd6c5b 1723@ref{OMP_PLACES}, @ref{OMP_PROC_BIND}
3721b9e1
DF
1724@end table
1725
1726
1727
41dbbb37
TS
1728@node GOMP_DEBUG
1729@section @env{GOMP_DEBUG} -- Enable debugging output
1730@cindex Environment Variable
1731@table @asis
1732@item @emph{Description}:
1733Enable debugging output. The variable should be set to @code{0}
1734(disabled, also the default if not set), or @code{1} (enabled).
1735
1736If enabled, some debugging output will be printed during execution.
1737This is currently not specified in more detail, and subject to change.
1738@end table
1739
1740
1741
3721b9e1
DF
1742@node GOMP_STACKSIZE
1743@section @env{GOMP_STACKSIZE} -- Set default thread stack size
1744@cindex Environment Variable
14734fc7 1745@cindex Implementation specific setting
3721b9e1
DF
1746@table @asis
1747@item @emph{Description}:
83fd6c5b 1748Set the default thread stack size in kilobytes. This is different from
5c6ed53a 1749@code{pthread_attr_setstacksize} which gets the number of bytes as an
83fd6c5b
TB
1750argument. If the stack size cannot be set due to system constraints, an
1751error is reported and the initial stack size is left unchanged. If undefined,
7c2b7f45 1752the stack size is system dependent.
3721b9e1 1753
5c6ed53a 1754@item @emph{See also}:
0024f1af 1755@ref{OMP_STACKSIZE}
5c6ed53a 1756
3721b9e1 1757@item @emph{Reference}:
c1030b5c 1758@uref{https://gcc.gnu.org/ml/gcc-patches/2006-06/msg00493.html,
3721b9e1 1759GCC Patches Mailinglist},
c1030b5c 1760@uref{https://gcc.gnu.org/ml/gcc-patches/2006-06/msg00496.html,
3721b9e1
DF
1761GCC Patches Mailinglist}
1762@end table
1763
1764
1765
acf0174b
JJ
1766@node GOMP_SPINCOUNT
1767@section @env{GOMP_SPINCOUNT} -- Set the busy-wait spin count
1768@cindex Environment Variable
1769@cindex Implementation specific setting
1770@table @asis
1771@item @emph{Description}:
1772Determines how long a threads waits actively with consuming CPU power
83fd6c5b 1773before waiting passively without consuming CPU power. The value may be
acf0174b 1774either @code{INFINITE}, @code{INFINITY} to always wait actively or an
83fd6c5b 1775integer which gives the number of spins of the busy-wait loop. The
acf0174b
JJ
1776integer may optionally be followed by the following suffixes acting
1777as multiplication factors: @code{k} (kilo, thousand), @code{M} (mega,
1778million), @code{G} (giga, billion), or @code{T} (tera, trillion).
1779If undefined, 0 is used when @env{OMP_WAIT_POLICY} is @code{PASSIVE},
1780300,000 is used when @env{OMP_WAIT_POLICY} is undefined and
178130 billion is used when @env{OMP_WAIT_POLICY} is @code{ACTIVE}.
1782If there are more OpenMP threads than available CPUs, 1000 and 100
1783spins are used for @env{OMP_WAIT_POLICY} being @code{ACTIVE} or
1784undefined, respectively; unless the @env{GOMP_SPINCOUNT} is lower
1785or @env{OMP_WAIT_POLICY} is @code{PASSIVE}.
1786
1787@item @emph{See also}:
1788@ref{OMP_WAIT_POLICY}
1789@end table
1790
1791
1792
06441dd5
SH
1793@node GOMP_RTEMS_THREAD_POOLS
1794@section @env{GOMP_RTEMS_THREAD_POOLS} -- Set the RTEMS specific thread pools
1795@cindex Environment Variable
1796@cindex Implementation specific setting
1797@table @asis
1798@item @emph{Description}:
1799This environment variable is only used on the RTEMS real-time operating system.
1800It determines the scheduler instance specific thread pools. The format for
1801@env{GOMP_RTEMS_THREAD_POOLS} is a list of optional
1802@code{<thread-pool-count>[$<priority>]@@<scheduler-name>} configurations
1803separated by @code{:} where:
1804@itemize @bullet
1805@item @code{<thread-pool-count>} is the thread pool count for this scheduler
1806instance.
1807@item @code{$<priority>} is an optional priority for the worker threads of a
1808thread pool according to @code{pthread_setschedparam}. In case a priority
1809value is omitted, then a worker thread will inherit the priority of the OpenMP
1810master thread that created it. The priority of the worker thread is not
1811changed after creation, even if a new OpenMP master thread using the worker has
1812a different priority.
1813@item @code{@@<scheduler-name>} is the scheduler instance name according to the
1814RTEMS application configuration.
1815@end itemize
1816In case no thread pool configuration is specified for a scheduler instance,
1817then each OpenMP master thread of this scheduler instance will use its own
1818dynamically allocated thread pool. To limit the worker thread count of the
1819thread pools, each OpenMP master thread must call @code{omp_set_num_threads}.
1820@item @emph{Example}:
1821Lets suppose we have three scheduler instances @code{IO}, @code{WRK0}, and
1822@code{WRK1} with @env{GOMP_RTEMS_THREAD_POOLS} set to
1823@code{"1@@WRK0:3$4@@WRK1"}. Then there are no thread pool restrictions for
1824scheduler instance @code{IO}. In the scheduler instance @code{WRK0} there is
1825one thread pool available. Since no priority is specified for this scheduler
1826instance, the worker thread inherits the priority of the OpenMP master thread
1827that created it. In the scheduler instance @code{WRK1} there are three thread
1828pools available and their worker threads run at priority four.
1829@end table
1830
1831
1832
cdf6119d
JN
1833@c ---------------------------------------------------------------------
1834@c Enabling OpenACC
1835@c ---------------------------------------------------------------------
1836
1837@node Enabling OpenACC
1838@chapter Enabling OpenACC
1839
1840To activate the OpenACC extensions for C/C++ and Fortran, the compile-time
1841flag @option{-fopenacc} must be specified. This enables the OpenACC directive
c1030b5c 1842@code{#pragma acc} in C/C++ and @code{!$acc} directives in free form,
cdf6119d
JN
1843@code{c$acc}, @code{*$acc} and @code{!$acc} directives in fixed form,
1844@code{!$} conditional compilation sentinels in free form and @code{c$},
1845@code{*$} and @code{!$} sentinels in fixed form, for Fortran. The flag also
1846arranges for automatic linking of the OpenACC runtime library
1847(@ref{OpenACC Runtime Library Routines}).
1848
8d1a1cb1
TB
1849See @uref{https://gcc.gnu.org/wiki/OpenACC} for more information.
1850
cdf6119d 1851A complete description of all OpenACC directives accepted may be found in
9651fbaf 1852the @uref{https://www.openacc.org, OpenACC} Application Programming
e464fc90 1853Interface manual, version 2.6.
cdf6119d 1854
cdf6119d
JN
1855
1856
1857@c ---------------------------------------------------------------------
1858@c OpenACC Runtime Library Routines
1859@c ---------------------------------------------------------------------
1860
1861@node OpenACC Runtime Library Routines
1862@chapter OpenACC Runtime Library Routines
1863
1864The runtime routines described here are defined by section 3 of the OpenACC
e464fc90 1865specifications in version 2.6.
cdf6119d
JN
1866They have C linkage, and do not throw exceptions.
1867Generally, they are available only for the host, with the exception of
1868@code{acc_on_device}, which is available for both the host and the
1869acceleration device.
1870
1871@menu
1872* acc_get_num_devices:: Get number of devices for the given device
1873 type.
1874* acc_set_device_type:: Set type of device accelerator to use.
1875* acc_get_device_type:: Get type of device accelerator to be used.
1876* acc_set_device_num:: Set device number to use.
1877* acc_get_device_num:: Get device number to be used.
6c84c8bf 1878* acc_get_property:: Get device property.
cdf6119d
JN
1879* acc_async_test:: Tests for completion of a specific asynchronous
1880 operation.
c1030b5c 1881* acc_async_test_all:: Tests for completion of all asynchronous
cdf6119d
JN
1882 operations.
1883* acc_wait:: Wait for completion of a specific asynchronous
1884 operation.
c1030b5c 1885* acc_wait_all:: Waits for completion of all asynchronous
cdf6119d
JN
1886 operations.
1887* acc_wait_all_async:: Wait for completion of all asynchronous
1888 operations.
1889* acc_wait_async:: Wait for completion of asynchronous operations.
1890* acc_init:: Initialize runtime for a specific device type.
1891* acc_shutdown:: Shuts down the runtime for a specific device
1892 type.
1893* acc_on_device:: Whether executing on a particular device
1894* acc_malloc:: Allocate device memory.
1895* acc_free:: Free device memory.
1896* acc_copyin:: Allocate device memory and copy host memory to
1897 it.
1898* acc_present_or_copyin:: If the data is not present on the device,
1899 allocate device memory and copy from host
1900 memory.
1901* acc_create:: Allocate device memory and map it to host
1902 memory.
1903* acc_present_or_create:: If the data is not present on the device,
1904 allocate device memory and map it to host
1905 memory.
1906* acc_copyout:: Copy device memory to host memory.
1907* acc_delete:: Free device memory.
1908* acc_update_device:: Update device memory from mapped host memory.
1909* acc_update_self:: Update host memory from mapped device memory.
1910* acc_map_data:: Map previously allocated device memory to host
1911 memory.
1912* acc_unmap_data:: Unmap device memory from host memory.
1913* acc_deviceptr:: Get device pointer associated with specific
1914 host address.
1915* acc_hostptr:: Get host pointer associated with specific
1916 device address.
93d90219 1917* acc_is_present:: Indicate whether host variable / array is
cdf6119d
JN
1918 present on device.
1919* acc_memcpy_to_device:: Copy host memory to device memory.
1920* acc_memcpy_from_device:: Copy device memory to host memory.
e464fc90
TB
1921* acc_attach:: Let device pointer point to device-pointer target.
1922* acc_detach:: Let device pointer point to host-pointer target.
cdf6119d
JN
1923
1924API routines for target platforms.
1925
1926* acc_get_current_cuda_device:: Get CUDA device handle.
1927* acc_get_current_cuda_context::Get CUDA context handle.
1928* acc_get_cuda_stream:: Get CUDA stream handle.
1929* acc_set_cuda_stream:: Set CUDA stream handle.
5fae049d
TS
1930
1931API routines for the OpenACC Profiling Interface.
1932
1933* acc_prof_register:: Register callbacks.
1934* acc_prof_unregister:: Unregister callbacks.
1935* acc_prof_lookup:: Obtain inquiry functions.
1936* acc_register_library:: Library registration.
cdf6119d
JN
1937@end menu
1938
1939
1940
1941@node acc_get_num_devices
1942@section @code{acc_get_num_devices} -- Get number of devices for given device type
1943@table @asis
1944@item @emph{Description}
1945This function returns a value indicating the number of devices available
1946for the device type specified in @var{devicetype}.
1947
1948@item @emph{C/C++}:
1949@multitable @columnfractions .20 .80
1950@item @emph{Prototype}: @tab @code{int acc_get_num_devices(acc_device_t devicetype);}
1951@end multitable
1952
1953@item @emph{Fortran}:
1954@multitable @columnfractions .20 .80
1955@item @emph{Interface}: @tab @code{integer function acc_get_num_devices(devicetype)}
1956@item @tab @code{integer(kind=acc_device_kind) devicetype}
1957@end multitable
1958
1959@item @emph{Reference}:
e464fc90 1960@uref{https://www.openacc.org, OpenACC specification v2.6}, section
cdf6119d
JN
19613.2.1.
1962@end table
1963
1964
1965
1966@node acc_set_device_type
1967@section @code{acc_set_device_type} -- Set type of device accelerator to use.
1968@table @asis
1969@item @emph{Description}
c1030b5c 1970This function indicates to the runtime library which device type, specified
cdf6119d
JN
1971in @var{devicetype}, to use when executing a parallel or kernels region.
1972
1973@item @emph{C/C++}:
1974@multitable @columnfractions .20 .80
1975@item @emph{Prototype}: @tab @code{acc_set_device_type(acc_device_t devicetype);}
1976@end multitable
1977
1978@item @emph{Fortran}:
1979@multitable @columnfractions .20 .80
1980@item @emph{Interface}: @tab @code{subroutine acc_set_device_type(devicetype)}
1981@item @tab @code{integer(kind=acc_device_kind) devicetype}
1982@end multitable
1983
1984@item @emph{Reference}:
e464fc90 1985@uref{https://www.openacc.org, OpenACC specification v2.6}, section
cdf6119d
JN
19863.2.2.
1987@end table
1988
1989
1990
1991@node acc_get_device_type
1992@section @code{acc_get_device_type} -- Get type of device accelerator to be used.
1993@table @asis
1994@item @emph{Description}
1995This function returns what device type will be used when executing a
1996parallel or kernels region.
1997
b52643ab
KCY
1998This function returns @code{acc_device_none} if
1999@code{acc_get_device_type} is called from
2000@code{acc_ev_device_init_start}, @code{acc_ev_device_init_end}
2001callbacks of the OpenACC Profiling Interface (@ref{OpenACC Profiling
2002Interface}), that is, if the device is currently being initialized.
2003
cdf6119d
JN
2004@item @emph{C/C++}:
2005@multitable @columnfractions .20 .80
2006@item @emph{Prototype}: @tab @code{acc_device_t acc_get_device_type(void);}
2007@end multitable
2008
2009@item @emph{Fortran}:
2010@multitable @columnfractions .20 .80
2011@item @emph{Interface}: @tab @code{function acc_get_device_type(void)}
2012@item @tab @code{integer(kind=acc_device_kind) acc_get_device_type}
2013@end multitable
2014
2015@item @emph{Reference}:
e464fc90 2016@uref{https://www.openacc.org, OpenACC specification v2.6}, section
cdf6119d
JN
20173.2.3.
2018@end table
2019
2020
2021
2022@node acc_set_device_num
2023@section @code{acc_set_device_num} -- Set device number to use.
2024@table @asis
2025@item @emph{Description}
2026This function will indicate to the runtime which device number,
8d1a1cb1 2027specified by @var{devicenum}, associated with the specified device
cdf6119d
JN
2028type @var{devicetype}.
2029
2030@item @emph{C/C++}:
2031@multitable @columnfractions .20 .80
8d1a1cb1 2032@item @emph{Prototype}: @tab @code{acc_set_device_num(int devicenum, acc_device_t devicetype);}
cdf6119d
JN
2033@end multitable
2034
2035@item @emph{Fortran}:
2036@multitable @columnfractions .20 .80
2037@item @emph{Interface}: @tab @code{subroutine acc_set_device_num(devicenum, devicetype)}
2038@item @tab @code{integer devicenum}
2039@item @tab @code{integer(kind=acc_device_kind) devicetype}
2040@end multitable
2041
2042@item @emph{Reference}:
e464fc90 2043@uref{https://www.openacc.org, OpenACC specification v2.6}, section
cdf6119d
JN
20443.2.4.
2045@end table
2046
2047
2048
2049@node acc_get_device_num
2050@section @code{acc_get_device_num} -- Get device number to be used.
2051@table @asis
2052@item @emph{Description}
2053This function returns which device number associated with the specified device
2054type @var{devicetype}, will be used when executing a parallel or kernels
2055region.
2056
2057@item @emph{C/C++}:
2058@multitable @columnfractions .20 .80
2059@item @emph{Prototype}: @tab @code{int acc_get_device_num(acc_device_t devicetype);}
2060@end multitable
2061
2062@item @emph{Fortran}:
2063@multitable @columnfractions .20 .80
2064@item @emph{Interface}: @tab @code{function acc_get_device_num(devicetype)}
2065@item @tab @code{integer(kind=acc_device_kind) devicetype}
2066@item @tab @code{integer acc_get_device_num}
2067@end multitable
2068
2069@item @emph{Reference}:
e464fc90 2070@uref{https://www.openacc.org, OpenACC specification v2.6}, section
cdf6119d
JN
20713.2.5.
2072@end table
2073
2074
2075
6c84c8bf
MR
2076@node acc_get_property
2077@section @code{acc_get_property} -- Get device property.
2078@cindex acc_get_property
2079@cindex acc_get_property_string
2080@table @asis
2081@item @emph{Description}
2082These routines return the value of the specified @var{property} for the
2083device being queried according to @var{devicenum} and @var{devicetype}.
2084Integer-valued and string-valued properties are returned by
2085@code{acc_get_property} and @code{acc_get_property_string} respectively.
2086The Fortran @code{acc_get_property_string} subroutine returns the string
2087retrieved in its fourth argument while the remaining entry points are
2088functions, which pass the return value as their result.
2089
8d1a1cb1
TB
2090Note for Fortran, only: the OpenACC technical committee corrected and, hence,
2091modified the interface introduced in OpenACC 2.6. The kind-value parameter
2092@code{acc_device_property} has been renamed to @code{acc_device_property_kind}
2093for consistency and the return type of the @code{acc_get_property} function is
2094now a @code{c_size_t} integer instead of a @code{acc_device_property} integer.
2095The parameter @code{acc_device_property} will continue to be provided,
2096but might be removed in a future version of GCC.
2097
6c84c8bf
MR
2098@item @emph{C/C++}:
2099@multitable @columnfractions .20 .80
2100@item @emph{Prototype}: @tab @code{size_t acc_get_property(int devicenum, acc_device_t devicetype, acc_device_property_t property);}
2101@item @emph{Prototype}: @tab @code{const char *acc_get_property_string(int devicenum, acc_device_t devicetype, acc_device_property_t property);}
2102@end multitable
2103
2104@item @emph{Fortran}:
2105@multitable @columnfractions .20 .80
2106@item @emph{Interface}: @tab @code{function acc_get_property(devicenum, devicetype, property)}
2107@item @emph{Interface}: @tab @code{subroutine acc_get_property_string(devicenum, devicetype, property, string)}
8d1a1cb1 2108@item @tab @code{use ISO_C_Binding, only: c_size_t}
6c84c8bf
MR
2109@item @tab @code{integer devicenum}
2110@item @tab @code{integer(kind=acc_device_kind) devicetype}
8d1a1cb1
TB
2111@item @tab @code{integer(kind=acc_device_property_kind) property}
2112@item @tab @code{integer(kind=c_size_t) acc_get_property}
6c84c8bf
MR
2113@item @tab @code{character(*) string}
2114@end multitable
2115
2116@item @emph{Reference}:
2117@uref{https://www.openacc.org, OpenACC specification v2.6}, section
21183.2.6.
2119@end table
2120
2121
2122
cdf6119d
JN
2123@node acc_async_test
2124@section @code{acc_async_test} -- Test for completion of a specific asynchronous operation.
2125@table @asis
2126@item @emph{Description}
93d90219 2127This function tests for completion of the asynchronous operation specified
cdf6119d
JN
2128in @var{arg}. In C/C++, a non-zero value will be returned to indicate
2129the specified asynchronous operation has completed. While Fortran will return
93d90219 2130a @code{true}. If the asynchronous operation has not completed, C/C++ returns
cdf6119d
JN
2131a zero and Fortran returns a @code{false}.
2132
2133@item @emph{C/C++}:
2134@multitable @columnfractions .20 .80
2135@item @emph{Prototype}: @tab @code{int acc_async_test(int arg);}
2136@end multitable
2137
2138@item @emph{Fortran}:
2139@multitable @columnfractions .20 .80
2140@item @emph{Interface}: @tab @code{function acc_async_test(arg)}
2141@item @tab @code{integer(kind=acc_handle_kind) arg}
2142@item @tab @code{logical acc_async_test}
2143@end multitable
2144
2145@item @emph{Reference}:
e464fc90
TB
2146@uref{https://www.openacc.org, OpenACC specification v2.6}, section
21473.2.9.
cdf6119d
JN
2148@end table
2149
2150
2151
2152@node acc_async_test_all
2153@section @code{acc_async_test_all} -- Tests for completion of all asynchronous operations.
2154@table @asis
2155@item @emph{Description}
93d90219 2156This function tests for completion of all asynchronous operations.
cdf6119d
JN
2157In C/C++, a non-zero value will be returned to indicate all asynchronous
2158operations have completed. While Fortran will return a @code{true}. If
2159any asynchronous operation has not completed, C/C++ returns a zero and
2160Fortran returns a @code{false}.
2161
2162@item @emph{C/C++}:
2163@multitable @columnfractions .20 .80
2164@item @emph{Prototype}: @tab @code{int acc_async_test_all(void);}
2165@end multitable
2166
2167@item @emph{Fortran}:
2168@multitable @columnfractions .20 .80
2169@item @emph{Interface}: @tab @code{function acc_async_test()}
2170@item @tab @code{logical acc_get_device_num}
2171@end multitable
2172
2173@item @emph{Reference}:
e464fc90
TB
2174@uref{https://www.openacc.org, OpenACC specification v2.6}, section
21753.2.10.
cdf6119d
JN
2176@end table
2177
2178
2179
2180@node acc_wait
2181@section @code{acc_wait} -- Wait for completion of a specific asynchronous operation.
2182@table @asis
2183@item @emph{Description}
2184This function waits for completion of the asynchronous operation
2185specified in @var{arg}.
2186
2187@item @emph{C/C++}:
2188@multitable @columnfractions .20 .80
2189@item @emph{Prototype}: @tab @code{acc_wait(arg);}
7ce64403 2190@item @emph{Prototype (OpenACC 1.0 compatibility)}: @tab @code{acc_async_wait(arg);}
cdf6119d
JN
2191@end multitable
2192
2193@item @emph{Fortran}:
2194@multitable @columnfractions .20 .80
2195@item @emph{Interface}: @tab @code{subroutine acc_wait(arg)}
2196@item @tab @code{integer(acc_handle_kind) arg}
7ce64403
TS
2197@item @emph{Interface (OpenACC 1.0 compatibility)}: @tab @code{subroutine acc_async_wait(arg)}
2198@item @tab @code{integer(acc_handle_kind) arg}
cdf6119d
JN
2199@end multitable
2200
2201@item @emph{Reference}:
e464fc90
TB
2202@uref{https://www.openacc.org, OpenACC specification v2.6}, section
22033.2.11.
cdf6119d
JN
2204@end table
2205
2206
2207
2208@node acc_wait_all
2209@section @code{acc_wait_all} -- Waits for completion of all asynchronous operations.
2210@table @asis
2211@item @emph{Description}
2212This function waits for the completion of all asynchronous operations.
2213
2214@item @emph{C/C++}:
2215@multitable @columnfractions .20 .80
2216@item @emph{Prototype}: @tab @code{acc_wait_all(void);}
7ce64403 2217@item @emph{Prototype (OpenACC 1.0 compatibility)}: @tab @code{acc_async_wait_all(void);}
cdf6119d
JN
2218@end multitable
2219
2220@item @emph{Fortran}:
2221@multitable @columnfractions .20 .80
7ce64403
TS
2222@item @emph{Interface}: @tab @code{subroutine acc_wait_all()}
2223@item @emph{Interface (OpenACC 1.0 compatibility)}: @tab @code{subroutine acc_async_wait_all()}
cdf6119d
JN
2224@end multitable
2225
2226@item @emph{Reference}:
e464fc90
TB
2227@uref{https://www.openacc.org, OpenACC specification v2.6}, section
22283.2.13.
cdf6119d
JN
2229@end table
2230
2231
2232
2233@node acc_wait_all_async
2234@section @code{acc_wait_all_async} -- Wait for completion of all asynchronous operations.
2235@table @asis
2236@item @emph{Description}
2237This function enqueues a wait operation on the queue @var{async} for any
2238and all asynchronous operations that have been previously enqueued on
2239any queue.
2240
2241@item @emph{C/C++}:
2242@multitable @columnfractions .20 .80
2243@item @emph{Prototype}: @tab @code{acc_wait_all_async(int async);}
2244@end multitable
2245
2246@item @emph{Fortran}:
2247@multitable @columnfractions .20 .80
2248@item @emph{Interface}: @tab @code{subroutine acc_wait_all_async(async)}
2249@item @tab @code{integer(acc_handle_kind) async}
2250@end multitable
2251
2252@item @emph{Reference}:
e464fc90
TB
2253@uref{https://www.openacc.org, OpenACC specification v2.6}, section
22543.2.14.
cdf6119d
JN
2255@end table
2256
2257
2258
2259@node acc_wait_async
2260@section @code{acc_wait_async} -- Wait for completion of asynchronous operations.
2261@table @asis
2262@item @emph{Description}
2263This function enqueues a wait operation on queue @var{async} for any and all
2264asynchronous operations enqueued on queue @var{arg}.
2265
2266@item @emph{C/C++}:
2267@multitable @columnfractions .20 .80
2268@item @emph{Prototype}: @tab @code{acc_wait_async(int arg, int async);}
2269@end multitable
2270
2271@item @emph{Fortran}:
2272@multitable @columnfractions .20 .80
2273@item @emph{Interface}: @tab @code{subroutine acc_wait_async(arg, async)}
2274@item @tab @code{integer(acc_handle_kind) arg, async}
2275@end multitable
2276
2277@item @emph{Reference}:
e464fc90
TB
2278@uref{https://www.openacc.org, OpenACC specification v2.6}, section
22793.2.12.
cdf6119d
JN
2280@end table
2281
2282
2283
2284@node acc_init
2285@section @code{acc_init} -- Initialize runtime for a specific device type.
2286@table @asis
2287@item @emph{Description}
2288This function initializes the runtime for the device type specified in
2289@var{devicetype}.
2290
2291@item @emph{C/C++}:
2292@multitable @columnfractions .20 .80
2293@item @emph{Prototype}: @tab @code{acc_init(acc_device_t devicetype);}
2294@end multitable
2295
2296@item @emph{Fortran}:
2297@multitable @columnfractions .20 .80
2298@item @emph{Interface}: @tab @code{subroutine acc_init(devicetype)}
2299@item @tab @code{integer(acc_device_kind) devicetype}
2300@end multitable
2301
2302@item @emph{Reference}:
e464fc90
TB
2303@uref{https://www.openacc.org, OpenACC specification v2.6}, section
23043.2.7.
cdf6119d
JN
2305@end table
2306
2307
2308
2309@node acc_shutdown
2310@section @code{acc_shutdown} -- Shuts down the runtime for a specific device type.
2311@table @asis
2312@item @emph{Description}
2313This function shuts down the runtime for the device type specified in
2314@var{devicetype}.
2315
2316@item @emph{C/C++}:
2317@multitable @columnfractions .20 .80
2318@item @emph{Prototype}: @tab @code{acc_shutdown(acc_device_t devicetype);}
2319@end multitable
2320
2321@item @emph{Fortran}:
2322@multitable @columnfractions .20 .80
2323@item @emph{Interface}: @tab @code{subroutine acc_shutdown(devicetype)}
2324@item @tab @code{integer(acc_device_kind) devicetype}
2325@end multitable
2326
2327@item @emph{Reference}:
e464fc90
TB
2328@uref{https://www.openacc.org, OpenACC specification v2.6}, section
23293.2.8.
cdf6119d
JN
2330@end table
2331
2332
2333
2334@node acc_on_device
2335@section @code{acc_on_device} -- Whether executing on a particular device
2336@table @asis
2337@item @emph{Description}:
2338This function returns whether the program is executing on a particular
2339device specified in @var{devicetype}. In C/C++ a non-zero value is
93d90219 2340returned to indicate the device is executing on the specified device type.
cdf6119d
JN
2341In Fortran, @code{true} will be returned. If the program is not executing
2342on the specified device type C/C++ will return a zero, while Fortran will
2343return @code{false}.
2344
2345@item @emph{C/C++}:
2346@multitable @columnfractions .20 .80
2347@item @emph{Prototype}: @tab @code{acc_on_device(acc_device_t devicetype);}
2348@end multitable
2349
2350@item @emph{Fortran}:
2351@multitable @columnfractions .20 .80
2352@item @emph{Interface}: @tab @code{function acc_on_device(devicetype)}
2353@item @tab @code{integer(acc_device_kind) devicetype}
2354@item @tab @code{logical acc_on_device}
2355@end multitable
2356
2357
2358@item @emph{Reference}:
e464fc90
TB
2359@uref{https://www.openacc.org, OpenACC specification v2.6}, section
23603.2.17.
cdf6119d
JN
2361@end table
2362
2363
2364
2365@node acc_malloc
2366@section @code{acc_malloc} -- Allocate device memory.
2367@table @asis
2368@item @emph{Description}
2369This function allocates @var{len} bytes of device memory. It returns
2370the device address of the allocated memory.
2371
2372@item @emph{C/C++}:
2373@multitable @columnfractions .20 .80
2374@item @emph{Prototype}: @tab @code{d_void* acc_malloc(size_t len);}
2375@end multitable
2376
2377@item @emph{Reference}:
e464fc90
TB
2378@uref{https://www.openacc.org, OpenACC specification v2.6}, section
23793.2.18.
cdf6119d
JN
2380@end table
2381
2382
2383
2384@node acc_free
2385@section @code{acc_free} -- Free device memory.
2386@table @asis
2387@item @emph{Description}
2388Free previously allocated device memory at the device address @code{a}.
2389
2390@item @emph{C/C++}:
2391@multitable @columnfractions .20 .80
2392@item @emph{Prototype}: @tab @code{acc_free(d_void *a);}
2393@end multitable
2394
2395@item @emph{Reference}:
e464fc90
TB
2396@uref{https://www.openacc.org, OpenACC specification v2.6}, section
23973.2.19.
cdf6119d
JN
2398@end table
2399
2400
2401
2402@node acc_copyin
2403@section @code{acc_copyin} -- Allocate device memory and copy host memory to it.
2404@table @asis
2405@item @emph{Description}
2406In C/C++, this function allocates @var{len} bytes of device memory
2407and maps it to the specified host address in @var{a}. The device
2408address of the newly allocated device memory is returned.
2409
2410In Fortran, two (2) forms are supported. In the first form, @var{a} specifies
2411a contiguous array section. The second form @var{a} specifies a
2412variable or array element and @var{len} specifies the length in bytes.
2413
2414@item @emph{C/C++}:
2415@multitable @columnfractions .20 .80
2416@item @emph{Prototype}: @tab @code{void *acc_copyin(h_void *a, size_t len);}
e464fc90 2417@item @emph{Prototype}: @tab @code{void *acc_copyin_async(h_void *a, size_t len, int async);}
cdf6119d
JN
2418@end multitable
2419
2420@item @emph{Fortran}:
2421@multitable @columnfractions .20 .80
2422@item @emph{Interface}: @tab @code{subroutine acc_copyin(a)}
2423@item @tab @code{type, dimension(:[,:]...) :: a}
2424@item @emph{Interface}: @tab @code{subroutine acc_copyin(a, len)}
2425@item @tab @code{type, dimension(:[,:]...) :: a}
2426@item @tab @code{integer len}
e464fc90
TB
2427@item @emph{Interface}: @tab @code{subroutine acc_copyin_async(a, async)}
2428@item @tab @code{type, dimension(:[,:]...) :: a}
2429@item @tab @code{integer(acc_handle_kind) :: async}
2430@item @emph{Interface}: @tab @code{subroutine acc_copyin_async(a, len, async)}
2431@item @tab @code{type, dimension(:[,:]...) :: a}
2432@item @tab @code{integer len}
2433@item @tab @code{integer(acc_handle_kind) :: async}
cdf6119d
JN
2434@end multitable
2435
2436@item @emph{Reference}:
e464fc90
TB
2437@uref{https://www.openacc.org, OpenACC specification v2.6}, section
24383.2.20.
cdf6119d
JN
2439@end table
2440
2441
2442
2443@node acc_present_or_copyin
2444@section @code{acc_present_or_copyin} -- If the data is not present on the device, allocate device memory and copy from host memory.
2445@table @asis
2446@item @emph{Description}
c1030b5c 2447This function tests if the host data specified by @var{a} and of length
cdf6119d
JN
2448@var{len} is present or not. If it is not present, then device memory
2449will be allocated and the host memory copied. The device address of
2450the newly allocated device memory is returned.
2451
2452In Fortran, two (2) forms are supported. In the first form, @var{a} specifies
2453a contiguous array section. The second form @var{a} specifies a variable or
2454array element and @var{len} specifies the length in bytes.
2455
e464fc90
TB
2456Note that @code{acc_present_or_copyin} and @code{acc_pcopyin} exist for
2457backward compatibility with OpenACC 2.0; use @ref{acc_copyin} instead.
2458
cdf6119d
JN
2459@item @emph{C/C++}:
2460@multitable @columnfractions .20 .80
2461@item @emph{Prototype}: @tab @code{void *acc_present_or_copyin(h_void *a, size_t len);}
2462@item @emph{Prototype}: @tab @code{void *acc_pcopyin(h_void *a, size_t len);}
2463@end multitable
2464
2465@item @emph{Fortran}:
2466@multitable @columnfractions .20 .80
2467@item @emph{Interface}: @tab @code{subroutine acc_present_or_copyin(a)}
2468@item @tab @code{type, dimension(:[,:]...) :: a}
2469@item @emph{Interface}: @tab @code{subroutine acc_present_or_copyin(a, len)}
2470@item @tab @code{type, dimension(:[,:]...) :: a}
2471@item @tab @code{integer len}
2472@item @emph{Interface}: @tab @code{subroutine acc_pcopyin(a)}
2473@item @tab @code{type, dimension(:[,:]...) :: a}
2474@item @emph{Interface}: @tab @code{subroutine acc_pcopyin(a, len)}
2475@item @tab @code{type, dimension(:[,:]...) :: a}
2476@item @tab @code{integer len}
2477@end multitable
2478
2479@item @emph{Reference}:
e464fc90
TB
2480@uref{https://www.openacc.org, OpenACC specification v2.6}, section
24813.2.20.
cdf6119d
JN
2482@end table
2483
2484
2485
2486@node acc_create
2487@section @code{acc_create} -- Allocate device memory and map it to host memory.
2488@table @asis
2489@item @emph{Description}
2490This function allocates device memory and maps it to host memory specified
2491by the host address @var{a} with a length of @var{len} bytes. In C/C++,
2492the function returns the device address of the allocated device memory.
2493
2494In Fortran, two (2) forms are supported. In the first form, @var{a} specifies
2495a contiguous array section. The second form @var{a} specifies a variable or
2496array element and @var{len} specifies the length in bytes.
2497
2498@item @emph{C/C++}:
2499@multitable @columnfractions .20 .80
2500@item @emph{Prototype}: @tab @code{void *acc_create(h_void *a, size_t len);}
e464fc90 2501@item @emph{Prototype}: @tab @code{void *acc_create_async(h_void *a, size_t len, int async);}
cdf6119d
JN
2502@end multitable
2503
2504@item @emph{Fortran}:
2505@multitable @columnfractions .20 .80
2506@item @emph{Interface}: @tab @code{subroutine acc_create(a)}
2507@item @tab @code{type, dimension(:[,:]...) :: a}
2508@item @emph{Interface}: @tab @code{subroutine acc_create(a, len)}
2509@item @tab @code{type, dimension(:[,:]...) :: a}
2510@item @tab @code{integer len}
e464fc90
TB
2511@item @emph{Interface}: @tab @code{subroutine acc_create_async(a, async)}
2512@item @tab @code{type, dimension(:[,:]...) :: a}
2513@item @tab @code{integer(acc_handle_kind) :: async}
2514@item @emph{Interface}: @tab @code{subroutine acc_create_async(a, len, async)}
2515@item @tab @code{type, dimension(:[,:]...) :: a}
2516@item @tab @code{integer len}
2517@item @tab @code{integer(acc_handle_kind) :: async}
cdf6119d
JN
2518@end multitable
2519
2520@item @emph{Reference}:
e464fc90
TB
2521@uref{https://www.openacc.org, OpenACC specification v2.6}, section
25223.2.21.
cdf6119d
JN
2523@end table
2524
2525
2526
2527@node acc_present_or_create
2528@section @code{acc_present_or_create} -- If the data is not present on the device, allocate device memory and map it to host memory.
2529@table @asis
2530@item @emph{Description}
c1030b5c 2531This function tests if the host data specified by @var{a} and of length
cdf6119d
JN
2532@var{len} is present or not. If it is not present, then device memory
2533will be allocated and mapped to host memory. In C/C++, the device address
2534of the newly allocated device memory is returned.
2535
2536In Fortran, two (2) forms are supported. In the first form, @var{a} specifies
2537a contiguous array section. The second form @var{a} specifies a variable or
2538array element and @var{len} specifies the length in bytes.
2539
e464fc90
TB
2540Note that @code{acc_present_or_create} and @code{acc_pcreate} exist for
2541backward compatibility with OpenACC 2.0; use @ref{acc_create} instead.
cdf6119d
JN
2542
2543@item @emph{C/C++}:
2544@multitable @columnfractions .20 .80
2545@item @emph{Prototype}: @tab @code{void *acc_present_or_create(h_void *a, size_t len)}
2546@item @emph{Prototype}: @tab @code{void *acc_pcreate(h_void *a, size_t len)}
2547@end multitable
2548
2549@item @emph{Fortran}:
2550@multitable @columnfractions .20 .80
2551@item @emph{Interface}: @tab @code{subroutine acc_present_or_create(a)}
2552@item @tab @code{type, dimension(:[,:]...) :: a}
2553@item @emph{Interface}: @tab @code{subroutine acc_present_or_create(a, len)}
2554@item @tab @code{type, dimension(:[,:]...) :: a}
2555@item @tab @code{integer len}
2556@item @emph{Interface}: @tab @code{subroutine acc_pcreate(a)}
2557@item @tab @code{type, dimension(:[,:]...) :: a}
2558@item @emph{Interface}: @tab @code{subroutine acc_pcreate(a, len)}
2559@item @tab @code{type, dimension(:[,:]...) :: a}
2560@item @tab @code{integer len}
2561@end multitable
2562
2563@item @emph{Reference}:
e464fc90
TB
2564@uref{https://www.openacc.org, OpenACC specification v2.6}, section
25653.2.21.
cdf6119d
JN
2566@end table
2567
2568
2569
2570@node acc_copyout
2571@section @code{acc_copyout} -- Copy device memory to host memory.
2572@table @asis
2573@item @emph{Description}
2574This function copies mapped device memory to host memory which is specified
2575by host address @var{a} for a length @var{len} bytes in C/C++.
2576
2577In Fortran, two (2) forms are supported. In the first form, @var{a} specifies
2578a contiguous array section. The second form @var{a} specifies a variable or
2579array element and @var{len} specifies the length in bytes.
2580
2581@item @emph{C/C++}:
2582@multitable @columnfractions .20 .80
2583@item @emph{Prototype}: @tab @code{acc_copyout(h_void *a, size_t len);}
e464fc90
TB
2584@item @emph{Prototype}: @tab @code{acc_copyout_async(h_void *a, size_t len, int async);}
2585@item @emph{Prototype}: @tab @code{acc_copyout_finalize(h_void *a, size_t len);}
2586@item @emph{Prototype}: @tab @code{acc_copyout_finalize_async(h_void *a, size_t len, int async);}
cdf6119d
JN
2587@end multitable
2588
2589@item @emph{Fortran}:
2590@multitable @columnfractions .20 .80
2591@item @emph{Interface}: @tab @code{subroutine acc_copyout(a)}
2592@item @tab @code{type, dimension(:[,:]...) :: a}
2593@item @emph{Interface}: @tab @code{subroutine acc_copyout(a, len)}
2594@item @tab @code{type, dimension(:[,:]...) :: a}
2595@item @tab @code{integer len}
e464fc90
TB
2596@item @emph{Interface}: @tab @code{subroutine acc_copyout_async(a, async)}
2597@item @tab @code{type, dimension(:[,:]...) :: a}
2598@item @tab @code{integer(acc_handle_kind) :: async}
2599@item @emph{Interface}: @tab @code{subroutine acc_copyout_async(a, len, async)}
2600@item @tab @code{type, dimension(:[,:]...) :: a}
2601@item @tab @code{integer len}
2602@item @tab @code{integer(acc_handle_kind) :: async}
2603@item @emph{Interface}: @tab @code{subroutine acc_copyout_finalize(a)}
2604@item @tab @code{type, dimension(:[,:]...) :: a}
2605@item @emph{Interface}: @tab @code{subroutine acc_copyout_finalize(a, len)}
2606@item @tab @code{type, dimension(:[,:]...) :: a}
2607@item @tab @code{integer len}
2608@item @emph{Interface}: @tab @code{subroutine acc_copyout_finalize_async(a, async)}
2609@item @tab @code{type, dimension(:[,:]...) :: a}
2610@item @tab @code{integer(acc_handle_kind) :: async}
2611@item @emph{Interface}: @tab @code{subroutine acc_copyout_finalize_async(a, len, async)}
2612@item @tab @code{type, dimension(:[,:]...) :: a}
2613@item @tab @code{integer len}
2614@item @tab @code{integer(acc_handle_kind) :: async}
cdf6119d
JN
2615@end multitable
2616
2617@item @emph{Reference}:
e464fc90
TB
2618@uref{https://www.openacc.org, OpenACC specification v2.6}, section
26193.2.22.
cdf6119d
JN
2620@end table
2621
2622
2623
2624@node acc_delete
2625@section @code{acc_delete} -- Free device memory.
2626@table @asis
2627@item @emph{Description}
2628This function frees previously allocated device memory specified by
2629the device address @var{a} and the length of @var{len} bytes.
2630
2631In Fortran, two (2) forms are supported. In the first form, @var{a} specifies
2632a contiguous array section. The second form @var{a} specifies a variable or
2633array element and @var{len} specifies the length in bytes.
2634
2635@item @emph{C/C++}:
2636@multitable @columnfractions .20 .80
2637@item @emph{Prototype}: @tab @code{acc_delete(h_void *a, size_t len);}
e464fc90
TB
2638@item @emph{Prototype}: @tab @code{acc_delete_async(h_void *a, size_t len, int async);}
2639@item @emph{Prototype}: @tab @code{acc_delete_finalize(h_void *a, size_t len);}
2640@item @emph{Prototype}: @tab @code{acc_delete_finalize_async(h_void *a, size_t len, int async);}
cdf6119d
JN
2641@end multitable
2642
2643@item @emph{Fortran}:
2644@multitable @columnfractions .20 .80
2645@item @emph{Interface}: @tab @code{subroutine acc_delete(a)}
2646@item @tab @code{type, dimension(:[,:]...) :: a}
2647@item @emph{Interface}: @tab @code{subroutine acc_delete(a, len)}
2648@item @tab @code{type, dimension(:[,:]...) :: a}
2649@item @tab @code{integer len}
e464fc90
TB
2650@item @emph{Interface}: @tab @code{subroutine acc_delete_async(a, async)}
2651@item @tab @code{type, dimension(:[,:]...) :: a}
2652@item @tab @code{integer(acc_handle_kind) :: async}
2653@item @emph{Interface}: @tab @code{subroutine acc_delete_async(a, len, async)}
2654@item @tab @code{type, dimension(:[,:]...) :: a}
2655@item @tab @code{integer len}
2656@item @tab @code{integer(acc_handle_kind) :: async}
2657@item @emph{Interface}: @tab @code{subroutine acc_delete_finalize(a)}
2658@item @tab @code{type, dimension(:[,:]...) :: a}
2659@item @emph{Interface}: @tab @code{subroutine acc_delete_finalize(a, len)}
2660@item @tab @code{type, dimension(:[,:]...) :: a}
2661@item @tab @code{integer len}
2662@item @emph{Interface}: @tab @code{subroutine acc_delete_async_finalize(a, async)}
2663@item @tab @code{type, dimension(:[,:]...) :: a}
2664@item @tab @code{integer(acc_handle_kind) :: async}
2665@item @emph{Interface}: @tab @code{subroutine acc_delete_async_finalize(a, len, async)}
2666@item @tab @code{type, dimension(:[,:]...) :: a}
2667@item @tab @code{integer len}
2668@item @tab @code{integer(acc_handle_kind) :: async}
cdf6119d
JN
2669@end multitable
2670
2671@item @emph{Reference}:
e464fc90
TB
2672@uref{https://www.openacc.org, OpenACC specification v2.6}, section
26733.2.23.
cdf6119d
JN
2674@end table
2675
2676
2677
2678@node acc_update_device
2679@section @code{acc_update_device} -- Update device memory from mapped host memory.
2680@table @asis
2681@item @emph{Description}
2682This function updates the device copy from the previously mapped host memory.
2683The host memory is specified with the host address @var{a} and a length of
2684@var{len} bytes.
2685
2686In Fortran, two (2) forms are supported. In the first form, @var{a} specifies
2687a contiguous array section. The second form @var{a} specifies a variable or
2688array element and @var{len} specifies the length in bytes.
2689
2690@item @emph{C/C++}:
2691@multitable @columnfractions .20 .80
2692@item @emph{Prototype}: @tab @code{acc_update_device(h_void *a, size_t len);}
e464fc90 2693@item @emph{Prototype}: @tab @code{acc_update_device(h_void *a, size_t len, async);}
cdf6119d
JN
2694@end multitable
2695
2696@item @emph{Fortran}:
2697@multitable @columnfractions .20 .80
2698@item @emph{Interface}: @tab @code{subroutine acc_update_device(a)}
2699@item @tab @code{type, dimension(:[,:]...) :: a}
2700@item @emph{Interface}: @tab @code{subroutine acc_update_device(a, len)}
2701@item @tab @code{type, dimension(:[,:]...) :: a}
2702@item @tab @code{integer len}
e464fc90
TB
2703@item @emph{Interface}: @tab @code{subroutine acc_update_device_async(a, async)}
2704@item @tab @code{type, dimension(:[,:]...) :: a}
2705@item @tab @code{integer(acc_handle_kind) :: async}
2706@item @emph{Interface}: @tab @code{subroutine acc_update_device_async(a, len, async)}
2707@item @tab @code{type, dimension(:[,:]...) :: a}
2708@item @tab @code{integer len}
2709@item @tab @code{integer(acc_handle_kind) :: async}
cdf6119d
JN
2710@end multitable
2711
2712@item @emph{Reference}:
e464fc90
TB
2713@uref{https://www.openacc.org, OpenACC specification v2.6}, section
27143.2.24.
cdf6119d
JN
2715@end table
2716
2717
2718
2719@node acc_update_self
2720@section @code{acc_update_self} -- Update host memory from mapped device memory.
2721@table @asis
2722@item @emph{Description}
2723This function updates the host copy from the previously mapped device memory.
2724The host memory is specified with the host address @var{a} and a length of
2725@var{len} bytes.
2726
2727In Fortran, two (2) forms are supported. In the first form, @var{a} specifies
2728a contiguous array section. The second form @var{a} specifies a variable or
2729array element and @var{len} specifies the length in bytes.
2730
2731@item @emph{C/C++}:
2732@multitable @columnfractions .20 .80
2733@item @emph{Prototype}: @tab @code{acc_update_self(h_void *a, size_t len);}
e464fc90 2734@item @emph{Prototype}: @tab @code{acc_update_self_async(h_void *a, size_t len, int async);}
cdf6119d
JN
2735@end multitable
2736
2737@item @emph{Fortran}:
2738@multitable @columnfractions .20 .80
2739@item @emph{Interface}: @tab @code{subroutine acc_update_self(a)}
2740@item @tab @code{type, dimension(:[,:]...) :: a}
2741@item @emph{Interface}: @tab @code{subroutine acc_update_self(a, len)}
2742@item @tab @code{type, dimension(:[,:]...) :: a}
2743@item @tab @code{integer len}
e464fc90
TB
2744@item @emph{Interface}: @tab @code{subroutine acc_update_self_async(a, async)}
2745@item @tab @code{type, dimension(:[,:]...) :: a}
2746@item @tab @code{integer(acc_handle_kind) :: async}
2747@item @emph{Interface}: @tab @code{subroutine acc_update_self_async(a, len, async)}
2748@item @tab @code{type, dimension(:[,:]...) :: a}
2749@item @tab @code{integer len}
2750@item @tab @code{integer(acc_handle_kind) :: async}
cdf6119d
JN
2751@end multitable
2752
2753@item @emph{Reference}:
e464fc90
TB
2754@uref{https://www.openacc.org, OpenACC specification v2.6}, section
27553.2.25.
cdf6119d
JN
2756@end table
2757
2758
2759
2760@node acc_map_data
2761@section @code{acc_map_data} -- Map previously allocated device memory to host memory.
2762@table @asis
2763@item @emph{Description}
2764This function maps previously allocated device and host memory. The device
2765memory is specified with the device address @var{d}. The host memory is
2766specified with the host address @var{h} and a length of @var{len}.
2767
2768@item @emph{C/C++}:
2769@multitable @columnfractions .20 .80
2770@item @emph{Prototype}: @tab @code{acc_map_data(h_void *h, d_void *d, size_t len);}
2771@end multitable
2772
2773@item @emph{Reference}:
e464fc90
TB
2774@uref{https://www.openacc.org, OpenACC specification v2.6}, section
27753.2.26.
cdf6119d
JN
2776@end table
2777
2778
2779
2780@node acc_unmap_data
2781@section @code{acc_unmap_data} -- Unmap device memory from host memory.
2782@table @asis
2783@item @emph{Description}
2784This function unmaps previously mapped device and host memory. The latter
2785specified by @var{h}.
2786
2787@item @emph{C/C++}:
2788@multitable @columnfractions .20 .80
2789@item @emph{Prototype}: @tab @code{acc_unmap_data(h_void *h);}
2790@end multitable
2791
2792@item @emph{Reference}:
e464fc90
TB
2793@uref{https://www.openacc.org, OpenACC specification v2.6}, section
27943.2.27.
cdf6119d
JN
2795@end table
2796
2797
2798
2799@node acc_deviceptr
2800@section @code{acc_deviceptr} -- Get device pointer associated with specific host address.
2801@table @asis
2802@item @emph{Description}
2803This function returns the device address that has been mapped to the
2804host address specified by @var{h}.
2805
2806@item @emph{C/C++}:
2807@multitable @columnfractions .20 .80
2808@item @emph{Prototype}: @tab @code{void *acc_deviceptr(h_void *h);}
2809@end multitable
2810
2811@item @emph{Reference}:
e464fc90
TB
2812@uref{https://www.openacc.org, OpenACC specification v2.6}, section
28133.2.28.
cdf6119d
JN
2814@end table
2815
2816
2817
2818@node acc_hostptr
2819@section @code{acc_hostptr} -- Get host pointer associated with specific device address.
2820@table @asis
2821@item @emph{Description}
2822This function returns the host address that has been mapped to the
2823device address specified by @var{d}.
2824
2825@item @emph{C/C++}:
2826@multitable @columnfractions .20 .80
2827@item @emph{Prototype}: @tab @code{void *acc_hostptr(d_void *d);}
2828@end multitable
2829
2830@item @emph{Reference}:
e464fc90
TB
2831@uref{https://www.openacc.org, OpenACC specification v2.6}, section
28323.2.29.
cdf6119d
JN
2833@end table
2834
2835
2836
2837@node acc_is_present
2838@section @code{acc_is_present} -- Indicate whether host variable / array is present on device.
2839@table @asis
2840@item @emph{Description}
2841This function indicates whether the specified host address in @var{a} and a
2842length of @var{len} bytes is present on the device. In C/C++, a non-zero
2843value is returned to indicate the presence of the mapped memory on the
2844device. A zero is returned to indicate the memory is not mapped on the
2845device.
2846
2847In Fortran, two (2) forms are supported. In the first form, @var{a} specifies
2848a contiguous array section. The second form @var{a} specifies a variable or
2849array element and @var{len} specifies the length in bytes. If the host
2850memory is mapped to device memory, then a @code{true} is returned. Otherwise,
2851a @code{false} is return to indicate the mapped memory is not present.
2852
2853@item @emph{C/C++}:
2854@multitable @columnfractions .20 .80
2855@item @emph{Prototype}: @tab @code{int acc_is_present(h_void *a, size_t len);}
2856@end multitable
2857
2858@item @emph{Fortran}:
2859@multitable @columnfractions .20 .80
2860@item @emph{Interface}: @tab @code{function acc_is_present(a)}
2861@item @tab @code{type, dimension(:[,:]...) :: a}
2862@item @tab @code{logical acc_is_present}
2863@item @emph{Interface}: @tab @code{function acc_is_present(a, len)}
2864@item @tab @code{type, dimension(:[,:]...) :: a}
2865@item @tab @code{integer len}
2866@item @tab @code{logical acc_is_present}
2867@end multitable
2868
2869@item @emph{Reference}:
e464fc90
TB
2870@uref{https://www.openacc.org, OpenACC specification v2.6}, section
28713.2.30.
cdf6119d
JN
2872@end table
2873
2874
2875
2876@node acc_memcpy_to_device
2877@section @code{acc_memcpy_to_device} -- Copy host memory to device memory.
2878@table @asis
2879@item @emph{Description}
2880This function copies host memory specified by host address of @var{src} to
2881device memory specified by the device address @var{dest} for a length of
2882@var{bytes} bytes.
2883
2884@item @emph{C/C++}:
2885@multitable @columnfractions .20 .80
2886@item @emph{Prototype}: @tab @code{acc_memcpy_to_device(d_void *dest, h_void *src, size_t bytes);}
2887@end multitable
2888
2889@item @emph{Reference}:
e464fc90
TB
2890@uref{https://www.openacc.org, OpenACC specification v2.6}, section
28913.2.31.
cdf6119d
JN
2892@end table
2893
2894
2895
2896@node acc_memcpy_from_device
2897@section @code{acc_memcpy_from_device} -- Copy device memory to host memory.
2898@table @asis
2899@item @emph{Description}
2900This function copies host memory specified by host address of @var{src} from
2901device memory specified by the device address @var{dest} for a length of
2902@var{bytes} bytes.
2903
2904@item @emph{C/C++}:
2905@multitable @columnfractions .20 .80
2906@item @emph{Prototype}: @tab @code{acc_memcpy_from_device(d_void *dest, h_void *src, size_t bytes);}
2907@end multitable
2908
2909@item @emph{Reference}:
e464fc90
TB
2910@uref{https://www.openacc.org, OpenACC specification v2.6}, section
29113.2.32.
2912@end table
2913
2914
2915
2916@node acc_attach
2917@section @code{acc_attach} -- Let device pointer point to device-pointer target.
2918@table @asis
2919@item @emph{Description}
2920This function updates a pointer on the device from pointing to a host-pointer
2921address to pointing to the corresponding device data.
2922
2923@item @emph{C/C++}:
2924@multitable @columnfractions .20 .80
2925@item @emph{Prototype}: @tab @code{acc_attach(h_void **ptr);}
2926@item @emph{Prototype}: @tab @code{acc_attach_async(h_void **ptr, int async);}
2927@end multitable
2928
2929@item @emph{Reference}:
2930@uref{https://www.openacc.org, OpenACC specification v2.6}, section
29313.2.34.
2932@end table
2933
2934
2935
2936@node acc_detach
2937@section @code{acc_detach} -- Let device pointer point to host-pointer target.
2938@table @asis
2939@item @emph{Description}
2940This function updates a pointer on the device from pointing to a device-pointer
2941address to pointing to the corresponding host data.
2942
2943@item @emph{C/C++}:
2944@multitable @columnfractions .20 .80
2945@item @emph{Prototype}: @tab @code{acc_detach(h_void **ptr);}
2946@item @emph{Prototype}: @tab @code{acc_detach_async(h_void **ptr, int async);}
2947@item @emph{Prototype}: @tab @code{acc_detach_finalize(h_void **ptr);}
2948@item @emph{Prototype}: @tab @code{acc_detach_finalize_async(h_void **ptr, int async);}
2949@end multitable
2950
2951@item @emph{Reference}:
2952@uref{https://www.openacc.org, OpenACC specification v2.6}, section
29533.2.35.
cdf6119d
JN
2954@end table
2955
2956
2957
2958@node acc_get_current_cuda_device
2959@section @code{acc_get_current_cuda_device} -- Get CUDA device handle.
2960@table @asis
2961@item @emph{Description}
2962This function returns the CUDA device handle. This handle is the same
2963as used by the CUDA Runtime or Driver API's.
2964
2965@item @emph{C/C++}:
2966@multitable @columnfractions .20 .80
2967@item @emph{Prototype}: @tab @code{void *acc_get_current_cuda_device(void);}
2968@end multitable
2969
2970@item @emph{Reference}:
e464fc90 2971@uref{https://www.openacc.org, OpenACC specification v2.6}, section
cdf6119d
JN
2972A.2.1.1.
2973@end table
2974
2975
2976
2977@node acc_get_current_cuda_context
2978@section @code{acc_get_current_cuda_context} -- Get CUDA context handle.
2979@table @asis
2980@item @emph{Description}
2981This function returns the CUDA context handle. This handle is the same
2982as used by the CUDA Runtime or Driver API's.
2983
2984@item @emph{C/C++}:
2985@multitable @columnfractions .20 .80
18c247cc 2986@item @emph{Prototype}: @tab @code{void *acc_get_current_cuda_context(void);}
cdf6119d
JN
2987@end multitable
2988
2989@item @emph{Reference}:
e464fc90 2990@uref{https://www.openacc.org, OpenACC specification v2.6}, section
cdf6119d
JN
2991A.2.1.2.
2992@end table
2993
2994
2995
2996@node acc_get_cuda_stream
2997@section @code{acc_get_cuda_stream} -- Get CUDA stream handle.
2998@table @asis
2999@item @emph{Description}
18c247cc
TS
3000This function returns the CUDA stream handle for the queue @var{async}.
3001This handle is the same as used by the CUDA Runtime or Driver API's.
cdf6119d
JN
3002
3003@item @emph{C/C++}:
3004@multitable @columnfractions .20 .80
18c247cc 3005@item @emph{Prototype}: @tab @code{void *acc_get_cuda_stream(int async);}
cdf6119d
JN
3006@end multitable
3007
3008@item @emph{Reference}:
e464fc90 3009@uref{https://www.openacc.org, OpenACC specification v2.6}, section
cdf6119d
JN
3010A.2.1.3.
3011@end table
3012
3013
3014
3015@node acc_set_cuda_stream
3016@section @code{acc_set_cuda_stream} -- Set CUDA stream handle.
3017@table @asis
3018@item @emph{Description}
3019This function associates the stream handle specified by @var{stream} with
18c247cc
TS
3020the queue @var{async}.
3021
3022This cannot be used to change the stream handle associated with
3023@code{acc_async_sync}.
3024
3025The return value is not specified.
cdf6119d
JN
3026
3027@item @emph{C/C++}:
3028@multitable @columnfractions .20 .80
18c247cc 3029@item @emph{Prototype}: @tab @code{int acc_set_cuda_stream(int async, void *stream);}
cdf6119d
JN
3030@end multitable
3031
3032@item @emph{Reference}:
e464fc90 3033@uref{https://www.openacc.org, OpenACC specification v2.6}, section
cdf6119d
JN
3034A.2.1.4.
3035@end table
3036
3037
3038
5fae049d
TS
3039@node acc_prof_register
3040@section @code{acc_prof_register} -- Register callbacks.
3041@table @asis
3042@item @emph{Description}:
3043This function registers callbacks.
3044
3045@item @emph{C/C++}:
3046@multitable @columnfractions .20 .80
3047@item @emph{Prototype}: @tab @code{void acc_prof_register (acc_event_t, acc_prof_callback, acc_register_t);}
3048@end multitable
3049
3050@item @emph{See also}:
3051@ref{OpenACC Profiling Interface}
3052
3053@item @emph{Reference}:
3054@uref{https://www.openacc.org, OpenACC specification v2.6}, section
30555.3.
3056@end table
3057
3058
3059
3060@node acc_prof_unregister
3061@section @code{acc_prof_unregister} -- Unregister callbacks.
3062@table @asis
3063@item @emph{Description}:
3064This function unregisters callbacks.
3065
3066@item @emph{C/C++}:
3067@multitable @columnfractions .20 .80
3068@item @emph{Prototype}: @tab @code{void acc_prof_unregister (acc_event_t, acc_prof_callback, acc_register_t);}
3069@end multitable
3070
3071@item @emph{See also}:
3072@ref{OpenACC Profiling Interface}
3073
3074@item @emph{Reference}:
3075@uref{https://www.openacc.org, OpenACC specification v2.6}, section
30765.3.
3077@end table
3078
3079
3080
3081@node acc_prof_lookup
3082@section @code{acc_prof_lookup} -- Obtain inquiry functions.
3083@table @asis
3084@item @emph{Description}:
3085Function to obtain inquiry functions.
3086
3087@item @emph{C/C++}:
3088@multitable @columnfractions .20 .80
3089@item @emph{Prototype}: @tab @code{acc_query_fn acc_prof_lookup (const char *);}
3090@end multitable
3091
3092@item @emph{See also}:
3093@ref{OpenACC Profiling Interface}
3094
3095@item @emph{Reference}:
3096@uref{https://www.openacc.org, OpenACC specification v2.6}, section
30975.3.
3098@end table
3099
3100
3101
3102@node acc_register_library
3103@section @code{acc_register_library} -- Library registration.
3104@table @asis
3105@item @emph{Description}:
3106Function for library registration.
3107
3108@item @emph{C/C++}:
3109@multitable @columnfractions .20 .80
3110@item @emph{Prototype}: @tab @code{void acc_register_library (acc_prof_reg, acc_prof_reg, acc_prof_lookup_func);}
3111@end multitable
3112
3113@item @emph{See also}:
3114@ref{OpenACC Profiling Interface}, @ref{ACC_PROFLIB}
3115
3116@item @emph{Reference}:
3117@uref{https://www.openacc.org, OpenACC specification v2.6}, section
31185.3.
3119@end table
3120
3121
3122
cdf6119d
JN
3123@c ---------------------------------------------------------------------
3124@c OpenACC Environment Variables
3125@c ---------------------------------------------------------------------
3126
3127@node OpenACC Environment Variables
3128@chapter OpenACC Environment Variables
3129
3130The variables @env{ACC_DEVICE_TYPE} and @env{ACC_DEVICE_NUM}
3131are defined by section 4 of the OpenACC specification in version 2.0.
5fae049d
TS
3132The variable @env{ACC_PROFLIB}
3133is defined by section 4 of the OpenACC specification in version 2.6.
cdf6119d
JN
3134The variable @env{GCC_ACC_NOTIFY} is used for diagnostic purposes.
3135
3136@menu
3137* ACC_DEVICE_TYPE::
3138* ACC_DEVICE_NUM::
5fae049d 3139* ACC_PROFLIB::
cdf6119d
JN
3140* GCC_ACC_NOTIFY::
3141@end menu
3142
3143
3144
3145@node ACC_DEVICE_TYPE
3146@section @code{ACC_DEVICE_TYPE}
3147@table @asis
3148@item @emph{Reference}:
e464fc90 3149@uref{https://www.openacc.org, OpenACC specification v2.6}, section
cdf6119d
JN
31504.1.
3151@end table
3152
3153
3154
3155@node ACC_DEVICE_NUM
3156@section @code{ACC_DEVICE_NUM}
3157@table @asis
3158@item @emph{Reference}:
e464fc90 3159@uref{https://www.openacc.org, OpenACC specification v2.6}, section
cdf6119d
JN
31604.2.
3161@end table
3162
3163
3164
5fae049d
TS
3165@node ACC_PROFLIB
3166@section @code{ACC_PROFLIB}
3167@table @asis
3168@item @emph{See also}:
3169@ref{acc_register_library}, @ref{OpenACC Profiling Interface}
3170
3171@item @emph{Reference}:
3172@uref{https://www.openacc.org, OpenACC specification v2.6}, section
31734.3.
3174@end table
3175
3176
3177
cdf6119d
JN
3178@node GCC_ACC_NOTIFY
3179@section @code{GCC_ACC_NOTIFY}
3180@table @asis
3181@item @emph{Description}:
3182Print debug information pertaining to the accelerator.
3183@end table
3184
3185
3186
3187@c ---------------------------------------------------------------------
3188@c CUDA Streams Usage
3189@c ---------------------------------------------------------------------
3190
3191@node CUDA Streams Usage
3192@chapter CUDA Streams Usage
3193
3194This applies to the @code{nvptx} plugin only.
3195
3196The library provides elements that perform asynchronous movement of
3197data and asynchronous operation of computing constructs. This
3198asynchronous functionality is implemented by making use of CUDA
3199streams@footnote{See "Stream Management" in "CUDA Driver API",
3200TRM-06703-001, Version 5.5, for additional information}.
3201
c1030b5c 3202The primary means by that the asynchronous functionality is accessed
cdf6119d
JN
3203is through the use of those OpenACC directives which make use of the
3204@code{async} and @code{wait} clauses. When the @code{async} clause is
3205first used with a directive, it creates a CUDA stream. If an
3206@code{async-argument} is used with the @code{async} clause, then the
3207stream is associated with the specified @code{async-argument}.
3208
3209Following the creation of an association between a CUDA stream and the
3210@code{async-argument} of an @code{async} clause, both the @code{wait}
3211clause and the @code{wait} directive can be used. When either the
3212clause or directive is used after stream creation, it creates a
3213rendezvous point whereby execution waits until all operations
3214associated with the @code{async-argument}, that is, stream, have
3215completed.
3216
3217Normally, the management of the streams that are created as a result of
3218using the @code{async} clause, is done without any intervention by the
3219caller. This implies the association between the @code{async-argument}
3220and the CUDA stream will be maintained for the lifetime of the program.
3221However, this association can be changed through the use of the library
3222function @code{acc_set_cuda_stream}. When the function
3223@code{acc_set_cuda_stream} is called, the CUDA stream that was
3224originally associated with the @code{async} clause will be destroyed.
3225Caution should be taken when changing the association as subsequent
3226references to the @code{async-argument} refer to a different
3227CUDA stream.
3228
3229
3230
3231@c ---------------------------------------------------------------------
3232@c OpenACC Library Interoperability
3233@c ---------------------------------------------------------------------
3234
3235@node OpenACC Library Interoperability
3236@chapter OpenACC Library Interoperability
3237
3238@section Introduction
3239
3240The OpenACC library uses the CUDA Driver API, and may interact with
3241programs that use the Runtime library directly, or another library
3242based on the Runtime library, e.g., CUBLAS@footnote{See section 2.26,
3243"Interactions with the CUDA Driver API" in
3244"CUDA Runtime API", Version 5.5, and section 2.27, "VDPAU
3245Interoperability", in "CUDA Driver API", TRM-06703-001, Version 5.5,
3246for additional information on library interoperability.}.
3247This chapter describes the use cases and what changes are
3248required in order to use both the OpenACC library and the CUBLAS and Runtime
3249libraries within a program.
3250
3251@section First invocation: NVIDIA CUBLAS library API
3252
3253In this first use case (see below), a function in the CUBLAS library is called
3254prior to any of the functions in the OpenACC library. More specifically, the
3255function @code{cublasCreate()}.
3256
3257When invoked, the function initializes the library and allocates the
3258hardware resources on the host and the device on behalf of the caller. Once
3259the initialization and allocation has completed, a handle is returned to the
3260caller. The OpenACC library also requires initialization and allocation of
3261hardware resources. Since the CUBLAS library has already allocated the
3262hardware resources for the device, all that is left to do is to initialize
3263the OpenACC library and acquire the hardware resources on the host.
3264
3265Prior to calling the OpenACC function that initializes the library and
3266allocate the host hardware resources, you need to acquire the device number
3267that was allocated during the call to @code{cublasCreate()}. The invoking of the
3268runtime library function @code{cudaGetDevice()} accomplishes this. Once
3269acquired, the device number is passed along with the device type as
3270parameters to the OpenACC library function @code{acc_set_device_num()}.
3271
3272Once the call to @code{acc_set_device_num()} has completed, the OpenACC
3273library uses the context that was created during the call to
3274@code{cublasCreate()}. In other words, both libraries will be sharing the
3275same context.
3276
3277@smallexample
3278 /* Create the handle */
3279 s = cublasCreate(&h);
3280 if (s != CUBLAS_STATUS_SUCCESS)
3281 @{
3282 fprintf(stderr, "cublasCreate failed %d\n", s);
3283 exit(EXIT_FAILURE);
3284 @}
3285
3286 /* Get the device number */
3287 e = cudaGetDevice(&dev);
3288 if (e != cudaSuccess)
3289 @{
3290 fprintf(stderr, "cudaGetDevice failed %d\n", e);
3291 exit(EXIT_FAILURE);
3292 @}
3293
3294 /* Initialize OpenACC library and use device 'dev' */
3295 acc_set_device_num(dev, acc_device_nvidia);
3296
3297@end smallexample
3298@center Use Case 1
3299
3300@section First invocation: OpenACC library API
3301
3302In this second use case (see below), a function in the OpenACC library is
3303called prior to any of the functions in the CUBLAS library. More specificially,
3304the function @code{acc_set_device_num()}.
3305
3306In the use case presented here, the function @code{acc_set_device_num()}
3307is used to both initialize the OpenACC library and allocate the hardware
3308resources on the host and the device. In the call to the function, the
3309call parameters specify which device to use and what device
3310type to use, i.e., @code{acc_device_nvidia}. It should be noted that this
3311is but one method to initialize the OpenACC library and allocate the
3312appropriate hardware resources. Other methods are available through the
3313use of environment variables and these will be discussed in the next section.
3314
3315Once the call to @code{acc_set_device_num()} has completed, other OpenACC
3316functions can be called as seen with multiple calls being made to
3317@code{acc_copyin()}. In addition, calls can be made to functions in the
3318CUBLAS library. In the use case a call to @code{cublasCreate()} is made
3319subsequent to the calls to @code{acc_copyin()}.
3320As seen in the previous use case, a call to @code{cublasCreate()}
3321initializes the CUBLAS library and allocates the hardware resources on the
3322host and the device. However, since the device has already been allocated,
3323@code{cublasCreate()} will only initialize the CUBLAS library and allocate
3324the appropriate hardware resources on the host. The context that was created
3325as part of the OpenACC initialization is shared with the CUBLAS library,
3326similarly to the first use case.
3327
3328@smallexample
3329 dev = 0;
3330
3331 acc_set_device_num(dev, acc_device_nvidia);
3332
3333 /* Copy the first set to the device */
3334 d_X = acc_copyin(&h_X[0], N * sizeof (float));
3335 if (d_X == NULL)
3336 @{
3337 fprintf(stderr, "copyin error h_X\n");
3338 exit(EXIT_FAILURE);
3339 @}
3340
3341 /* Copy the second set to the device */
3342 d_Y = acc_copyin(&h_Y1[0], N * sizeof (float));
3343 if (d_Y == NULL)
3344 @{
3345 fprintf(stderr, "copyin error h_Y1\n");
3346 exit(EXIT_FAILURE);
3347 @}
3348
3349 /* Create the handle */
3350 s = cublasCreate(&h);
3351 if (s != CUBLAS_STATUS_SUCCESS)
3352 @{
3353 fprintf(stderr, "cublasCreate failed %d\n", s);
3354 exit(EXIT_FAILURE);
3355 @}
3356
3357 /* Perform saxpy using CUBLAS library function */
3358 s = cublasSaxpy(h, N, &alpha, d_X, 1, d_Y, 1);
3359 if (s != CUBLAS_STATUS_SUCCESS)
3360 @{
3361 fprintf(stderr, "cublasSaxpy failed %d\n", s);
3362 exit(EXIT_FAILURE);
3363 @}
3364
3365 /* Copy the results from the device */
3366 acc_memcpy_from_device(&h_Y1[0], d_Y, N * sizeof (float));
3367
3368@end smallexample
3369@center Use Case 2
3370
3371@section OpenACC library and environment variables
3372
3373There are two environment variables associated with the OpenACC library
3374that may be used to control the device type and device number:
8d1a1cb1
TB
3375@env{ACC_DEVICE_TYPE} and @env{ACC_DEVICE_NUM}, respectively. These two
3376environment variables can be used as an alternative to calling
cdf6119d
JN
3377@code{acc_set_device_num()}. As seen in the second use case, the device
3378type and device number were specified using @code{acc_set_device_num()}.
3379If however, the aforementioned environment variables were set, then the
3380call to @code{acc_set_device_num()} would not be required.
3381
3382
3383The use of the environment variables is only relevant when an OpenACC function
3384is called prior to a call to @code{cudaCreate()}. If @code{cudaCreate()}
3385is called prior to a call to an OpenACC function, then you must call
3386@code{acc_set_device_num()}@footnote{More complete information
3387about @env{ACC_DEVICE_TYPE} and @env{ACC_DEVICE_NUM} can be found in
9651fbaf 3388sections 4.1 and 4.2 of the @uref{https://www.openacc.org, OpenACC}
e464fc90 3389Application Programming Interface”, Version 2.6.}
cdf6119d
JN
3390
3391
3392
5fae049d
TS
3393@c ---------------------------------------------------------------------
3394@c OpenACC Profiling Interface
3395@c ---------------------------------------------------------------------
3396
3397@node OpenACC Profiling Interface
3398@chapter OpenACC Profiling Interface
3399
3400@section Implementation Status and Implementation-Defined Behavior
3401
3402We're implementing the OpenACC Profiling Interface as defined by the
3403OpenACC 2.6 specification. We're clarifying some aspects here as
3404@emph{implementation-defined behavior}, while they're still under
3405discussion within the OpenACC Technical Committee.
3406
3407This implementation is tuned to keep the performance impact as low as
3408possible for the (very common) case that the Profiling Interface is
3409not enabled. This is relevant, as the Profiling Interface affects all
3410the @emph{hot} code paths (in the target code, not in the offloaded
3411code). Users of the OpenACC Profiling Interface can be expected to
3412understand that performance will be impacted to some degree once the
3413Profiling Interface has gotten enabled: for example, because of the
3414@emph{runtime} (libgomp) calling into a third-party @emph{library} for
3415every event that has been registered.
3416
3417We're not yet accounting for the fact that @cite{OpenACC events may
3418occur during event processing}.
b52643ab
KCY
3419We just handle one case specially, as required by CUDA 9.0
3420@command{nvprof}, that @code{acc_get_device_type}
3421(@ref{acc_get_device_type})) may be called from
3422@code{acc_ev_device_init_start}, @code{acc_ev_device_init_end}
3423callbacks.
5fae049d
TS
3424
3425We're not yet implementing initialization via a
3426@code{acc_register_library} function that is either statically linked
3427in, or dynamically via @env{LD_PRELOAD}.
3428Initialization via @code{acc_register_library} functions dynamically
3429loaded via the @env{ACC_PROFLIB} environment variable does work, as
3430does directly calling @code{acc_prof_register},
3431@code{acc_prof_unregister}, @code{acc_prof_lookup}.
3432
3433As currently there are no inquiry functions defined, calls to
3434@code{acc_prof_lookup} will always return @code{NULL}.
3435
3436There aren't separate @emph{start}, @emph{stop} events defined for the
3437event types @code{acc_ev_create}, @code{acc_ev_delete},
3438@code{acc_ev_alloc}, @code{acc_ev_free}. It's not clear if these
3439should be triggered before or after the actual device-specific call is
3440made. We trigger them after.
3441
3442Remarks about data provided to callbacks:
3443
3444@table @asis
3445
3446@item @code{acc_prof_info.event_type}
3447It's not clear if for @emph{nested} event callbacks (for example,
3448@code{acc_ev_enqueue_launch_start} as part of a parent compute
3449construct), this should be set for the nested event
3450(@code{acc_ev_enqueue_launch_start}), or if the value of the parent
3451construct should remain (@code{acc_ev_compute_construct_start}). In
3452this implementation, the value will generally correspond to the
3453innermost nested event type.
3454
3455@item @code{acc_prof_info.device_type}
3456@itemize
3457
3458@item
3459For @code{acc_ev_compute_construct_start}, and in presence of an
3460@code{if} clause with @emph{false} argument, this will still refer to
3461the offloading device type.
3462It's not clear if that's the expected behavior.
3463
3464@item
3465Complementary to the item before, for
3466@code{acc_ev_compute_construct_end}, this is set to
3467@code{acc_device_host} in presence of an @code{if} clause with
3468@emph{false} argument.
3469It's not clear if that's the expected behavior.
3470
3471@end itemize
3472
3473@item @code{acc_prof_info.thread_id}
3474Always @code{-1}; not yet implemented.
3475
3476@item @code{acc_prof_info.async}
3477@itemize
3478
3479@item
3480Not yet implemented correctly for
3481@code{acc_ev_compute_construct_start}.
3482
3483@item
3484In a compute construct, for host-fallback
3485execution/@code{acc_device_host} it will always be
3486@code{acc_async_sync}.
3487It's not clear if that's the expected behavior.
3488
3489@item
3490For @code{acc_ev_device_init_start} and @code{acc_ev_device_init_end},
3491it will always be @code{acc_async_sync}.
3492It's not clear if that's the expected behavior.
3493
3494@end itemize
3495
3496@item @code{acc_prof_info.async_queue}
3497There is no @cite{limited number of asynchronous queues} in libgomp.
3498This will always have the same value as @code{acc_prof_info.async}.
3499
3500@item @code{acc_prof_info.src_file}
3501Always @code{NULL}; not yet implemented.
3502
3503@item @code{acc_prof_info.func_name}
3504Always @code{NULL}; not yet implemented.
3505
3506@item @code{acc_prof_info.line_no}
3507Always @code{-1}; not yet implemented.
3508
3509@item @code{acc_prof_info.end_line_no}
3510Always @code{-1}; not yet implemented.
3511
3512@item @code{acc_prof_info.func_line_no}
3513Always @code{-1}; not yet implemented.
3514
3515@item @code{acc_prof_info.func_end_line_no}
3516Always @code{-1}; not yet implemented.
3517
3518@item @code{acc_event_info.event_type}, @code{acc_event_info.*.event_type}
3519Relating to @code{acc_prof_info.event_type} discussed above, in this
3520implementation, this will always be the same value as
3521@code{acc_prof_info.event_type}.
3522
3523@item @code{acc_event_info.*.parent_construct}
3524@itemize
3525
3526@item
3527Will be @code{acc_construct_parallel} for all OpenACC compute
3528constructs as well as many OpenACC Runtime API calls; should be the
3529one matching the actual construct, or
3530@code{acc_construct_runtime_api}, respectively.
3531
3532@item
3533Will be @code{acc_construct_enter_data} or
3534@code{acc_construct_exit_data} when processing variable mappings
3535specified in OpenACC @emph{declare} directives; should be
3536@code{acc_construct_declare}.
3537
3538@item
3539For implicit @code{acc_ev_device_init_start},
3540@code{acc_ev_device_init_end}, and explicit as well as implicit
3541@code{acc_ev_alloc}, @code{acc_ev_free},
3542@code{acc_ev_enqueue_upload_start}, @code{acc_ev_enqueue_upload_end},
3543@code{acc_ev_enqueue_download_start}, and
3544@code{acc_ev_enqueue_download_end}, will be
3545@code{acc_construct_parallel}; should reflect the real parent
3546construct.
3547
3548@end itemize
3549
3550@item @code{acc_event_info.*.implicit}
3551For @code{acc_ev_alloc}, @code{acc_ev_free},
3552@code{acc_ev_enqueue_upload_start}, @code{acc_ev_enqueue_upload_end},
3553@code{acc_ev_enqueue_download_start}, and
3554@code{acc_ev_enqueue_download_end}, this currently will be @code{1}
3555also for explicit usage.
3556
3557@item @code{acc_event_info.data_event.var_name}
3558Always @code{NULL}; not yet implemented.
3559
3560@item @code{acc_event_info.data_event.host_ptr}
3561For @code{acc_ev_alloc}, and @code{acc_ev_free}, this is always
3562@code{NULL}.
3563
3564@item @code{typedef union acc_api_info}
3565@dots{} as printed in @cite{5.2.3. Third Argument: API-Specific
3566Information}. This should obviously be @code{typedef @emph{struct}
3567acc_api_info}.
3568
3569@item @code{acc_api_info.device_api}
3570Possibly not yet implemented correctly for
3571@code{acc_ev_compute_construct_start},
3572@code{acc_ev_device_init_start}, @code{acc_ev_device_init_end}:
3573will always be @code{acc_device_api_none} for these event types.
3574For @code{acc_ev_enter_data_start}, it will be
3575@code{acc_device_api_none} in some cases.
3576
3577@item @code{acc_api_info.device_type}
3578Always the same as @code{acc_prof_info.device_type}.
3579
3580@item @code{acc_api_info.vendor}
3581Always @code{-1}; not yet implemented.
3582
3583@item @code{acc_api_info.device_handle}
3584Always @code{NULL}; not yet implemented.
3585
3586@item @code{acc_api_info.context_handle}
3587Always @code{NULL}; not yet implemented.
3588
3589@item @code{acc_api_info.async_handle}
3590Always @code{NULL}; not yet implemented.
3591
3592@end table
3593
3594Remarks about certain event types:
3595
3596@table @asis
3597
3598@item @code{acc_ev_device_init_start}, @code{acc_ev_device_init_end}
3599@itemize
3600
3601@item
3602@c See 'DEVICE_INIT_INSIDE_COMPUTE_CONSTRUCT' in
3603@c 'libgomp.oacc-c-c++-common/acc_prof-kernels-1.c',
3604@c 'libgomp.oacc-c-c++-common/acc_prof-parallel-1.c'.
3605Whan a compute construct triggers implicit
3606@code{acc_ev_device_init_start} and @code{acc_ev_device_init_end}
3607events, they currently aren't @emph{nested within} the corresponding
3608@code{acc_ev_compute_construct_start} and
3609@code{acc_ev_compute_construct_end}, but they're currently observed
3610@emph{before} @code{acc_ev_compute_construct_start}.
3611It's not clear what to do: the standard asks us provide a lot of
3612details to the @code{acc_ev_compute_construct_start} callback, without
3613(implicitly) initializing a device before?
3614
3615@item
3616Callbacks for these event types will not be invoked for calls to the
3617@code{acc_set_device_type} and @code{acc_set_device_num} functions.
3618It's not clear if they should be.
3619
3620@end itemize
3621
3622@item @code{acc_ev_enter_data_start}, @code{acc_ev_enter_data_end}, @code{acc_ev_exit_data_start}, @code{acc_ev_exit_data_end}
3623@itemize
3624
3625@item
3626Callbacks for these event types will also be invoked for OpenACC
3627@emph{host_data} constructs.
3628It's not clear if they should be.
3629
3630@item
3631Callbacks for these event types will also be invoked when processing
3632variable mappings specified in OpenACC @emph{declare} directives.
3633It's not clear if they should be.
3634
3635@end itemize
3636
3637@end table
3638
3639Callbacks for the following event types will be invoked, but dispatch
3640and information provided therein has not yet been thoroughly reviewed:
3641
3642@itemize
3643@item @code{acc_ev_alloc}
3644@item @code{acc_ev_free}
3645@item @code{acc_ev_update_start}, @code{acc_ev_update_end}
3646@item @code{acc_ev_enqueue_upload_start}, @code{acc_ev_enqueue_upload_end}
3647@item @code{acc_ev_enqueue_download_start}, @code{acc_ev_enqueue_download_end}
3648@end itemize
3649
3650During device initialization, and finalization, respectively,
3651callbacks for the following event types will not yet be invoked:
3652
3653@itemize
3654@item @code{acc_ev_alloc}
3655@item @code{acc_ev_free}
3656@end itemize
3657
3658Callbacks for the following event types have not yet been implemented,
3659so currently won't be invoked:
3660
3661@itemize
3662@item @code{acc_ev_device_shutdown_start}, @code{acc_ev_device_shutdown_end}
3663@item @code{acc_ev_runtime_shutdown}
3664@item @code{acc_ev_create}, @code{acc_ev_delete}
3665@item @code{acc_ev_wait_start}, @code{acc_ev_wait_end}
3666@end itemize
3667
3668For the following runtime library functions, not all expected
3669callbacks will be invoked (mostly concerning implicit device
3670initialization):
3671
3672@itemize
3673@item @code{acc_get_num_devices}
3674@item @code{acc_set_device_type}
3675@item @code{acc_get_device_type}
3676@item @code{acc_set_device_num}
3677@item @code{acc_get_device_num}
3678@item @code{acc_init}
3679@item @code{acc_shutdown}
3680@end itemize
3681
3682Aside from implicit device initialization, for the following runtime
3683library functions, no callbacks will be invoked for shared-memory
3684offloading devices (it's not clear if they should be):
3685
3686@itemize
3687@item @code{acc_malloc}
3688@item @code{acc_free}
3689@item @code{acc_copyin}, @code{acc_present_or_copyin}, @code{acc_copyin_async}
3690@item @code{acc_create}, @code{acc_present_or_create}, @code{acc_create_async}
3691@item @code{acc_copyout}, @code{acc_copyout_async}, @code{acc_copyout_finalize}, @code{acc_copyout_finalize_async}
3692@item @code{acc_delete}, @code{acc_delete_async}, @code{acc_delete_finalize}, @code{acc_delete_finalize_async}
3693@item @code{acc_update_device}, @code{acc_update_device_async}
3694@item @code{acc_update_self}, @code{acc_update_self_async}
3695@item @code{acc_map_data}, @code{acc_unmap_data}
3696@item @code{acc_memcpy_to_device}, @code{acc_memcpy_to_device_async}
3697@item @code{acc_memcpy_from_device}, @code{acc_memcpy_from_device_async}
3698@end itemize
3699
3700
3701
3721b9e1
DF
3702@c ---------------------------------------------------------------------
3703@c The libgomp ABI
3704@c ---------------------------------------------------------------------
3705
3706@node The libgomp ABI
3707@chapter The libgomp ABI
3708
3709The following sections present notes on the external ABI as
6a2ba183 3710presented by libgomp. Only maintainers should need them.
3721b9e1
DF
3711
3712@menu
3713* Implementing MASTER construct::
3714* Implementing CRITICAL construct::
3715* Implementing ATOMIC construct::
3716* Implementing FLUSH construct::
3717* Implementing BARRIER construct::
3718* Implementing THREADPRIVATE construct::
3719* Implementing PRIVATE clause::
3720* Implementing FIRSTPRIVATE LASTPRIVATE COPYIN and COPYPRIVATE clauses::
3721* Implementing REDUCTION clause::
3722* Implementing PARALLEL construct::
3723* Implementing FOR construct::
3724* Implementing ORDERED construct::
3725* Implementing SECTIONS construct::
3726* Implementing SINGLE construct::
cdf6119d 3727* Implementing OpenACC's PARALLEL construct::
3721b9e1
DF
3728@end menu
3729
3730
3731@node Implementing MASTER construct
3732@section Implementing MASTER construct
3733
3734@smallexample
3735if (omp_get_thread_num () == 0)
3736 block
3737@end smallexample
3738
3739Alternately, we generate two copies of the parallel subfunction
3740and only include this in the version run by the master thread.
6a2ba183 3741Surely this is not worthwhile though...
3721b9e1
DF
3742
3743
3744
3745@node Implementing CRITICAL construct
3746@section Implementing CRITICAL construct
3747
3748Without a specified name,
3749
3750@smallexample
3751 void GOMP_critical_start (void);
3752 void GOMP_critical_end (void);
3753@end smallexample
3754
3755so that we don't get COPY relocations from libgomp to the main
3756application.
3757
3758With a specified name, use omp_set_lock and omp_unset_lock with
3759name being transformed into a variable declared like
3760
3761@smallexample
3762 omp_lock_t gomp_critical_user_<name> __attribute__((common))
3763@end smallexample
3764
3765Ideally the ABI would specify that all zero is a valid unlocked
6a2ba183 3766state, and so we wouldn't need to initialize this at
3721b9e1
DF
3767startup.
3768
3769
3770
3771@node Implementing ATOMIC construct
3772@section Implementing ATOMIC construct
3773
3774The target should implement the @code{__sync} builtins.
3775
3776Failing that we could add
3777
3778@smallexample
3779 void GOMP_atomic_enter (void)
3780 void GOMP_atomic_exit (void)
3781@end smallexample
3782
3783which reuses the regular lock code, but with yet another lock
3784object private to the library.
3785
3786
3787
3788@node Implementing FLUSH construct
3789@section Implementing FLUSH construct
3790
3791Expands to the @code{__sync_synchronize} builtin.
3792
3793
3794
3795@node Implementing BARRIER construct
3796@section Implementing BARRIER construct
3797
3798@smallexample
3799 void GOMP_barrier (void)
3800@end smallexample
3801
3802
3803@node Implementing THREADPRIVATE construct
3804@section Implementing THREADPRIVATE construct
3805
3806In _most_ cases we can map this directly to @code{__thread}. Except
3807that OMP allows constructors for C++ objects. We can either
3808refuse to support this (how often is it used?) or we can
3809implement something akin to .ctors.
3810
3811Even more ideally, this ctor feature is handled by extensions
3812to the main pthreads library. Failing that, we can have a set
3813of entry points to register ctor functions to be called.
3814
3815
3816
3817@node Implementing PRIVATE clause
3818@section Implementing PRIVATE clause
3819
3820In association with a PARALLEL, or within the lexical extent
3821of a PARALLEL block, the variable becomes a local variable in
3822the parallel subfunction.
3823
3824In association with FOR or SECTIONS blocks, create a new
3825automatic variable within the current function. This preserves
3826the semantic of new variable creation.
3827
3828
3829
3830@node Implementing FIRSTPRIVATE LASTPRIVATE COPYIN and COPYPRIVATE clauses
3831@section Implementing FIRSTPRIVATE LASTPRIVATE COPYIN and COPYPRIVATE clauses
3832
6a2ba183
AH
3833This seems simple enough for PARALLEL blocks. Create a private
3834struct for communicating between the parent and subfunction.
3721b9e1
DF
3835In the parent, copy in values for scalar and "small" structs;
3836copy in addresses for others TREE_ADDRESSABLE types. In the
3837subfunction, copy the value into the local variable.
3838
6a2ba183
AH
3839It is not clear what to do with bare FOR or SECTION blocks.
3840The only thing I can figure is that we do something like:
3721b9e1
DF
3841
3842@smallexample
3843#pragma omp for firstprivate(x) lastprivate(y)
3844for (int i = 0; i < n; ++i)
3845 body;
3846@end smallexample
3847
3848which becomes
3849
3850@smallexample
3851@{
3852 int x = x, y;
3853
3854 // for stuff
3855
3856 if (i == n)
3857 y = y;
3858@}
3859@end smallexample
3860
3861where the "x=x" and "y=y" assignments actually have different
3862uids for the two variables, i.e. not something you could write
3863directly in C. Presumably this only makes sense if the "outer"
3864x and y are global variables.
3865
3866COPYPRIVATE would work the same way, except the structure
3867broadcast would have to happen via SINGLE machinery instead.
3868
3869
3870
3871@node Implementing REDUCTION clause
3872@section Implementing REDUCTION clause
3873
3874The private struct mentioned in the previous section should have
3875a pointer to an array of the type of the variable, indexed by the
3876thread's @var{team_id}. The thread stores its final value into the
6a2ba183 3877array, and after the barrier, the master thread iterates over the
3721b9e1
DF
3878array to collect the values.
3879
3880
3881@node Implementing PARALLEL construct
3882@section Implementing PARALLEL construct
3883
3884@smallexample
3885 #pragma omp parallel
3886 @{
3887 body;
3888 @}
3889@end smallexample
3890
3891becomes
3892
3893@smallexample
3894 void subfunction (void *data)
3895 @{
3896 use data;
3897 body;
3898 @}
3899
3900 setup data;
3901 GOMP_parallel_start (subfunction, &data, num_threads);
3902 subfunction (&data);
3903 GOMP_parallel_end ();
3904@end smallexample
3905
3906@smallexample
3907 void GOMP_parallel_start (void (*fn)(void *), void *data, unsigned num_threads)
3908@end smallexample
3909
3910The @var{FN} argument is the subfunction to be run in parallel.
3911
3912The @var{DATA} argument is a pointer to a structure used to
3913communicate data in and out of the subfunction, as discussed
f1b0882e 3914above with respect to FIRSTPRIVATE et al.
3721b9e1
DF
3915
3916The @var{NUM_THREADS} argument is 1 if an IF clause is present
3917and false, or the value of the NUM_THREADS clause, if
3918present, or 0.
3919
3920The function needs to create the appropriate number of
3921threads and/or launch them from the dock. It needs to
3922create the team structure and assign team ids.
3923
3924@smallexample
3925 void GOMP_parallel_end (void)
3926@end smallexample
3927
3928Tears down the team and returns us to the previous @code{omp_in_parallel()} state.
3929
3930
3931
3932@node Implementing FOR construct
3933@section Implementing FOR construct
3934
3935@smallexample
3936 #pragma omp parallel for
3937 for (i = lb; i <= ub; i++)
3938 body;
3939@end smallexample
3940
3941becomes
3942
3943@smallexample
3944 void subfunction (void *data)
3945 @{
3946 long _s0, _e0;
3947 while (GOMP_loop_static_next (&_s0, &_e0))
3948 @{
3949 long _e1 = _e0, i;
3950 for (i = _s0; i < _e1; i++)
3951 body;
3952 @}
3953 GOMP_loop_end_nowait ();
3954 @}
3955
3956 GOMP_parallel_loop_static (subfunction, NULL, 0, lb, ub+1, 1, 0);
3957 subfunction (NULL);
3958 GOMP_parallel_end ();
3959@end smallexample
3960
3961@smallexample
3962 #pragma omp for schedule(runtime)
3963 for (i = 0; i < n; i++)
3964 body;
3965@end smallexample
3966
3967becomes
3968
3969@smallexample
3970 @{
3971 long i, _s0, _e0;
3972 if (GOMP_loop_runtime_start (0, n, 1, &_s0, &_e0))
3973 do @{
3974 long _e1 = _e0;
3975 for (i = _s0, i < _e0; i++)
3976 body;
3977 @} while (GOMP_loop_runtime_next (&_s0, _&e0));
3978 GOMP_loop_end ();
3979 @}
3980@end smallexample
3981
6a2ba183 3982Note that while it looks like there is trickiness to propagating
3721b9e1
DF
3983a non-constant STEP, there isn't really. We're explicitly allowed
3984to evaluate it as many times as we want, and any variables involved
3985should automatically be handled as PRIVATE or SHARED like any other
3986variables. So the expression should remain evaluable in the
3987subfunction. We can also pull it into a local variable if we like,
3988but since its supposed to remain unchanged, we can also not if we like.
3989
3990If we have SCHEDULE(STATIC), and no ORDERED, then we ought to be
3991able to get away with no work-sharing context at all, since we can
3992simply perform the arithmetic directly in each thread to divide up
3993the iterations. Which would mean that we wouldn't need to call any
3994of these routines.
3995
3996There are separate routines for handling loops with an ORDERED
3997clause. Bookkeeping for that is non-trivial...
3998
3999
4000
4001@node Implementing ORDERED construct
4002@section Implementing ORDERED construct
4003
4004@smallexample
4005 void GOMP_ordered_start (void)
4006 void GOMP_ordered_end (void)
4007@end smallexample
4008
4009
4010
4011@node Implementing SECTIONS construct
4012@section Implementing SECTIONS construct
4013
4014A block as
4015
4016@smallexample
4017 #pragma omp sections
4018 @{
4019 #pragma omp section
4020 stmt1;
4021 #pragma omp section
4022 stmt2;
4023 #pragma omp section
4024 stmt3;
4025 @}
4026@end smallexample
4027
4028becomes
4029
4030@smallexample
4031 for (i = GOMP_sections_start (3); i != 0; i = GOMP_sections_next ())
4032 switch (i)
4033 @{
4034 case 1:
4035 stmt1;
4036 break;
4037 case 2:
4038 stmt2;
4039 break;
4040 case 3:
4041 stmt3;
4042 break;
4043 @}
4044 GOMP_barrier ();
4045@end smallexample
4046
4047
4048@node Implementing SINGLE construct
4049@section Implementing SINGLE construct
4050
4051A block like
4052
4053@smallexample
4054 #pragma omp single
4055 @{
4056 body;
4057 @}
4058@end smallexample
4059
4060becomes
4061
4062@smallexample
4063 if (GOMP_single_start ())
4064 body;
4065 GOMP_barrier ();
4066@end smallexample
4067
4068while
4069
4070@smallexample
4071 #pragma omp single copyprivate(x)
4072 body;
4073@end smallexample
4074
4075becomes
4076
4077@smallexample
4078 datap = GOMP_single_copy_start ();
4079 if (datap == NULL)
4080 @{
4081 body;
4082 data.x = x;
4083 GOMP_single_copy_end (&data);
4084 @}
4085 else
4086 x = datap->x;
4087 GOMP_barrier ();
4088@end smallexample
4089
4090
4091
cdf6119d
JN
4092@node Implementing OpenACC's PARALLEL construct
4093@section Implementing OpenACC's PARALLEL construct
4094
4095@smallexample
4096 void GOACC_parallel ()
4097@end smallexample
4098
4099
4100
3721b9e1 4101@c ---------------------------------------------------------------------
f1f3453e 4102@c Reporting Bugs
3721b9e1
DF
4103@c ---------------------------------------------------------------------
4104
4105@node Reporting Bugs
4106@chapter Reporting Bugs
4107
f1f3453e 4108Bugs in the GNU Offloading and Multi Processing Runtime Library should
c1030b5c 4109be reported via @uref{https://gcc.gnu.org/bugzilla/, Bugzilla}. Please add
41dbbb37
TS
4110"openacc", or "openmp", or both to the keywords field in the bug
4111report, as appropriate.
3721b9e1
DF
4112
4113
4114
4115@c ---------------------------------------------------------------------
4116@c GNU General Public License
4117@c ---------------------------------------------------------------------
4118
e6fdc918 4119@include gpl_v3.texi
3721b9e1
DF
4120
4121
4122
4123@c ---------------------------------------------------------------------
4124@c GNU Free Documentation License
4125@c ---------------------------------------------------------------------
4126
4127@include fdl.texi
4128
4129
4130
4131@c ---------------------------------------------------------------------
4132@c Funding Free Software
4133@c ---------------------------------------------------------------------
4134
4135@include funding.texi
4136
4137@c ---------------------------------------------------------------------
4138@c Index
4139@c ---------------------------------------------------------------------
4140
3d3949df
SL
4141@node Library Index
4142@unnumbered Library Index
3721b9e1
DF
4143
4144@printindex cp
4145
4146@bye