]>
Commit | Line | Data |
---|---|---|
d77de738 ML |
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 | |
4e053a7e | 10 | Copyright @copyright{} 2006-2024 Free Software Foundation, Inc. |
d77de738 ML |
11 | |
12 | Permission is granted to copy, distribute and/or modify this document | |
13 | under the terms of the GNU Free Documentation License, Version 1.3 or | |
14 | any later version published by the Free Software Foundation; with the | |
15 | Invariant Sections being ``Funding Free Software'', the Front-Cover | |
16 | texts 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 | |
34 | * libgomp: (libgomp). GNU Offloading and Multi Processing Runtime Library. | |
35 | @end direntry | |
36 | ||
37 | This manual documents libgomp, the GNU Offloading and Multi Processing | |
38 | Runtime library. This is the GNU implementation of the OpenMP and | |
39 | OpenACC APIs for parallel and accelerator programming in C/C++ and | |
40 | Fortran. | |
41 | ||
42 | Published by the Free Software Foundation | |
43 | 51 Franklin Street, Fifth Floor | |
44 | Boston, MA 02110-1301 USA | |
45 | ||
46 | @insertcopying | |
47 | @end ifinfo | |
48 | ||
49 | ||
50 | @setchapternewpage odd | |
51 | ||
52 | @titlepage | |
53 | @title GNU Offloading and Multi Processing Runtime Library | |
54 | @subtitle The GNU OpenMP and OpenACC Implementation | |
55 | @page | |
56 | @vskip 0pt plus 1filll | |
57 | @comment For the @value{version-GCC} Version* | |
58 | @sp 1 | |
59 | Published by the Free Software Foundation @* | |
60 | 51 Franklin Street, Fifth Floor@* | |
61 | Boston, MA 02110-1301, USA@* | |
62 | @sp 1 | |
63 | @insertcopying | |
64 | @end titlepage | |
65 | ||
66 | @summarycontents | |
67 | @contents | |
68 | @page | |
69 | ||
70 | ||
71 | @node Top, Enabling OpenMP | |
72 | @top Introduction | |
73 | @cindex Introduction | |
74 | ||
75 | This manual documents the usage of libgomp, the GNU Offloading and | |
76 | Multi Processing Runtime Library. This includes the GNU | |
77 | implementation of the @uref{https://www.openmp.org, OpenMP} Application | |
78 | Programming Interface (API) for multi-platform shared-memory parallel | |
79 | programming in C/C++ and Fortran, and the GNU implementation of the | |
80 | @uref{https://www.openacc.org, OpenACC} Application Programming | |
81 | Interface (API) for offloading of code to accelerator devices in C/C++ | |
82 | and Fortran. | |
83 | ||
84 | Originally, libgomp implemented the GNU OpenMP Runtime Library. Based | |
85 | on this, support for OpenACC and offloading (both OpenACC and OpenMP | |
86 | 4's target construct) has been added later on, and the library's name | |
87 | changed to GNU Offloading and Multi Processing Runtime Library. | |
88 | ||
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. | |
98 | * OpenMP Implementation Status:: List of implemented features by OpenMP version | |
99 | * OpenMP Runtime Library Routines: Runtime Library Routines. | |
100 | The OpenMP runtime application programming | |
101 | interface. | |
102 | * OpenMP Environment Variables: Environment Variables. | |
103 | Influencing OpenMP runtime behavior with | |
104 | environment variables. | |
105 | * Enabling OpenACC:: How to enable OpenACC for your | |
106 | applications. | |
107 | * OpenACC Runtime Library Routines:: The OpenACC runtime application | |
108 | programming interface. | |
109 | * OpenACC Environment Variables:: Influencing OpenACC runtime behavior with | |
110 | environment variables. | |
111 | * CUDA Streams Usage:: Notes on the implementation of | |
112 | asynchronous operations. | |
113 | * OpenACC Library Interoperability:: OpenACC library interoperability with the | |
114 | NVIDIA CUBLAS library. | |
115 | * OpenACC Profiling Interface:: | |
116 | * OpenMP-Implementation Specifics:: Notes specifics of this OpenMP | |
117 | implementation | |
118 | * Offload-Target Specifics:: Notes on offload-target specific internals | |
119 | * The libgomp ABI:: Notes on the external ABI presented by libgomp. | |
120 | * Reporting Bugs:: How to report bugs in the GNU Offloading and | |
121 | Multi Processing Runtime Library. | |
122 | * Copying:: GNU general public license says | |
123 | how you can copy and share libgomp. | |
124 | * GNU Free Documentation License:: | |
125 | How you can copy and share this manual. | |
126 | * Funding:: How to help assure continued work for free | |
127 | software. | |
128 | * Library Index:: Index of this documentation. | |
129 | @end menu | |
130 | ||
131 | ||
132 | @c --------------------------------------------------------------------- | |
133 | @c Enabling OpenMP | |
134 | @c --------------------------------------------------------------------- | |
135 | ||
136 | @node Enabling OpenMP | |
137 | @chapter Enabling OpenMP | |
138 | ||
643a5223 TB |
139 | To activate the OpenMP extensions for C/C++ and Fortran, the compile-time |
140 | flag @option{-fopenmp} must be specified. For C and C++, this enables | |
5648446c | 141 | the handling of the OpenMP directives using @code{#pragma omp} and the |
643a5223 TB |
142 | @code{[[omp::directive(...)]]}, @code{[[omp::sequence(...)]]} and |
143 | @code{[[omp::decl(...)]]} attributes. For Fortran, it enables for | |
144 | free source form the @code{!$omp} sentinel for directives and the | |
145 | @code{!$} conditional compilation sentinel and for fixed source form the | |
146 | @code{c$omp}, @code{*$omp} and @code{!$omp} sentinels for directives and | |
147 | the @code{c$}, @code{*$} and @code{!$} conditional compilation sentinels. | |
148 | The flag also arranges for automatic linking of the OpenMP runtime library | |
d77de738 ML |
149 | (@ref{Runtime Library Routines}). |
150 | ||
643a5223 TB |
151 | The @option{-fopenmp-simd} flag can be used to enable a subset of |
152 | OpenMP directives that do not require the linking of either the | |
153 | OpenMP runtime library or the POSIX threads library. | |
154 | ||
d77de738 ML |
155 | A complete description of all OpenMP directives may be found in the |
156 | @uref{https://www.openmp.org, OpenMP Application Program Interface} manuals. | |
157 | See also @ref{OpenMP Implementation Status}. | |
158 | ||
159 | ||
160 | @c --------------------------------------------------------------------- | |
161 | @c OpenMP Implementation Status | |
162 | @c --------------------------------------------------------------------- | |
163 | ||
164 | @node OpenMP Implementation Status | |
165 | @chapter OpenMP Implementation Status | |
166 | ||
167 | @menu | |
168 | * OpenMP 4.5:: Feature completion status to 4.5 specification | |
169 | * OpenMP 5.0:: Feature completion status to 5.0 specification | |
170 | * OpenMP 5.1:: Feature completion status to 5.1 specification | |
171 | * OpenMP 5.2:: Feature completion status to 5.2 specification | |
fcddf7ce | 172 | * OpenMP Technical Report 12:: Feature completion status to second 6.0 preview |
d77de738 ML |
173 | @end menu |
174 | ||
175 | The @code{_OPENMP} preprocessor macro and Fortran's @code{openmp_version} | |
176 | parameter, provided by @code{omp_lib.h} and the @code{omp_lib} module, have | |
177 | the value @code{201511} (i.e. OpenMP 4.5). | |
178 | ||
179 | @node OpenMP 4.5 | |
180 | @section OpenMP 4.5 | |
181 | ||
182 | The OpenMP 4.5 specification is fully supported. | |
183 | ||
184 | @node OpenMP 5.0 | |
185 | @section OpenMP 5.0 | |
186 | ||
187 | @unnumberedsubsec New features listed in Appendix B of the OpenMP specification | |
188 | @c This list is sorted as in OpenMP 5.1's B.3 not as in OpenMP 5.0's B.2 | |
189 | ||
190 | @multitable @columnfractions .60 .10 .25 | |
191 | @headitem Description @tab Status @tab Comments | |
192 | @item Array shaping @tab N @tab | |
193 | @item Array sections with non-unit strides in C and C++ @tab N @tab | |
194 | @item Iterators @tab Y @tab | |
195 | @item @code{metadirective} directive @tab N @tab | |
196 | @item @code{declare variant} directive | |
197 | @tab P @tab @emph{simd} traits not handled correctly | |
2cd0689a | 198 | @item @var{target-offload-var} ICV and @code{OMP_TARGET_OFFLOAD} |
d77de738 | 199 | env variable @tab Y @tab |
2cd0689a | 200 | @item Nested-parallel changes to @var{max-active-levels-var} ICV @tab Y @tab |
d77de738 | 201 | @item @code{requires} directive @tab P |
8c2fc744 | 202 | @tab complete but no non-host device provides @code{unified_shared_memory} |
d77de738 | 203 | @item @code{teams} construct outside an enclosing target region @tab Y @tab |
85da0b40 TB |
204 | @item Non-rectangular loop nests @tab P |
205 | @tab Full support for C/C++, partial for Fortran | |
206 | (@uref{https://gcc.gnu.org/PR110735,PR110735}) | |
d77de738 ML |
207 | @item @code{!=} as relational-op in canonical loop form for C/C++ @tab Y @tab |
208 | @item @code{nonmonotonic} as default loop schedule modifier for worksharing-loop | |
209 | constructs @tab Y @tab | |
87f9b6c2 | 210 | @item Collapse of associated loops that are imperfectly nested loops @tab Y @tab |
d77de738 ML |
211 | @item Clauses @code{if}, @code{nontemporal} and @code{order(concurrent)} in |
212 | @code{simd} construct @tab Y @tab | |
213 | @item @code{atomic} constructs in @code{simd} @tab Y @tab | |
214 | @item @code{loop} construct @tab Y @tab | |
215 | @item @code{order(concurrent)} clause @tab Y @tab | |
216 | @item @code{scan} directive and @code{in_scan} modifier for the | |
217 | @code{reduction} clause @tab Y @tab | |
218 | @item @code{in_reduction} clause on @code{task} constructs @tab Y @tab | |
219 | @item @code{in_reduction} clause on @code{target} constructs @tab P | |
220 | @tab @code{nowait} only stub | |
221 | @item @code{task_reduction} clause with @code{taskgroup} @tab Y @tab | |
222 | @item @code{task} modifier to @code{reduction} clause @tab Y @tab | |
223 | @item @code{affinity} clause to @code{task} construct @tab Y @tab Stub only | |
224 | @item @code{detach} clause to @code{task} construct @tab Y @tab | |
225 | @item @code{omp_fulfill_event} runtime routine @tab Y @tab | |
226 | @item @code{reduction} and @code{in_reduction} clauses on @code{taskloop} | |
227 | and @code{taskloop simd} constructs @tab Y @tab | |
228 | @item @code{taskloop} construct cancelable by @code{cancel} construct | |
229 | @tab Y @tab | |
230 | @item @code{mutexinoutset} @emph{dependence-type} for @code{depend} clause | |
231 | @tab Y @tab | |
232 | @item Predefined memory spaces, memory allocators, allocator traits | |
13c3e29d | 233 | @tab Y @tab See also @ref{Memory allocation} |
d77de738 | 234 | @item Memory management routines @tab Y @tab |
d4b6d147 TB |
235 | @item @code{allocate} directive @tab P |
236 | @tab Only C for stack/automatic and Fortran for stack/automatic | |
237 | and allocatable/pointer variables | |
d77de738 ML |
238 | @item @code{allocate} clause @tab P @tab Initial support |
239 | @item @code{use_device_addr} clause on @code{target data} @tab Y @tab | |
f84fdb13 | 240 | @item @code{ancestor} modifier on @code{device} clause @tab Y @tab |
d77de738 ML |
241 | @item Implicit declare target directive @tab Y @tab |
242 | @item Discontiguous array section with @code{target update} construct | |
243 | @tab N @tab | |
244 | @item C/C++'s lvalue expressions in @code{to}, @code{from} | |
245 | and @code{map} clauses @tab N @tab | |
246 | @item C/C++'s lvalue expressions in @code{depend} clauses @tab Y @tab | |
247 | @item Nested @code{declare target} directive @tab Y @tab | |
248 | @item Combined @code{master} constructs @tab Y @tab | |
249 | @item @code{depend} clause on @code{taskwait} @tab Y @tab | |
250 | @item Weak memory ordering clauses on @code{atomic} and @code{flush} construct | |
251 | @tab Y @tab | |
252 | @item @code{hint} clause on the @code{atomic} construct @tab Y @tab Stub only | |
253 | @item @code{depobj} construct and depend objects @tab Y @tab | |
254 | @item Lock hints were renamed to synchronization hints @tab Y @tab | |
255 | @item @code{conditional} modifier to @code{lastprivate} clause @tab Y @tab | |
256 | @item Map-order clarifications @tab P @tab | |
257 | @item @code{close} @emph{map-type-modifier} @tab Y @tab | |
258 | @item Mapping C/C++ pointer variables and to assign the address of | |
259 | device memory mapped by an array section @tab P @tab | |
260 | @item Mapping of Fortran pointer and allocatable variables, including pointer | |
261 | and allocatable components of variables | |
262 | @tab P @tab Mapping of vars with allocatable components unsupported | |
263 | @item @code{defaultmap} extensions @tab Y @tab | |
264 | @item @code{declare mapper} directive @tab N @tab | |
265 | @item @code{omp_get_supported_active_levels} routine @tab Y @tab | |
266 | @item Runtime routines and environment variables to display runtime thread | |
267 | affinity information @tab Y @tab | |
268 | @item @code{omp_pause_resource} and @code{omp_pause_resource_all} runtime | |
269 | routines @tab Y @tab | |
270 | @item @code{omp_get_device_num} runtime routine @tab Y @tab | |
271 | @item OMPT interface @tab N @tab | |
272 | @item OMPD interface @tab N @tab | |
273 | @end multitable | |
274 | ||
275 | @unnumberedsubsec Other new OpenMP 5.0 features | |
276 | ||
277 | @multitable @columnfractions .60 .10 .25 | |
278 | @headitem Description @tab Status @tab Comments | |
279 | @item Supporting C++'s range-based for loop @tab Y @tab | |
280 | @end multitable | |
281 | ||
282 | ||
283 | @node OpenMP 5.1 | |
284 | @section OpenMP 5.1 | |
285 | ||
286 | @unnumberedsubsec New features listed in Appendix B of the OpenMP specification | |
287 | ||
288 | @multitable @columnfractions .60 .10 .25 | |
289 | @headitem Description @tab Status @tab Comments | |
290 | @item OpenMP directive as C++ attribute specifiers @tab Y @tab | |
291 | @item @code{omp_all_memory} reserved locator @tab Y @tab | |
292 | @item @emph{target_device trait} in OpenMP Context @tab N @tab | |
293 | @item @code{target_device} selector set in context selectors @tab N @tab | |
294 | @item C/C++'s @code{declare variant} directive: elision support of | |
295 | preprocessed code @tab N @tab | |
296 | @item @code{declare variant}: new clauses @code{adjust_args} and | |
297 | @code{append_args} @tab N @tab | |
298 | @item @code{dispatch} construct @tab N @tab | |
299 | @item device-specific ICV settings with environment variables @tab Y @tab | |
eda38850 | 300 | @item @code{assume} and @code{assumes} directives @tab Y @tab |
d77de738 ML |
301 | @item @code{nothing} directive @tab Y @tab |
302 | @item @code{error} directive @tab Y @tab | |
303 | @item @code{masked} construct @tab Y @tab | |
304 | @item @code{scope} directive @tab Y @tab | |
305 | @item Loop transformation constructs @tab N @tab | |
306 | @item @code{strict} modifier in the @code{grainsize} and @code{num_tasks} | |
307 | clauses of the @code{taskloop} construct @tab Y @tab | |
1a554a2c | 308 | @item @code{align} clause in @code{allocate} directive @tab P |
d4b6d147 | 309 | @tab Only C and Fortran (and not for static variables) |
b2e1c49b | 310 | @item @code{align} modifier in @code{allocate} clause @tab Y @tab |
d77de738 ML |
311 | @item @code{thread_limit} clause to @code{target} construct @tab Y @tab |
312 | @item @code{has_device_addr} clause to @code{target} construct @tab Y @tab | |
313 | @item Iterators in @code{target update} motion clauses and @code{map} | |
314 | clauses @tab N @tab | |
315 | @item Indirect calls to the device version of a procedure or function in | |
a49c7d31 | 316 | @code{target} regions @tab P @tab Only C and C++ |
d77de738 ML |
317 | @item @code{interop} directive @tab N @tab |
318 | @item @code{omp_interop_t} object support in runtime routines @tab N @tab | |
319 | @item @code{nowait} clause in @code{taskwait} directive @tab Y @tab | |
320 | @item Extensions to the @code{atomic} directive @tab Y @tab | |
321 | @item @code{seq_cst} clause on a @code{flush} construct @tab Y @tab | |
322 | @item @code{inoutset} argument to the @code{depend} clause @tab Y @tab | |
323 | @item @code{private} and @code{firstprivate} argument to @code{default} | |
324 | clause in C and C++ @tab Y @tab | |
4ede915d | 325 | @item @code{present} argument to @code{defaultmap} clause @tab Y @tab |
d77de738 ML |
326 | @item @code{omp_set_num_teams}, @code{omp_set_teams_thread_limit}, |
327 | @code{omp_get_max_teams}, @code{omp_get_teams_thread_limit} runtime | |
328 | routines @tab Y @tab | |
329 | @item @code{omp_target_is_accessible} runtime routine @tab Y @tab | |
330 | @item @code{omp_target_memcpy_async} and @code{omp_target_memcpy_rect_async} | |
331 | runtime routines @tab Y @tab | |
332 | @item @code{omp_get_mapped_ptr} runtime routine @tab Y @tab | |
333 | @item @code{omp_calloc}, @code{omp_realloc}, @code{omp_aligned_alloc} and | |
334 | @code{omp_aligned_calloc} runtime routines @tab Y @tab | |
335 | @item @code{omp_alloctrait_key_t} enum: @code{omp_atv_serialized} added, | |
336 | @code{omp_atv_default} changed @tab Y @tab | |
337 | @item @code{omp_display_env} runtime routine @tab Y @tab | |
338 | @item @code{ompt_scope_endpoint_t} enum: @code{ompt_scope_beginend} @tab N @tab | |
339 | @item @code{ompt_sync_region_t} enum additions @tab N @tab | |
340 | @item @code{ompt_state_t} enum: @code{ompt_state_wait_barrier_implementation} | |
341 | and @code{ompt_state_wait_barrier_teams} @tab N @tab | |
342 | @item @code{ompt_callback_target_data_op_emi_t}, | |
343 | @code{ompt_callback_target_emi_t}, @code{ompt_callback_target_map_emi_t} | |
344 | and @code{ompt_callback_target_submit_emi_t} @tab N @tab | |
345 | @item @code{ompt_callback_error_t} type @tab N @tab | |
346 | @item @code{OMP_PLACES} syntax extensions @tab Y @tab | |
347 | @item @code{OMP_NUM_TEAMS} and @code{OMP_TEAMS_THREAD_LIMIT} environment | |
348 | variables @tab Y @tab | |
349 | @end multitable | |
350 | ||
351 | @unnumberedsubsec Other new OpenMP 5.1 features | |
352 | ||
353 | @multitable @columnfractions .60 .10 .25 | |
354 | @headitem Description @tab Status @tab Comments | |
355 | @item Support of strictly structured blocks in Fortran @tab Y @tab | |
356 | @item Support of structured block sequences in C/C++ @tab Y @tab | |
357 | @item @code{unconstrained} and @code{reproducible} modifiers on @code{order} | |
358 | clause @tab Y @tab | |
359 | @item Support @code{begin/end declare target} syntax in C/C++ @tab Y @tab | |
360 | @item Pointer predetermined firstprivate getting initialized | |
361 | to address of matching mapped list item per 5.1, Sect. 2.21.7.2 @tab N @tab | |
362 | @item For Fortran, diagnose placing declarative before/between @code{USE}, | |
363 | @code{IMPORT}, and @code{IMPLICIT} as invalid @tab N @tab | |
eda38850 | 364 | @item Optional comma between directive and clause in the @code{#pragma} form @tab Y @tab |
a49c7d31 | 365 | @item @code{indirect} clause in @code{declare target} @tab P @tab Only C and C++ |
c16e85d7 | 366 | @item @code{device_type(nohost)}/@code{device_type(host)} for variables @tab N @tab |
4ede915d TB |
367 | @item @code{present} modifier to the @code{map}, @code{to} and @code{from} |
368 | clauses @tab Y @tab | |
d77de738 ML |
369 | @end multitable |
370 | ||
371 | ||
372 | @node OpenMP 5.2 | |
373 | @section OpenMP 5.2 | |
374 | ||
375 | @unnumberedsubsec New features listed in Appendix B of the OpenMP specification | |
376 | ||
377 | @multitable @columnfractions .60 .10 .25 | |
378 | @headitem Description @tab Status @tab Comments | |
2cd0689a | 379 | @item @code{omp_in_explicit_task} routine and @var{explicit-task-var} ICV |
d77de738 ML |
380 | @tab Y @tab |
381 | @item @code{omp}/@code{ompx}/@code{omx} sentinels and @code{omp_}/@code{ompx_} | |
382 | namespaces @tab N/A | |
383 | @tab warning for @code{ompx/omx} sentinels@footnote{The @code{ompx} | |
384 | sentinel as C/C++ pragma and C++ attributes are warned for with | |
385 | @code{-Wunknown-pragmas} (implied by @code{-Wall}) and @code{-Wattributes} | |
386 | (enabled by default), respectively; for Fortran free-source code, there is | |
387 | a warning enabled by default and, for fixed-source code, the @code{omx} | |
388 | sentinel is warned for with with @code{-Wsurprising} (enabled by | |
389 | @code{-Wall}). Unknown clauses are always rejected with an error.} | |
091b6dbc | 390 | @item Clauses on @code{end} directive can be on directive @tab Y @tab |
0698c9fd | 391 | @item @code{destroy} clause with destroy-var argument on @code{depobj} |
1802f64e | 392 | @tab Y @tab |
d77de738 ML |
393 | @item Deprecation of no-argument @code{destroy} clause on @code{depobj} |
394 | @tab N @tab | |
395 | @item @code{linear} clause syntax changes and @code{step} modifier @tab Y @tab | |
396 | @item Deprecation of minus operator for reductions @tab N @tab | |
397 | @item Deprecation of separating @code{map} modifiers without comma @tab N @tab | |
398 | @item @code{declare mapper} with iterator and @code{present} modifiers | |
399 | @tab N @tab | |
400 | @item If a matching mapped list item is not found in the data environment, the | |
b25ea7ab | 401 | pointer retains its original value @tab Y @tab |
d77de738 ML |
402 | @item New @code{enter} clause as alias for @code{to} on declare target directive |
403 | @tab Y @tab | |
404 | @item Deprecation of @code{to} clause on declare target directive @tab N @tab | |
405 | @item Extended list of directives permitted in Fortran pure procedures | |
2df7e451 | 406 | @tab Y @tab |
d4b6d147 | 407 | @item New @code{allocators} directive for Fortran @tab Y @tab |
d77de738 ML |
408 | @item Deprecation of @code{allocate} directive for Fortran |
409 | allocatables/pointers @tab N @tab | |
410 | @item Optional paired @code{end} directive with @code{dispatch} @tab N @tab | |
411 | @item New @code{memspace} and @code{traits} modifiers for @code{uses_allocators} | |
412 | @tab N @tab | |
413 | @item Deprecation of traits array following the allocator_handle expression in | |
414 | @code{uses_allocators} @tab N @tab | |
415 | @item New @code{otherwise} clause as alias for @code{default} on metadirectives | |
416 | @tab N @tab | |
417 | @item Deprecation of @code{default} clause on metadirectives @tab N @tab | |
418 | @item Deprecation of delimited form of @code{declare target} @tab N @tab | |
419 | @item Reproducible semantics changed for @code{order(concurrent)} @tab N @tab | |
420 | @item @code{allocate} and @code{firstprivate} clauses on @code{scope} | |
421 | @tab Y @tab | |
422 | @item @code{ompt_callback_work} @tab N @tab | |
9f80367e | 423 | @item Default map-type for the @code{map} clause in @code{target enter/exit data} |
d77de738 ML |
424 | @tab Y @tab |
425 | @item New @code{doacross} clause as alias for @code{depend} with | |
426 | @code{source}/@code{sink} modifier @tab Y @tab | |
427 | @item Deprecation of @code{depend} with @code{source}/@code{sink} modifier | |
428 | @tab N @tab | |
429 | @item @code{omp_cur_iteration} keyword @tab Y @tab | |
430 | @end multitable | |
431 | ||
432 | @unnumberedsubsec Other new OpenMP 5.2 features | |
433 | ||
434 | @multitable @columnfractions .60 .10 .25 | |
435 | @headitem Description @tab Status @tab Comments | |
436 | @item For Fortran, optional comma between directive and clause @tab N @tab | |
437 | @item Conforming device numbers and @code{omp_initial_device} and | |
438 | @code{omp_invalid_device} enum/PARAMETER @tab Y @tab | |
2cd0689a | 439 | @item Initial value of @var{default-device-var} ICV with |
18c8b56c | 440 | @code{OMP_TARGET_OFFLOAD=mandatory} @tab Y @tab |
0698c9fd | 441 | @item @code{all} as @emph{implicit-behavior} for @code{defaultmap} @tab Y @tab |
d77de738 ML |
442 | @item @emph{interop_types} in any position of the modifier list for the @code{init} clause |
443 | of the @code{interop} construct @tab N @tab | |
a49c7d31 KCY |
444 | @item Invoke virtual member functions of C++ objects created on the host device |
445 | on other devices @tab N @tab | |
d77de738 ML |
446 | @end multitable |
447 | ||
448 | ||
fcddf7ce TB |
449 | @node OpenMP Technical Report 12 |
450 | @section OpenMP Technical Report 12 | |
c16e85d7 | 451 | |
fcddf7ce | 452 | Technical Report (TR) 12 is the second preview for OpenMP 6.0. |
c16e85d7 TB |
453 | |
454 | @unnumberedsubsec New features listed in Appendix B of the OpenMP specification | |
455 | @multitable @columnfractions .60 .10 .25 | |
456 | @item Features deprecated in versions 5.2, 5.1 and 5.0 were removed | |
457 | @tab N/A @tab Backward compatibility | |
fcddf7ce TB |
458 | @item Full support for C23 was added @tab P @tab |
459 | @item Full support for C++23 was added @tab P @tab | |
c16e85d7 TB |
460 | @item @code{_ALL} suffix to the device-scope environment variables |
461 | @tab P @tab Host device number wrongly accepted | |
fcddf7ce TB |
462 | @item @code{num_threads} now accepts a list @tab N @tab |
463 | @item Supporting increments with abstract names in @code{OMP_PLACES} @tab N @tab | |
464 | @item Extension of @code{OMP_DEFAULT_DEVICE} and new | |
465 | @code{OMP_AVAILABLE_DEVICES} environment vars @tab N @tab | |
466 | @item New @code{OMP_THREADS_RESERVE} environment variable @tab N @tab | |
467 | @item The @code{decl} attribute was added to the C++ attribute syntax | |
468 | @tab Y @tab | |
469 | @item The OpenMP directive syntax was extended to include C 23 attribute | |
470 | specifiers @tab Y @tab | |
471 | @item All inarguable clauses take now an optional Boolean argument @tab N @tab | |
c16e85d7 TB |
472 | @item For Fortran, @emph{locator list} can be also function reference with |
473 | data pointer result @tab N @tab | |
fcddf7ce TB |
474 | @item Concept of @emph{assumed-size arrays} in C and C++ |
475 | @tab N @tab | |
476 | @item @emph{directive-name-modifier} accepted in all clauses @tab N @tab | |
477 | @item For Fortran, atomic with BLOCK construct and, for C/C++, with | |
478 | unlimited curly braces supported @tab N @tab | |
479 | @item For Fortran, atomic compare with storing the comparison result | |
480 | @tab N @tab | |
481 | @item New @code{looprange} clause @tab N @tab | |
c16e85d7 TB |
482 | @item Ref-count change for @code{use_device_ptr}/@code{use_device_addr} |
483 | @tab N @tab | |
fcddf7ce | 484 | @item Support for inductions @tab N @tab |
c16e85d7 TB |
485 | @item Implicit reduction identifiers of C++ classes |
486 | @tab N @tab | |
487 | @item Change of the @emph{map-type} property from @emph{ultimate} to | |
488 | @emph{default} @tab N @tab | |
fcddf7ce TB |
489 | @item @code{self} modifier to @code{map} and @code{self} as |
490 | @code{defaultmap} argument @tab N @tab | |
c16e85d7 TB |
491 | @item Mapping of @emph{assumed-size arrays} in C, C++ and Fortran |
492 | @tab N @tab | |
493 | @item @code{groupprivate} directive @tab N @tab | |
fcddf7ce | 494 | @item @code{local} clause to @code{declare target} directive @tab N @tab |
c16e85d7 TB |
495 | @item @code{part_size} allocator trait @tab N @tab |
496 | @item @code{pin_device}, @code{preferred_device} and @code{target_access} | |
497 | allocator traits | |
498 | @tab N @tab | |
499 | @item @code{access} allocator trait changes @tab N @tab | |
500 | @item Extension of @code{interop} operation of @code{append_args}, allowing all | |
501 | modifiers of the @code{init} clause | |
9f80367e | 502 | @tab N @tab |
c16e85d7 | 503 | @item @code{interop} clause to @code{dispatch} @tab N @tab |
fefbd85b | 504 | @item @code{message} and @code{severity} clauses to @code{parallel} directive |
fcddf7ce TB |
505 | @tab N @tab |
506 | @item @code{self} clause to @code{requires} directive @tab N @tab | |
507 | @item @code{no_openmp_constructs} assumptions clause @tab N @tab | |
508 | @item @code{reverse} loop-transformation construct @tab N @tab | |
509 | @item @code{interchange} loop-transformation construct @tab N @tab | |
510 | @item @code{fuse} loop-transformation construct @tab N @tab | |
c16e85d7 TB |
511 | @item @code{apply} code to loop-transforming constructs @tab N @tab |
512 | @item @code{omp_curr_progress_width} identifier @tab N @tab | |
513 | @item @code{safesync} clause to the @code{parallel} construct @tab N @tab | |
514 | @item @code{omp_get_max_progress_width} runtime routine @tab N @tab | |
8da7476c | 515 | @item @code{strict} modifier keyword to @code{num_threads} @tab N @tab |
fcddf7ce TB |
516 | @item @code{atomic} permitted in a construct with @code{order(concurrent)} |
517 | @tab N @tab | |
518 | @item @code{coexecute} directive for Fortran @tab N @tab | |
519 | @item Fortran DO CONCURRENT as associated loop in a @code{loop} construct | |
520 | @tab N @tab | |
521 | @item @code{threadset} clause in task-generating constructs @tab N @tab | |
522 | @item @code{nowait} clause with reverse-offload @code{target} directives | |
523 | @tab N @tab | |
524 | @item Boolean argument to @code{nowait} and @code{nogroup} may be non constant | |
525 | @tab N @tab | |
c16e85d7 | 526 | @item @code{memscope} clause to @code{atomic} and @code{flush} @tab N @tab |
fcddf7ce TB |
527 | @item @code{omp_is_free_agent} and @code{omp_ancestor_is_free_agent} routines |
528 | @tab N @tab | |
529 | @item @code{omp_target_memset} and @code{omp_target_memset_rect_async} routines | |
530 | @tab N @tab | |
c16e85d7 TB |
531 | @item Routines for obtaining memory spaces/allocators for shared/device memory |
532 | @tab N @tab | |
533 | @item @code{omp_get_memspace_num_resources} routine @tab N @tab | |
534 | @item @code{omp_get_submemspace} routine @tab N @tab | |
fcddf7ce TB |
535 | @item @code{ompt_target_data_transfer} and @code{ompt_target_data_transfer_async} |
536 | values in @code{ompt_target_data_op_t} enum @tab N @tab | |
c16e85d7 | 537 | @item @code{ompt_get_buffer_limits} OMPT routine @tab N @tab |
c16e85d7 TB |
538 | @end multitable |
539 | ||
fcddf7ce | 540 | @unnumberedsubsec Other new TR 12 features |
c16e85d7 TB |
541 | @multitable @columnfractions .60 .10 .25 |
542 | @item Relaxed Fortran restrictions to the @code{aligned} clause @tab N @tab | |
543 | @item Mapping lambda captures @tab N @tab | |
fcddf7ce | 544 | @item New @code{omp_pause_stop_tool} constant for omp_pause_resource @tab N @tab |
c16e85d7 TB |
545 | @end multitable |
546 | ||
547 | ||
548 | ||
d77de738 ML |
549 | @c --------------------------------------------------------------------- |
550 | @c OpenMP Runtime Library Routines | |
551 | @c --------------------------------------------------------------------- | |
552 | ||
553 | @node Runtime Library Routines | |
554 | @chapter OpenMP Runtime Library Routines | |
555 | ||
506f068e TB |
556 | The runtime routines described here are defined by Section 18 of the OpenMP |
557 | specification in version 5.2. | |
d77de738 ML |
558 | |
559 | @menu | |
506f068e TB |
560 | * Thread Team Routines:: |
561 | * Thread Affinity Routines:: | |
562 | * Teams Region Routines:: | |
563 | * Tasking Routines:: | |
564 | @c * Resource Relinquishing Routines:: | |
565 | * Device Information Routines:: | |
e0786ba6 | 566 | * Device Memory Routines:: |
506f068e TB |
567 | * Lock Routines:: |
568 | * Timing Routines:: | |
569 | * Event Routine:: | |
570 | @c * Interoperability Routines:: | |
971f119f | 571 | * Memory Management Routines:: |
506f068e | 572 | @c * Tool Control Routine:: |
fefbd85b | 573 | * Environment Display Routine:: |
506f068e | 574 | @end menu |
d77de738 | 575 | |
506f068e TB |
576 | |
577 | ||
578 | @node Thread Team Routines | |
579 | @section Thread Team Routines | |
580 | ||
581 | Routines controlling threads in the current contention group. | |
582 | They have C linkage and do not throw exceptions. | |
583 | ||
584 | @menu | |
585 | * omp_set_num_threads:: Set upper team size limit | |
d77de738 | 586 | * omp_get_num_threads:: Size of the active team |
506f068e | 587 | * omp_get_max_threads:: Maximum number of threads of parallel region |
d77de738 ML |
588 | * omp_get_thread_num:: Current thread ID |
589 | * omp_in_parallel:: Whether a parallel region is active | |
d77de738 | 590 | * omp_set_dynamic:: Enable/disable dynamic teams |
506f068e TB |
591 | * omp_get_dynamic:: Dynamic teams setting |
592 | * omp_get_cancellation:: Whether cancellation support is enabled | |
d77de738 | 593 | * omp_set_nested:: Enable/disable nested parallel regions |
506f068e | 594 | * omp_get_nested:: Nested parallel regions |
d77de738 | 595 | * omp_set_schedule:: Set the runtime scheduling method |
506f068e TB |
596 | * omp_get_schedule:: Obtain the runtime scheduling method |
597 | * omp_get_teams_thread_limit:: Maximum number of threads imposed by teams | |
598 | * omp_get_supported_active_levels:: Maximum number of active regions supported | |
599 | * omp_set_max_active_levels:: Limits the number of active parallel regions | |
600 | * omp_get_max_active_levels:: Current maximum number of active regions | |
601 | * omp_get_level:: Number of parallel regions | |
602 | * omp_get_ancestor_thread_num:: Ancestor thread ID | |
603 | * omp_get_team_size:: Number of threads in a team | |
604 | * omp_get_active_level:: Number of active parallel regions | |
605 | @end menu | |
d77de738 | 606 | |
d77de738 | 607 | |
d77de738 | 608 | |
506f068e TB |
609 | @node omp_set_num_threads |
610 | @subsection @code{omp_set_num_threads} -- Set upper team size limit | |
611 | @table @asis | |
612 | @item @emph{Description}: | |
613 | Specifies the number of threads used by default in subsequent parallel | |
614 | sections, if those do not specify a @code{num_threads} clause. The | |
615 | argument of @code{omp_set_num_threads} shall be a positive integer. | |
d77de738 | 616 | |
506f068e TB |
617 | @item @emph{C/C++}: |
618 | @multitable @columnfractions .20 .80 | |
619 | @item @emph{Prototype}: @tab @code{void omp_set_num_threads(int num_threads);} | |
620 | @end multitable | |
d77de738 | 621 | |
506f068e TB |
622 | @item @emph{Fortran}: |
623 | @multitable @columnfractions .20 .80 | |
624 | @item @emph{Interface}: @tab @code{subroutine omp_set_num_threads(num_threads)} | |
625 | @item @tab @code{integer, intent(in) :: num_threads} | |
626 | @end multitable | |
d77de738 | 627 | |
506f068e TB |
628 | @item @emph{See also}: |
629 | @ref{OMP_NUM_THREADS}, @ref{omp_get_num_threads}, @ref{omp_get_max_threads} | |
d77de738 | 630 | |
506f068e TB |
631 | @item @emph{Reference}: |
632 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.1. | |
633 | @end table | |
d77de738 ML |
634 | |
635 | ||
506f068e TB |
636 | |
637 | @node omp_get_num_threads | |
638 | @subsection @code{omp_get_num_threads} -- Size of the active team | |
d77de738 ML |
639 | @table @asis |
640 | @item @emph{Description}: | |
506f068e TB |
641 | Returns the number of threads in the current team. In a sequential section of |
642 | the program @code{omp_get_num_threads} returns 1. | |
d77de738 | 643 | |
506f068e TB |
644 | The default team size may be initialized at startup by the |
645 | @env{OMP_NUM_THREADS} environment variable. At runtime, the size | |
646 | of the current team may be set either by the @code{NUM_THREADS} | |
647 | clause or by @code{omp_set_num_threads}. If none of the above were | |
648 | used to define a specific value and @env{OMP_DYNAMIC} is disabled, | |
649 | one thread per CPU online is used. | |
650 | ||
651 | @item @emph{C/C++}: | |
d77de738 | 652 | @multitable @columnfractions .20 .80 |
506f068e | 653 | @item @emph{Prototype}: @tab @code{int omp_get_num_threads(void);} |
d77de738 ML |
654 | @end multitable |
655 | ||
656 | @item @emph{Fortran}: | |
657 | @multitable @columnfractions .20 .80 | |
506f068e | 658 | @item @emph{Interface}: @tab @code{integer function omp_get_num_threads()} |
d77de738 ML |
659 | @end multitable |
660 | ||
661 | @item @emph{See also}: | |
506f068e | 662 | @ref{omp_get_max_threads}, @ref{omp_set_num_threads}, @ref{OMP_NUM_THREADS} |
d77de738 ML |
663 | |
664 | @item @emph{Reference}: | |
506f068e | 665 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.2. |
d77de738 ML |
666 | @end table |
667 | ||
668 | ||
669 | ||
506f068e TB |
670 | @node omp_get_max_threads |
671 | @subsection @code{omp_get_max_threads} -- Maximum number of threads of parallel region | |
d77de738 ML |
672 | @table @asis |
673 | @item @emph{Description}: | |
506f068e TB |
674 | Return the maximum number of threads used for the current parallel region |
675 | that does not use the clause @code{num_threads}. | |
d77de738 | 676 | |
506f068e | 677 | @item @emph{C/C++}: |
d77de738 | 678 | @multitable @columnfractions .20 .80 |
506f068e | 679 | @item @emph{Prototype}: @tab @code{int omp_get_max_threads(void);} |
d77de738 ML |
680 | @end multitable |
681 | ||
682 | @item @emph{Fortran}: | |
683 | @multitable @columnfractions .20 .80 | |
506f068e | 684 | @item @emph{Interface}: @tab @code{integer function omp_get_max_threads()} |
d77de738 ML |
685 | @end multitable |
686 | ||
687 | @item @emph{See also}: | |
506f068e | 688 | @ref{omp_set_num_threads}, @ref{omp_set_dynamic}, @ref{omp_get_thread_limit} |
d77de738 ML |
689 | |
690 | @item @emph{Reference}: | |
506f068e | 691 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.3. |
d77de738 ML |
692 | @end table |
693 | ||
694 | ||
695 | ||
506f068e TB |
696 | @node omp_get_thread_num |
697 | @subsection @code{omp_get_thread_num} -- Current thread ID | |
d77de738 ML |
698 | @table @asis |
699 | @item @emph{Description}: | |
506f068e TB |
700 | Returns a unique thread identification number within the current team. |
701 | In a sequential parts of the program, @code{omp_get_thread_num} | |
702 | always returns 0. In parallel regions the return value varies | |
703 | from 0 to @code{omp_get_num_threads}-1 inclusive. The return | |
704 | value of the primary thread of a team is always 0. | |
d77de738 ML |
705 | |
706 | @item @emph{C/C++}: | |
707 | @multitable @columnfractions .20 .80 | |
506f068e | 708 | @item @emph{Prototype}: @tab @code{int omp_get_thread_num(void);} |
d77de738 ML |
709 | @end multitable |
710 | ||
711 | @item @emph{Fortran}: | |
712 | @multitable @columnfractions .20 .80 | |
506f068e | 713 | @item @emph{Interface}: @tab @code{integer function omp_get_thread_num()} |
d77de738 ML |
714 | @end multitable |
715 | ||
716 | @item @emph{See also}: | |
506f068e | 717 | @ref{omp_get_num_threads}, @ref{omp_get_ancestor_thread_num} |
d77de738 ML |
718 | |
719 | @item @emph{Reference}: | |
506f068e | 720 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.4. |
d77de738 ML |
721 | @end table |
722 | ||
723 | ||
724 | ||
506f068e TB |
725 | @node omp_in_parallel |
726 | @subsection @code{omp_in_parallel} -- Whether a parallel region is active | |
d77de738 ML |
727 | @table @asis |
728 | @item @emph{Description}: | |
506f068e TB |
729 | This function returns @code{true} if currently running in parallel, |
730 | @code{false} otherwise. Here, @code{true} and @code{false} represent | |
731 | their language-specific counterparts. | |
d77de738 ML |
732 | |
733 | @item @emph{C/C++}: | |
734 | @multitable @columnfractions .20 .80 | |
506f068e | 735 | @item @emph{Prototype}: @tab @code{int omp_in_parallel(void);} |
d77de738 ML |
736 | @end multitable |
737 | ||
738 | @item @emph{Fortran}: | |
739 | @multitable @columnfractions .20 .80 | |
506f068e | 740 | @item @emph{Interface}: @tab @code{logical function omp_in_parallel()} |
d77de738 ML |
741 | @end multitable |
742 | ||
d77de738 | 743 | @item @emph{Reference}: |
506f068e | 744 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.6. |
d77de738 ML |
745 | @end table |
746 | ||
747 | ||
506f068e TB |
748 | @node omp_set_dynamic |
749 | @subsection @code{omp_set_dynamic} -- Enable/disable dynamic teams | |
d77de738 ML |
750 | @table @asis |
751 | @item @emph{Description}: | |
506f068e TB |
752 | Enable or disable the dynamic adjustment of the number of threads |
753 | within a team. The function takes the language-specific equivalent | |
754 | of @code{true} and @code{false}, where @code{true} enables dynamic | |
755 | adjustment of team sizes and @code{false} disables it. | |
d77de738 | 756 | |
506f068e | 757 | @item @emph{C/C++}: |
d77de738 | 758 | @multitable @columnfractions .20 .80 |
506f068e | 759 | @item @emph{Prototype}: @tab @code{void omp_set_dynamic(int dynamic_threads);} |
d77de738 ML |
760 | @end multitable |
761 | ||
762 | @item @emph{Fortran}: | |
763 | @multitable @columnfractions .20 .80 | |
506f068e TB |
764 | @item @emph{Interface}: @tab @code{subroutine omp_set_dynamic(dynamic_threads)} |
765 | @item @tab @code{logical, intent(in) :: dynamic_threads} | |
d77de738 ML |
766 | @end multitable |
767 | ||
768 | @item @emph{See also}: | |
506f068e | 769 | @ref{OMP_DYNAMIC}, @ref{omp_get_dynamic} |
d77de738 ML |
770 | |
771 | @item @emph{Reference}: | |
506f068e | 772 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.7. |
d77de738 ML |
773 | @end table |
774 | ||
775 | ||
776 | ||
777 | @node omp_get_dynamic | |
506f068e | 778 | @subsection @code{omp_get_dynamic} -- Dynamic teams setting |
d77de738 ML |
779 | @table @asis |
780 | @item @emph{Description}: | |
781 | This function returns @code{true} if enabled, @code{false} otherwise. | |
782 | Here, @code{true} and @code{false} represent their language-specific | |
783 | counterparts. | |
784 | ||
785 | The dynamic team setting may be initialized at startup by the | |
786 | @env{OMP_DYNAMIC} environment variable or at runtime using | |
787 | @code{omp_set_dynamic}. If undefined, dynamic adjustment is | |
788 | disabled by default. | |
789 | ||
790 | @item @emph{C/C++}: | |
791 | @multitable @columnfractions .20 .80 | |
792 | @item @emph{Prototype}: @tab @code{int omp_get_dynamic(void);} | |
793 | @end multitable | |
794 | ||
795 | @item @emph{Fortran}: | |
796 | @multitable @columnfractions .20 .80 | |
797 | @item @emph{Interface}: @tab @code{logical function omp_get_dynamic()} | |
798 | @end multitable | |
799 | ||
800 | @item @emph{See also}: | |
801 | @ref{omp_set_dynamic}, @ref{OMP_DYNAMIC} | |
802 | ||
803 | @item @emph{Reference}: | |
804 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.8. | |
805 | @end table | |
806 | ||
807 | ||
808 | ||
506f068e TB |
809 | @node omp_get_cancellation |
810 | @subsection @code{omp_get_cancellation} -- Whether cancellation support is enabled | |
d77de738 ML |
811 | @table @asis |
812 | @item @emph{Description}: | |
506f068e TB |
813 | This function returns @code{true} if cancellation is activated, @code{false} |
814 | otherwise. Here, @code{true} and @code{false} represent their language-specific | |
815 | counterparts. Unless @env{OMP_CANCELLATION} is set true, cancellations are | |
816 | deactivated. | |
d77de738 | 817 | |
506f068e | 818 | @item @emph{C/C++}: |
d77de738 | 819 | @multitable @columnfractions .20 .80 |
506f068e | 820 | @item @emph{Prototype}: @tab @code{int omp_get_cancellation(void);} |
d77de738 ML |
821 | @end multitable |
822 | ||
823 | @item @emph{Fortran}: | |
824 | @multitable @columnfractions .20 .80 | |
506f068e | 825 | @item @emph{Interface}: @tab @code{logical function omp_get_cancellation()} |
d77de738 ML |
826 | @end multitable |
827 | ||
828 | @item @emph{See also}: | |
506f068e | 829 | @ref{OMP_CANCELLATION} |
d77de738 ML |
830 | |
831 | @item @emph{Reference}: | |
506f068e | 832 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.9. |
d77de738 ML |
833 | @end table |
834 | ||
835 | ||
836 | ||
506f068e TB |
837 | @node omp_set_nested |
838 | @subsection @code{omp_set_nested} -- Enable/disable nested parallel regions | |
d77de738 ML |
839 | @table @asis |
840 | @item @emph{Description}: | |
506f068e TB |
841 | Enable or disable nested parallel regions, i.e., whether team members |
842 | are allowed to create new teams. The function takes the language-specific | |
843 | equivalent of @code{true} and @code{false}, where @code{true} enables | |
844 | dynamic adjustment of team sizes and @code{false} disables it. | |
d77de738 | 845 | |
15886c03 | 846 | Enabling nested parallel regions also sets the maximum number of |
506f068e | 847 | active nested regions to the maximum supported. Disabling nested parallel |
15886c03 | 848 | regions sets the maximum number of active nested regions to one. |
506f068e TB |
849 | |
850 | Note that the @code{omp_set_nested} API routine was deprecated | |
851 | in the OpenMP specification 5.2 in favor of @code{omp_set_max_active_levels}. | |
852 | ||
853 | @item @emph{C/C++}: | |
d77de738 | 854 | @multitable @columnfractions .20 .80 |
506f068e | 855 | @item @emph{Prototype}: @tab @code{void omp_set_nested(int nested);} |
d77de738 ML |
856 | @end multitable |
857 | ||
858 | @item @emph{Fortran}: | |
859 | @multitable @columnfractions .20 .80 | |
506f068e TB |
860 | @item @emph{Interface}: @tab @code{subroutine omp_set_nested(nested)} |
861 | @item @tab @code{logical, intent(in) :: nested} | |
d77de738 ML |
862 | @end multitable |
863 | ||
864 | @item @emph{See also}: | |
506f068e TB |
865 | @ref{omp_get_nested}, @ref{omp_set_max_active_levels}, |
866 | @ref{OMP_MAX_ACTIVE_LEVELS}, @ref{OMP_NESTED} | |
d77de738 ML |
867 | |
868 | @item @emph{Reference}: | |
506f068e | 869 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.10. |
d77de738 ML |
870 | @end table |
871 | ||
872 | ||
873 | ||
506f068e TB |
874 | @node omp_get_nested |
875 | @subsection @code{omp_get_nested} -- Nested parallel regions | |
d77de738 ML |
876 | @table @asis |
877 | @item @emph{Description}: | |
506f068e TB |
878 | This function returns @code{true} if nested parallel regions are |
879 | enabled, @code{false} otherwise. Here, @code{true} and @code{false} | |
880 | represent their language-specific counterparts. | |
881 | ||
882 | The state of nested parallel regions at startup depends on several | |
883 | environment variables. If @env{OMP_MAX_ACTIVE_LEVELS} is defined | |
884 | and is set to greater than one, then nested parallel regions will be | |
885 | enabled. If not defined, then the value of the @env{OMP_NESTED} | |
886 | environment variable will be followed if defined. If neither are | |
887 | defined, then if either @env{OMP_NUM_THREADS} or @env{OMP_PROC_BIND} | |
888 | are defined with a list of more than one value, then nested parallel | |
889 | regions are enabled. If none of these are defined, then nested parallel | |
890 | regions are disabled by default. | |
891 | ||
892 | Nested parallel regions can be enabled or disabled at runtime using | |
893 | @code{omp_set_nested}, or by setting the maximum number of nested | |
894 | regions with @code{omp_set_max_active_levels} to one to disable, or | |
895 | above one to enable. | |
896 | ||
897 | Note that the @code{omp_get_nested} API routine was deprecated | |
898 | in the OpenMP specification 5.2 in favor of @code{omp_get_max_active_levels}. | |
899 | ||
900 | @item @emph{C/C++}: | |
901 | @multitable @columnfractions .20 .80 | |
902 | @item @emph{Prototype}: @tab @code{int omp_get_nested(void);} | |
903 | @end multitable | |
904 | ||
905 | @item @emph{Fortran}: | |
906 | @multitable @columnfractions .20 .80 | |
907 | @item @emph{Interface}: @tab @code{logical function omp_get_nested()} | |
908 | @end multitable | |
909 | ||
910 | @item @emph{See also}: | |
911 | @ref{omp_get_max_active_levels}, @ref{omp_set_nested}, | |
912 | @ref{OMP_MAX_ACTIVE_LEVELS}, @ref{OMP_NESTED} | |
913 | ||
914 | @item @emph{Reference}: | |
915 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.11. | |
916 | @end table | |
917 | ||
918 | ||
919 | ||
920 | @node omp_set_schedule | |
921 | @subsection @code{omp_set_schedule} -- Set the runtime scheduling method | |
922 | @table @asis | |
923 | @item @emph{Description}: | |
924 | Sets the runtime scheduling method. The @var{kind} argument can have the | |
925 | value @code{omp_sched_static}, @code{omp_sched_dynamic}, | |
926 | @code{omp_sched_guided} or @code{omp_sched_auto}. Except for | |
927 | @code{omp_sched_auto}, the chunk size is set to the value of | |
928 | @var{chunk_size} if positive, or to the default value if zero or negative. | |
929 | For @code{omp_sched_auto} the @var{chunk_size} argument is ignored. | |
d77de738 ML |
930 | |
931 | @item @emph{C/C++} | |
932 | @multitable @columnfractions .20 .80 | |
506f068e | 933 | @item @emph{Prototype}: @tab @code{void omp_set_schedule(omp_sched_t kind, int chunk_size);} |
d77de738 ML |
934 | @end multitable |
935 | ||
936 | @item @emph{Fortran}: | |
937 | @multitable @columnfractions .20 .80 | |
506f068e TB |
938 | @item @emph{Interface}: @tab @code{subroutine omp_set_schedule(kind, chunk_size)} |
939 | @item @tab @code{integer(kind=omp_sched_kind) kind} | |
940 | @item @tab @code{integer chunk_size} | |
d77de738 ML |
941 | @end multitable |
942 | ||
943 | @item @emph{See also}: | |
506f068e TB |
944 | @ref{omp_get_schedule} |
945 | @ref{OMP_SCHEDULE} | |
d77de738 ML |
946 | |
947 | @item @emph{Reference}: | |
506f068e | 948 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.12. |
d77de738 ML |
949 | @end table |
950 | ||
951 | ||
506f068e TB |
952 | |
953 | @node omp_get_schedule | |
954 | @subsection @code{omp_get_schedule} -- Obtain the runtime scheduling method | |
d77de738 ML |
955 | @table @asis |
956 | @item @emph{Description}: | |
15886c03 TB |
957 | Obtain the runtime scheduling method. The @var{kind} argument is set to |
958 | @code{omp_sched_static}, @code{omp_sched_dynamic}, | |
506f068e TB |
959 | @code{omp_sched_guided} or @code{omp_sched_auto}. The second argument, |
960 | @var{chunk_size}, is set to the chunk size. | |
d77de738 ML |
961 | |
962 | @item @emph{C/C++} | |
963 | @multitable @columnfractions .20 .80 | |
506f068e | 964 | @item @emph{Prototype}: @tab @code{void omp_get_schedule(omp_sched_t *kind, int *chunk_size);} |
d77de738 ML |
965 | @end multitable |
966 | ||
967 | @item @emph{Fortran}: | |
968 | @multitable @columnfractions .20 .80 | |
506f068e TB |
969 | @item @emph{Interface}: @tab @code{subroutine omp_get_schedule(kind, chunk_size)} |
970 | @item @tab @code{integer(kind=omp_sched_kind) kind} | |
971 | @item @tab @code{integer chunk_size} | |
d77de738 ML |
972 | @end multitable |
973 | ||
506f068e TB |
974 | @item @emph{See also}: |
975 | @ref{omp_set_schedule}, @ref{OMP_SCHEDULE} | |
976 | ||
d77de738 | 977 | @item @emph{Reference}: |
506f068e | 978 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.13. |
d77de738 ML |
979 | @end table |
980 | ||
981 | ||
506f068e TB |
982 | @node omp_get_teams_thread_limit |
983 | @subsection @code{omp_get_teams_thread_limit} -- Maximum number of threads imposed by teams | |
d77de738 ML |
984 | @table @asis |
985 | @item @emph{Description}: | |
15886c03 | 986 | Return the maximum number of threads that are able to participate in |
506f068e | 987 | each team created by a teams construct. |
d77de738 ML |
988 | |
989 | @item @emph{C/C++}: | |
990 | @multitable @columnfractions .20 .80 | |
506f068e | 991 | @item @emph{Prototype}: @tab @code{int omp_get_teams_thread_limit(void);} |
d77de738 ML |
992 | @end multitable |
993 | ||
994 | @item @emph{Fortran}: | |
995 | @multitable @columnfractions .20 .80 | |
506f068e | 996 | @item @emph{Interface}: @tab @code{integer function omp_get_teams_thread_limit()} |
d77de738 ML |
997 | @end multitable |
998 | ||
999 | @item @emph{See also}: | |
506f068e | 1000 | @ref{omp_set_teams_thread_limit}, @ref{OMP_TEAMS_THREAD_LIMIT} |
d77de738 ML |
1001 | |
1002 | @item @emph{Reference}: | |
506f068e | 1003 | @uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.4.6. |
d77de738 ML |
1004 | @end table |
1005 | ||
1006 | ||
1007 | ||
506f068e TB |
1008 | @node omp_get_supported_active_levels |
1009 | @subsection @code{omp_get_supported_active_levels} -- Maximum number of active regions supported | |
d77de738 ML |
1010 | @table @asis |
1011 | @item @emph{Description}: | |
506f068e TB |
1012 | This function returns the maximum number of nested, active parallel regions |
1013 | supported by this implementation. | |
d77de738 | 1014 | |
506f068e | 1015 | @item @emph{C/C++} |
d77de738 | 1016 | @multitable @columnfractions .20 .80 |
506f068e | 1017 | @item @emph{Prototype}: @tab @code{int omp_get_supported_active_levels(void);} |
d77de738 ML |
1018 | @end multitable |
1019 | ||
1020 | @item @emph{Fortran}: | |
1021 | @multitable @columnfractions .20 .80 | |
506f068e | 1022 | @item @emph{Interface}: @tab @code{integer function omp_get_supported_active_levels()} |
d77de738 ML |
1023 | @end multitable |
1024 | ||
1025 | @item @emph{See also}: | |
506f068e | 1026 | @ref{omp_get_max_active_levels}, @ref{omp_set_max_active_levels} |
d77de738 ML |
1027 | |
1028 | @item @emph{Reference}: | |
506f068e | 1029 | @uref{https://www.openmp.org, OpenMP specification v5.0}, Section 3.2.15. |
d77de738 ML |
1030 | @end table |
1031 | ||
1032 | ||
1033 | ||
506f068e TB |
1034 | @node omp_set_max_active_levels |
1035 | @subsection @code{omp_set_max_active_levels} -- Limits the number of active parallel regions | |
d77de738 ML |
1036 | @table @asis |
1037 | @item @emph{Description}: | |
506f068e TB |
1038 | This function limits the maximum allowed number of nested, active |
1039 | parallel regions. @var{max_levels} must be less or equal to | |
1040 | the value returned by @code{omp_get_supported_active_levels}. | |
d77de738 | 1041 | |
506f068e TB |
1042 | @item @emph{C/C++} |
1043 | @multitable @columnfractions .20 .80 | |
1044 | @item @emph{Prototype}: @tab @code{void omp_set_max_active_levels(int max_levels);} | |
1045 | @end multitable | |
d77de738 | 1046 | |
506f068e TB |
1047 | @item @emph{Fortran}: |
1048 | @multitable @columnfractions .20 .80 | |
1049 | @item @emph{Interface}: @tab @code{subroutine omp_set_max_active_levels(max_levels)} | |
1050 | @item @tab @code{integer max_levels} | |
1051 | @end multitable | |
d77de738 | 1052 | |
506f068e TB |
1053 | @item @emph{See also}: |
1054 | @ref{omp_get_max_active_levels}, @ref{omp_get_active_level}, | |
1055 | @ref{omp_get_supported_active_levels} | |
2cd0689a | 1056 | |
506f068e TB |
1057 | @item @emph{Reference}: |
1058 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.15. | |
1059 | @end table | |
1060 | ||
1061 | ||
1062 | ||
1063 | @node omp_get_max_active_levels | |
1064 | @subsection @code{omp_get_max_active_levels} -- Current maximum number of active regions | |
1065 | @table @asis | |
1066 | @item @emph{Description}: | |
1067 | This function obtains the maximum allowed number of nested, active parallel regions. | |
1068 | ||
1069 | @item @emph{C/C++} | |
d77de738 | 1070 | @multitable @columnfractions .20 .80 |
506f068e | 1071 | @item @emph{Prototype}: @tab @code{int omp_get_max_active_levels(void);} |
d77de738 ML |
1072 | @end multitable |
1073 | ||
1074 | @item @emph{Fortran}: | |
1075 | @multitable @columnfractions .20 .80 | |
506f068e | 1076 | @item @emph{Interface}: @tab @code{integer function omp_get_max_active_levels()} |
d77de738 ML |
1077 | @end multitable |
1078 | ||
1079 | @item @emph{See also}: | |
506f068e | 1080 | @ref{omp_set_max_active_levels}, @ref{omp_get_active_level} |
d77de738 ML |
1081 | |
1082 | @item @emph{Reference}: | |
506f068e | 1083 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.16. |
d77de738 ML |
1084 | @end table |
1085 | ||
1086 | ||
506f068e TB |
1087 | @node omp_get_level |
1088 | @subsection @code{omp_get_level} -- Obtain the current nesting level | |
d77de738 ML |
1089 | @table @asis |
1090 | @item @emph{Description}: | |
506f068e TB |
1091 | This function returns the nesting level for the parallel blocks, |
1092 | which enclose the calling call. | |
d77de738 | 1093 | |
506f068e | 1094 | @item @emph{C/C++} |
d77de738 | 1095 | @multitable @columnfractions .20 .80 |
506f068e | 1096 | @item @emph{Prototype}: @tab @code{int omp_get_level(void);} |
d77de738 ML |
1097 | @end multitable |
1098 | ||
1099 | @item @emph{Fortran}: | |
1100 | @multitable @columnfractions .20 .80 | |
506f068e | 1101 | @item @emph{Interface}: @tab @code{integer function omp_level()} |
d77de738 ML |
1102 | @end multitable |
1103 | ||
506f068e TB |
1104 | @item @emph{See also}: |
1105 | @ref{omp_get_active_level} | |
1106 | ||
d77de738 | 1107 | @item @emph{Reference}: |
506f068e | 1108 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.17. |
d77de738 ML |
1109 | @end table |
1110 | ||
1111 | ||
1112 | ||
506f068e TB |
1113 | @node omp_get_ancestor_thread_num |
1114 | @subsection @code{omp_get_ancestor_thread_num} -- Ancestor thread ID | |
d77de738 ML |
1115 | @table @asis |
1116 | @item @emph{Description}: | |
506f068e TB |
1117 | This function returns the thread identification number for the given |
1118 | nesting level of the current thread. For values of @var{level} outside | |
1119 | zero to @code{omp_get_level} -1 is returned; if @var{level} is | |
1120 | @code{omp_get_level} the result is identical to @code{omp_get_thread_num}. | |
d77de738 | 1121 | |
506f068e | 1122 | @item @emph{C/C++} |
d77de738 | 1123 | @multitable @columnfractions .20 .80 |
506f068e | 1124 | @item @emph{Prototype}: @tab @code{int omp_get_ancestor_thread_num(int level);} |
d77de738 ML |
1125 | @end multitable |
1126 | ||
1127 | @item @emph{Fortran}: | |
1128 | @multitable @columnfractions .20 .80 | |
506f068e TB |
1129 | @item @emph{Interface}: @tab @code{integer function omp_get_ancestor_thread_num(level)} |
1130 | @item @tab @code{integer level} | |
d77de738 ML |
1131 | @end multitable |
1132 | ||
506f068e TB |
1133 | @item @emph{See also}: |
1134 | @ref{omp_get_level}, @ref{omp_get_thread_num}, @ref{omp_get_team_size} | |
1135 | ||
d77de738 | 1136 | @item @emph{Reference}: |
506f068e | 1137 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.18. |
d77de738 ML |
1138 | @end table |
1139 | ||
1140 | ||
1141 | ||
506f068e TB |
1142 | @node omp_get_team_size |
1143 | @subsection @code{omp_get_team_size} -- Number of threads in a team | |
d77de738 ML |
1144 | @table @asis |
1145 | @item @emph{Description}: | |
506f068e TB |
1146 | This function returns the number of threads in a thread team to which |
1147 | either the current thread or its ancestor belongs. For values of @var{level} | |
1148 | outside zero to @code{omp_get_level}, -1 is returned; if @var{level} is zero, | |
1149 | 1 is returned, and for @code{omp_get_level}, the result is identical | |
1150 | to @code{omp_get_num_threads}. | |
d77de738 ML |
1151 | |
1152 | @item @emph{C/C++}: | |
1153 | @multitable @columnfractions .20 .80 | |
506f068e | 1154 | @item @emph{Prototype}: @tab @code{int omp_get_team_size(int level);} |
d77de738 ML |
1155 | @end multitable |
1156 | ||
1157 | @item @emph{Fortran}: | |
1158 | @multitable @columnfractions .20 .80 | |
506f068e TB |
1159 | @item @emph{Interface}: @tab @code{integer function omp_get_team_size(level)} |
1160 | @item @tab @code{integer level} | |
d77de738 ML |
1161 | @end multitable |
1162 | ||
506f068e TB |
1163 | @item @emph{See also}: |
1164 | @ref{omp_get_num_threads}, @ref{omp_get_level}, @ref{omp_get_ancestor_thread_num} | |
1165 | ||
d77de738 | 1166 | @item @emph{Reference}: |
506f068e | 1167 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.19. |
d77de738 ML |
1168 | @end table |
1169 | ||
1170 | ||
1171 | ||
506f068e TB |
1172 | @node omp_get_active_level |
1173 | @subsection @code{omp_get_active_level} -- Number of parallel regions | |
d77de738 ML |
1174 | @table @asis |
1175 | @item @emph{Description}: | |
506f068e TB |
1176 | This function returns the nesting level for the active parallel blocks, |
1177 | which enclose the calling call. | |
d77de738 | 1178 | |
506f068e | 1179 | @item @emph{C/C++} |
d77de738 | 1180 | @multitable @columnfractions .20 .80 |
506f068e | 1181 | @item @emph{Prototype}: @tab @code{int omp_get_active_level(void);} |
d77de738 ML |
1182 | @end multitable |
1183 | ||
1184 | @item @emph{Fortran}: | |
1185 | @multitable @columnfractions .20 .80 | |
506f068e | 1186 | @item @emph{Interface}: @tab @code{integer function omp_get_active_level()} |
d77de738 ML |
1187 | @end multitable |
1188 | ||
1189 | @item @emph{See also}: | |
506f068e | 1190 | @ref{omp_get_level}, @ref{omp_get_max_active_levels}, @ref{omp_set_max_active_levels} |
d77de738 ML |
1191 | |
1192 | @item @emph{Reference}: | |
506f068e | 1193 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.20. |
d77de738 ML |
1194 | @end table |
1195 | ||
1196 | ||
1197 | ||
506f068e TB |
1198 | @node Thread Affinity Routines |
1199 | @section Thread Affinity Routines | |
1200 | ||
1201 | Routines controlling and accessing thread-affinity policies. | |
1202 | They have C linkage and do not throw exceptions. | |
1203 | ||
1204 | @menu | |
1205 | * omp_get_proc_bind:: Whether threads may be moved between CPUs | |
1206 | @c * omp_get_num_places:: <fixme> | |
1207 | @c * omp_get_place_num_procs:: <fixme> | |
1208 | @c * omp_get_place_proc_ids:: <fixme> | |
1209 | @c * omp_get_place_num:: <fixme> | |
1210 | @c * omp_get_partition_num_places:: <fixme> | |
1211 | @c * omp_get_partition_place_nums:: <fixme> | |
1212 | @c * omp_set_affinity_format:: <fixme> | |
1213 | @c * omp_get_affinity_format:: <fixme> | |
1214 | @c * omp_display_affinity:: <fixme> | |
1215 | @c * omp_capture_affinity:: <fixme> | |
1216 | @end menu | |
1217 | ||
1218 | ||
1219 | ||
d77de738 | 1220 | @node omp_get_proc_bind |
506f068e | 1221 | @subsection @code{omp_get_proc_bind} -- Whether threads may be moved between CPUs |
d77de738 ML |
1222 | @table @asis |
1223 | @item @emph{Description}: | |
1224 | This functions returns the currently active thread affinity policy, which is | |
1225 | set via @env{OMP_PROC_BIND}. Possible values are @code{omp_proc_bind_false}, | |
1226 | @code{omp_proc_bind_true}, @code{omp_proc_bind_primary}, | |
1227 | @code{omp_proc_bind_master}, @code{omp_proc_bind_close} and @code{omp_proc_bind_spread}, | |
1228 | where @code{omp_proc_bind_master} is an alias for @code{omp_proc_bind_primary}. | |
1229 | ||
1230 | @item @emph{C/C++}: | |
1231 | @multitable @columnfractions .20 .80 | |
1232 | @item @emph{Prototype}: @tab @code{omp_proc_bind_t omp_get_proc_bind(void);} | |
1233 | @end multitable | |
1234 | ||
1235 | @item @emph{Fortran}: | |
1236 | @multitable @columnfractions .20 .80 | |
1237 | @item @emph{Interface}: @tab @code{integer(kind=omp_proc_bind_kind) function omp_get_proc_bind()} | |
1238 | @end multitable | |
1239 | ||
1240 | @item @emph{See also}: | |
1241 | @ref{OMP_PROC_BIND}, @ref{OMP_PLACES}, @ref{GOMP_CPU_AFFINITY}, | |
1242 | ||
1243 | @item @emph{Reference}: | |
1244 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.22. | |
1245 | @end table | |
1246 | ||
1247 | ||
1248 | ||
506f068e TB |
1249 | @node Teams Region Routines |
1250 | @section Teams Region Routines | |
d77de738 | 1251 | |
506f068e TB |
1252 | Routines controlling the league of teams that are executed in a @code{teams} |
1253 | region. They have C linkage and do not throw exceptions. | |
d77de738 | 1254 | |
506f068e TB |
1255 | @menu |
1256 | * omp_get_num_teams:: Number of teams | |
1257 | * omp_get_team_num:: Get team number | |
1258 | * omp_set_num_teams:: Set upper teams limit for teams region | |
1259 | * omp_get_max_teams:: Maximum number of teams for teams region | |
1260 | * omp_set_teams_thread_limit:: Set upper thread limit for teams construct | |
1261 | * omp_get_thread_limit:: Maximum number of threads | |
1262 | @end menu | |
d77de738 | 1263 | |
d77de738 ML |
1264 | |
1265 | ||
506f068e TB |
1266 | @node omp_get_num_teams |
1267 | @subsection @code{omp_get_num_teams} -- Number of teams | |
d77de738 ML |
1268 | @table @asis |
1269 | @item @emph{Description}: | |
506f068e | 1270 | Returns the number of teams in the current team region. |
d77de738 | 1271 | |
506f068e | 1272 | @item @emph{C/C++}: |
d77de738 | 1273 | @multitable @columnfractions .20 .80 |
506f068e | 1274 | @item @emph{Prototype}: @tab @code{int omp_get_num_teams(void);} |
d77de738 ML |
1275 | @end multitable |
1276 | ||
1277 | @item @emph{Fortran}: | |
1278 | @multitable @columnfractions .20 .80 | |
506f068e | 1279 | @item @emph{Interface}: @tab @code{integer function omp_get_num_teams()} |
d77de738 ML |
1280 | @end multitable |
1281 | ||
d77de738 | 1282 | @item @emph{Reference}: |
506f068e | 1283 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.32. |
d77de738 ML |
1284 | @end table |
1285 | ||
1286 | ||
1287 | ||
1288 | @node omp_get_team_num | |
506f068e | 1289 | @subsection @code{omp_get_team_num} -- Get team number |
d77de738 ML |
1290 | @table @asis |
1291 | @item @emph{Description}: | |
1292 | Returns the team number of the calling thread. | |
1293 | ||
1294 | @item @emph{C/C++}: | |
1295 | @multitable @columnfractions .20 .80 | |
1296 | @item @emph{Prototype}: @tab @code{int omp_get_team_num(void);} | |
1297 | @end multitable | |
1298 | ||
1299 | @item @emph{Fortran}: | |
1300 | @multitable @columnfractions .20 .80 | |
1301 | @item @emph{Interface}: @tab @code{integer function omp_get_team_num()} | |
1302 | @end multitable | |
1303 | ||
1304 | @item @emph{Reference}: | |
1305 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.33. | |
1306 | @end table | |
1307 | ||
1308 | ||
1309 | ||
506f068e TB |
1310 | @node omp_set_num_teams |
1311 | @subsection @code{omp_set_num_teams} -- Set upper teams limit for teams construct | |
d77de738 ML |
1312 | @table @asis |
1313 | @item @emph{Description}: | |
506f068e TB |
1314 | Specifies the upper bound for number of teams created by the teams construct |
1315 | which does not specify a @code{num_teams} clause. The | |
1316 | argument of @code{omp_set_num_teams} shall be a positive integer. | |
d77de738 ML |
1317 | |
1318 | @item @emph{C/C++}: | |
1319 | @multitable @columnfractions .20 .80 | |
506f068e | 1320 | @item @emph{Prototype}: @tab @code{void omp_set_num_teams(int num_teams);} |
d77de738 ML |
1321 | @end multitable |
1322 | ||
1323 | @item @emph{Fortran}: | |
1324 | @multitable @columnfractions .20 .80 | |
506f068e TB |
1325 | @item @emph{Interface}: @tab @code{subroutine omp_set_num_teams(num_teams)} |
1326 | @item @tab @code{integer, intent(in) :: num_teams} | |
d77de738 ML |
1327 | @end multitable |
1328 | ||
1329 | @item @emph{See also}: | |
506f068e | 1330 | @ref{OMP_NUM_TEAMS}, @ref{omp_get_num_teams}, @ref{omp_get_max_teams} |
d77de738 ML |
1331 | |
1332 | @item @emph{Reference}: | |
506f068e | 1333 | @uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.4.3. |
d77de738 ML |
1334 | @end table |
1335 | ||
1336 | ||
1337 | ||
506f068e TB |
1338 | @node omp_get_max_teams |
1339 | @subsection @code{omp_get_max_teams} -- Maximum number of teams of teams region | |
d77de738 ML |
1340 | @table @asis |
1341 | @item @emph{Description}: | |
506f068e TB |
1342 | Return the maximum number of teams used for the teams region |
1343 | that does not use the clause @code{num_teams}. | |
d77de738 ML |
1344 | |
1345 | @item @emph{C/C++}: | |
1346 | @multitable @columnfractions .20 .80 | |
506f068e | 1347 | @item @emph{Prototype}: @tab @code{int omp_get_max_teams(void);} |
d77de738 ML |
1348 | @end multitable |
1349 | ||
1350 | @item @emph{Fortran}: | |
1351 | @multitable @columnfractions .20 .80 | |
506f068e | 1352 | @item @emph{Interface}: @tab @code{integer function omp_get_max_teams()} |
d77de738 ML |
1353 | @end multitable |
1354 | ||
1355 | @item @emph{See also}: | |
506f068e | 1356 | @ref{omp_set_num_teams}, @ref{omp_get_num_teams} |
d77de738 ML |
1357 | |
1358 | @item @emph{Reference}: | |
506f068e | 1359 | @uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.4.4. |
d77de738 ML |
1360 | @end table |
1361 | ||
1362 | ||
1363 | ||
506f068e TB |
1364 | @node omp_set_teams_thread_limit |
1365 | @subsection @code{omp_set_teams_thread_limit} -- Set upper thread limit for teams construct | |
d77de738 ML |
1366 | @table @asis |
1367 | @item @emph{Description}: | |
15886c03 | 1368 | Specifies the upper bound for number of threads that are available |
506f068e TB |
1369 | for each team created by the teams construct which does not specify a |
1370 | @code{thread_limit} clause. The argument of | |
1371 | @code{omp_set_teams_thread_limit} shall be a positive integer. | |
d77de738 ML |
1372 | |
1373 | @item @emph{C/C++}: | |
1374 | @multitable @columnfractions .20 .80 | |
506f068e | 1375 | @item @emph{Prototype}: @tab @code{void omp_set_teams_thread_limit(int thread_limit);} |
d77de738 ML |
1376 | @end multitable |
1377 | ||
1378 | @item @emph{Fortran}: | |
1379 | @multitable @columnfractions .20 .80 | |
506f068e TB |
1380 | @item @emph{Interface}: @tab @code{subroutine omp_set_teams_thread_limit(thread_limit)} |
1381 | @item @tab @code{integer, intent(in) :: thread_limit} | |
d77de738 ML |
1382 | @end multitable |
1383 | ||
1384 | @item @emph{See also}: | |
506f068e | 1385 | @ref{OMP_TEAMS_THREAD_LIMIT}, @ref{omp_get_teams_thread_limit}, @ref{omp_get_thread_limit} |
d77de738 ML |
1386 | |
1387 | @item @emph{Reference}: | |
506f068e | 1388 | @uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.4.5. |
d77de738 ML |
1389 | @end table |
1390 | ||
1391 | ||
1392 | ||
506f068e TB |
1393 | @node omp_get_thread_limit |
1394 | @subsection @code{omp_get_thread_limit} -- Maximum number of threads | |
d77de738 ML |
1395 | @table @asis |
1396 | @item @emph{Description}: | |
506f068e | 1397 | Return the maximum number of threads of the program. |
d77de738 ML |
1398 | |
1399 | @item @emph{C/C++}: | |
1400 | @multitable @columnfractions .20 .80 | |
506f068e | 1401 | @item @emph{Prototype}: @tab @code{int omp_get_thread_limit(void);} |
d77de738 ML |
1402 | @end multitable |
1403 | ||
1404 | @item @emph{Fortran}: | |
1405 | @multitable @columnfractions .20 .80 | |
506f068e | 1406 | @item @emph{Interface}: @tab @code{integer function omp_get_thread_limit()} |
d77de738 ML |
1407 | @end multitable |
1408 | ||
1409 | @item @emph{See also}: | |
506f068e | 1410 | @ref{omp_get_max_threads}, @ref{OMP_THREAD_LIMIT} |
d77de738 ML |
1411 | |
1412 | @item @emph{Reference}: | |
506f068e | 1413 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.14. |
d77de738 ML |
1414 | @end table |
1415 | ||
1416 | ||
1417 | ||
506f068e TB |
1418 | @node Tasking Routines |
1419 | @section Tasking Routines | |
1420 | ||
1421 | Routines relating to explicit tasks. | |
1422 | They have C linkage and do not throw exceptions. | |
1423 | ||
1424 | @menu | |
1425 | * omp_get_max_task_priority:: Maximum task priority value that can be set | |
819f3d36 | 1426 | * omp_in_explicit_task:: Whether a given task is an explicit task |
506f068e | 1427 | * omp_in_final:: Whether in final or included task region |
fcddf7ce TB |
1428 | @c * omp_is_free_agent:: <fixme>/TR12 |
1429 | @c * omp_ancestor_is_free_agent:: <fixme>/TR12 | |
506f068e TB |
1430 | @end menu |
1431 | ||
1432 | ||
1433 | ||
1434 | @node omp_get_max_task_priority | |
1435 | @subsection @code{omp_get_max_task_priority} -- Maximum priority value | |
1436 | that can be set for tasks. | |
d77de738 ML |
1437 | @table @asis |
1438 | @item @emph{Description}: | |
506f068e | 1439 | This function obtains the maximum allowed priority number for tasks. |
d77de738 | 1440 | |
506f068e | 1441 | @item @emph{C/C++} |
d77de738 | 1442 | @multitable @columnfractions .20 .80 |
506f068e | 1443 | @item @emph{Prototype}: @tab @code{int omp_get_max_task_priority(void);} |
d77de738 ML |
1444 | @end multitable |
1445 | ||
1446 | @item @emph{Fortran}: | |
1447 | @multitable @columnfractions .20 .80 | |
506f068e | 1448 | @item @emph{Interface}: @tab @code{integer function omp_get_max_task_priority()} |
d77de738 ML |
1449 | @end multitable |
1450 | ||
1451 | @item @emph{Reference}: | |
506f068e | 1452 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.29. |
d77de738 ML |
1453 | @end table |
1454 | ||
1455 | ||
506f068e | 1456 | |
819f3d36 TB |
1457 | @node omp_in_explicit_task |
1458 | @subsection @code{omp_in_explicit_task} -- Whether a given task is an explicit task | |
1459 | @table @asis | |
1460 | @item @emph{Description}: | |
1461 | The function returns the @var{explicit-task-var} ICV; it returns true when the | |
1462 | encountering task was generated by a task-generating construct such as | |
1463 | @code{target}, @code{task} or @code{taskloop}. Otherwise, the encountering task | |
1464 | is in an implicit task region such as generated by the implicit or explicit | |
1465 | @code{parallel} region and @code{omp_in_explicit_task} returns false. | |
1466 | ||
1467 | @item @emph{C/C++} | |
1468 | @multitable @columnfractions .20 .80 | |
1469 | @item @emph{Prototype}: @tab @code{int omp_in_explicit_task(void);} | |
1470 | @end multitable | |
1471 | ||
1472 | @item @emph{Fortran}: | |
1473 | @multitable @columnfractions .20 .80 | |
1474 | @item @emph{Interface}: @tab @code{logical function omp_in_explicit_task()} | |
1475 | @end multitable | |
1476 | ||
1477 | @item @emph{Reference}: | |
1478 | @uref{https://www.openmp.org, OpenMP specification v5.2}, Section 18.5.2. | |
1479 | @end table | |
1480 | ||
1481 | ||
1482 | ||
d77de738 | 1483 | @node omp_in_final |
506f068e | 1484 | @subsection @code{omp_in_final} -- Whether in final or included task region |
d77de738 ML |
1485 | @table @asis |
1486 | @item @emph{Description}: | |
1487 | This function returns @code{true} if currently running in a final | |
1488 | or included task region, @code{false} otherwise. Here, @code{true} | |
1489 | and @code{false} represent their language-specific counterparts. | |
1490 | ||
1491 | @item @emph{C/C++}: | |
1492 | @multitable @columnfractions .20 .80 | |
1493 | @item @emph{Prototype}: @tab @code{int omp_in_final(void);} | |
1494 | @end multitable | |
1495 | ||
1496 | @item @emph{Fortran}: | |
1497 | @multitable @columnfractions .20 .80 | |
1498 | @item @emph{Interface}: @tab @code{logical function omp_in_final()} | |
1499 | @end multitable | |
1500 | ||
1501 | @item @emph{Reference}: | |
1502 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.21. | |
1503 | @end table | |
1504 | ||
1505 | ||
1506 | ||
506f068e TB |
1507 | @c @node Resource Relinquishing Routines |
1508 | @c @section Resource Relinquishing Routines | |
1509 | @c | |
1510 | @c Routines releasing resources used by the OpenMP runtime. | |
1511 | @c They have C linkage and do not throw exceptions. | |
1512 | @c | |
1513 | @c @menu | |
1514 | @c * omp_pause_resource:: <fixme> | |
1515 | @c * omp_pause_resource_all:: <fixme> | |
1516 | @c @end menu | |
1517 | ||
1518 | @node Device Information Routines | |
1519 | @section Device Information Routines | |
1520 | ||
1521 | Routines related to devices available to an OpenMP program. | |
1522 | They have C linkage and do not throw exceptions. | |
1523 | ||
1524 | @menu | |
1525 | * omp_get_num_procs:: Number of processors online | |
1526 | @c * omp_get_max_progress_width:: <fixme>/TR11 | |
1527 | * omp_set_default_device:: Set the default device for target regions | |
1528 | * omp_get_default_device:: Get the default device for target regions | |
1529 | * omp_get_num_devices:: Number of target devices | |
1530 | * omp_get_device_num:: Get device that current thread is running on | |
1531 | * omp_is_initial_device:: Whether executing on the host device | |
1532 | * omp_get_initial_device:: Device number of host device | |
1533 | @end menu | |
1534 | ||
1535 | ||
1536 | ||
1537 | @node omp_get_num_procs | |
1538 | @subsection @code{omp_get_num_procs} -- Number of processors online | |
d77de738 ML |
1539 | @table @asis |
1540 | @item @emph{Description}: | |
506f068e | 1541 | Returns the number of processors online on that device. |
d77de738 ML |
1542 | |
1543 | @item @emph{C/C++}: | |
1544 | @multitable @columnfractions .20 .80 | |
506f068e | 1545 | @item @emph{Prototype}: @tab @code{int omp_get_num_procs(void);} |
d77de738 ML |
1546 | @end multitable |
1547 | ||
1548 | @item @emph{Fortran}: | |
1549 | @multitable @columnfractions .20 .80 | |
506f068e | 1550 | @item @emph{Interface}: @tab @code{integer function omp_get_num_procs()} |
d77de738 ML |
1551 | @end multitable |
1552 | ||
1553 | @item @emph{Reference}: | |
506f068e | 1554 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.5. |
d77de738 ML |
1555 | @end table |
1556 | ||
1557 | ||
1558 | ||
1559 | @node omp_set_default_device | |
506f068e | 1560 | @subsection @code{omp_set_default_device} -- Set the default device for target regions |
d77de738 ML |
1561 | @table @asis |
1562 | @item @emph{Description}: | |
1563 | Set the default device for target regions without device clause. The argument | |
1564 | shall be a nonnegative device number. | |
1565 | ||
1566 | @item @emph{C/C++}: | |
1567 | @multitable @columnfractions .20 .80 | |
1568 | @item @emph{Prototype}: @tab @code{void omp_set_default_device(int device_num);} | |
1569 | @end multitable | |
1570 | ||
1571 | @item @emph{Fortran}: | |
1572 | @multitable @columnfractions .20 .80 | |
1573 | @item @emph{Interface}: @tab @code{subroutine omp_set_default_device(device_num)} | |
1574 | @item @tab @code{integer device_num} | |
1575 | @end multitable | |
1576 | ||
1577 | @item @emph{See also}: | |
1578 | @ref{OMP_DEFAULT_DEVICE}, @ref{omp_get_default_device} | |
1579 | ||
1580 | @item @emph{Reference}: | |
1581 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.29. | |
1582 | @end table | |
1583 | ||
1584 | ||
1585 | ||
506f068e TB |
1586 | @node omp_get_default_device |
1587 | @subsection @code{omp_get_default_device} -- Get the default device for target regions | |
d77de738 ML |
1588 | @table @asis |
1589 | @item @emph{Description}: | |
506f068e | 1590 | Get the default device for target regions without device clause. |
2cd0689a | 1591 | |
d77de738 ML |
1592 | @item @emph{C/C++}: |
1593 | @multitable @columnfractions .20 .80 | |
506f068e | 1594 | @item @emph{Prototype}: @tab @code{int omp_get_default_device(void);} |
d77de738 ML |
1595 | @end multitable |
1596 | ||
1597 | @item @emph{Fortran}: | |
1598 | @multitable @columnfractions .20 .80 | |
506f068e | 1599 | @item @emph{Interface}: @tab @code{integer function omp_get_default_device()} |
d77de738 ML |
1600 | @end multitable |
1601 | ||
1602 | @item @emph{See also}: | |
506f068e | 1603 | @ref{OMP_DEFAULT_DEVICE}, @ref{omp_set_default_device} |
d77de738 ML |
1604 | |
1605 | @item @emph{Reference}: | |
506f068e | 1606 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.30. |
d77de738 ML |
1607 | @end table |
1608 | ||
1609 | ||
1610 | ||
506f068e TB |
1611 | @node omp_get_num_devices |
1612 | @subsection @code{omp_get_num_devices} -- Number of target devices | |
d77de738 ML |
1613 | @table @asis |
1614 | @item @emph{Description}: | |
506f068e | 1615 | Returns the number of target devices. |
d77de738 ML |
1616 | |
1617 | @item @emph{C/C++}: | |
1618 | @multitable @columnfractions .20 .80 | |
506f068e | 1619 | @item @emph{Prototype}: @tab @code{int omp_get_num_devices(void);} |
d77de738 ML |
1620 | @end multitable |
1621 | ||
1622 | @item @emph{Fortran}: | |
1623 | @multitable @columnfractions .20 .80 | |
506f068e | 1624 | @item @emph{Interface}: @tab @code{integer function omp_get_num_devices()} |
d77de738 ML |
1625 | @end multitable |
1626 | ||
d77de738 | 1627 | @item @emph{Reference}: |
506f068e | 1628 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.31. |
d77de738 ML |
1629 | @end table |
1630 | ||
1631 | ||
1632 | ||
506f068e TB |
1633 | @node omp_get_device_num |
1634 | @subsection @code{omp_get_device_num} -- Return device number of current device | |
d77de738 ML |
1635 | @table @asis |
1636 | @item @emph{Description}: | |
506f068e TB |
1637 | This function returns a device number that represents the device that the |
1638 | current thread is executing on. For OpenMP 5.0, this must be equal to the | |
1639 | value returned by the @code{omp_get_initial_device} function when called | |
1640 | from the host. | |
d77de738 | 1641 | |
506f068e | 1642 | @item @emph{C/C++} |
d77de738 | 1643 | @multitable @columnfractions .20 .80 |
506f068e | 1644 | @item @emph{Prototype}: @tab @code{int omp_get_device_num(void);} |
d77de738 ML |
1645 | @end multitable |
1646 | ||
1647 | @item @emph{Fortran}: | |
506f068e TB |
1648 | @multitable @columnfractions .20 .80 |
1649 | @item @emph{Interface}: @tab @code{integer function omp_get_device_num()} | |
d77de738 ML |
1650 | @end multitable |
1651 | ||
1652 | @item @emph{See also}: | |
506f068e | 1653 | @ref{omp_get_initial_device} |
d77de738 ML |
1654 | |
1655 | @item @emph{Reference}: | |
506f068e | 1656 | @uref{https://www.openmp.org, OpenMP specification v5.0}, Section 3.2.37. |
d77de738 ML |
1657 | @end table |
1658 | ||
1659 | ||
1660 | ||
506f068e TB |
1661 | @node omp_is_initial_device |
1662 | @subsection @code{omp_is_initial_device} -- Whether executing on the host device | |
d77de738 ML |
1663 | @table @asis |
1664 | @item @emph{Description}: | |
506f068e TB |
1665 | This function returns @code{true} if currently running on the host device, |
1666 | @code{false} otherwise. Here, @code{true} and @code{false} represent | |
1667 | their language-specific counterparts. | |
d77de738 | 1668 | |
506f068e | 1669 | @item @emph{C/C++}: |
d77de738 | 1670 | @multitable @columnfractions .20 .80 |
506f068e | 1671 | @item @emph{Prototype}: @tab @code{int omp_is_initial_device(void);} |
d77de738 ML |
1672 | @end multitable |
1673 | ||
1674 | @item @emph{Fortran}: | |
1675 | @multitable @columnfractions .20 .80 | |
506f068e | 1676 | @item @emph{Interface}: @tab @code{logical function omp_is_initial_device()} |
d77de738 ML |
1677 | @end multitable |
1678 | ||
d77de738 | 1679 | @item @emph{Reference}: |
506f068e | 1680 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.34. |
d77de738 ML |
1681 | @end table |
1682 | ||
1683 | ||
1684 | ||
506f068e TB |
1685 | @node omp_get_initial_device |
1686 | @subsection @code{omp_get_initial_device} -- Return device number of initial device | |
d77de738 ML |
1687 | @table @asis |
1688 | @item @emph{Description}: | |
506f068e TB |
1689 | This function returns a device number that represents the host device. |
1690 | For OpenMP 5.1, this must be equal to the value returned by the | |
1691 | @code{omp_get_num_devices} function. | |
d77de738 | 1692 | |
506f068e | 1693 | @item @emph{C/C++} |
d77de738 | 1694 | @multitable @columnfractions .20 .80 |
506f068e | 1695 | @item @emph{Prototype}: @tab @code{int omp_get_initial_device(void);} |
d77de738 ML |
1696 | @end multitable |
1697 | ||
1698 | @item @emph{Fortran}: | |
1699 | @multitable @columnfractions .20 .80 | |
506f068e | 1700 | @item @emph{Interface}: @tab @code{integer function omp_get_initial_device()} |
d77de738 ML |
1701 | @end multitable |
1702 | ||
1703 | @item @emph{See also}: | |
506f068e | 1704 | @ref{omp_get_num_devices} |
d77de738 ML |
1705 | |
1706 | @item @emph{Reference}: | |
506f068e | 1707 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.35. |
d77de738 ML |
1708 | @end table |
1709 | ||
1710 | ||
1711 | ||
e0786ba6 TB |
1712 | @node Device Memory Routines |
1713 | @section Device Memory Routines | |
1714 | ||
1715 | Routines related to memory allocation and managing corresponding | |
1716 | pointers on devices. They have C linkage and do not throw exceptions. | |
1717 | ||
1718 | @menu | |
1719 | * omp_target_alloc:: Allocate device memory | |
1720 | * omp_target_free:: Free device memory | |
1721 | * omp_target_is_present:: Check whether storage is mapped | |
fefbd85b | 1722 | * omp_target_is_accessible:: Check whether memory is device accessible |
506f068e TB |
1723 | @c * omp_target_memcpy:: <fixme> |
1724 | @c * omp_target_memcpy_rect:: <fixme> | |
1725 | @c * omp_target_memcpy_async:: <fixme> | |
1726 | @c * omp_target_memcpy_rect_async:: <fixme> | |
e0786ba6 TB |
1727 | @c * omp_target_memset:: <fixme>/TR12 |
1728 | @c * omp_target_memset_async:: <fixme>/TR12 | |
1729 | * omp_target_associate_ptr:: Associate a device pointer with a host pointer | |
1730 | * omp_target_disassociate_ptr:: Remove device--host pointer association | |
1731 | * omp_get_mapped_ptr:: Return device pointer to a host pointer | |
1732 | @end menu | |
1733 | ||
1734 | ||
1735 | ||
1736 | @node omp_target_alloc | |
1737 | @subsection @code{omp_target_alloc} -- Allocate device memory | |
1738 | @table @asis | |
1739 | @item @emph{Description}: | |
1740 | This routine allocates @var{size} bytes of memory in the device environment | |
1741 | associated with the device number @var{device_num}. If successful, a device | |
1742 | pointer is returned, otherwise a null pointer. | |
1743 | ||
1744 | In GCC, when the device is the host or the device shares memory with the host, | |
1745 | the memory is allocated on the host; in that case, when @var{size} is zero, | |
1746 | either NULL or a unique pointer value that can later be successfully passed to | |
1747 | @code{omp_target_free} is returned. When the allocation is not performed on | |
1748 | the host, a null pointer is returned when @var{size} is zero; in that case, | |
1749 | additionally a diagnostic might be printed to standard error (stderr). | |
1750 | ||
1751 | Running this routine in a @code{target} region except on the initial device | |
1752 | is not supported. | |
1753 | ||
1754 | @item @emph{C/C++} | |
1755 | @multitable @columnfractions .20 .80 | |
1756 | @item @emph{Prototype}: @tab @code{void *omp_target_alloc(size_t size, int device_num)} | |
1757 | @end multitable | |
1758 | ||
1759 | @item @emph{Fortran}: | |
1760 | @multitable @columnfractions .20 .80 | |
1761 | @item @emph{Interface}: @tab @code{type(c_ptr) function omp_target_alloc(size, device_num) bind(C)} | |
1762 | @item @tab @code{use, intrinsic :: iso_c_binding, only: c_ptr, c_int, c_size_t} | |
1763 | @item @tab @code{integer(c_size_t), value :: size} | |
1764 | @item @tab @code{integer(c_int), value :: device_num} | |
1765 | @end multitable | |
1766 | ||
1767 | @item @emph{See also}: | |
1768 | @ref{omp_target_free}, @ref{omp_target_associate_ptr} | |
1769 | ||
1770 | @item @emph{Reference}: | |
fefbd85b | 1771 | @uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.8.1 |
e0786ba6 TB |
1772 | @end table |
1773 | ||
1774 | ||
1775 | ||
1776 | @node omp_target_free | |
1777 | @subsection @code{omp_target_free} -- Free device memory | |
1778 | @table @asis | |
1779 | @item @emph{Description}: | |
1780 | This routine frees memory allocated by the @code{omp_target_alloc} routine. | |
1781 | The @var{device_ptr} argument must be either a null pointer or a device pointer | |
1782 | returned by @code{omp_target_alloc} for the specified @code{device_num}. The | |
1783 | device number @var{device_num} must be a conforming device number. | |
1784 | ||
1785 | Running this routine in a @code{target} region except on the initial device | |
1786 | is not supported. | |
1787 | ||
1788 | @item @emph{C/C++} | |
1789 | @multitable @columnfractions .20 .80 | |
1790 | @item @emph{Prototype}: @tab @code{void omp_target_free(void *device_ptr, int device_num)} | |
1791 | @end multitable | |
1792 | ||
1793 | @item @emph{Fortran}: | |
1794 | @multitable @columnfractions .20 .80 | |
1795 | @item @emph{Interface}: @tab @code{subroutine omp_target_free(device_ptr, device_num) bind(C)} | |
1796 | @item @tab @code{use, intrinsic :: iso_c_binding, only: c_ptr, c_int} | |
1797 | @item @tab @code{type(c_ptr), value :: device_ptr} | |
1798 | @item @tab @code{integer(c_int), value :: device_num} | |
1799 | @end multitable | |
1800 | ||
1801 | @item @emph{See also}: | |
1802 | @ref{omp_target_alloc}, @ref{omp_target_disassociate_ptr} | |
1803 | ||
1804 | @item @emph{Reference}: | |
fefbd85b | 1805 | @uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.8.2 |
e0786ba6 TB |
1806 | @end table |
1807 | ||
1808 | ||
1809 | ||
1810 | @node omp_target_is_present | |
1811 | @subsection @code{omp_target_is_present} -- Check whether storage is mapped | |
1812 | @table @asis | |
1813 | @item @emph{Description}: | |
1814 | This routine tests whether storage, identified by the host pointer @var{ptr} | |
1815 | is mapped to the device specified by @var{device_num}. If so, it returns | |
fefbd85b | 1816 | a nonzero value and otherwise zero. |
e0786ba6 TB |
1817 | |
1818 | In GCC, this includes self mapping such that @code{omp_target_is_present} | |
1819 | returns @emph{true} when @var{device_num} specifies the host or when the host | |
1820 | and the device share memory. If @var{ptr} is a null pointer, @var{true} is | |
1821 | returned and if @var{device_num} is an invalid device number, @var{false} is | |
1822 | returned. | |
1823 | ||
1824 | If those conditions do not apply, @emph{true} is returned if the association has | |
1825 | been established by an explicit or implicit @code{map} clause, the | |
1826 | @code{declare target} directive or a call to the @code{omp_target_associate_ptr} | |
1827 | routine. | |
1828 | ||
1829 | Running this routine in a @code{target} region except on the initial device | |
1830 | is not supported. | |
1831 | ||
1832 | @item @emph{C/C++} | |
1833 | @multitable @columnfractions .20 .80 | |
1834 | @item @emph{Prototype}: @tab @code{int omp_target_is_present(const void *ptr,} | |
1835 | @item @tab @code{ int device_num)} | |
1836 | @end multitable | |
1837 | ||
1838 | @item @emph{Fortran}: | |
1839 | @multitable @columnfractions .20 .80 | |
1840 | @item @emph{Interface}: @tab @code{integer(c_int) function omp_target_is_present(ptr, &} | |
1841 | @item @tab @code{ device_num) bind(C)} | |
1842 | @item @tab @code{use, intrinsic :: iso_c_binding, only: c_ptr, c_int} | |
1843 | @item @tab @code{type(c_ptr), value :: ptr} | |
1844 | @item @tab @code{integer(c_int), value :: device_num} | |
1845 | @end multitable | |
1846 | ||
1847 | @item @emph{See also}: | |
1848 | @ref{omp_target_associate_ptr} | |
1849 | ||
1850 | @item @emph{Reference}: | |
fefbd85b TB |
1851 | @uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.8.3 |
1852 | @end table | |
1853 | ||
1854 | ||
1855 | ||
1856 | @node omp_target_is_accessible | |
1857 | @subsection @code{omp_target_is_accessible} -- Check whether memory is device accessible | |
1858 | @table @asis | |
1859 | @item @emph{Description}: | |
1860 | This routine tests whether memory, starting at the address given by @var{ptr} | |
1861 | and extending @var{size} bytes, is accessibly on the device specified by | |
1862 | @var{device_num}. If so, it returns a nonzero value and otherwise zero. | |
1863 | ||
1864 | The address given by @var{ptr} is interpreted to be in the address space of | |
1865 | the device and @var{size} must be positive. | |
1866 | ||
1867 | Note that GCC's current implementation assumes that @var{ptr} is a valid host | |
1868 | pointer. Therefore, all addresses given by @var{ptr} are assumed to be | |
1869 | accessible on the initial device. And, to err on the safe side, this memory | |
1870 | is only available on a non-host device that can access all host memory | |
1871 | ([uniform] shared memory access). | |
1872 | ||
1873 | Running this routine in a @code{target} region except on the initial device | |
1874 | is not supported. | |
1875 | ||
1876 | @item @emph{C/C++} | |
1877 | @multitable @columnfractions .20 .80 | |
1878 | @item @emph{Prototype}: @tab @code{int omp_target_is_accessible(const void *ptr,} | |
1879 | @item @tab @code{ size_t size,} | |
1880 | @item @tab @code{ int device_num)} | |
1881 | @end multitable | |
1882 | ||
1883 | @item @emph{Fortran}: | |
1884 | @multitable @columnfractions .20 .80 | |
1885 | @item @emph{Interface}: @tab @code{integer(c_int) function omp_target_is_accessible(ptr, &} | |
1886 | @item @tab @code{ size, device_num) bind(C)} | |
1887 | @item @tab @code{use, intrinsic :: iso_c_binding, only: c_ptr, c_size_t, c_int} | |
1888 | @item @tab @code{type(c_ptr), value :: ptr} | |
1889 | @item @tab @code{integer(c_size_t), value :: size} | |
1890 | @item @tab @code{integer(c_int), value :: device_num} | |
1891 | @end multitable | |
1892 | ||
1893 | @item @emph{See also}: | |
1894 | @ref{omp_target_associate_ptr} | |
1895 | ||
1896 | @item @emph{Reference}: | |
1897 | @uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.8.4 | |
e0786ba6 TB |
1898 | @end table |
1899 | ||
1900 | ||
1901 | ||
1902 | @node omp_target_associate_ptr | |
1903 | @subsection @code{omp_target_associate_ptr} -- Associate a device pointer with a host pointer | |
1904 | @table @asis | |
1905 | @item @emph{Description}: | |
1906 | This routine associates storage on the host with storage on a device identified | |
1907 | by @var{device_num}. The device pointer is usually obtained by calling | |
1908 | @code{omp_target_alloc} or by other means (but not by using the @code{map} | |
1909 | clauses or the @code{declare target} directive). The host pointer should point | |
1910 | to memory that has a storage size of at least @var{size}. | |
1911 | ||
1912 | The @var{device_offset} parameter specifies the offset into @var{device_ptr} | |
1913 | that is used as the base address for the device side of the mapping; the | |
1914 | storage size should be at least @var{device_offset} plus @var{size}. | |
1915 | ||
1916 | After the association, the host pointer can be used in a @code{map} clause and | |
1917 | in the @code{to} and @code{from} clauses of the @code{target update} directive | |
1918 | to transfer data between the associated pointers. The reference count of such | |
1919 | associated storage is infinite. The association can be removed by calling | |
1920 | @code{omp_target_disassociate_ptr} which should be done before the lifetime | |
1921 | of either either storage ends. | |
1922 | ||
1923 | The routine returns nonzero (@code{EINVAL}) when the @var{device_num} invalid, | |
1924 | for when the initial device or the associated device shares memory with the | |
1925 | host. @code{omp_target_associate_ptr} returns zero if @var{host_ptr} points | |
1926 | into already associated storage that is fully inside of a previously associated | |
1927 | memory. Otherwise, if the association was successful zero is returned; if none | |
1928 | of the cases above apply, nonzero (@code{EINVAL}) is returned. | |
1929 | ||
1930 | The @code{omp_target_is_present} routine can be used to test whether | |
1931 | associated storage for a device pointer exists. | |
1932 | ||
1933 | Running this routine in a @code{target} region except on the initial device | |
1934 | is not supported. | |
1935 | ||
1936 | @item @emph{C/C++} | |
1937 | @multitable @columnfractions .20 .80 | |
1938 | @item @emph{Prototype}: @tab @code{int omp_target_associate_ptr(const void *host_ptr,} | |
1939 | @item @tab @code{ const void *device_ptr,} | |
1940 | @item @tab @code{ size_t size,} | |
1941 | @item @tab @code{ size_t device_offset,} | |
1942 | @item @tab @code{ int device_num)} | |
1943 | @end multitable | |
1944 | ||
1945 | @item @emph{Fortran}: | |
1946 | @multitable @columnfractions .20 .80 | |
1947 | @item @emph{Interface}: @tab @code{integer(c_int) function omp_target_associate_ptr(host_ptr, &} | |
1948 | @item @tab @code{ device_ptr, size, device_offset, device_num) bind(C)} | |
1949 | @item @tab @code{use, intrinsic :: iso_c_binding, only: c_ptr, c_int, c_size_t} | |
1950 | @item @tab @code{type(c_ptr), value :: host_ptr, device_ptr} | |
1951 | @item @tab @code{integer(c_size_t), value :: size, device_offset} | |
1952 | @item @tab @code{integer(c_int), value :: device_num} | |
1953 | @end multitable | |
1954 | ||
1955 | @item @emph{See also}: | |
1956 | @ref{omp_target_disassociate_ptr}, @ref{omp_target_is_present}, | |
1957 | @ref{omp_target_alloc} | |
1958 | ||
1959 | @item @emph{Reference}: | |
fefbd85b | 1960 | @uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.8.9 |
e0786ba6 TB |
1961 | @end table |
1962 | ||
1963 | ||
1964 | ||
1965 | @node omp_target_disassociate_ptr | |
1966 | @subsection @code{omp_target_disassociate_ptr} -- Remove device--host pointer association | |
1967 | @table @asis | |
1968 | @item @emph{Description}: | |
1969 | This routine removes the storage association established by calling | |
1970 | @code{omp_target_associate_ptr} and sets the reference count to zero, | |
1971 | even if @code{omp_target_associate_ptr} was invoked multiple times for | |
1972 | for host pointer @code{ptr}. If applicable, the device memory needs | |
1973 | to be freed by the user. | |
1974 | ||
1975 | If an associated device storage location for the @var{device_num} was | |
1976 | found and has infinite reference count, the association is removed and | |
1977 | zero is returned. In all other cases, nonzero (@code{EINVAL}) is returned | |
1978 | and no other action is taken. | |
1979 | ||
1980 | Note that passing a host pointer where the association to the device pointer | |
1981 | was established with the @code{declare target} directive yields undefined | |
1982 | behavior. | |
1983 | ||
1984 | Running this routine in a @code{target} region except on the initial device | |
1985 | is not supported. | |
1986 | ||
1987 | @item @emph{C/C++} | |
1988 | @multitable @columnfractions .20 .80 | |
1989 | @item @emph{Prototype}: @tab @code{int omp_target_disassociate_ptr(const void *ptr,} | |
1990 | @item @tab @code{ int device_num)} | |
1991 | @end multitable | |
1992 | ||
1993 | @item @emph{Fortran}: | |
1994 | @multitable @columnfractions .20 .80 | |
1995 | @item @emph{Interface}: @tab @code{integer(c_int) function omp_target_disassociate_ptr(ptr, &} | |
1996 | @item @tab @code{ device_num) bind(C)} | |
1997 | @item @tab @code{use, intrinsic :: iso_c_binding, only: c_ptr, c_int} | |
1998 | @item @tab @code{type(c_ptr), value :: ptr} | |
1999 | @item @tab @code{integer(c_int), value :: device_num} | |
2000 | @end multitable | |
2001 | ||
2002 | @item @emph{See also}: | |
2003 | @ref{omp_target_associate_ptr} | |
2004 | ||
2005 | @item @emph{Reference}: | |
fefbd85b | 2006 | @uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.8.10 |
e0786ba6 TB |
2007 | @end table |
2008 | ||
2009 | ||
2010 | ||
2011 | @node omp_get_mapped_ptr | |
2012 | @subsection @code{omp_get_mapped_ptr} -- Return device pointer to a host pointer | |
2013 | @table @asis | |
2014 | @item @emph{Description}: | |
2015 | If the device number is refers to the initial device or to a device with | |
2016 | memory accessible from the host (shared memory), the @code{omp_get_mapped_ptr} | |
bc238c40 | 2017 | routines returns the value of the passed @var{ptr}. Otherwise, if associated |
e0786ba6 TB |
2018 | storage to the passed host pointer @var{ptr} exists on device associated with |
2019 | @var{device_num}, it returns that pointer. In all other cases and in cases of | |
2020 | an error, a null pointer is returned. | |
2021 | ||
2022 | The association of storage location is established either via an explicit or | |
2023 | implicit @code{map} clause, the @code{declare target} directive or the | |
2024 | @code{omp_target_associate_ptr} routine. | |
2025 | ||
2026 | Running this routine in a @code{target} region except on the initial device | |
2027 | is not supported. | |
2028 | ||
2029 | @item @emph{C/C++} | |
2030 | @multitable @columnfractions .20 .80 | |
2031 | @item @emph{Prototype}: @tab @code{void *omp_get_mapped_ptr(const void *ptr, int device_num);} | |
2032 | @end multitable | |
2033 | ||
2034 | @item @emph{Fortran}: | |
2035 | @multitable @columnfractions .20 .80 | |
2036 | @item @emph{Interface}: @tab @code{type(c_ptr) function omp_get_mapped_ptr(ptr, device_num) bind(C)} | |
2037 | @item @tab @code{use, intrinsic :: iso_c_binding, only: c_ptr, c_int} | |
2038 | @item @tab @code{type(c_ptr), value :: ptr} | |
2039 | @item @tab @code{integer(c_int), value :: device_num} | |
2040 | @end multitable | |
2041 | ||
2042 | @item @emph{See also}: | |
2043 | @ref{omp_target_associate_ptr} | |
2044 | ||
2045 | @item @emph{Reference}: | |
fefbd85b | 2046 | @uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.8.11 |
e0786ba6 TB |
2047 | @end table |
2048 | ||
2049 | ||
506f068e TB |
2050 | |
2051 | @node Lock Routines | |
2052 | @section Lock Routines | |
2053 | ||
2054 | Initialize, set, test, unset and destroy simple and nested locks. | |
2055 | The routines have C linkage and do not throw exceptions. | |
2056 | ||
2057 | @menu | |
2058 | * omp_init_lock:: Initialize simple lock | |
2059 | * omp_init_nest_lock:: Initialize nested lock | |
2060 | @c * omp_init_lock_with_hint:: <fixme> | |
2061 | @c * omp_init_nest_lock_with_hint:: <fixme> | |
2062 | * omp_destroy_lock:: Destroy simple lock | |
2063 | * omp_destroy_nest_lock:: Destroy nested lock | |
2064 | * omp_set_lock:: Wait for and set simple lock | |
2065 | * omp_set_nest_lock:: Wait for and set simple lock | |
2066 | * omp_unset_lock:: Unset simple lock | |
2067 | * omp_unset_nest_lock:: Unset nested lock | |
2068 | * omp_test_lock:: Test and set simple lock if available | |
2069 | * omp_test_nest_lock:: Test and set nested lock if available | |
2070 | @end menu | |
2071 | ||
2072 | ||
2073 | ||
d77de738 | 2074 | @node omp_init_lock |
506f068e | 2075 | @subsection @code{omp_init_lock} -- Initialize simple lock |
d77de738 ML |
2076 | @table @asis |
2077 | @item @emph{Description}: | |
2078 | Initialize a simple lock. After initialization, the lock is in | |
2079 | an unlocked state. | |
2080 | ||
2081 | @item @emph{C/C++}: | |
2082 | @multitable @columnfractions .20 .80 | |
2083 | @item @emph{Prototype}: @tab @code{void omp_init_lock(omp_lock_t *lock);} | |
2084 | @end multitable | |
2085 | ||
2086 | @item @emph{Fortran}: | |
2087 | @multitable @columnfractions .20 .80 | |
2088 | @item @emph{Interface}: @tab @code{subroutine omp_init_lock(svar)} | |
2089 | @item @tab @code{integer(omp_lock_kind), intent(out) :: svar} | |
2090 | @end multitable | |
2091 | ||
2092 | @item @emph{See also}: | |
2093 | @ref{omp_destroy_lock} | |
2094 | ||
2095 | @item @emph{Reference}: | |
2096 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.1. | |
2097 | @end table | |
2098 | ||
2099 | ||
2100 | ||
506f068e TB |
2101 | @node omp_init_nest_lock |
2102 | @subsection @code{omp_init_nest_lock} -- Initialize nested lock | |
d77de738 ML |
2103 | @table @asis |
2104 | @item @emph{Description}: | |
506f068e TB |
2105 | Initialize a nested lock. After initialization, the lock is in |
2106 | an unlocked state and the nesting count is set to zero. | |
d77de738 ML |
2107 | |
2108 | @item @emph{C/C++}: | |
2109 | @multitable @columnfractions .20 .80 | |
506f068e | 2110 | @item @emph{Prototype}: @tab @code{void omp_init_nest_lock(omp_nest_lock_t *lock);} |
d77de738 ML |
2111 | @end multitable |
2112 | ||
2113 | @item @emph{Fortran}: | |
2114 | @multitable @columnfractions .20 .80 | |
506f068e TB |
2115 | @item @emph{Interface}: @tab @code{subroutine omp_init_nest_lock(nvar)} |
2116 | @item @tab @code{integer(omp_nest_lock_kind), intent(out) :: nvar} | |
d77de738 ML |
2117 | @end multitable |
2118 | ||
2119 | @item @emph{See also}: | |
506f068e | 2120 | @ref{omp_destroy_nest_lock} |
d77de738 | 2121 | |
506f068e TB |
2122 | @item @emph{Reference}: |
2123 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.1. | |
d77de738 ML |
2124 | @end table |
2125 | ||
2126 | ||
2127 | ||
506f068e TB |
2128 | @node omp_destroy_lock |
2129 | @subsection @code{omp_destroy_lock} -- Destroy simple lock | |
d77de738 ML |
2130 | @table @asis |
2131 | @item @emph{Description}: | |
506f068e TB |
2132 | Destroy a simple lock. In order to be destroyed, a simple lock must be |
2133 | in the unlocked state. | |
d77de738 ML |
2134 | |
2135 | @item @emph{C/C++}: | |
2136 | @multitable @columnfractions .20 .80 | |
506f068e | 2137 | @item @emph{Prototype}: @tab @code{void omp_destroy_lock(omp_lock_t *lock);} |
d77de738 ML |
2138 | @end multitable |
2139 | ||
2140 | @item @emph{Fortran}: | |
2141 | @multitable @columnfractions .20 .80 | |
506f068e | 2142 | @item @emph{Interface}: @tab @code{subroutine omp_destroy_lock(svar)} |
d77de738 ML |
2143 | @item @tab @code{integer(omp_lock_kind), intent(inout) :: svar} |
2144 | @end multitable | |
2145 | ||
2146 | @item @emph{See also}: | |
506f068e | 2147 | @ref{omp_init_lock} |
d77de738 ML |
2148 | |
2149 | @item @emph{Reference}: | |
506f068e | 2150 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.3. |
d77de738 ML |
2151 | @end table |
2152 | ||
2153 | ||
2154 | ||
506f068e TB |
2155 | @node omp_destroy_nest_lock |
2156 | @subsection @code{omp_destroy_nest_lock} -- Destroy nested lock | |
d77de738 ML |
2157 | @table @asis |
2158 | @item @emph{Description}: | |
506f068e TB |
2159 | Destroy a nested lock. In order to be destroyed, a nested lock must be |
2160 | in the unlocked state and its nesting count must equal zero. | |
d77de738 ML |
2161 | |
2162 | @item @emph{C/C++}: | |
2163 | @multitable @columnfractions .20 .80 | |
506f068e | 2164 | @item @emph{Prototype}: @tab @code{void omp_destroy_nest_lock(omp_nest_lock_t *);} |
d77de738 ML |
2165 | @end multitable |
2166 | ||
2167 | @item @emph{Fortran}: | |
2168 | @multitable @columnfractions .20 .80 | |
506f068e TB |
2169 | @item @emph{Interface}: @tab @code{subroutine omp_destroy_nest_lock(nvar)} |
2170 | @item @tab @code{integer(omp_nest_lock_kind), intent(inout) :: nvar} | |
d77de738 ML |
2171 | @end multitable |
2172 | ||
2173 | @item @emph{See also}: | |
506f068e | 2174 | @ref{omp_init_lock} |
d77de738 ML |
2175 | |
2176 | @item @emph{Reference}: | |
506f068e | 2177 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.3. |
d77de738 ML |
2178 | @end table |
2179 | ||
2180 | ||
2181 | ||
506f068e TB |
2182 | @node omp_set_lock |
2183 | @subsection @code{omp_set_lock} -- Wait for and set simple lock | |
d77de738 ML |
2184 | @table @asis |
2185 | @item @emph{Description}: | |
506f068e TB |
2186 | Before setting a simple lock, the lock variable must be initialized by |
2187 | @code{omp_init_lock}. The calling thread is blocked until the lock | |
2188 | is available. If the lock is already held by the current thread, | |
2189 | a deadlock occurs. | |
d77de738 ML |
2190 | |
2191 | @item @emph{C/C++}: | |
2192 | @multitable @columnfractions .20 .80 | |
506f068e | 2193 | @item @emph{Prototype}: @tab @code{void omp_set_lock(omp_lock_t *lock);} |
d77de738 ML |
2194 | @end multitable |
2195 | ||
2196 | @item @emph{Fortran}: | |
2197 | @multitable @columnfractions .20 .80 | |
506f068e | 2198 | @item @emph{Interface}: @tab @code{subroutine omp_set_lock(svar)} |
d77de738 ML |
2199 | @item @tab @code{integer(omp_lock_kind), intent(inout) :: svar} |
2200 | @end multitable | |
2201 | ||
2202 | @item @emph{See also}: | |
506f068e | 2203 | @ref{omp_init_lock}, @ref{omp_test_lock}, @ref{omp_unset_lock} |
d77de738 ML |
2204 | |
2205 | @item @emph{Reference}: | |
506f068e | 2206 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.4. |
d77de738 ML |
2207 | @end table |
2208 | ||
2209 | ||
2210 | ||
d77de738 | 2211 | @node omp_set_nest_lock |
506f068e | 2212 | @subsection @code{omp_set_nest_lock} -- Wait for and set nested lock |
d77de738 ML |
2213 | @table @asis |
2214 | @item @emph{Description}: | |
2215 | Before setting a nested lock, the lock variable must be initialized by | |
2216 | @code{omp_init_nest_lock}. The calling thread is blocked until the lock | |
2217 | is available. If the lock is already held by the current thread, the | |
2218 | nesting count for the lock is incremented. | |
2219 | ||
2220 | @item @emph{C/C++}: | |
2221 | @multitable @columnfractions .20 .80 | |
2222 | @item @emph{Prototype}: @tab @code{void omp_set_nest_lock(omp_nest_lock_t *lock);} | |
2223 | @end multitable | |
2224 | ||
2225 | @item @emph{Fortran}: | |
2226 | @multitable @columnfractions .20 .80 | |
2227 | @item @emph{Interface}: @tab @code{subroutine omp_set_nest_lock(nvar)} | |
2228 | @item @tab @code{integer(omp_nest_lock_kind), intent(inout) :: nvar} | |
2229 | @end multitable | |
2230 | ||
2231 | @item @emph{See also}: | |
2232 | @ref{omp_init_nest_lock}, @ref{omp_unset_nest_lock} | |
2233 | ||
2234 | @item @emph{Reference}: | |
2235 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.4. | |
2236 | @end table | |
2237 | ||
2238 | ||
2239 | ||
506f068e TB |
2240 | @node omp_unset_lock |
2241 | @subsection @code{omp_unset_lock} -- Unset simple lock | |
d77de738 ML |
2242 | @table @asis |
2243 | @item @emph{Description}: | |
506f068e TB |
2244 | A simple lock about to be unset must have been locked by @code{omp_set_lock} |
2245 | or @code{omp_test_lock} before. In addition, the lock must be held by the | |
2246 | thread calling @code{omp_unset_lock}. Then, the lock becomes unlocked. If one | |
2247 | or more threads attempted to set the lock before, one of them is chosen to, | |
2248 | again, set the lock to itself. | |
d77de738 ML |
2249 | |
2250 | @item @emph{C/C++}: | |
2251 | @multitable @columnfractions .20 .80 | |
506f068e | 2252 | @item @emph{Prototype}: @tab @code{void omp_unset_lock(omp_lock_t *lock);} |
d77de738 ML |
2253 | @end multitable |
2254 | ||
2255 | @item @emph{Fortran}: | |
2256 | @multitable @columnfractions .20 .80 | |
506f068e TB |
2257 | @item @emph{Interface}: @tab @code{subroutine omp_unset_lock(svar)} |
2258 | @item @tab @code{integer(omp_lock_kind), intent(inout) :: svar} | |
d77de738 ML |
2259 | @end multitable |
2260 | ||
d77de738 | 2261 | @item @emph{See also}: |
506f068e | 2262 | @ref{omp_set_lock}, @ref{omp_test_lock} |
d77de738 ML |
2263 | |
2264 | @item @emph{Reference}: | |
506f068e | 2265 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.5. |
d77de738 ML |
2266 | @end table |
2267 | ||
2268 | ||
2269 | ||
2270 | @node omp_unset_nest_lock | |
506f068e | 2271 | @subsection @code{omp_unset_nest_lock} -- Unset nested lock |
d77de738 ML |
2272 | @table @asis |
2273 | @item @emph{Description}: | |
2274 | A nested lock about to be unset must have been locked by @code{omp_set_nested_lock} | |
2275 | or @code{omp_test_nested_lock} before. In addition, the lock must be held by the | |
2276 | thread calling @code{omp_unset_nested_lock}. If the nesting count drops to zero, the | |
2277 | lock becomes unlocked. If one ore more threads attempted to set the lock before, | |
2278 | one of them is chosen to, again, set the lock to itself. | |
2279 | ||
2280 | @item @emph{C/C++}: | |
2281 | @multitable @columnfractions .20 .80 | |
2282 | @item @emph{Prototype}: @tab @code{void omp_unset_nest_lock(omp_nest_lock_t *lock);} | |
2283 | @end multitable | |
2284 | ||
2285 | @item @emph{Fortran}: | |
2286 | @multitable @columnfractions .20 .80 | |
2287 | @item @emph{Interface}: @tab @code{subroutine omp_unset_nest_lock(nvar)} | |
2288 | @item @tab @code{integer(omp_nest_lock_kind), intent(inout) :: nvar} | |
2289 | @end multitable | |
2290 | ||
2291 | @item @emph{See also}: | |
2292 | @ref{omp_set_nest_lock} | |
2293 | ||
2294 | @item @emph{Reference}: | |
2295 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.5. | |
2296 | @end table | |
2297 | ||
2298 | ||
2299 | ||
506f068e TB |
2300 | @node omp_test_lock |
2301 | @subsection @code{omp_test_lock} -- Test and set simple lock if available | |
d77de738 ML |
2302 | @table @asis |
2303 | @item @emph{Description}: | |
506f068e TB |
2304 | Before setting a simple lock, the lock variable must be initialized by |
2305 | @code{omp_init_lock}. Contrary to @code{omp_set_lock}, @code{omp_test_lock} | |
2306 | does not block if the lock is not available. This function returns | |
2307 | @code{true} upon success, @code{false} otherwise. Here, @code{true} and | |
2308 | @code{false} represent their language-specific counterparts. | |
d77de738 ML |
2309 | |
2310 | @item @emph{C/C++}: | |
2311 | @multitable @columnfractions .20 .80 | |
506f068e | 2312 | @item @emph{Prototype}: @tab @code{int omp_test_lock(omp_lock_t *lock);} |
d77de738 ML |
2313 | @end multitable |
2314 | ||
2315 | @item @emph{Fortran}: | |
2316 | @multitable @columnfractions .20 .80 | |
506f068e TB |
2317 | @item @emph{Interface}: @tab @code{logical function omp_test_lock(svar)} |
2318 | @item @tab @code{integer(omp_lock_kind), intent(inout) :: svar} | |
2319 | @end multitable | |
2320 | ||
2321 | @item @emph{See also}: | |
2322 | @ref{omp_init_lock}, @ref{omp_set_lock}, @ref{omp_set_lock} | |
2323 | ||
2324 | @item @emph{Reference}: | |
2325 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.6. | |
2326 | @end table | |
2327 | ||
2328 | ||
2329 | ||
2330 | @node omp_test_nest_lock | |
2331 | @subsection @code{omp_test_nest_lock} -- Test and set nested lock if available | |
2332 | @table @asis | |
2333 | @item @emph{Description}: | |
2334 | Before setting a nested lock, the lock variable must be initialized by | |
2335 | @code{omp_init_nest_lock}. Contrary to @code{omp_set_nest_lock}, | |
2336 | @code{omp_test_nest_lock} does not block if the lock is not available. | |
2337 | If the lock is already held by the current thread, the new nesting count | |
2338 | is returned. Otherwise, the return value equals zero. | |
2339 | ||
2340 | @item @emph{C/C++}: | |
2341 | @multitable @columnfractions .20 .80 | |
2342 | @item @emph{Prototype}: @tab @code{int omp_test_nest_lock(omp_nest_lock_t *lock);} | |
2343 | @end multitable | |
2344 | ||
2345 | @item @emph{Fortran}: | |
2346 | @multitable @columnfractions .20 .80 | |
2347 | @item @emph{Interface}: @tab @code{logical function omp_test_nest_lock(nvar)} | |
d77de738 ML |
2348 | @item @tab @code{integer(omp_nest_lock_kind), intent(inout) :: nvar} |
2349 | @end multitable | |
2350 | ||
506f068e | 2351 | |
d77de738 | 2352 | @item @emph{See also}: |
506f068e | 2353 | @ref{omp_init_lock}, @ref{omp_set_lock}, @ref{omp_set_lock} |
d77de738 ML |
2354 | |
2355 | @item @emph{Reference}: | |
506f068e | 2356 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.6. |
d77de738 ML |
2357 | @end table |
2358 | ||
2359 | ||
2360 | ||
506f068e TB |
2361 | @node Timing Routines |
2362 | @section Timing Routines | |
2363 | ||
2364 | Portable, thread-based, wall clock timer. | |
2365 | The routines have C linkage and do not throw exceptions. | |
2366 | ||
2367 | @menu | |
2368 | * omp_get_wtick:: Get timer precision. | |
2369 | * omp_get_wtime:: Elapsed wall clock time. | |
2370 | @end menu | |
2371 | ||
2372 | ||
2373 | ||
d77de738 | 2374 | @node omp_get_wtick |
506f068e | 2375 | @subsection @code{omp_get_wtick} -- Get timer precision |
d77de738 ML |
2376 | @table @asis |
2377 | @item @emph{Description}: | |
2378 | Gets the timer precision, i.e., the number of seconds between two | |
2379 | successive clock ticks. | |
2380 | ||
2381 | @item @emph{C/C++}: | |
2382 | @multitable @columnfractions .20 .80 | |
2383 | @item @emph{Prototype}: @tab @code{double omp_get_wtick(void);} | |
2384 | @end multitable | |
2385 | ||
2386 | @item @emph{Fortran}: | |
2387 | @multitable @columnfractions .20 .80 | |
2388 | @item @emph{Interface}: @tab @code{double precision function omp_get_wtick()} | |
2389 | @end multitable | |
2390 | ||
2391 | @item @emph{See also}: | |
2392 | @ref{omp_get_wtime} | |
2393 | ||
2394 | @item @emph{Reference}: | |
2395 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.4.2. | |
2396 | @end table | |
2397 | ||
2398 | ||
2399 | ||
2400 | @node omp_get_wtime | |
506f068e | 2401 | @subsection @code{omp_get_wtime} -- Elapsed wall clock time |
d77de738 ML |
2402 | @table @asis |
2403 | @item @emph{Description}: | |
2404 | Elapsed wall clock time in seconds. The time is measured per thread, no | |
2405 | guarantee can be made that two distinct threads measure the same time. | |
2406 | Time is measured from some "time in the past", which is an arbitrary time | |
2407 | guaranteed not to change during the execution of the program. | |
2408 | ||
2409 | @item @emph{C/C++}: | |
2410 | @multitable @columnfractions .20 .80 | |
2411 | @item @emph{Prototype}: @tab @code{double omp_get_wtime(void);} | |
2412 | @end multitable | |
2413 | ||
2414 | @item @emph{Fortran}: | |
2415 | @multitable @columnfractions .20 .80 | |
2416 | @item @emph{Interface}: @tab @code{double precision function omp_get_wtime()} | |
2417 | @end multitable | |
2418 | ||
2419 | @item @emph{See also}: | |
2420 | @ref{omp_get_wtick} | |
2421 | ||
2422 | @item @emph{Reference}: | |
2423 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.4.1. | |
2424 | @end table | |
2425 | ||
2426 | ||
2427 | ||
506f068e TB |
2428 | @node Event Routine |
2429 | @section Event Routine | |
2430 | ||
2431 | Support for event objects. | |
2432 | The routine has C linkage and do not throw exceptions. | |
2433 | ||
2434 | @menu | |
2435 | * omp_fulfill_event:: Fulfill and destroy an OpenMP event. | |
2436 | @end menu | |
2437 | ||
2438 | ||
2439 | ||
d77de738 | 2440 | @node omp_fulfill_event |
506f068e | 2441 | @subsection @code{omp_fulfill_event} -- Fulfill and destroy an OpenMP event |
d77de738 ML |
2442 | @table @asis |
2443 | @item @emph{Description}: | |
2444 | Fulfill the event associated with the event handle argument. Currently, it | |
2445 | is only used to fulfill events generated by detach clauses on task | |
2446 | constructs - the effect of fulfilling the event is to allow the task to | |
2447 | complete. | |
2448 | ||
2449 | The result of calling @code{omp_fulfill_event} with an event handle other | |
2450 | than that generated by a detach clause is undefined. Calling it with an | |
2451 | event handle that has already been fulfilled is also undefined. | |
2452 | ||
2453 | @item @emph{C/C++}: | |
2454 | @multitable @columnfractions .20 .80 | |
2455 | @item @emph{Prototype}: @tab @code{void omp_fulfill_event(omp_event_handle_t event);} | |
2456 | @end multitable | |
2457 | ||
2458 | @item @emph{Fortran}: | |
2459 | @multitable @columnfractions .20 .80 | |
2460 | @item @emph{Interface}: @tab @code{subroutine omp_fulfill_event(event)} | |
2461 | @item @tab @code{integer (kind=omp_event_handle_kind) :: event} | |
2462 | @end multitable | |
2463 | ||
2464 | @item @emph{Reference}: | |
2465 | @uref{https://www.openmp.org, OpenMP specification v5.0}, Section 3.5.1. | |
2466 | @end table | |
2467 | ||
2468 | ||
2469 | ||
506f068e TB |
2470 | @c @node Interoperability Routines |
2471 | @c @section Interoperability Routines | |
2472 | @c | |
2473 | @c Routines to obtain properties from an @code{omp_interop_t} object. | |
2474 | @c They have C linkage and do not throw exceptions. | |
2475 | @c | |
2476 | @c @menu | |
2477 | @c * omp_get_num_interop_properties:: <fixme> | |
2478 | @c * omp_get_interop_int:: <fixme> | |
2479 | @c * omp_get_interop_ptr:: <fixme> | |
2480 | @c * omp_get_interop_str:: <fixme> | |
2481 | @c * omp_get_interop_name:: <fixme> | |
2482 | @c * omp_get_interop_type_desc:: <fixme> | |
2483 | @c * omp_get_interop_rc_desc:: <fixme> | |
2484 | @c @end menu | |
2485 | ||
971f119f TB |
2486 | @node Memory Management Routines |
2487 | @section Memory Management Routines | |
2488 | ||
2489 | Routines to manage and allocate memory on the current device. | |
2490 | They have C linkage and do not throw exceptions. | |
2491 | ||
2492 | @menu | |
2493 | * omp_init_allocator:: Create an allocator | |
2494 | * omp_destroy_allocator:: Destroy an allocator | |
2495 | * omp_set_default_allocator:: Set the default allocator | |
2496 | * omp_get_default_allocator:: Get the default allocator | |
bc238c40 TB |
2497 | * omp_alloc:: Memory allocation with an allocator |
2498 | * omp_aligned_alloc:: Memory allocation with an allocator and alignment | |
2499 | * omp_free:: Freeing memory allocated with OpenMP routines | |
2500 | * omp_calloc:: Allocate nullified memory with an allocator | |
2501 | * omp_aligned_calloc:: Allocate nullified aligned memory with an allocator | |
2502 | * omp_realloc:: Reallocate memory allocated with OpenMP routines | |
506f068e TB |
2503 | @c * omp_get_memspace_num_resources:: <fixme>/TR11 |
2504 | @c * omp_get_submemspace:: <fixme>/TR11 | |
971f119f TB |
2505 | @end menu |
2506 | ||
2507 | ||
2508 | ||
2509 | @node omp_init_allocator | |
2510 | @subsection @code{omp_init_allocator} -- Create an allocator | |
2511 | @table @asis | |
2512 | @item @emph{Description}: | |
2513 | Create an allocator that uses the specified memory space and has the specified | |
2514 | traits; if an allocator that fulfills the requirements cannot be created, | |
2515 | @code{omp_null_allocator} is returned. | |
2516 | ||
2517 | The predefined memory spaces and available traits can be found at | |
2518 | @ref{OMP_ALLOCATOR}, where the trait names have to be be prefixed by | |
2519 | @code{omp_atk_} (e.g. @code{omp_atk_pinned}) and the named trait values by | |
2520 | @code{omp_atv_} (e.g. @code{omp_atv_true}); additionally, @code{omp_atv_default} | |
2521 | may be used as trait value to specify that the default value should be used. | |
2522 | ||
2523 | @item @emph{C/C++}: | |
2524 | @multitable @columnfractions .20 .80 | |
2525 | @item @emph{Prototype}: @tab @code{omp_allocator_handle_t omp_init_allocator(} | |
2526 | @item @tab @code{ omp_memspace_handle_t memspace,} | |
2527 | @item @tab @code{ int ntraits,} | |
2528 | @item @tab @code{ const omp_alloctrait_t traits[]);} | |
2529 | @end multitable | |
2530 | ||
2531 | @item @emph{Fortran}: | |
2532 | @multitable @columnfractions .20 .80 | |
2533 | @item @emph{Interface}: @tab @code{function omp_init_allocator(memspace, ntraits, traits)} | |
bc238c40 TB |
2534 | @item @tab @code{integer (omp_allocator_handle_kind) :: omp_init_allocator} |
2535 | @item @tab @code{integer (omp_memspace_handle_kind), intent(in) :: memspace} | |
971f119f TB |
2536 | @item @tab @code{integer, intent(in) :: ntraits} |
2537 | @item @tab @code{type (omp_alloctrait), intent(in) :: traits(*)} | |
2538 | @end multitable | |
2539 | ||
2540 | @item @emph{See also}: | |
2541 | @ref{OMP_ALLOCATOR}, @ref{Memory allocation}, @ref{omp_destroy_allocator} | |
2542 | ||
2543 | @item @emph{Reference}: | |
2544 | @uref{https://www.openmp.org, OpenMP specification v5.0}, Section 3.7.2 | |
2545 | @end table | |
2546 | ||
2547 | ||
2548 | ||
2549 | @node omp_destroy_allocator | |
2550 | @subsection @code{omp_destroy_allocator} -- Destroy an allocator | |
2551 | @table @asis | |
2552 | @item @emph{Description}: | |
2553 | Releases all resources used by a memory allocator, which must not represent | |
2554 | a predefined memory allocator. Accessing memory after its allocator has been | |
2555 | destroyed has unspecified behavior. Passing @code{omp_null_allocator} to the | |
15886c03 | 2556 | routine is permitted but has no effect. |
971f119f TB |
2557 | |
2558 | ||
2559 | @item @emph{C/C++}: | |
2560 | @multitable @columnfractions .20 .80 | |
2561 | @item @emph{Prototype}: @tab @code{void omp_destroy_allocator (omp_allocator_handle_t allocator);} | |
2562 | @end multitable | |
2563 | ||
2564 | @item @emph{Fortran}: | |
2565 | @multitable @columnfractions .20 .80 | |
2566 | @item @emph{Interface}: @tab @code{subroutine omp_destroy_allocator(allocator)} | |
bc238c40 | 2567 | @item @tab @code{integer (omp_allocator_handle_kind), intent(in) :: allocator} |
971f119f TB |
2568 | @end multitable |
2569 | ||
2570 | @item @emph{See also}: | |
2571 | @ref{omp_init_allocator} | |
2572 | ||
2573 | @item @emph{Reference}: | |
2574 | @uref{https://www.openmp.org, OpenMP specification v5.0}, Section 3.7.3 | |
2575 | @end table | |
2576 | ||
2577 | ||
2578 | ||
2579 | @node omp_set_default_allocator | |
2580 | @subsection @code{omp_set_default_allocator} -- Set the default allocator | |
2581 | @table @asis | |
2582 | @item @emph{Description}: | |
2583 | Sets the default allocator that is used when no allocator has been specified | |
2584 | in the @code{allocate} or @code{allocator} clause or if an OpenMP memory | |
2585 | routine is invoked with the @code{omp_null_allocator} allocator. | |
2586 | ||
2587 | @item @emph{C/C++}: | |
2588 | @multitable @columnfractions .20 .80 | |
2589 | @item @emph{Prototype}: @tab @code{void omp_set_default_allocator(omp_allocator_handle_t allocator);} | |
2590 | @end multitable | |
2591 | ||
2592 | @item @emph{Fortran}: | |
2593 | @multitable @columnfractions .20 .80 | |
2594 | @item @emph{Interface}: @tab @code{subroutine omp_set_default_allocator(allocator)} | |
bc238c40 | 2595 | @item @tab @code{integer (omp_allocator_handle_kind), intent(in) :: allocator} |
971f119f TB |
2596 | @end multitable |
2597 | ||
2598 | @item @emph{See also}: | |
2599 | @ref{omp_get_default_allocator}, @ref{omp_init_allocator}, @ref{OMP_ALLOCATOR}, | |
2600 | @ref{Memory allocation} | |
2601 | ||
2602 | @item @emph{Reference}: | |
2603 | @uref{https://www.openmp.org, OpenMP specification v5.0}, Section 3.7.4 | |
2604 | @end table | |
2605 | ||
2606 | ||
2607 | ||
2608 | @node omp_get_default_allocator | |
2609 | @subsection @code{omp_get_default_allocator} -- Get the default allocator | |
2610 | @table @asis | |
2611 | @item @emph{Description}: | |
2612 | The routine returns the default allocator that is used when no allocator has | |
2613 | been specified in the @code{allocate} or @code{allocator} clause or if an | |
2614 | OpenMP memory routine is invoked with the @code{omp_null_allocator} allocator. | |
2615 | ||
2616 | @item @emph{C/C++}: | |
2617 | @multitable @columnfractions .20 .80 | |
2618 | @item @emph{Prototype}: @tab @code{omp_allocator_handle_t omp_get_default_allocator();} | |
2619 | @end multitable | |
2620 | ||
2621 | @item @emph{Fortran}: | |
2622 | @multitable @columnfractions .20 .80 | |
2623 | @item @emph{Interface}: @tab @code{function omp_get_default_allocator()} | |
bc238c40 | 2624 | @item @tab @code{integer (omp_allocator_handle_kind) :: omp_get_default_allocator} |
971f119f TB |
2625 | @end multitable |
2626 | ||
2627 | @item @emph{See also}: | |
2628 | @ref{omp_set_default_allocator}, @ref{OMP_ALLOCATOR} | |
2629 | ||
2630 | @item @emph{Reference}: | |
2631 | @uref{https://www.openmp.org, OpenMP specification v5.0}, Section 3.7.5 | |
2632 | @end table | |
2633 | ||
2634 | ||
506f068e | 2635 | |
bc238c40 TB |
2636 | @node omp_alloc |
2637 | @subsection @code{omp_alloc} -- Memory allocation with an allocator | |
2638 | @table @asis | |
2639 | @item @emph{Description}: | |
2640 | Allocate memory with the specified allocator, which can either be a predefined | |
2641 | allocator, an allocator handle or @code{omp_null_allocator}. If the allocators | |
2642 | is @code{omp_null_allocator}, the allocator specified by the | |
2643 | @var{def-allocator-var} ICV is used. @var{size} must be a nonnegative number | |
2644 | denoting the number of bytes to be allocated; if @var{size} is zero, | |
2645 | @code{omp_alloc} will return a null pointer. If successful, a pointer to the | |
2646 | allocated memory is returned, otherwise the @code{fallback} trait of the | |
2647 | allocator determines the behavior. The content of the allocated memory is | |
2648 | unspecified. | |
2649 | ||
2650 | In @code{target} regions, either the @code{dynamic_allocators} clause must | |
2651 | appear on a @code{requires} directive in the same compilation unit -- or the | |
2652 | @var{allocator} argument may only be a constant expression with the value of | |
2653 | one of the predefined allocators and may not be @code{omp_null_allocator}. | |
2654 | ||
2655 | Memory allocated by @code{omp_alloc} must be freed using @code{omp_free}. | |
2656 | ||
2657 | @item @emph{C}: | |
2658 | @multitable @columnfractions .20 .80 | |
2659 | @item @emph{Prototype}: @tab @code{void* omp_alloc(size_t size,} | |
2660 | @item @tab @code{ omp_allocator_handle_t allocator)} | |
2661 | @end multitable | |
2662 | ||
2663 | @item @emph{C++}: | |
2664 | @multitable @columnfractions .20 .80 | |
2665 | @item @emph{Prototype}: @tab @code{void* omp_alloc(size_t size,} | |
2666 | @item @tab @code{ omp_allocator_handle_t allocator=omp_null_allocator)} | |
2667 | @end multitable | |
2668 | ||
2669 | @item @emph{Fortran}: | |
2670 | @multitable @columnfractions .20 .80 | |
2671 | @item @emph{Interface}: @tab @code{type(c_ptr) function omp_alloc(size, allocator) bind(C)} | |
2672 | @item @tab @code{use, intrinsic :: iso_c_binding, only : c_ptr, c_size_t} | |
2673 | @item @tab @code{integer (c_size_t), value :: size} | |
2674 | @item @tab @code{integer (omp_allocator_handle_kind), value :: allocator} | |
2675 | @end multitable | |
2676 | ||
2677 | @item @emph{See also}: | |
2678 | @ref{OMP_ALLOCATOR}, @ref{Memory allocation}, @ref{omp_set_default_allocator}, | |
2679 | @ref{omp_free}, @ref{omp_init_allocator} | |
2680 | ||
2681 | @item @emph{Reference}: | |
2682 | @uref{https://www.openmp.org, OpenMP specification v5.0}, Section 3.7.6 | |
2683 | @end table | |
2684 | ||
2685 | ||
2686 | ||
2687 | @node omp_aligned_alloc | |
2688 | @subsection @code{omp_aligned_alloc} -- Memory allocation with an allocator and alignment | |
2689 | @table @asis | |
2690 | @item @emph{Description}: | |
2691 | Allocate memory with the specified allocator, which can either be a predefined | |
2692 | allocator, an allocator handle or @code{omp_null_allocator}. If the allocators | |
2693 | is @code{omp_null_allocator}, the allocator specified by the | |
2694 | @var{def-allocator-var} ICV is used. @var{alignment} must be a positive power | |
2695 | of two and @var{size} must be a nonnegative number that is a multiple of the | |
2696 | alignment and denotes the number of bytes to be allocated; if @var{size} is | |
2697 | zero, @code{omp_aligned_alloc} will return a null pointer. The alignment will | |
2698 | be at least the maximal value required by @code{alignment} trait of the | |
2699 | allocator and the value of the passed @var{alignment} argument. If successful, | |
2700 | a pointer to the allocated memory is returned, otherwise the @code{fallback} | |
2701 | trait of the allocator determines the behavior. The content of the allocated | |
2702 | memory is unspecified. | |
2703 | ||
2704 | In @code{target} regions, either the @code{dynamic_allocators} clause must | |
2705 | appear on a @code{requires} directive in the same compilation unit -- or the | |
2706 | @var{allocator} argument may only be a constant expression with the value of | |
2707 | one of the predefined allocators and may not be @code{omp_null_allocator}. | |
2708 | ||
2709 | Memory allocated by @code{omp_aligned_alloc} must be freed using | |
2710 | @code{omp_free}. | |
2711 | ||
2712 | @item @emph{C}: | |
2713 | @multitable @columnfractions .20 .80 | |
2714 | @item @emph{Prototype}: @tab @code{void* omp_aligned_alloc(size_t alignment,} | |
2715 | @item @tab @code{ size_t size,} | |
2716 | @item @tab @code{ omp_allocator_handle_t allocator)} | |
2717 | @end multitable | |
2718 | ||
2719 | @item @emph{C++}: | |
2720 | @multitable @columnfractions .20 .80 | |
2721 | @item @emph{Prototype}: @tab @code{void* omp_aligned_alloc(size_t alignment,} | |
2722 | @item @tab @code{ size_t size,} | |
2723 | @item @tab @code{ omp_allocator_handle_t allocator=omp_null_allocator)} | |
2724 | @end multitable | |
2725 | ||
2726 | @item @emph{Fortran}: | |
2727 | @multitable @columnfractions .20 .80 | |
2728 | @item @emph{Interface}: @tab @code{type(c_ptr) function omp_aligned_alloc(alignment, size, allocator) bind(C)} | |
2729 | @item @tab @code{use, intrinsic :: iso_c_binding, only : c_ptr, c_size_t} | |
2730 | @item @tab @code{integer (c_size_t), value :: alignment, size} | |
2731 | @item @tab @code{integer (omp_allocator_handle_kind), value :: allocator} | |
2732 | @end multitable | |
2733 | ||
2734 | @item @emph{See also}: | |
2735 | @ref{OMP_ALLOCATOR}, @ref{Memory allocation}, @ref{omp_set_default_allocator}, | |
2736 | @ref{omp_free}, @ref{omp_init_allocator} | |
2737 | ||
2738 | @item @emph{Reference}: | |
2739 | @uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.13.6 | |
2740 | @end table | |
2741 | ||
2742 | ||
2743 | ||
2744 | @node omp_free | |
2745 | @subsection @code{omp_free} -- Freeing memory allocated with OpenMP routines | |
2746 | @table @asis | |
2747 | @item @emph{Description}: | |
2748 | The @code{omp_free} routine deallocates memory previously allocated by an | |
2749 | OpenMP memory-management routine. The @var{ptr} argument must point to such | |
2750 | memory or be a null pointer; if it is a null pointer, no operation is | |
2751 | performed. If specified, the @var{allocator} argument must be either the | |
2752 | memory allocator that was used for the allocation or @code{omp_null_allocator}; | |
2753 | if it is @code{omp_null_allocator}, the implementation will determine the value | |
2754 | automatically. | |
2755 | ||
2756 | Calling @code{omp_free} invokes undefined behavior if the memory | |
2757 | was already deallocated or when the used allocator has already been destroyed. | |
2758 | ||
2759 | @item @emph{C}: | |
2760 | @multitable @columnfractions .20 .80 | |
2761 | @item @emph{Prototype}: @tab @code{void omp_free(void *ptr,} | |
2762 | @item @tab @code{ omp_allocator_handle_t allocator)} | |
2763 | @end multitable | |
2764 | ||
2765 | @item @emph{C++}: | |
2766 | @multitable @columnfractions .20 .80 | |
2767 | @item @emph{Prototype}: @tab @code{void omp_free(void *ptr,} | |
2768 | @item @tab @code{ omp_allocator_handle_t allocator=omp_null_allocator)} | |
2769 | @end multitable | |
2770 | ||
2771 | @item @emph{Fortran}: | |
2772 | @multitable @columnfractions .20 .80 | |
2773 | @item @emph{Interface}: @tab @code{subroutine omp_free(ptr, allocator) bind(C)} | |
2774 | @item @tab @code{use, intrinsic :: iso_c_binding, only : c_ptr} | |
2775 | @item @tab @code{type (c_ptr), value :: ptr} | |
2776 | @item @tab @code{integer (omp_allocator_handle_kind), value :: allocator} | |
2777 | @end multitable | |
2778 | ||
2779 | @item @emph{See also}: | |
2780 | @ref{omp_alloc}, @ref{omp_aligned_alloc}, @ref{omp_calloc}, | |
2781 | @ref{omp_aligned_calloc}, @ref{omp_realloc} | |
2782 | ||
2783 | @item @emph{Reference}: | |
2784 | @uref{https://www.openmp.org, OpenMP specification v5.0}, Section 3.7.7 | |
2785 | @end table | |
2786 | ||
2787 | ||
2788 | ||
2789 | @node omp_calloc | |
2790 | @subsection @code{omp_calloc} -- Allocate nullified memory with an allocator | |
2791 | @table @asis | |
2792 | @item @emph{Description}: | |
2793 | Allocate zero-initialized memory with the specified allocator, which can either | |
2794 | be a predefined allocator, an allocator handle or @code{omp_null_allocator}. If | |
2795 | the allocators is @code{omp_null_allocator}, the allocator specified by the | |
2796 | @var{def-allocator-var} ICV is used. The to-be allocated memory is for an | |
2797 | array with @var{nmemb} elements, each having a size of @var{size} bytes. Both | |
2798 | @var{nmemb} and @var{size} must be nonnegative numbers; if either of them is | |
2799 | zero, @code{omp_calloc} will return a null pointer. If successful, a pointer to | |
2800 | the zero-initialized allocated memory is returned, otherwise the @code{fallback} | |
2801 | trait of the allocator determines the behavior. | |
2802 | ||
2803 | In @code{target} regions, either the @code{dynamic_allocators} clause must | |
2804 | appear on a @code{requires} directive in the same compilation unit -- or the | |
2805 | @var{allocator} argument may only be a constant expression with the value of | |
2806 | one of the predefined allocators and may not be @code{omp_null_allocator}. | |
2807 | ||
2808 | Memory allocated by @code{omp_calloc} must be freed using @code{omp_free}. | |
2809 | ||
2810 | @item @emph{C}: | |
2811 | @multitable @columnfractions .20 .80 | |
2812 | @item @emph{Prototype}: @tab @code{void* omp_calloc(size_t nmemb, size_t size,} | |
2813 | @item @tab @code{ omp_allocator_handle_t allocator)} | |
2814 | @end multitable | |
2815 | ||
2816 | @item @emph{C++}: | |
2817 | @multitable @columnfractions .20 .80 | |
2818 | @item @emph{Prototype}: @tab @code{void* omp_calloc(size_t nmemb, size_t size,} | |
2819 | @item @tab @code{ omp_allocator_handle_t allocator=omp_null_allocator)} | |
2820 | @end multitable | |
2821 | ||
2822 | @item @emph{Fortran}: | |
2823 | @multitable @columnfractions .20 .80 | |
2824 | @item @emph{Interface}: @tab @code{type(c_ptr) function omp_calloc(nmemb, size, allocator) bind(C)} | |
2825 | @item @tab @code{use, intrinsic :: iso_c_binding, only : c_ptr, c_size_t} | |
2826 | @item @tab @code{integer (c_size_t), value :: nmemb, size} | |
2827 | @item @tab @code{integer (omp_allocator_handle_kind), value :: allocator} | |
2828 | @end multitable | |
2829 | ||
2830 | @item @emph{See also}: | |
2831 | @ref{OMP_ALLOCATOR}, @ref{Memory allocation}, @ref{omp_set_default_allocator}, | |
2832 | @ref{omp_free}, @ref{omp_init_allocator} | |
2833 | ||
2834 | @item @emph{Reference}: | |
2835 | @uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.13.8 | |
2836 | @end table | |
2837 | ||
2838 | ||
2839 | ||
2840 | @node omp_aligned_calloc | |
2841 | @subsection @code{omp_aligned_calloc} -- Allocate aligned nullified memory with an allocator | |
2842 | @table @asis | |
2843 | @item @emph{Description}: | |
2844 | Allocate zero-initialized memory with the specified allocator, which can either | |
2845 | be a predefined allocator, an allocator handle or @code{omp_null_allocator}. If | |
2846 | the allocators is @code{omp_null_allocator}, the allocator specified by the | |
2847 | @var{def-allocator-var} ICV is used. The to-be allocated memory is for an | |
2848 | array with @var{nmemb} elements, each having a size of @var{size} bytes. Both | |
2849 | @var{nmemb} and @var{size} must be nonnegative numbers; if either of them is | |
2850 | zero, @code{omp_aligned_calloc} will return a null pointer. @var{alignment} | |
2851 | must be a positive power of two and @var{size} must be a multiple of the | |
2852 | alignment; the alignment will be at least the maximal value required by | |
2853 | @code{alignment} trait of the allocator and the value of the passed | |
2854 | @var{alignment} argument. If successful, a pointer to the zero-initialized | |
2855 | allocated memory is returned, otherwise the @code{fallback} trait of the | |
2856 | allocator determines the behavior. | |
2857 | ||
2858 | In @code{target} regions, either the @code{dynamic_allocators} clause must | |
2859 | appear on a @code{requires} directive in the same compilation unit -- or the | |
2860 | @var{allocator} argument may only be a constant expression with the value of | |
2861 | one of the predefined allocators and may not be @code{omp_null_allocator}. | |
2862 | ||
2863 | Memory allocated by @code{omp_aligned_calloc} must be freed using | |
2864 | @code{omp_free}. | |
2865 | ||
2866 | @item @emph{C}: | |
2867 | @multitable @columnfractions .20 .80 | |
2868 | @item @emph{Prototype}: @tab @code{void* omp_aligned_calloc(size_t nmemb, size_t size,} | |
2869 | @item @tab @code{ omp_allocator_handle_t allocator)} | |
2870 | @end multitable | |
2871 | ||
2872 | @item @emph{C++}: | |
2873 | @multitable @columnfractions .20 .80 | |
2874 | @item @emph{Prototype}: @tab @code{void* omp_aligned_calloc(size_t nmemb, size_t size,} | |
2875 | @item @tab @code{ omp_allocator_handle_t allocator=omp_null_allocator)} | |
2876 | @end multitable | |
2877 | ||
2878 | @item @emph{Fortran}: | |
2879 | @multitable @columnfractions .20 .80 | |
2880 | @item @emph{Interface}: @tab @code{type(c_ptr) function omp_aligned_calloc(nmemb, size, allocator) bind(C)} | |
2881 | @item @tab @code{use, intrinsic :: iso_c_binding, only : c_ptr, c_size_t} | |
2882 | @item @tab @code{integer (c_size_t), value :: nmemb, size} | |
2883 | @item @tab @code{integer (omp_allocator_handle_kind), value :: allocator} | |
2884 | @end multitable | |
2885 | ||
2886 | @item @emph{See also}: | |
2887 | @ref{OMP_ALLOCATOR}, @ref{Memory allocation}, @ref{omp_set_default_allocator}, | |
2888 | @ref{omp_free}, @ref{omp_init_allocator} | |
2889 | ||
2890 | @item @emph{Reference}: | |
2891 | @uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.13.8 | |
2892 | @end table | |
2893 | ||
2894 | ||
2895 | ||
2896 | @node omp_realloc | |
2897 | @subsection @code{omp_realloc} -- Reallocate memory allocated with OpenMP routines | |
2898 | @table @asis | |
2899 | @item @emph{Description}: | |
2900 | The @code{omp_realloc} routine deallocates memory to which @var{ptr} points to | |
2901 | and allocates new memory with the specified @var{allocator} argument; the | |
2902 | new memory will have the content of the old memory up to the minimum of the | |
2903 | old size and the new @var{size}, otherwise the content of the returned memory | |
2904 | is unspecified. If the new allocator is the same as the old one, the routine | |
2905 | tries to resize the existing memory allocation, returning the same address as | |
2906 | @var{ptr} if successful. @var{ptr} must point to memory allocated by an OpenMP | |
2907 | memory-management routine. | |
2908 | ||
2909 | The @var{allocator} and @var{free_allocator} arguments must be a predefined | |
2910 | allocator, an allocator handle or @code{omp_null_allocator}. If | |
2911 | @var{free_allocator} is @code{omp_null_allocator}, the implementation | |
2912 | automatically determines the allocator used for the allocation of @var{ptr}. | |
2913 | If @var{allocator} is @code{omp_null_allocator} and @var{ptr} is is not a | |
2914 | null pointer, the same allocator as @code{free_allocator} is used and | |
2915 | when @var{ptr} is a null pointer the allocator specified by the | |
2916 | @var{def-allocator-var} ICV is used. | |
2917 | ||
2918 | The @var{size} must be a nonnegative number denoting the number of bytes to be | |
2919 | allocated; if @var{size} is zero, @code{omp_realloc} will return free the | |
2920 | memory and return a null pointer. When @var{size} is nonzero: if successful, | |
2921 | a pointer to the allocated memory is returned, otherwise the @code{fallback} | |
2922 | trait of the allocator determines the behavior. | |
2923 | ||
2924 | In @code{target} regions, either the @code{dynamic_allocators} clause must | |
2925 | appear on a @code{requires} directive in the same compilation unit -- or the | |
2926 | @var{free_allocator} and @var{allocator} arguments may only be a constant | |
2927 | expression with the value of one of the predefined allocators and may not be | |
2928 | @code{omp_null_allocator}. | |
2929 | ||
2930 | Memory allocated by @code{omp_realloc} must be freed using @code{omp_free}. | |
2931 | Calling @code{omp_free} invokes undefined behavior if the memory | |
2932 | was already deallocated or when the used allocator has already been destroyed. | |
2933 | ||
2934 | @item @emph{C}: | |
2935 | @multitable @columnfractions .20 .80 | |
2936 | @item @emph{Prototype}: @tab @code{void* omp_realloc(void *ptr, size_t size,} | |
2937 | @item @tab @code{ omp_allocator_handle_t allocator,} | |
2938 | @item @tab @code{ omp_allocator_handle_t free_allocator)} | |
2939 | @end multitable | |
2940 | ||
2941 | @item @emph{C++}: | |
2942 | @multitable @columnfractions .20 .80 | |
2943 | @item @emph{Prototype}: @tab @code{void* omp_realloc(void *ptr, size_t size,} | |
2944 | @item @tab @code{ omp_allocator_handle_t allocator=omp_null_allocator,} | |
2945 | @item @tab @code{ omp_allocator_handle_t free_allocator=omp_null_allocator)} | |
2946 | @end multitable | |
2947 | ||
2948 | @item @emph{Fortran}: | |
2949 | @multitable @columnfractions .20 .80 | |
2950 | @item @emph{Interface}: @tab @code{type(c_ptr) function omp_realloc(ptr, size, allocator, free_allocator) bind(C)} | |
2951 | @item @tab @code{use, intrinsic :: iso_c_binding, only : c_ptr, c_size_t} | |
2952 | @item @tab @code{type(C_ptr), value :: ptr} | |
2953 | @item @tab @code{integer (c_size_t), value :: size} | |
2954 | @item @tab @code{integer (omp_allocator_handle_kind), value :: allocator, free_allocator} | |
2955 | @end multitable | |
2956 | ||
2957 | @item @emph{See also}: | |
2958 | @ref{OMP_ALLOCATOR}, @ref{Memory allocation}, @ref{omp_set_default_allocator}, | |
2959 | @ref{omp_free}, @ref{omp_init_allocator} | |
2960 | ||
2961 | @item @emph{Reference}: | |
2962 | @uref{https://www.openmp.org, OpenMP specification v5.0}, Section 3.7.9 | |
2963 | @end table | |
2964 | ||
2965 | ||
2966 | ||
506f068e | 2967 | @c @node Tool Control Routine |
fefbd85b | 2968 | @c @section Tool Control Routine |
506f068e TB |
2969 | @c |
2970 | @c FIXME | |
2971 | ||
fefbd85b TB |
2972 | @node Environment Display Routine |
2973 | @section Environment Display Routine | |
2974 | ||
2975 | Routine to display the OpenMP version number and the initial value of ICVs. | |
2976 | It has C linkage and does not throw exceptions. | |
2977 | ||
2978 | @menu | |
2979 | * omp_display_env:: print the initial ICV values | |
2980 | @end menu | |
2981 | ||
2982 | @node omp_display_env | |
2983 | @subsection @code{omp_display_env} -- print the initial ICV values | |
2984 | @table @asis | |
2985 | @item @emph{Description}: | |
2986 | Each time this routine is invoked, the OpenMP version number and initial value | |
2987 | of internal control variables (ICVs) is printed on @code{stderr}. The displayed | |
2988 | values are those at startup after evaluating the environment variables; later | |
2989 | calls to API routines or clauses used in enclosing constructs do not affect | |
2990 | the output. | |
2991 | ||
2992 | If the @var{verbose} argument is @code{false}, only the OpenMP version and | |
2993 | standard OpenMP ICVs are shown; if it is @code{true}, additionally, the | |
2994 | GCC-specific ICVs are shown. | |
2995 | ||
2996 | The output consists of multiple lines and starts with | |
2997 | @samp{OPENMP DISPLAY ENVIRONMENT BEGIN} followed by the name-value lines and | |
2998 | ends with @samp{OPENMP DISPLAY ENVIRONMENT END}. The @var{name} is followed by | |
2999 | an equal sign and the @var{value} is enclosed in single quotes. | |
3000 | ||
3001 | The first line has as @var{name} either @samp{_OPENMP} or @samp{openmp_version} | |
3002 | and shows as value the supported OpenMP version number (4-digit year, 2-digit | |
3003 | month) of the implementation, matching the value of the @code{_OPENMP} macro | |
3004 | and, in Fortran, the named constant @code{openmp_version}. | |
3005 | ||
3006 | In each of the succeeding lines, the @var{name} matches the environment-variable | |
3007 | name of an ICV and shows its value. Those line are might be prefixed by pair of | |
3008 | brackets and a space, where the brackets enclose a comma-separated list of | |
3009 | devices to which the ICV-value combination applies to; the value can either be a | |
3010 | numeric device number or an abstract name denoting all devices (@code{all}), the | |
3011 | initial host device (@code{host}) or all devices but the host (@code{device}). | |
3012 | Note that the same ICV might be printed multiple times for multiple devices, | |
3013 | even if all have the same value. | |
3014 | ||
3015 | The effect when invoked from within a @code{target} region is unspecified. | |
3016 | ||
3017 | @item @emph{C/C++}: | |
3018 | @multitable @columnfractions .20 .80 | |
3019 | @item @emph{Prototype}: @tab @code{void omp_display_env(int verbose)} | |
3020 | @end multitable | |
3021 | ||
3022 | @item @emph{Fortran}: | |
3023 | @multitable @columnfractions .20 .80 | |
3024 | @item @emph{Interface}: @tab @code{subroutine omp_display_env(vebose)} | |
3025 | @item @tab @code{logical, intent(in) :: verbose} | |
3026 | @end multitable | |
3027 | ||
3028 | @item @emph{Example}: | |
3029 | Note that the GCC-specific ICVs, such as the shown @code{GOMP_SPINCOUNT}, | |
3030 | are only printed when @var{varbose} set to @code{true}. | |
3031 | ||
3032 | @smallexample | |
3033 | OPENMP DISPLAY ENVIRONMENT BEGIN | |
3034 | _OPENMP = '201511' | |
3035 | [host] OMP_DYNAMIC = 'FALSE' | |
3036 | [host] OMP_NESTED = 'FALSE' | |
3037 | [all] OMP_CANCELLATION = 'FALSE' | |
3038 | ... | |
3039 | [host] GOMP_SPINCOUNT = '300000' | |
3040 | OPENMP DISPLAY ENVIRONMENT END | |
3041 | @end smallexample | |
3042 | ||
3043 | ||
3044 | @item @emph{See also}: | |
3045 | @ref{OMP_DISPLAY_ENV}, @ref{Environment Variables}, | |
3046 | @ref{Implementation-defined ICV Initialization} | |
3047 | ||
3048 | @item @emph{Reference}: | |
3049 | @uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.15 | |
3050 | @end table | |
3051 | ||
506f068e | 3052 | |
d77de738 ML |
3053 | @c --------------------------------------------------------------------- |
3054 | @c OpenMP Environment Variables | |
3055 | @c --------------------------------------------------------------------- | |
3056 | ||
3057 | @node Environment Variables | |
3058 | @chapter OpenMP Environment Variables | |
3059 | ||
3060 | The environment variables which beginning with @env{OMP_} are defined by | |
2cd0689a TB |
3061 | section 4 of the OpenMP specification in version 4.5 or in a later version |
3062 | of the specification, while those beginning with @env{GOMP_} are GNU extensions. | |
3063 | Most @env{OMP_} environment variables have an associated internal control | |
3064 | variable (ICV). | |
3065 | ||
3066 | For any OpenMP environment variable that sets an ICV and is neither | |
3067 | @code{OMP_DEFAULT_DEVICE} nor has global ICV scope, associated | |
3068 | device-specific environment variables exist. For them, the environment | |
3069 | variable without suffix affects the host. The suffix @code{_DEV_} followed | |
3070 | by a non-negative device number less that the number of available devices sets | |
3071 | the ICV for the corresponding device. The suffix @code{_DEV} sets the ICV | |
3072 | of all non-host devices for which a device-specific corresponding environment | |
3073 | variable has not been set while the @code{_ALL} suffix sets the ICV of all | |
3074 | host and non-host devices for which a more specific corresponding environment | |
3075 | variable is not set. | |
d77de738 ML |
3076 | |
3077 | @menu | |
73a0d3bf TB |
3078 | * OMP_ALLOCATOR:: Set the default allocator |
3079 | * OMP_AFFINITY_FORMAT:: Set the format string used for affinity display | |
d77de738 | 3080 | * OMP_CANCELLATION:: Set whether cancellation is activated |
73a0d3bf | 3081 | * OMP_DISPLAY_AFFINITY:: Display thread affinity information |
d77de738 ML |
3082 | * OMP_DISPLAY_ENV:: Show OpenMP version and environment variables |
3083 | * OMP_DEFAULT_DEVICE:: Set the device used in target regions | |
3084 | * OMP_DYNAMIC:: Dynamic adjustment of threads | |
3085 | * OMP_MAX_ACTIVE_LEVELS:: Set the maximum number of nested parallel regions | |
3086 | * OMP_MAX_TASK_PRIORITY:: Set the maximum task priority value | |
3087 | * OMP_NESTED:: Nested parallel regions | |
3088 | * OMP_NUM_TEAMS:: Specifies the number of teams to use by teams region | |
3089 | * OMP_NUM_THREADS:: Specifies the number of threads to use | |
0b9bd33d JJ |
3090 | * OMP_PROC_BIND:: Whether threads may be moved between CPUs |
3091 | * OMP_PLACES:: Specifies on which CPUs the threads should be placed | |
d77de738 ML |
3092 | * OMP_STACKSIZE:: Set default thread stack size |
3093 | * OMP_SCHEDULE:: How threads are scheduled | |
bc238c40 | 3094 | * OMP_TARGET_OFFLOAD:: Controls offloading behavior |
d77de738 ML |
3095 | * OMP_TEAMS_THREAD_LIMIT:: Set the maximum number of threads imposed by teams |
3096 | * OMP_THREAD_LIMIT:: Set the maximum number of threads | |
3097 | * OMP_WAIT_POLICY:: How waiting threads are handled | |
3098 | * GOMP_CPU_AFFINITY:: Bind threads to specific CPUs | |
3099 | * GOMP_DEBUG:: Enable debugging output | |
3100 | * GOMP_STACKSIZE:: Set default thread stack size | |
3101 | * GOMP_SPINCOUNT:: Set the busy-wait spin count | |
3102 | * GOMP_RTEMS_THREAD_POOLS:: Set the RTEMS specific thread pools | |
3103 | @end menu | |
3104 | ||
3105 | ||
73a0d3bf TB |
3106 | @node OMP_ALLOCATOR |
3107 | @section @env{OMP_ALLOCATOR} -- Set the default allocator | |
3108 | @cindex Environment Variable | |
3109 | @table @asis | |
971f119f | 3110 | @item @emph{ICV:} @var{def-allocator-var} |
2cd0689a | 3111 | @item @emph{Scope:} data environment |
73a0d3bf TB |
3112 | @item @emph{Description}: |
3113 | Sets the default allocator that is used when no allocator has been specified | |
3114 | in the @code{allocate} or @code{allocator} clause or if an OpenMP memory | |
3115 | routine is invoked with the @code{omp_null_allocator} allocator. | |
3116 | If unset, @code{omp_default_mem_alloc} is used. | |
3117 | ||
3118 | The value can either be a predefined allocator or a predefined memory space | |
3119 | or a predefined memory space followed by a colon and a comma-separated list | |
3120 | of memory trait and value pairs, separated by @code{=}. | |
3121 | ||
2cd0689a TB |
3122 | Note: The corresponding device environment variables are currently not |
3123 | supported. Therefore, the non-host @var{def-allocator-var} ICVs are always | |
3124 | initialized to @code{omp_default_mem_alloc}. However, on all devices, | |
3125 | the @code{omp_set_default_allocator} API routine can be used to change | |
3126 | value. | |
3127 | ||
73a0d3bf | 3128 | @multitable @columnfractions .45 .45 |
a85a106c | 3129 | @headitem Predefined allocators @tab Associated predefined memory spaces |
73a0d3bf TB |
3130 | @item omp_default_mem_alloc @tab omp_default_mem_space |
3131 | @item omp_large_cap_mem_alloc @tab omp_large_cap_mem_space | |
3132 | @item omp_const_mem_alloc @tab omp_const_mem_space | |
3133 | @item omp_high_bw_mem_alloc @tab omp_high_bw_mem_space | |
3134 | @item omp_low_lat_mem_alloc @tab omp_low_lat_mem_space | |
30486fab AS |
3135 | @item omp_cgroup_mem_alloc @tab omp_low_lat_mem_space (implementation defined) |
3136 | @item omp_pteam_mem_alloc @tab omp_low_lat_mem_space (implementation defined) | |
3137 | @item omp_thread_mem_alloc @tab omp_low_lat_mem_space (implementation defined) | |
73a0d3bf TB |
3138 | @end multitable |
3139 | ||
a85a106c TB |
3140 | The predefined allocators use the default values for the traits, |
3141 | as listed below. Except that the last three allocators have the | |
3142 | @code{access} trait set to @code{cgroup}, @code{pteam}, and | |
3143 | @code{thread}, respectively. | |
3144 | ||
3145 | @multitable @columnfractions .25 .40 .25 | |
3146 | @headitem Trait @tab Allowed values @tab Default value | |
73a0d3bf TB |
3147 | @item @code{sync_hint} @tab @code{contended}, @code{uncontended}, |
3148 | @code{serialized}, @code{private} | |
a85a106c | 3149 | @tab @code{contended} |
73a0d3bf | 3150 | @item @code{alignment} @tab Positive integer being a power of two |
a85a106c | 3151 | @tab 1 byte |
73a0d3bf TB |
3152 | @item @code{access} @tab @code{all}, @code{cgroup}, |
3153 | @code{pteam}, @code{thread} | |
a85a106c | 3154 | @tab @code{all} |
73a0d3bf | 3155 | @item @code{pool_size} @tab Positive integer |
a85a106c | 3156 | @tab See @ref{Memory allocation} |
73a0d3bf TB |
3157 | @item @code{fallback} @tab @code{default_mem_fb}, @code{null_fb}, |
3158 | @code{abort_fb}, @code{allocator_fb} | |
a85a106c | 3159 | @tab See below |
73a0d3bf | 3160 | @item @code{fb_data} @tab @emph{unsupported as it needs an allocator handle} |
a85a106c | 3161 | @tab (none) |
73a0d3bf | 3162 | @item @code{pinned} @tab @code{true}, @code{false} |
a85a106c | 3163 | @tab @code{false} |
73a0d3bf TB |
3164 | @item @code{partition} @tab @code{environment}, @code{nearest}, |
3165 | @code{blocked}, @code{interleaved} | |
a85a106c | 3166 | @tab @code{environment} |
73a0d3bf TB |
3167 | @end multitable |
3168 | ||
a85a106c TB |
3169 | For the @code{fallback} trait, the default value is @code{null_fb} for the |
3170 | @code{omp_default_mem_alloc} allocator and any allocator that is associated | |
3171 | with device memory; for all other other allocators, it is @code{default_mem_fb} | |
3172 | by default. | |
3173 | ||
73a0d3bf TB |
3174 | Examples: |
3175 | @smallexample | |
3176 | OMP_ALLOCATOR=omp_high_bw_mem_alloc | |
3177 | OMP_ALLOCATOR=omp_large_cap_mem_space | |
506f068e | 3178 | OMP_ALLOCATOR=omp_low_lat_mem_space:pinned=true,partition=nearest |
73a0d3bf TB |
3179 | @end smallexample |
3180 | ||
a85a106c | 3181 | @item @emph{See also}: |
971f119f | 3182 | @ref{Memory allocation}, @ref{omp_get_default_allocator}, |
30486fab | 3183 | @ref{omp_set_default_allocator}, @ref{Offload-Target Specifics} |
73a0d3bf TB |
3184 | |
3185 | @item @emph{Reference}: | |
3186 | @uref{https://www.openmp.org, OpenMP specification v5.0}, Section 6.21 | |
3187 | @end table | |
3188 | ||
3189 | ||
3190 | ||
3191 | @node OMP_AFFINITY_FORMAT | |
3192 | @section @env{OMP_AFFINITY_FORMAT} -- Set the format string used for affinity display | |
3193 | @cindex Environment Variable | |
3194 | @table @asis | |
2cd0689a TB |
3195 | @item @emph{ICV:} @var{affinity-format-var} |
3196 | @item @emph{Scope:} device | |
73a0d3bf TB |
3197 | @item @emph{Description}: |
3198 | Sets the format string used when displaying OpenMP thread affinity information. | |
3199 | Special values are output using @code{%} followed by an optional size | |
3200 | specification and then either the single-character field type or its long | |
15886c03 | 3201 | name enclosed in curly braces; using @code{%%} displays a literal percent. |
73a0d3bf | 3202 | The size specification consists of an optional @code{0.} or @code{.} followed |
450b05ce | 3203 | by a positive integer, specifying the minimal width of the output. With |
73a0d3bf TB |
3204 | @code{0.} and numerical values, the output is padded with zeros on the left; |
3205 | with @code{.}, the output is padded by spaces on the left; otherwise, the | |
3206 | output is padded by spaces on the right. If unset, the value is | |
3207 | ``@code{level %L thread %i affinity %A}''. | |
3208 | ||
3209 | Supported field types are: | |
3210 | ||
3211 | @multitable @columnfractions .10 .25 .60 | |
3212 | @item t @tab team_num @tab value returned by @code{omp_get_team_num} | |
3213 | @item T @tab num_teams @tab value returned by @code{omp_get_num_teams} | |
3214 | @item L @tab nesting_level @tab value returned by @code{omp_get_level} | |
3215 | @item n @tab thread_num @tab value returned by @code{omp_get_thread_num} | |
3216 | @item N @tab num_threads @tab value returned by @code{omp_get_num_threads} | |
3217 | @item a @tab ancestor_tnum | |
3218 | @tab value returned by | |
3219 | @code{omp_get_ancestor_thread_num(omp_get_level()-1)} | |
3220 | @item H @tab host @tab name of the host that executes the thread | |
450b05ce TB |
3221 | @item P @tab process_id @tab process identifier |
3222 | @item i @tab native_thread_id @tab native thread identifier | |
73a0d3bf TB |
3223 | @item A @tab thread_affinity |
3224 | @tab comma separated list of integer values or ranges, representing the | |
3225 | processors on which a process might execute, subject to affinity | |
3226 | mechanisms | |
3227 | @end multitable | |
3228 | ||
3229 | For instance, after setting | |
3230 | ||
3231 | @smallexample | |
3232 | OMP_AFFINITY_FORMAT="%0.2a!%n!%.4L!%N;%.2t;%0.2T;%@{team_num@};%@{num_teams@};%A" | |
3233 | @end smallexample | |
3234 | ||
3235 | with either @code{OMP_DISPLAY_AFFINITY} being set or when calling | |
3236 | @code{omp_display_affinity} with @code{NULL} or an empty string, the program | |
3237 | might display the following: | |
3238 | ||
3239 | @smallexample | |
3240 | 00!0! 1!4; 0;01;0;1;0-11 | |
3241 | 00!3! 1!4; 0;01;0;1;0-11 | |
3242 | 00!2! 1!4; 0;01;0;1;0-11 | |
3243 | 00!1! 1!4; 0;01;0;1;0-11 | |
3244 | @end smallexample | |
3245 | ||
3246 | @item @emph{See also}: | |
3247 | @ref{OMP_DISPLAY_AFFINITY} | |
3248 | ||
3249 | @item @emph{Reference}: | |
3250 | @uref{https://www.openmp.org, OpenMP specification v5.0}, Section 6.14 | |
3251 | @end table | |
3252 | ||
3253 | ||
3254 | ||
d77de738 ML |
3255 | @node OMP_CANCELLATION |
3256 | @section @env{OMP_CANCELLATION} -- Set whether cancellation is activated | |
3257 | @cindex Environment Variable | |
3258 | @table @asis | |
2cd0689a TB |
3259 | @item @emph{ICV:} @var{cancel-var} |
3260 | @item @emph{Scope:} global | |
d77de738 ML |
3261 | @item @emph{Description}: |
3262 | If set to @code{TRUE}, the cancellation is activated. If set to @code{FALSE} or | |
3263 | if unset, cancellation is disabled and the @code{cancel} construct is ignored. | |
3264 | ||
3265 | @item @emph{See also}: | |
3266 | @ref{omp_get_cancellation} | |
3267 | ||
3268 | @item @emph{Reference}: | |
3269 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.11 | |
3270 | @end table | |
3271 | ||
3272 | ||
3273 | ||
73a0d3bf TB |
3274 | @node OMP_DISPLAY_AFFINITY |
3275 | @section @env{OMP_DISPLAY_AFFINITY} -- Display thread affinity information | |
3276 | @cindex Environment Variable | |
3277 | @table @asis | |
2cd0689a TB |
3278 | @item @emph{ICV:} @var{display-affinity-var} |
3279 | @item @emph{Scope:} global | |
73a0d3bf TB |
3280 | @item @emph{Description}: |
3281 | If set to @code{FALSE} or if unset, affinity displaying is disabled. | |
15886c03 | 3282 | If set to @code{TRUE}, the runtime displays affinity information about |
73a0d3bf TB |
3283 | OpenMP threads in a parallel region upon entering the region and every time |
3284 | any change occurs. | |
3285 | ||
3286 | @item @emph{See also}: | |
3287 | @ref{OMP_AFFINITY_FORMAT} | |
3288 | ||
3289 | @item @emph{Reference}: | |
3290 | @uref{https://www.openmp.org, OpenMP specification v5.0}, Section 6.13 | |
3291 | @end table | |
3292 | ||
3293 | ||
3294 | ||
3295 | ||
d77de738 ML |
3296 | @node OMP_DISPLAY_ENV |
3297 | @section @env{OMP_DISPLAY_ENV} -- Show OpenMP version and environment variables | |
3298 | @cindex Environment Variable | |
3299 | @table @asis | |
2cd0689a TB |
3300 | @item @emph{ICV:} none |
3301 | @item @emph{Scope:} not applicable | |
d77de738 | 3302 | @item @emph{Description}: |
fefbd85b TB |
3303 | If set to @code{TRUE}, the runtime displays the same information to |
3304 | @code{stderr} as shown by the @code{omp_display_env} routine invoked with | |
3305 | @var{verbose} argument set to @code{false}. If set to @code{VERBOSE}, the same | |
3306 | information is shown as invoking the routine with @var{verbose} set to | |
3307 | @code{true}. If unset or set to @code{FALSE}, this information is not shown. | |
3308 | The result for any other value is unspecified. | |
d77de738 | 3309 | |
fefbd85b TB |
3310 | @item @emph{See also}: |
3311 | @ref{omp_display_env} | |
d77de738 ML |
3312 | |
3313 | @item @emph{Reference}: | |
3314 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.12 | |
3315 | @end table | |
3316 | ||
3317 | ||
3318 | ||
3319 | @node OMP_DEFAULT_DEVICE | |
3320 | @section @env{OMP_DEFAULT_DEVICE} -- Set the device used in target regions | |
3321 | @cindex Environment Variable | |
3322 | @table @asis | |
2cd0689a TB |
3323 | @item @emph{ICV:} @var{default-device-var} |
3324 | @item @emph{Scope:} data environment | |
d77de738 ML |
3325 | @item @emph{Description}: |
3326 | Set to choose the device which is used in a @code{target} region, unless the | |
3327 | value is overridden by @code{omp_set_default_device} or by a @code{device} | |
3328 | clause. The value shall be the nonnegative device number. If no device with | |
3329 | the given device number exists, the code is executed on the host. If unset, | |
18c8b56c TB |
3330 | @env{OMP_TARGET_OFFLOAD} is @code{mandatory} and no non-host devices are |
3331 | available, it is set to @code{omp_invalid_device}. Otherwise, if unset, | |
15886c03 | 3332 | device number 0 is used. |
d77de738 ML |
3333 | |
3334 | ||
3335 | @item @emph{See also}: | |
3336 | @ref{omp_get_default_device}, @ref{omp_set_default_device}, | |
8bd11fa4 | 3337 | @ref{OMP_TARGET_OFFLOAD} |
d77de738 ML |
3338 | |
3339 | @item @emph{Reference}: | |
8bd11fa4 | 3340 | @uref{https://www.openmp.org, OpenMP specification v5.2}, Section 21.2.7 |
d77de738 ML |
3341 | @end table |
3342 | ||
3343 | ||
3344 | ||
3345 | @node OMP_DYNAMIC | |
3346 | @section @env{OMP_DYNAMIC} -- Dynamic adjustment of threads | |
3347 | @cindex Environment Variable | |
3348 | @table @asis | |
2cd0689a TB |
3349 | @item @emph{ICV:} @var{dyn-var} |
3350 | @item @emph{Scope:} global | |
d77de738 ML |
3351 | @item @emph{Description}: |
3352 | Enable or disable the dynamic adjustment of the number of threads | |
3353 | within a team. The value of this environment variable shall be | |
3354 | @code{TRUE} or @code{FALSE}. If undefined, dynamic adjustment is | |
3355 | disabled by default. | |
3356 | ||
3357 | @item @emph{See also}: | |
3358 | @ref{omp_set_dynamic} | |
3359 | ||
3360 | @item @emph{Reference}: | |
3361 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.3 | |
3362 | @end table | |
3363 | ||
3364 | ||
3365 | ||
3366 | @node OMP_MAX_ACTIVE_LEVELS | |
3367 | @section @env{OMP_MAX_ACTIVE_LEVELS} -- Set the maximum number of nested parallel regions | |
3368 | @cindex Environment Variable | |
3369 | @table @asis | |
2cd0689a TB |
3370 | @item @emph{ICV:} @var{max-active-levels-var} |
3371 | @item @emph{Scope:} data environment | |
d77de738 ML |
3372 | @item @emph{Description}: |
3373 | Specifies the initial value for the maximum number of nested parallel | |
3374 | regions. The value of this variable shall be a positive integer. | |
3375 | If undefined, then if @env{OMP_NESTED} is defined and set to true, or | |
3376 | if @env{OMP_NUM_THREADS} or @env{OMP_PROC_BIND} are defined and set to | |
3377 | a list with more than one item, the maximum number of nested parallel | |
15886c03 TB |
3378 | regions is initialized to the largest number supported, otherwise |
3379 | it is set to one. | |
d77de738 ML |
3380 | |
3381 | @item @emph{See also}: | |
2cd0689a TB |
3382 | @ref{omp_set_max_active_levels}, @ref{OMP_NESTED}, @ref{OMP_PROC_BIND}, |
3383 | @ref{OMP_NUM_THREADS} | |
3384 | ||
d77de738 ML |
3385 | |
3386 | @item @emph{Reference}: | |
3387 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.9 | |
3388 | @end table | |
3389 | ||
3390 | ||
3391 | ||
3392 | @node OMP_MAX_TASK_PRIORITY | |
3393 | @section @env{OMP_MAX_TASK_PRIORITY} -- Set the maximum priority | |
3394 | number that can be set for a task. | |
3395 | @cindex Environment Variable | |
3396 | @table @asis | |
2cd0689a TB |
3397 | @item @emph{ICV:} @var{max-task-priority-var} |
3398 | @item @emph{Scope:} global | |
d77de738 ML |
3399 | @item @emph{Description}: |
3400 | Specifies the initial value for the maximum priority value that can be | |
3401 | set for a task. The value of this variable shall be a non-negative | |
3402 | integer, and zero is allowed. If undefined, the default priority is | |
3403 | 0. | |
3404 | ||
3405 | @item @emph{See also}: | |
3406 | @ref{omp_get_max_task_priority} | |
3407 | ||
3408 | @item @emph{Reference}: | |
3409 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.14 | |
3410 | @end table | |
3411 | ||
3412 | ||
3413 | ||
3414 | @node OMP_NESTED | |
3415 | @section @env{OMP_NESTED} -- Nested parallel regions | |
3416 | @cindex Environment Variable | |
3417 | @cindex Implementation specific setting | |
3418 | @table @asis | |
2cd0689a TB |
3419 | @item @emph{ICV:} @var{max-active-levels-var} |
3420 | @item @emph{Scope:} data environment | |
d77de738 ML |
3421 | @item @emph{Description}: |
3422 | Enable or disable nested parallel regions, i.e., whether team members | |
3423 | are allowed to create new teams. The value of this environment variable | |
3424 | shall be @code{TRUE} or @code{FALSE}. If set to @code{TRUE}, the number | |
15886c03 TB |
3425 | of maximum active nested regions supported is by default set to the |
3426 | maximum supported, otherwise it is set to one. If | |
3427 | @env{OMP_MAX_ACTIVE_LEVELS} is defined, its setting overrides this | |
d77de738 ML |
3428 | setting. If both are undefined, nested parallel regions are enabled if |
3429 | @env{OMP_NUM_THREADS} or @env{OMP_PROC_BINDS} are defined to a list with | |
3430 | more than one item, otherwise they are disabled by default. | |
3431 | ||
2cd0689a TB |
3432 | Note that the @code{OMP_NESTED} environment variable was deprecated in |
3433 | the OpenMP specification 5.2 in favor of @code{OMP_MAX_ACTIVE_LEVELS}. | |
3434 | ||
d77de738 | 3435 | @item @emph{See also}: |
2cd0689a TB |
3436 | @ref{omp_set_max_active_levels}, @ref{omp_set_nested}, |
3437 | @ref{OMP_MAX_ACTIVE_LEVELS} | |
d77de738 ML |
3438 | |
3439 | @item @emph{Reference}: | |
3440 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.6 | |
3441 | @end table | |
3442 | ||
3443 | ||
3444 | ||
3445 | @node OMP_NUM_TEAMS | |
3446 | @section @env{OMP_NUM_TEAMS} -- Specifies the number of teams to use by teams region | |
3447 | @cindex Environment Variable | |
3448 | @table @asis | |
2cd0689a TB |
3449 | @item @emph{ICV:} @var{nteams-var} |
3450 | @item @emph{Scope:} device | |
d77de738 ML |
3451 | @item @emph{Description}: |
3452 | Specifies the upper bound for number of teams to use in teams regions | |
3453 | without explicit @code{num_teams} clause. The value of this variable shall | |
3454 | be a positive integer. If undefined it defaults to 0 which means | |
3455 | implementation defined upper bound. | |
3456 | ||
3457 | @item @emph{See also}: | |
3458 | @ref{omp_set_num_teams} | |
3459 | ||
3460 | @item @emph{Reference}: | |
3461 | @uref{https://www.openmp.org, OpenMP specification v5.1}, Section 6.23 | |
3462 | @end table | |
3463 | ||
3464 | ||
3465 | ||
3466 | @node OMP_NUM_THREADS | |
3467 | @section @env{OMP_NUM_THREADS} -- Specifies the number of threads to use | |
3468 | @cindex Environment Variable | |
3469 | @cindex Implementation specific setting | |
3470 | @table @asis | |
2cd0689a TB |
3471 | @item @emph{ICV:} @var{nthreads-var} |
3472 | @item @emph{Scope:} data environment | |
d77de738 ML |
3473 | @item @emph{Description}: |
3474 | Specifies the default number of threads to use in parallel regions. The | |
3475 | value of this variable shall be a comma-separated list of positive integers; | |
3476 | the value specifies the number of threads to use for the corresponding nested | |
15886c03 | 3477 | level. Specifying more than one item in the list automatically enables |
d77de738 ML |
3478 | nesting by default. If undefined one thread per CPU is used. |
3479 | ||
2cd0689a TB |
3480 | When a list with more than value is specified, it also affects the |
3481 | @var{max-active-levels-var} ICV as described in @ref{OMP_MAX_ACTIVE_LEVELS}. | |
3482 | ||
d77de738 | 3483 | @item @emph{See also}: |
2cd0689a | 3484 | @ref{omp_set_num_threads}, @ref{OMP_MAX_ACTIVE_LEVELS} |
d77de738 ML |
3485 | |
3486 | @item @emph{Reference}: | |
3487 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.2 | |
3488 | @end table | |
3489 | ||
3490 | ||
3491 | ||
3492 | @node OMP_PROC_BIND | |
0b9bd33d | 3493 | @section @env{OMP_PROC_BIND} -- Whether threads may be moved between CPUs |
d77de738 ML |
3494 | @cindex Environment Variable |
3495 | @table @asis | |
2cd0689a TB |
3496 | @item @emph{ICV:} @var{bind-var} |
3497 | @item @emph{Scope:} data environment | |
d77de738 ML |
3498 | @item @emph{Description}: |
3499 | Specifies whether threads may be moved between processors. If set to | |
0b9bd33d | 3500 | @code{TRUE}, OpenMP threads should not be moved; if set to @code{FALSE} |
d77de738 ML |
3501 | they may be moved. Alternatively, a comma separated list with the |
3502 | values @code{PRIMARY}, @code{MASTER}, @code{CLOSE} and @code{SPREAD} can | |
3503 | be used to specify the thread affinity policy for the corresponding nesting | |
3504 | level. With @code{PRIMARY} and @code{MASTER} the worker threads are in the | |
3505 | same place partition as the primary thread. With @code{CLOSE} those are | |
3506 | kept close to the primary thread in contiguous place partitions. And | |
3507 | with @code{SPREAD} a sparse distribution | |
3508 | across the place partitions is used. Specifying more than one item in the | |
15886c03 | 3509 | list automatically enables nesting by default. |
d77de738 | 3510 | |
2cd0689a TB |
3511 | When a list is specified, it also affects the @var{max-active-levels-var} ICV |
3512 | as described in @ref{OMP_MAX_ACTIVE_LEVELS}. | |
3513 | ||
d77de738 ML |
3514 | When undefined, @env{OMP_PROC_BIND} defaults to @code{TRUE} when |
3515 | @env{OMP_PLACES} or @env{GOMP_CPU_AFFINITY} is set and @code{FALSE} otherwise. | |
3516 | ||
3517 | @item @emph{See also}: | |
2cd0689a TB |
3518 | @ref{omp_get_proc_bind}, @ref{GOMP_CPU_AFFINITY}, @ref{OMP_PLACES}, |
3519 | @ref{OMP_MAX_ACTIVE_LEVELS} | |
d77de738 ML |
3520 | |
3521 | @item @emph{Reference}: | |
3522 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.4 | |
3523 | @end table | |
3524 | ||
3525 | ||
3526 | ||
3527 | @node OMP_PLACES | |
0b9bd33d | 3528 | @section @env{OMP_PLACES} -- Specifies on which CPUs the threads should be placed |
d77de738 ML |
3529 | @cindex Environment Variable |
3530 | @table @asis | |
2cd0689a TB |
3531 | @item @emph{ICV:} @var{place-partition-var} |
3532 | @item @emph{Scope:} implicit tasks | |
d77de738 ML |
3533 | @item @emph{Description}: |
3534 | The thread placement can be either specified using an abstract name or by an | |
3535 | explicit list of the places. The abstract names @code{threads}, @code{cores}, | |
3536 | @code{sockets}, @code{ll_caches} and @code{numa_domains} can be optionally | |
3537 | followed by a positive number in parentheses, which denotes the how many places | |
3538 | shall be created. With @code{threads} each place corresponds to a single | |
3539 | hardware thread; @code{cores} to a single core with the corresponding number of | |
3540 | hardware threads; with @code{sockets} the place corresponds to a single | |
3541 | socket; with @code{ll_caches} to a set of cores that shares the last level | |
3542 | cache on the device; and @code{numa_domains} to a set of cores for which their | |
3543 | closest memory on the device is the same memory and at a similar distance from | |
3544 | the cores. The resulting placement can be shown by setting the | |
3545 | @env{OMP_DISPLAY_ENV} environment variable. | |
3546 | ||
3547 | Alternatively, the placement can be specified explicitly as comma-separated | |
3548 | list of places. A place is specified by set of nonnegative numbers in curly | |
3549 | braces, denoting the hardware threads. The curly braces can be omitted | |
3550 | when only a single number has been specified. The hardware threads | |
3551 | belonging to a place can either be specified as comma-separated list of | |
3552 | nonnegative thread numbers or using an interval. Multiple places can also be | |
3553 | either specified by a comma-separated list of places or by an interval. To | |
3554 | specify an interval, a colon followed by the count is placed after | |
3555 | the hardware thread number or the place. Optionally, the length can be | |
3556 | followed by a colon and the stride number -- otherwise a unit stride is | |
3557 | assumed. Placing an exclamation mark (@code{!}) directly before a curly | |
15886c03 TB |
3558 | brace or numbers inside the curly braces (excluding intervals) |
3559 | excludes those hardware threads. | |
d77de738 ML |
3560 | |
3561 | For instance, the following specifies the same places list: | |
3562 | @code{"@{0,1,2@}, @{3,4,6@}, @{7,8,9@}, @{10,11,12@}"}; | |
3563 | @code{"@{0:3@}, @{3:3@}, @{7:3@}, @{10:3@}"}; and @code{"@{0:2@}:4:3"}. | |
3564 | ||
3565 | If @env{OMP_PLACES} and @env{GOMP_CPU_AFFINITY} are unset and | |
3566 | @env{OMP_PROC_BIND} is either unset or @code{false}, threads may be moved | |
3567 | between CPUs following no placement policy. | |
3568 | ||
3569 | @item @emph{See also}: | |
3570 | @ref{OMP_PROC_BIND}, @ref{GOMP_CPU_AFFINITY}, @ref{omp_get_proc_bind}, | |
3571 | @ref{OMP_DISPLAY_ENV} | |
3572 | ||
3573 | @item @emph{Reference}: | |
3574 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.5 | |
3575 | @end table | |
3576 | ||
3577 | ||
3578 | ||
3579 | @node OMP_STACKSIZE | |
3580 | @section @env{OMP_STACKSIZE} -- Set default thread stack size | |
3581 | @cindex Environment Variable | |
3582 | @table @asis | |
2cd0689a TB |
3583 | @item @emph{ICV:} @var{stacksize-var} |
3584 | @item @emph{Scope:} device | |
d77de738 ML |
3585 | @item @emph{Description}: |
3586 | Set the default thread stack size in kilobytes, unless the number | |
3587 | is suffixed by @code{B}, @code{K}, @code{M} or @code{G}, in which | |
3588 | case the size is, respectively, in bytes, kilobytes, megabytes | |
3589 | or gigabytes. This is different from @code{pthread_attr_setstacksize} | |
3590 | which gets the number of bytes as an argument. If the stack size cannot | |
3591 | be set due to system constraints, an error is reported and the initial | |
3592 | stack size is left unchanged. If undefined, the stack size is system | |
3593 | dependent. | |
3594 | ||
2cd0689a TB |
3595 | @item @emph{See also}: |
3596 | @ref{GOMP_STACKSIZE} | |
3597 | ||
d77de738 ML |
3598 | @item @emph{Reference}: |
3599 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.7 | |
3600 | @end table | |
3601 | ||
3602 | ||
3603 | ||
3604 | @node OMP_SCHEDULE | |
3605 | @section @env{OMP_SCHEDULE} -- How threads are scheduled | |
3606 | @cindex Environment Variable | |
3607 | @cindex Implementation specific setting | |
3608 | @table @asis | |
2cd0689a TB |
3609 | @item @emph{ICV:} @var{run-sched-var} |
3610 | @item @emph{Scope:} data environment | |
d77de738 ML |
3611 | @item @emph{Description}: |
3612 | Allows to specify @code{schedule type} and @code{chunk size}. | |
3613 | The value of the variable shall have the form: @code{type[,chunk]} where | |
3614 | @code{type} is one of @code{static}, @code{dynamic}, @code{guided} or @code{auto} | |
3615 | The optional @code{chunk} size shall be a positive integer. If undefined, | |
3616 | dynamic scheduling and a chunk size of 1 is used. | |
3617 | ||
3618 | @item @emph{See also}: | |
3619 | @ref{omp_set_schedule} | |
3620 | ||
3621 | @item @emph{Reference}: | |
3622 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Sections 2.7.1.1 and 4.1 | |
3623 | @end table | |
3624 | ||
3625 | ||
3626 | ||
3627 | @node OMP_TARGET_OFFLOAD | |
bc238c40 | 3628 | @section @env{OMP_TARGET_OFFLOAD} -- Controls offloading behavior |
d77de738 ML |
3629 | @cindex Environment Variable |
3630 | @cindex Implementation specific setting | |
3631 | @table @asis | |
2cd0689a TB |
3632 | @item @emph{ICV:} @var{target-offload-var} |
3633 | @item @emph{Scope:} global | |
d77de738 | 3634 | @item @emph{Description}: |
bc238c40 | 3635 | Specifies the behavior with regard to offloading code to a device. This |
d77de738 ML |
3636 | variable can be set to one of three values - @code{MANDATORY}, @code{DISABLED} |
3637 | or @code{DEFAULT}. | |
3638 | ||
15886c03 | 3639 | If set to @code{MANDATORY}, the program terminates with an error if |
8bd11fa4 TB |
3640 | any device construct or device memory routine uses a device that is unavailable |
3641 | or not supported by the implementation, or uses a non-conforming device number. | |
15886c03 TB |
3642 | If set to @code{DISABLED}, then offloading is disabled and all code runs on |
3643 | the host. If set to @code{DEFAULT}, the program tries offloading to the | |
3644 | device first, then falls back to running code on the host if it cannot. | |
d77de738 | 3645 | |
15886c03 | 3646 | If undefined, then the program behaves as if @code{DEFAULT} was set. |
d77de738 | 3647 | |
15886c03 | 3648 | Note: Even with @code{MANDATORY}, no run-time termination is performed when |
8bd11fa4 TB |
3649 | the device number in a @code{device} clause or argument to a device memory |
3650 | routine is for host, which includes using the device number in the | |
3651 | @var{default-device-var} ICV. However, the initial value of | |
3652 | the @var{default-device-var} ICV is affected by @code{MANDATORY}. | |
3653 | ||
3654 | @item @emph{See also}: | |
3655 | @ref{OMP_DEFAULT_DEVICE} | |
3656 | ||
d77de738 | 3657 | @item @emph{Reference}: |
8bd11fa4 | 3658 | @uref{https://www.openmp.org, OpenMP specification v5.2}, Section 21.2.8 |
d77de738 ML |
3659 | @end table |
3660 | ||
3661 | ||
3662 | ||
3663 | @node OMP_TEAMS_THREAD_LIMIT | |
3664 | @section @env{OMP_TEAMS_THREAD_LIMIT} -- Set the maximum number of threads imposed by teams | |
3665 | @cindex Environment Variable | |
3666 | @table @asis | |
2cd0689a TB |
3667 | @item @emph{ICV:} @var{teams-thread-limit-var} |
3668 | @item @emph{Scope:} device | |
d77de738 ML |
3669 | @item @emph{Description}: |
3670 | Specifies an upper bound for the number of threads to use by each contention | |
3671 | group created by a teams construct without explicit @code{thread_limit} | |
3672 | clause. The value of this variable shall be a positive integer. If undefined, | |
3673 | the value of 0 is used which stands for an implementation defined upper | |
3674 | limit. | |
3675 | ||
3676 | @item @emph{See also}: | |
3677 | @ref{OMP_THREAD_LIMIT}, @ref{omp_set_teams_thread_limit} | |
3678 | ||
3679 | @item @emph{Reference}: | |
3680 | @uref{https://www.openmp.org, OpenMP specification v5.1}, Section 6.24 | |
3681 | @end table | |
3682 | ||
3683 | ||
3684 | ||
3685 | @node OMP_THREAD_LIMIT | |
3686 | @section @env{OMP_THREAD_LIMIT} -- Set the maximum number of threads | |
3687 | @cindex Environment Variable | |
3688 | @table @asis | |
2cd0689a TB |
3689 | @item @emph{ICV:} @var{thread-limit-var} |
3690 | @item @emph{Scope:} data environment | |
d77de738 ML |
3691 | @item @emph{Description}: |
3692 | Specifies the number of threads to use for the whole program. The | |
3693 | value of this variable shall be a positive integer. If undefined, | |
3694 | the number of threads is not limited. | |
3695 | ||
3696 | @item @emph{See also}: | |
3697 | @ref{OMP_NUM_THREADS}, @ref{omp_get_thread_limit} | |
3698 | ||
3699 | @item @emph{Reference}: | |
3700 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.10 | |
3701 | @end table | |
3702 | ||
3703 | ||
3704 | ||
3705 | @node OMP_WAIT_POLICY | |
3706 | @section @env{OMP_WAIT_POLICY} -- How waiting threads are handled | |
3707 | @cindex Environment Variable | |
3708 | @table @asis | |
3709 | @item @emph{Description}: | |
3710 | Specifies whether waiting threads should be active or passive. If | |
3711 | the value is @code{PASSIVE}, waiting threads should not consume CPU | |
3712 | power while waiting; while the value is @code{ACTIVE} specifies that | |
3713 | they should. If undefined, threads wait actively for a short time | |
3714 | before waiting passively. | |
3715 | ||
3716 | @item @emph{See also}: | |
3717 | @ref{GOMP_SPINCOUNT} | |
3718 | ||
3719 | @item @emph{Reference}: | |
3720 | @uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.8 | |
3721 | @end table | |
3722 | ||
3723 | ||
3724 | ||
3725 | @node GOMP_CPU_AFFINITY | |
3726 | @section @env{GOMP_CPU_AFFINITY} -- Bind threads to specific CPUs | |
3727 | @cindex Environment Variable | |
3728 | @table @asis | |
3729 | @item @emph{Description}: | |
3730 | Binds threads to specific CPUs. The variable should contain a space-separated | |
3731 | or comma-separated list of CPUs. This list may contain different kinds of | |
3732 | entries: either single CPU numbers in any order, a range of CPUs (M-N) | |
3733 | or a range with some stride (M-N:S). CPU numbers are zero based. For example, | |
15886c03 | 3734 | @code{GOMP_CPU_AFFINITY="0 3 1-2 4-15:2"} binds the initial thread |
d77de738 ML |
3735 | to CPU 0, the second to CPU 3, the third to CPU 1, the fourth to |
3736 | CPU 2, the fifth to CPU 4, the sixth through tenth to CPUs 6, 8, 10, 12, | |
15886c03 | 3737 | and 14 respectively and then starts assigning back from the beginning of |
d77de738 ML |
3738 | the list. @code{GOMP_CPU_AFFINITY=0} binds all threads to CPU 0. |
3739 | ||
3740 | There is no libgomp library routine to determine whether a CPU affinity | |
3741 | specification is in effect. As a workaround, language-specific library | |
3742 | functions, e.g., @code{getenv} in C or @code{GET_ENVIRONMENT_VARIABLE} in | |
3743 | Fortran, may be used to query the setting of the @code{GOMP_CPU_AFFINITY} | |
3744 | environment variable. A defined CPU affinity on startup cannot be changed | |
3745 | or disabled during the runtime of the application. | |
3746 | ||
3747 | If both @env{GOMP_CPU_AFFINITY} and @env{OMP_PROC_BIND} are set, | |
3748 | @env{OMP_PROC_BIND} has a higher precedence. If neither has been set and | |
3749 | @env{OMP_PROC_BIND} is unset, or when @env{OMP_PROC_BIND} is set to | |
15886c03 | 3750 | @code{FALSE}, the host system handles the assignment of threads to CPUs. |
d77de738 ML |
3751 | |
3752 | @item @emph{See also}: | |
3753 | @ref{OMP_PLACES}, @ref{OMP_PROC_BIND} | |
3754 | @end table | |
3755 | ||
3756 | ||
3757 | ||
3758 | @node GOMP_DEBUG | |
3759 | @section @env{GOMP_DEBUG} -- Enable debugging output | |
3760 | @cindex Environment Variable | |
3761 | @table @asis | |
3762 | @item @emph{Description}: | |
3763 | Enable debugging output. The variable should be set to @code{0} | |
3764 | (disabled, also the default if not set), or @code{1} (enabled). | |
3765 | ||
15886c03 | 3766 | If enabled, some debugging output is printed during execution. |
d77de738 ML |
3767 | This is currently not specified in more detail, and subject to change. |
3768 | @end table | |
3769 | ||
3770 | ||
3771 | ||
3772 | @node GOMP_STACKSIZE | |
3773 | @section @env{GOMP_STACKSIZE} -- Set default thread stack size | |
3774 | @cindex Environment Variable | |
3775 | @cindex Implementation specific setting | |
3776 | @table @asis | |
3777 | @item @emph{Description}: | |
3778 | Set the default thread stack size in kilobytes. This is different from | |
3779 | @code{pthread_attr_setstacksize} which gets the number of bytes as an | |
3780 | argument. If the stack size cannot be set due to system constraints, an | |
3781 | error is reported and the initial stack size is left unchanged. If undefined, | |
3782 | the stack size is system dependent. | |
3783 | ||
3784 | @item @emph{See also}: | |
3785 | @ref{OMP_STACKSIZE} | |
3786 | ||
3787 | @item @emph{Reference}: | |
3788 | @uref{https://gcc.gnu.org/ml/gcc-patches/2006-06/msg00493.html, | |
3789 | GCC Patches Mailinglist}, | |
3790 | @uref{https://gcc.gnu.org/ml/gcc-patches/2006-06/msg00496.html, | |
3791 | GCC Patches Mailinglist} | |
3792 | @end table | |
3793 | ||
3794 | ||
3795 | ||
3796 | @node GOMP_SPINCOUNT | |
3797 | @section @env{GOMP_SPINCOUNT} -- Set the busy-wait spin count | |
3798 | @cindex Environment Variable | |
3799 | @cindex Implementation specific setting | |
3800 | @table @asis | |
3801 | @item @emph{Description}: | |
3802 | Determines how long a threads waits actively with consuming CPU power | |
3803 | before waiting passively without consuming CPU power. The value may be | |
3804 | either @code{INFINITE}, @code{INFINITY} to always wait actively or an | |
3805 | integer which gives the number of spins of the busy-wait loop. The | |
3806 | integer may optionally be followed by the following suffixes acting | |
3807 | as multiplication factors: @code{k} (kilo, thousand), @code{M} (mega, | |
3808 | million), @code{G} (giga, billion), or @code{T} (tera, trillion). | |
3809 | If undefined, 0 is used when @env{OMP_WAIT_POLICY} is @code{PASSIVE}, | |
3810 | 300,000 is used when @env{OMP_WAIT_POLICY} is undefined and | |
3811 | 30 billion is used when @env{OMP_WAIT_POLICY} is @code{ACTIVE}. | |
3812 | If there are more OpenMP threads than available CPUs, 1000 and 100 | |
3813 | spins are used for @env{OMP_WAIT_POLICY} being @code{ACTIVE} or | |
3814 | undefined, respectively; unless the @env{GOMP_SPINCOUNT} is lower | |
3815 | or @env{OMP_WAIT_POLICY} is @code{PASSIVE}. | |
3816 | ||
3817 | @item @emph{See also}: | |
3818 | @ref{OMP_WAIT_POLICY} | |
3819 | @end table | |
3820 | ||
3821 | ||
3822 | ||
3823 | @node GOMP_RTEMS_THREAD_POOLS | |
3824 | @section @env{GOMP_RTEMS_THREAD_POOLS} -- Set the RTEMS specific thread pools | |
3825 | @cindex Environment Variable | |
3826 | @cindex Implementation specific setting | |
3827 | @table @asis | |
3828 | @item @emph{Description}: | |
3829 | This environment variable is only used on the RTEMS real-time operating system. | |
3830 | It determines the scheduler instance specific thread pools. The format for | |
3831 | @env{GOMP_RTEMS_THREAD_POOLS} is a list of optional | |
3832 | @code{<thread-pool-count>[$<priority>]@@<scheduler-name>} configurations | |
3833 | separated by @code{:} where: | |
3834 | @itemize @bullet | |
3835 | @item @code{<thread-pool-count>} is the thread pool count for this scheduler | |
3836 | instance. | |
3837 | @item @code{$<priority>} is an optional priority for the worker threads of a | |
3838 | thread pool according to @code{pthread_setschedparam}. In case a priority | |
15886c03 | 3839 | value is omitted, then a worker thread inherits the priority of the OpenMP |
d77de738 ML |
3840 | primary thread that created it. The priority of the worker thread is not |
3841 | changed after creation, even if a new OpenMP primary thread using the worker has | |
3842 | a different priority. | |
3843 | @item @code{@@<scheduler-name>} is the scheduler instance name according to the | |
3844 | RTEMS application configuration. | |
3845 | @end itemize | |
3846 | In case no thread pool configuration is specified for a scheduler instance, | |
15886c03 | 3847 | then each OpenMP primary thread of this scheduler instance uses its own |
d77de738 ML |
3848 | dynamically allocated thread pool. To limit the worker thread count of the |
3849 | thread pools, each OpenMP primary thread must call @code{omp_set_num_threads}. | |
3850 | @item @emph{Example}: | |
3851 | Lets suppose we have three scheduler instances @code{IO}, @code{WRK0}, and | |
3852 | @code{WRK1} with @env{GOMP_RTEMS_THREAD_POOLS} set to | |
3853 | @code{"1@@WRK0:3$4@@WRK1"}. Then there are no thread pool restrictions for | |
3854 | scheduler instance @code{IO}. In the scheduler instance @code{WRK0} there is | |
3855 | one thread pool available. Since no priority is specified for this scheduler | |
3856 | instance, the worker thread inherits the priority of the OpenMP primary thread | |
3857 | that created it. In the scheduler instance @code{WRK1} there are three thread | |
3858 | pools available and their worker threads run at priority four. | |
3859 | @end table | |
3860 | ||
3861 | ||
3862 | ||
3863 | @c --------------------------------------------------------------------- | |
3864 | @c Enabling OpenACC | |
3865 | @c --------------------------------------------------------------------- | |
3866 | ||
3867 | @node Enabling OpenACC | |
3868 | @chapter Enabling OpenACC | |
3869 | ||
3870 | To activate the OpenACC extensions for C/C++ and Fortran, the compile-time | |
3871 | flag @option{-fopenacc} must be specified. This enables the OpenACC directive | |
643a5223 TB |
3872 | @samp{#pragma acc} in C/C++ and, in Fortran, the @samp{!$acc} sentinel in free |
3873 | source form and the @samp{c$acc}, @samp{*$acc} and @samp{!$acc} sentinels in | |
3874 | fixed source form. The flag also arranges for automatic linking of the OpenACC | |
3875 | runtime library (@ref{OpenACC Runtime Library Routines}). | |
d77de738 ML |
3876 | |
3877 | See @uref{https://gcc.gnu.org/wiki/OpenACC} for more information. | |
3878 | ||
3879 | A complete description of all OpenACC directives accepted may be found in | |
3880 | the @uref{https://www.openacc.org, OpenACC} Application Programming | |
3881 | Interface manual, version 2.6. | |
3882 | ||
3883 | ||
3884 | ||
3885 | @c --------------------------------------------------------------------- | |
3886 | @c OpenACC Runtime Library Routines | |
3887 | @c --------------------------------------------------------------------- | |
3888 | ||
3889 | @node OpenACC Runtime Library Routines | |
3890 | @chapter OpenACC Runtime Library Routines | |
3891 | ||
3892 | The runtime routines described here are defined by section 3 of the OpenACC | |
3893 | specifications in version 2.6. | |
3894 | They have C linkage, and do not throw exceptions. | |
3895 | Generally, they are available only for the host, with the exception of | |
3896 | @code{acc_on_device}, which is available for both the host and the | |
3897 | acceleration device. | |
3898 | ||
3899 | @menu | |
3900 | * acc_get_num_devices:: Get number of devices for the given device | |
3901 | type. | |
3902 | * acc_set_device_type:: Set type of device accelerator to use. | |
3903 | * acc_get_device_type:: Get type of device accelerator to be used. | |
3904 | * acc_set_device_num:: Set device number to use. | |
3905 | * acc_get_device_num:: Get device number to be used. | |
3906 | * acc_get_property:: Get device property. | |
3907 | * acc_async_test:: Tests for completion of a specific asynchronous | |
3908 | operation. | |
3909 | * acc_async_test_all:: Tests for completion of all asynchronous | |
3910 | operations. | |
3911 | * acc_wait:: Wait for completion of a specific asynchronous | |
3912 | operation. | |
3913 | * acc_wait_all:: Waits for completion of all asynchronous | |
3914 | operations. | |
3915 | * acc_wait_all_async:: Wait for completion of all asynchronous | |
3916 | operations. | |
3917 | * acc_wait_async:: Wait for completion of asynchronous operations. | |
3918 | * acc_init:: Initialize runtime for a specific device type. | |
3919 | * acc_shutdown:: Shuts down the runtime for a specific device | |
3920 | type. | |
3921 | * acc_on_device:: Whether executing on a particular device | |
3922 | * acc_malloc:: Allocate device memory. | |
3923 | * acc_free:: Free device memory. | |
3924 | * acc_copyin:: Allocate device memory and copy host memory to | |
3925 | it. | |
3926 | * acc_present_or_copyin:: If the data is not present on the device, | |
3927 | allocate device memory and copy from host | |
3928 | memory. | |
3929 | * acc_create:: Allocate device memory and map it to host | |
3930 | memory. | |
3931 | * acc_present_or_create:: If the data is not present on the device, | |
3932 | allocate device memory and map it to host | |
3933 | memory. | |
3934 | * acc_copyout:: Copy device memory to host memory. | |
3935 | * acc_delete:: Free device memory. | |
3936 | * acc_update_device:: Update device memory from mapped host memory. | |
3937 | * acc_update_self:: Update host memory from mapped device memory. | |
3938 | * acc_map_data:: Map previously allocated device memory to host | |
3939 | memory. | |
3940 | * acc_unmap_data:: Unmap device memory from host memory. | |
3941 | * acc_deviceptr:: Get device pointer associated with specific | |
3942 | host address. | |
3943 | * acc_hostptr:: Get host pointer associated with specific | |
3944 | device address. | |
3945 | * acc_is_present:: Indicate whether host variable / array is | |
3946 | present on device. | |
3947 | * acc_memcpy_to_device:: Copy host memory to device memory. | |
3948 | * acc_memcpy_from_device:: Copy device memory to host memory. | |
3949 | * acc_attach:: Let device pointer point to device-pointer target. | |
3950 | * acc_detach:: Let device pointer point to host-pointer target. | |
3951 | ||
3952 | API routines for target platforms. | |
3953 | ||
3954 | * acc_get_current_cuda_device:: Get CUDA device handle. | |
3955 | * acc_get_current_cuda_context::Get CUDA context handle. | |
3956 | * acc_get_cuda_stream:: Get CUDA stream handle. | |
3957 | * acc_set_cuda_stream:: Set CUDA stream handle. | |
3958 | ||
3959 | API routines for the OpenACC Profiling Interface. | |
3960 | ||
3961 | * acc_prof_register:: Register callbacks. | |
3962 | * acc_prof_unregister:: Unregister callbacks. | |
3963 | * acc_prof_lookup:: Obtain inquiry functions. | |
3964 | * acc_register_library:: Library registration. | |
3965 | @end menu | |
3966 | ||
3967 | ||
3968 | ||
3969 | @node acc_get_num_devices | |
3970 | @section @code{acc_get_num_devices} -- Get number of devices for given device type | |
3971 | @table @asis | |
3972 | @item @emph{Description} | |
3973 | This function returns a value indicating the number of devices available | |
3974 | for the device type specified in @var{devicetype}. | |
3975 | ||
3976 | @item @emph{C/C++}: | |
3977 | @multitable @columnfractions .20 .80 | |
3978 | @item @emph{Prototype}: @tab @code{int acc_get_num_devices(acc_device_t devicetype);} | |
3979 | @end multitable | |
3980 | ||
3981 | @item @emph{Fortran}: | |
3982 | @multitable @columnfractions .20 .80 | |
3983 | @item @emph{Interface}: @tab @code{integer function acc_get_num_devices(devicetype)} | |
3984 | @item @tab @code{integer(kind=acc_device_kind) devicetype} | |
3985 | @end multitable | |
3986 | ||
3987 | @item @emph{Reference}: | |
3988 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
3989 | 3.2.1. | |
3990 | @end table | |
3991 | ||
3992 | ||
3993 | ||
3994 | @node acc_set_device_type | |
3995 | @section @code{acc_set_device_type} -- Set type of device accelerator to use. | |
3996 | @table @asis | |
3997 | @item @emph{Description} | |
3998 | This function indicates to the runtime library which device type, specified | |
3999 | in @var{devicetype}, to use when executing a parallel or kernels region. | |
4000 | ||
4001 | @item @emph{C/C++}: | |
4002 | @multitable @columnfractions .20 .80 | |
4003 | @item @emph{Prototype}: @tab @code{acc_set_device_type(acc_device_t devicetype);} | |
4004 | @end multitable | |
4005 | ||
4006 | @item @emph{Fortran}: | |
4007 | @multitable @columnfractions .20 .80 | |
4008 | @item @emph{Interface}: @tab @code{subroutine acc_set_device_type(devicetype)} | |
4009 | @item @tab @code{integer(kind=acc_device_kind) devicetype} | |
4010 | @end multitable | |
4011 | ||
4012 | @item @emph{Reference}: | |
4013 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
4014 | 3.2.2. | |
4015 | @end table | |
4016 | ||
4017 | ||
4018 | ||
4019 | @node acc_get_device_type | |
4020 | @section @code{acc_get_device_type} -- Get type of device accelerator to be used. | |
4021 | @table @asis | |
4022 | @item @emph{Description} | |
4023 | This function returns what device type will be used when executing a | |
4024 | parallel or kernels region. | |
4025 | ||
4026 | This function returns @code{acc_device_none} if | |
4027 | @code{acc_get_device_type} is called from | |
4028 | @code{acc_ev_device_init_start}, @code{acc_ev_device_init_end} | |
4029 | callbacks of the OpenACC Profiling Interface (@ref{OpenACC Profiling | |
4030 | Interface}), that is, if the device is currently being initialized. | |
4031 | ||
4032 | @item @emph{C/C++}: | |
4033 | @multitable @columnfractions .20 .80 | |
4034 | @item @emph{Prototype}: @tab @code{acc_device_t acc_get_device_type(void);} | |
4035 | @end multitable | |
4036 | ||
4037 | @item @emph{Fortran}: | |
4038 | @multitable @columnfractions .20 .80 | |
4039 | @item @emph{Interface}: @tab @code{function acc_get_device_type(void)} | |
4040 | @item @tab @code{integer(kind=acc_device_kind) acc_get_device_type} | |
4041 | @end multitable | |
4042 | ||
4043 | @item @emph{Reference}: | |
4044 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
4045 | 3.2.3. | |
4046 | @end table | |
4047 | ||
4048 | ||
4049 | ||
4050 | @node acc_set_device_num | |
4051 | @section @code{acc_set_device_num} -- Set device number to use. | |
4052 | @table @asis | |
4053 | @item @emph{Description} | |
4054 | This function will indicate to the runtime which device number, | |
4055 | specified by @var{devicenum}, associated with the specified device | |
4056 | type @var{devicetype}. | |
4057 | ||
4058 | @item @emph{C/C++}: | |
4059 | @multitable @columnfractions .20 .80 | |
4060 | @item @emph{Prototype}: @tab @code{acc_set_device_num(int devicenum, acc_device_t devicetype);} | |
4061 | @end multitable | |
4062 | ||
4063 | @item @emph{Fortran}: | |
4064 | @multitable @columnfractions .20 .80 | |
4065 | @item @emph{Interface}: @tab @code{subroutine acc_set_device_num(devicenum, devicetype)} | |
4066 | @item @tab @code{integer devicenum} | |
4067 | @item @tab @code{integer(kind=acc_device_kind) devicetype} | |
4068 | @end multitable | |
4069 | ||
4070 | @item @emph{Reference}: | |
4071 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
4072 | 3.2.4. | |
4073 | @end table | |
4074 | ||
4075 | ||
4076 | ||
4077 | @node acc_get_device_num | |
4078 | @section @code{acc_get_device_num} -- Get device number to be used. | |
4079 | @table @asis | |
4080 | @item @emph{Description} | |
4081 | This function returns which device number associated with the specified device | |
4082 | type @var{devicetype}, will be used when executing a parallel or kernels | |
4083 | region. | |
4084 | ||
4085 | @item @emph{C/C++}: | |
4086 | @multitable @columnfractions .20 .80 | |
4087 | @item @emph{Prototype}: @tab @code{int acc_get_device_num(acc_device_t devicetype);} | |
4088 | @end multitable | |
4089 | ||
4090 | @item @emph{Fortran}: | |
4091 | @multitable @columnfractions .20 .80 | |
4092 | @item @emph{Interface}: @tab @code{function acc_get_device_num(devicetype)} | |
4093 | @item @tab @code{integer(kind=acc_device_kind) devicetype} | |
4094 | @item @tab @code{integer acc_get_device_num} | |
4095 | @end multitable | |
4096 | ||
4097 | @item @emph{Reference}: | |
4098 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
4099 | 3.2.5. | |
4100 | @end table | |
4101 | ||
4102 | ||
4103 | ||
4104 | @node acc_get_property | |
4105 | @section @code{acc_get_property} -- Get device property. | |
4106 | @cindex acc_get_property | |
4107 | @cindex acc_get_property_string | |
4108 | @table @asis | |
4109 | @item @emph{Description} | |
4110 | These routines return the value of the specified @var{property} for the | |
4111 | device being queried according to @var{devicenum} and @var{devicetype}. | |
4112 | Integer-valued and string-valued properties are returned by | |
4113 | @code{acc_get_property} and @code{acc_get_property_string} respectively. | |
4114 | The Fortran @code{acc_get_property_string} subroutine returns the string | |
4115 | retrieved in its fourth argument while the remaining entry points are | |
4116 | functions, which pass the return value as their result. | |
4117 | ||
4118 | Note for Fortran, only: the OpenACC technical committee corrected and, hence, | |
4119 | modified the interface introduced in OpenACC 2.6. The kind-value parameter | |
4120 | @code{acc_device_property} has been renamed to @code{acc_device_property_kind} | |
4121 | for consistency and the return type of the @code{acc_get_property} function is | |
4122 | now a @code{c_size_t} integer instead of a @code{acc_device_property} integer. | |
15886c03 | 4123 | The parameter @code{acc_device_property} is still provided, |
d77de738 ML |
4124 | but might be removed in a future version of GCC. |
4125 | ||
4126 | @item @emph{C/C++}: | |
4127 | @multitable @columnfractions .20 .80 | |
4128 | @item @emph{Prototype}: @tab @code{size_t acc_get_property(int devicenum, acc_device_t devicetype, acc_device_property_t property);} | |
4129 | @item @emph{Prototype}: @tab @code{const char *acc_get_property_string(int devicenum, acc_device_t devicetype, acc_device_property_t property);} | |
4130 | @end multitable | |
4131 | ||
4132 | @item @emph{Fortran}: | |
4133 | @multitable @columnfractions .20 .80 | |
4134 | @item @emph{Interface}: @tab @code{function acc_get_property(devicenum, devicetype, property)} | |
4135 | @item @emph{Interface}: @tab @code{subroutine acc_get_property_string(devicenum, devicetype, property, string)} | |
4136 | @item @tab @code{use ISO_C_Binding, only: c_size_t} | |
4137 | @item @tab @code{integer devicenum} | |
4138 | @item @tab @code{integer(kind=acc_device_kind) devicetype} | |
4139 | @item @tab @code{integer(kind=acc_device_property_kind) property} | |
4140 | @item @tab @code{integer(kind=c_size_t) acc_get_property} | |
4141 | @item @tab @code{character(*) string} | |
4142 | @end multitable | |
4143 | ||
4144 | @item @emph{Reference}: | |
4145 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
4146 | 3.2.6. | |
4147 | @end table | |
4148 | ||
4149 | ||
4150 | ||
4151 | @node acc_async_test | |
4152 | @section @code{acc_async_test} -- Test for completion of a specific asynchronous operation. | |
4153 | @table @asis | |
4154 | @item @emph{Description} | |
4155 | This function tests for completion of the asynchronous operation specified | |
15886c03 TB |
4156 | in @var{arg}. In C/C++, a non-zero value is returned to indicate |
4157 | the specified asynchronous operation has completed while Fortran returns | |
4158 | @code{true}. If the asynchronous operation has not completed, C/C++ returns | |
4159 | zero and Fortran returns @code{false}. | |
d77de738 ML |
4160 | |
4161 | @item @emph{C/C++}: | |
4162 | @multitable @columnfractions .20 .80 | |
4163 | @item @emph{Prototype}: @tab @code{int acc_async_test(int arg);} | |
4164 | @end multitable | |
4165 | ||
4166 | @item @emph{Fortran}: | |
4167 | @multitable @columnfractions .20 .80 | |
4168 | @item @emph{Interface}: @tab @code{function acc_async_test(arg)} | |
4169 | @item @tab @code{integer(kind=acc_handle_kind) arg} | |
4170 | @item @tab @code{logical acc_async_test} | |
4171 | @end multitable | |
4172 | ||
4173 | @item @emph{Reference}: | |
4174 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
4175 | 3.2.9. | |
4176 | @end table | |
4177 | ||
4178 | ||
4179 | ||
4180 | @node acc_async_test_all | |
4181 | @section @code{acc_async_test_all} -- Tests for completion of all asynchronous operations. | |
4182 | @table @asis | |
4183 | @item @emph{Description} | |
4184 | This function tests for completion of all asynchronous operations. | |
15886c03 TB |
4185 | In C/C++, a non-zero value is returned to indicate all asynchronous |
4186 | operations have completed while Fortran returns @code{true}. If | |
4187 | any asynchronous operation has not completed, C/C++ returns zero and | |
4188 | Fortran returns @code{false}. | |
d77de738 ML |
4189 | |
4190 | @item @emph{C/C++}: | |
4191 | @multitable @columnfractions .20 .80 | |
4192 | @item @emph{Prototype}: @tab @code{int acc_async_test_all(void);} | |
4193 | @end multitable | |
4194 | ||
4195 | @item @emph{Fortran}: | |
4196 | @multitable @columnfractions .20 .80 | |
4197 | @item @emph{Interface}: @tab @code{function acc_async_test()} | |
4198 | @item @tab @code{logical acc_get_device_num} | |
4199 | @end multitable | |
4200 | ||
4201 | @item @emph{Reference}: | |
4202 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
4203 | 3.2.10. | |
4204 | @end table | |
4205 | ||
4206 | ||
4207 | ||
4208 | @node acc_wait | |
4209 | @section @code{acc_wait} -- Wait for completion of a specific asynchronous operation. | |
4210 | @table @asis | |
4211 | @item @emph{Description} | |
4212 | This function waits for completion of the asynchronous operation | |
4213 | specified in @var{arg}. | |
4214 | ||
4215 | @item @emph{C/C++}: | |
4216 | @multitable @columnfractions .20 .80 | |
4217 | @item @emph{Prototype}: @tab @code{acc_wait(arg);} | |
4218 | @item @emph{Prototype (OpenACC 1.0 compatibility)}: @tab @code{acc_async_wait(arg);} | |
4219 | @end multitable | |
4220 | ||
4221 | @item @emph{Fortran}: | |
4222 | @multitable @columnfractions .20 .80 | |
4223 | @item @emph{Interface}: @tab @code{subroutine acc_wait(arg)} | |
4224 | @item @tab @code{integer(acc_handle_kind) arg} | |
4225 | @item @emph{Interface (OpenACC 1.0 compatibility)}: @tab @code{subroutine acc_async_wait(arg)} | |
4226 | @item @tab @code{integer(acc_handle_kind) arg} | |
4227 | @end multitable | |
4228 | ||
4229 | @item @emph{Reference}: | |
4230 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
4231 | 3.2.11. | |
4232 | @end table | |
4233 | ||
4234 | ||
4235 | ||
4236 | @node acc_wait_all | |
4237 | @section @code{acc_wait_all} -- Waits for completion of all asynchronous operations. | |
4238 | @table @asis | |
4239 | @item @emph{Description} | |
4240 | This function waits for the completion of all asynchronous operations. | |
4241 | ||
4242 | @item @emph{C/C++}: | |
4243 | @multitable @columnfractions .20 .80 | |
4244 | @item @emph{Prototype}: @tab @code{acc_wait_all(void);} | |
4245 | @item @emph{Prototype (OpenACC 1.0 compatibility)}: @tab @code{acc_async_wait_all(void);} | |
4246 | @end multitable | |
4247 | ||
4248 | @item @emph{Fortran}: | |
4249 | @multitable @columnfractions .20 .80 | |
4250 | @item @emph{Interface}: @tab @code{subroutine acc_wait_all()} | |
4251 | @item @emph{Interface (OpenACC 1.0 compatibility)}: @tab @code{subroutine acc_async_wait_all()} | |
4252 | @end multitable | |
4253 | ||
4254 | @item @emph{Reference}: | |
4255 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
4256 | 3.2.13. | |
4257 | @end table | |
4258 | ||
4259 | ||
4260 | ||
4261 | @node acc_wait_all_async | |
4262 | @section @code{acc_wait_all_async} -- Wait for completion of all asynchronous operations. | |
4263 | @table @asis | |
4264 | @item @emph{Description} | |
4265 | This function enqueues a wait operation on the queue @var{async} for any | |
4266 | and all asynchronous operations that have been previously enqueued on | |
4267 | any queue. | |
4268 | ||
4269 | @item @emph{C/C++}: | |
4270 | @multitable @columnfractions .20 .80 | |
4271 | @item @emph{Prototype}: @tab @code{acc_wait_all_async(int async);} | |
4272 | @end multitable | |
4273 | ||
4274 | @item @emph{Fortran}: | |
4275 | @multitable @columnfractions .20 .80 | |
4276 | @item @emph{Interface}: @tab @code{subroutine acc_wait_all_async(async)} | |
4277 | @item @tab @code{integer(acc_handle_kind) async} | |
4278 | @end multitable | |
4279 | ||
4280 | @item @emph{Reference}: | |
4281 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
4282 | 3.2.14. | |
4283 | @end table | |
4284 | ||
4285 | ||
4286 | ||
4287 | @node acc_wait_async | |
4288 | @section @code{acc_wait_async} -- Wait for completion of asynchronous operations. | |
4289 | @table @asis | |
4290 | @item @emph{Description} | |
4291 | This function enqueues a wait operation on queue @var{async} for any and all | |
4292 | asynchronous operations enqueued on queue @var{arg}. | |
4293 | ||
4294 | @item @emph{C/C++}: | |
4295 | @multitable @columnfractions .20 .80 | |
4296 | @item @emph{Prototype}: @tab @code{acc_wait_async(int arg, int async);} | |
4297 | @end multitable | |
4298 | ||
4299 | @item @emph{Fortran}: | |
4300 | @multitable @columnfractions .20 .80 | |
4301 | @item @emph{Interface}: @tab @code{subroutine acc_wait_async(arg, async)} | |
4302 | @item @tab @code{integer(acc_handle_kind) arg, async} | |
4303 | @end multitable | |
4304 | ||
4305 | @item @emph{Reference}: | |
4306 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
4307 | 3.2.12. | |
4308 | @end table | |
4309 | ||
4310 | ||
4311 | ||
4312 | @node acc_init | |
4313 | @section @code{acc_init} -- Initialize runtime for a specific device type. | |
4314 | @table @asis | |
4315 | @item @emph{Description} | |
4316 | This function initializes the runtime for the device type specified in | |
4317 | @var{devicetype}. | |
4318 | ||
4319 | @item @emph{C/C++}: | |
4320 | @multitable @columnfractions .20 .80 | |
4321 | @item @emph{Prototype}: @tab @code{acc_init(acc_device_t devicetype);} | |
4322 | @end multitable | |
4323 | ||
4324 | @item @emph{Fortran}: | |
4325 | @multitable @columnfractions .20 .80 | |
4326 | @item @emph{Interface}: @tab @code{subroutine acc_init(devicetype)} | |
4327 | @item @tab @code{integer(acc_device_kind) devicetype} | |
4328 | @end multitable | |
4329 | ||
4330 | @item @emph{Reference}: | |
4331 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
4332 | 3.2.7. | |
4333 | @end table | |
4334 | ||
4335 | ||
4336 | ||
4337 | @node acc_shutdown | |
4338 | @section @code{acc_shutdown} -- Shuts down the runtime for a specific device type. | |
4339 | @table @asis | |
4340 | @item @emph{Description} | |
4341 | This function shuts down the runtime for the device type specified in | |
4342 | @var{devicetype}. | |
4343 | ||
4344 | @item @emph{C/C++}: | |
4345 | @multitable @columnfractions .20 .80 | |
4346 | @item @emph{Prototype}: @tab @code{acc_shutdown(acc_device_t devicetype);} | |
4347 | @end multitable | |
4348 | ||
4349 | @item @emph{Fortran}: | |
4350 | @multitable @columnfractions .20 .80 | |
4351 | @item @emph{Interface}: @tab @code{subroutine acc_shutdown(devicetype)} | |
4352 | @item @tab @code{integer(acc_device_kind) devicetype} | |
4353 | @end multitable | |
4354 | ||
4355 | @item @emph{Reference}: | |
4356 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
4357 | 3.2.8. | |
4358 | @end table | |
4359 | ||
4360 | ||
4361 | ||
4362 | @node acc_on_device | |
4363 | @section @code{acc_on_device} -- Whether executing on a particular device | |
4364 | @table @asis | |
4365 | @item @emph{Description}: | |
4366 | This function returns whether the program is executing on a particular | |
4367 | device specified in @var{devicetype}. In C/C++ a non-zero value is | |
4368 | returned to indicate the device is executing on the specified device type. | |
15886c03 TB |
4369 | In Fortran, @code{true} is returned. If the program is not executing |
4370 | on the specified device type C/C++ returns zero, while Fortran | |
4371 | returns @code{false}. | |
d77de738 ML |
4372 | |
4373 | @item @emph{C/C++}: | |
4374 | @multitable @columnfractions .20 .80 | |
4375 | @item @emph{Prototype}: @tab @code{acc_on_device(acc_device_t devicetype);} | |
4376 | @end multitable | |
4377 | ||
4378 | @item @emph{Fortran}: | |
4379 | @multitable @columnfractions .20 .80 | |
4380 | @item @emph{Interface}: @tab @code{function acc_on_device(devicetype)} | |
4381 | @item @tab @code{integer(acc_device_kind) devicetype} | |
4382 | @item @tab @code{logical acc_on_device} | |
4383 | @end multitable | |
4384 | ||
4385 | ||
4386 | @item @emph{Reference}: | |
4387 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
4388 | 3.2.17. | |
4389 | @end table | |
4390 | ||
4391 | ||
4392 | ||
4393 | @node acc_malloc | |
4394 | @section @code{acc_malloc} -- Allocate device memory. | |
4395 | @table @asis | |
4396 | @item @emph{Description} | |
4397 | This function allocates @var{len} bytes of device memory. It returns | |
4398 | the device address of the allocated memory. | |
4399 | ||
4400 | @item @emph{C/C++}: | |
4401 | @multitable @columnfractions .20 .80 | |
4402 | @item @emph{Prototype}: @tab @code{d_void* acc_malloc(size_t len);} | |
4403 | @end multitable | |
4404 | ||
4405 | @item @emph{Reference}: | |
4406 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
4407 | 3.2.18. | |
4408 | @end table | |
4409 | ||
4410 | ||
4411 | ||
4412 | @node acc_free | |
4413 | @section @code{acc_free} -- Free device memory. | |
4414 | @table @asis | |
4415 | @item @emph{Description} | |
4416 | Free previously allocated device memory at the device address @code{a}. | |
4417 | ||
4418 | @item @emph{C/C++}: | |
4419 | @multitable @columnfractions .20 .80 | |
4420 | @item @emph{Prototype}: @tab @code{acc_free(d_void *a);} | |
4421 | @end multitable | |
4422 | ||
4423 | @item @emph{Reference}: | |
4424 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
4425 | 3.2.19. | |
4426 | @end table | |
4427 | ||
4428 | ||
4429 | ||
4430 | @node acc_copyin | |
4431 | @section @code{acc_copyin} -- Allocate device memory and copy host memory to it. | |
4432 | @table @asis | |
4433 | @item @emph{Description} | |
4434 | In C/C++, this function allocates @var{len} bytes of device memory | |
4435 | and maps it to the specified host address in @var{a}. The device | |
4436 | address of the newly allocated device memory is returned. | |
4437 | ||
4438 | In Fortran, two (2) forms are supported. In the first form, @var{a} specifies | |
4439 | a contiguous array section. The second form @var{a} specifies a | |
4440 | variable or array element and @var{len} specifies the length in bytes. | |
4441 | ||
4442 | @item @emph{C/C++}: | |
4443 | @multitable @columnfractions .20 .80 | |
4444 | @item @emph{Prototype}: @tab @code{void *acc_copyin(h_void *a, size_t len);} | |
4445 | @item @emph{Prototype}: @tab @code{void *acc_copyin_async(h_void *a, size_t len, int async);} | |
4446 | @end multitable | |
4447 | ||
4448 | @item @emph{Fortran}: | |
4449 | @multitable @columnfractions .20 .80 | |
4450 | @item @emph{Interface}: @tab @code{subroutine acc_copyin(a)} | |
4451 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4452 | @item @emph{Interface}: @tab @code{subroutine acc_copyin(a, len)} | |
4453 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4454 | @item @tab @code{integer len} | |
4455 | @item @emph{Interface}: @tab @code{subroutine acc_copyin_async(a, async)} | |
4456 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4457 | @item @tab @code{integer(acc_handle_kind) :: async} | |
4458 | @item @emph{Interface}: @tab @code{subroutine acc_copyin_async(a, len, async)} | |
4459 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4460 | @item @tab @code{integer len} | |
4461 | @item @tab @code{integer(acc_handle_kind) :: async} | |
4462 | @end multitable | |
4463 | ||
4464 | @item @emph{Reference}: | |
4465 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
4466 | 3.2.20. | |
4467 | @end table | |
4468 | ||
4469 | ||
4470 | ||
4471 | @node acc_present_or_copyin | |
4472 | @section @code{acc_present_or_copyin} -- If the data is not present on the device, allocate device memory and copy from host memory. | |
4473 | @table @asis | |
4474 | @item @emph{Description} | |
4475 | This function tests if the host data specified by @var{a} and of length | |
15886c03 TB |
4476 | @var{len} is present or not. If it is not present, device memory |
4477 | is allocated and the host memory copied. The device address of | |
d77de738 ML |
4478 | the newly allocated device memory is returned. |
4479 | ||
4480 | In Fortran, two (2) forms are supported. In the first form, @var{a} specifies | |
4481 | a contiguous array section. The second form @var{a} specifies a variable or | |
4482 | array element and @var{len} specifies the length in bytes. | |
4483 | ||
4484 | Note that @code{acc_present_or_copyin} and @code{acc_pcopyin} exist for | |
4485 | backward compatibility with OpenACC 2.0; use @ref{acc_copyin} instead. | |
4486 | ||
4487 | @item @emph{C/C++}: | |
4488 | @multitable @columnfractions .20 .80 | |
4489 | @item @emph{Prototype}: @tab @code{void *acc_present_or_copyin(h_void *a, size_t len);} | |
4490 | @item @emph{Prototype}: @tab @code{void *acc_pcopyin(h_void *a, size_t len);} | |
4491 | @end multitable | |
4492 | ||
4493 | @item @emph{Fortran}: | |
4494 | @multitable @columnfractions .20 .80 | |
4495 | @item @emph{Interface}: @tab @code{subroutine acc_present_or_copyin(a)} | |
4496 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4497 | @item @emph{Interface}: @tab @code{subroutine acc_present_or_copyin(a, len)} | |
4498 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4499 | @item @tab @code{integer len} | |
4500 | @item @emph{Interface}: @tab @code{subroutine acc_pcopyin(a)} | |
4501 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4502 | @item @emph{Interface}: @tab @code{subroutine acc_pcopyin(a, len)} | |
4503 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4504 | @item @tab @code{integer len} | |
4505 | @end multitable | |
4506 | ||
4507 | @item @emph{Reference}: | |
4508 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
4509 | 3.2.20. | |
4510 | @end table | |
4511 | ||
4512 | ||
4513 | ||
4514 | @node acc_create | |
4515 | @section @code{acc_create} -- Allocate device memory and map it to host memory. | |
4516 | @table @asis | |
4517 | @item @emph{Description} | |
4518 | This function allocates device memory and maps it to host memory specified | |
4519 | by the host address @var{a} with a length of @var{len} bytes. In C/C++, | |
4520 | the function returns the device address of the allocated device memory. | |
4521 | ||
4522 | In Fortran, two (2) forms are supported. In the first form, @var{a} specifies | |
4523 | a contiguous array section. The second form @var{a} specifies a variable or | |
4524 | array element and @var{len} specifies the length in bytes. | |
4525 | ||
4526 | @item @emph{C/C++}: | |
4527 | @multitable @columnfractions .20 .80 | |
4528 | @item @emph{Prototype}: @tab @code{void *acc_create(h_void *a, size_t len);} | |
4529 | @item @emph{Prototype}: @tab @code{void *acc_create_async(h_void *a, size_t len, int async);} | |
4530 | @end multitable | |
4531 | ||
4532 | @item @emph{Fortran}: | |
4533 | @multitable @columnfractions .20 .80 | |
4534 | @item @emph{Interface}: @tab @code{subroutine acc_create(a)} | |
4535 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4536 | @item @emph{Interface}: @tab @code{subroutine acc_create(a, len)} | |
4537 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4538 | @item @tab @code{integer len} | |
4539 | @item @emph{Interface}: @tab @code{subroutine acc_create_async(a, async)} | |
4540 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4541 | @item @tab @code{integer(acc_handle_kind) :: async} | |
4542 | @item @emph{Interface}: @tab @code{subroutine acc_create_async(a, len, async)} | |
4543 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4544 | @item @tab @code{integer len} | |
4545 | @item @tab @code{integer(acc_handle_kind) :: async} | |
4546 | @end multitable | |
4547 | ||
4548 | @item @emph{Reference}: | |
4549 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
4550 | 3.2.21. | |
4551 | @end table | |
4552 | ||
4553 | ||
4554 | ||
4555 | @node acc_present_or_create | |
4556 | @section @code{acc_present_or_create} -- If the data is not present on the device, allocate device memory and map it to host memory. | |
4557 | @table @asis | |
4558 | @item @emph{Description} | |
4559 | This function tests if the host data specified by @var{a} and of length | |
15886c03 TB |
4560 | @var{len} is present or not. If it is not present, device memory |
4561 | is allocated and mapped to host memory. In C/C++, the device address | |
d77de738 ML |
4562 | of the newly allocated device memory is returned. |
4563 | ||
4564 | In Fortran, two (2) forms are supported. In the first form, @var{a} specifies | |
4565 | a contiguous array section. The second form @var{a} specifies a variable or | |
4566 | array element and @var{len} specifies the length in bytes. | |
4567 | ||
4568 | Note that @code{acc_present_or_create} and @code{acc_pcreate} exist for | |
4569 | backward compatibility with OpenACC 2.0; use @ref{acc_create} instead. | |
4570 | ||
4571 | @item @emph{C/C++}: | |
4572 | @multitable @columnfractions .20 .80 | |
4573 | @item @emph{Prototype}: @tab @code{void *acc_present_or_create(h_void *a, size_t len)} | |
4574 | @item @emph{Prototype}: @tab @code{void *acc_pcreate(h_void *a, size_t len)} | |
4575 | @end multitable | |
4576 | ||
4577 | @item @emph{Fortran}: | |
4578 | @multitable @columnfractions .20 .80 | |
4579 | @item @emph{Interface}: @tab @code{subroutine acc_present_or_create(a)} | |
4580 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4581 | @item @emph{Interface}: @tab @code{subroutine acc_present_or_create(a, len)} | |
4582 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4583 | @item @tab @code{integer len} | |
4584 | @item @emph{Interface}: @tab @code{subroutine acc_pcreate(a)} | |
4585 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4586 | @item @emph{Interface}: @tab @code{subroutine acc_pcreate(a, len)} | |
4587 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4588 | @item @tab @code{integer len} | |
4589 | @end multitable | |
4590 | ||
4591 | @item @emph{Reference}: | |
4592 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
4593 | 3.2.21. | |
4594 | @end table | |
4595 | ||
4596 | ||
4597 | ||
4598 | @node acc_copyout | |
4599 | @section @code{acc_copyout} -- Copy device memory to host memory. | |
4600 | @table @asis | |
4601 | @item @emph{Description} | |
4602 | This function copies mapped device memory to host memory which is specified | |
4603 | by host address @var{a} for a length @var{len} bytes in C/C++. | |
4604 | ||
4605 | In Fortran, two (2) forms are supported. In the first form, @var{a} specifies | |
4606 | a contiguous array section. The second form @var{a} specifies a variable or | |
4607 | array element and @var{len} specifies the length in bytes. | |
4608 | ||
4609 | @item @emph{C/C++}: | |
4610 | @multitable @columnfractions .20 .80 | |
4611 | @item @emph{Prototype}: @tab @code{acc_copyout(h_void *a, size_t len);} | |
4612 | @item @emph{Prototype}: @tab @code{acc_copyout_async(h_void *a, size_t len, int async);} | |
4613 | @item @emph{Prototype}: @tab @code{acc_copyout_finalize(h_void *a, size_t len);} | |
4614 | @item @emph{Prototype}: @tab @code{acc_copyout_finalize_async(h_void *a, size_t len, int async);} | |
4615 | @end multitable | |
4616 | ||
4617 | @item @emph{Fortran}: | |
4618 | @multitable @columnfractions .20 .80 | |
4619 | @item @emph{Interface}: @tab @code{subroutine acc_copyout(a)} | |
4620 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4621 | @item @emph{Interface}: @tab @code{subroutine acc_copyout(a, len)} | |
4622 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4623 | @item @tab @code{integer len} | |
4624 | @item @emph{Interface}: @tab @code{subroutine acc_copyout_async(a, async)} | |
4625 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4626 | @item @tab @code{integer(acc_handle_kind) :: async} | |
4627 | @item @emph{Interface}: @tab @code{subroutine acc_copyout_async(a, len, async)} | |
4628 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4629 | @item @tab @code{integer len} | |
4630 | @item @tab @code{integer(acc_handle_kind) :: async} | |
4631 | @item @emph{Interface}: @tab @code{subroutine acc_copyout_finalize(a)} | |
4632 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4633 | @item @emph{Interface}: @tab @code{subroutine acc_copyout_finalize(a, len)} | |
4634 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4635 | @item @tab @code{integer len} | |
4636 | @item @emph{Interface}: @tab @code{subroutine acc_copyout_finalize_async(a, async)} | |
4637 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4638 | @item @tab @code{integer(acc_handle_kind) :: async} | |
4639 | @item @emph{Interface}: @tab @code{subroutine acc_copyout_finalize_async(a, len, async)} | |
4640 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4641 | @item @tab @code{integer len} | |
4642 | @item @tab @code{integer(acc_handle_kind) :: async} | |
4643 | @end multitable | |
4644 | ||
4645 | @item @emph{Reference}: | |
4646 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
4647 | 3.2.22. | |
4648 | @end table | |
4649 | ||
4650 | ||
4651 | ||
4652 | @node acc_delete | |
4653 | @section @code{acc_delete} -- Free device memory. | |
4654 | @table @asis | |
4655 | @item @emph{Description} | |
4656 | This function frees previously allocated device memory specified by | |
4657 | the device address @var{a} and the length of @var{len} bytes. | |
4658 | ||
4659 | In Fortran, two (2) forms are supported. In the first form, @var{a} specifies | |
4660 | a contiguous array section. The second form @var{a} specifies a variable or | |
4661 | array element and @var{len} specifies the length in bytes. | |
4662 | ||
4663 | @item @emph{C/C++}: | |
4664 | @multitable @columnfractions .20 .80 | |
4665 | @item @emph{Prototype}: @tab @code{acc_delete(h_void *a, size_t len);} | |
4666 | @item @emph{Prototype}: @tab @code{acc_delete_async(h_void *a, size_t len, int async);} | |
4667 | @item @emph{Prototype}: @tab @code{acc_delete_finalize(h_void *a, size_t len);} | |
4668 | @item @emph{Prototype}: @tab @code{acc_delete_finalize_async(h_void *a, size_t len, int async);} | |
4669 | @end multitable | |
4670 | ||
4671 | @item @emph{Fortran}: | |
4672 | @multitable @columnfractions .20 .80 | |
4673 | @item @emph{Interface}: @tab @code{subroutine acc_delete(a)} | |
4674 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4675 | @item @emph{Interface}: @tab @code{subroutine acc_delete(a, len)} | |
4676 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4677 | @item @tab @code{integer len} | |
4678 | @item @emph{Interface}: @tab @code{subroutine acc_delete_async(a, async)} | |
4679 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4680 | @item @tab @code{integer(acc_handle_kind) :: async} | |
4681 | @item @emph{Interface}: @tab @code{subroutine acc_delete_async(a, len, async)} | |
4682 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4683 | @item @tab @code{integer len} | |
4684 | @item @tab @code{integer(acc_handle_kind) :: async} | |
4685 | @item @emph{Interface}: @tab @code{subroutine acc_delete_finalize(a)} | |
4686 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4687 | @item @emph{Interface}: @tab @code{subroutine acc_delete_finalize(a, len)} | |
4688 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4689 | @item @tab @code{integer len} | |
4690 | @item @emph{Interface}: @tab @code{subroutine acc_delete_async_finalize(a, async)} | |
4691 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4692 | @item @tab @code{integer(acc_handle_kind) :: async} | |
4693 | @item @emph{Interface}: @tab @code{subroutine acc_delete_async_finalize(a, len, async)} | |
4694 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4695 | @item @tab @code{integer len} | |
4696 | @item @tab @code{integer(acc_handle_kind) :: async} | |
4697 | @end multitable | |
4698 | ||
4699 | @item @emph{Reference}: | |
4700 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
4701 | 3.2.23. | |
4702 | @end table | |
4703 | ||
4704 | ||
4705 | ||
4706 | @node acc_update_device | |
4707 | @section @code{acc_update_device} -- Update device memory from mapped host memory. | |
4708 | @table @asis | |
4709 | @item @emph{Description} | |
4710 | This function updates the device copy from the previously mapped host memory. | |
4711 | The host memory is specified with the host address @var{a} and a length of | |
4712 | @var{len} bytes. | |
4713 | ||
4714 | In Fortran, two (2) forms are supported. In the first form, @var{a} specifies | |
4715 | a contiguous array section. The second form @var{a} specifies a variable or | |
4716 | array element and @var{len} specifies the length in bytes. | |
4717 | ||
4718 | @item @emph{C/C++}: | |
4719 | @multitable @columnfractions .20 .80 | |
4720 | @item @emph{Prototype}: @tab @code{acc_update_device(h_void *a, size_t len);} | |
4721 | @item @emph{Prototype}: @tab @code{acc_update_device(h_void *a, size_t len, async);} | |
4722 | @end multitable | |
4723 | ||
4724 | @item @emph{Fortran}: | |
4725 | @multitable @columnfractions .20 .80 | |
4726 | @item @emph{Interface}: @tab @code{subroutine acc_update_device(a)} | |
4727 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4728 | @item @emph{Interface}: @tab @code{subroutine acc_update_device(a, len)} | |
4729 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4730 | @item @tab @code{integer len} | |
4731 | @item @emph{Interface}: @tab @code{subroutine acc_update_device_async(a, async)} | |
4732 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4733 | @item @tab @code{integer(acc_handle_kind) :: async} | |
4734 | @item @emph{Interface}: @tab @code{subroutine acc_update_device_async(a, len, async)} | |
4735 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4736 | @item @tab @code{integer len} | |
4737 | @item @tab @code{integer(acc_handle_kind) :: async} | |
4738 | @end multitable | |
4739 | ||
4740 | @item @emph{Reference}: | |
4741 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
4742 | 3.2.24. | |
4743 | @end table | |
4744 | ||
4745 | ||
4746 | ||
4747 | @node acc_update_self | |
4748 | @section @code{acc_update_self} -- Update host memory from mapped device memory. | |
4749 | @table @asis | |
4750 | @item @emph{Description} | |
4751 | This function updates the host copy from the previously mapped device memory. | |
4752 | The host memory is specified with the host address @var{a} and a length of | |
4753 | @var{len} bytes. | |
4754 | ||
4755 | In Fortran, two (2) forms are supported. In the first form, @var{a} specifies | |
4756 | a contiguous array section. The second form @var{a} specifies a variable or | |
4757 | array element and @var{len} specifies the length in bytes. | |
4758 | ||
4759 | @item @emph{C/C++}: | |
4760 | @multitable @columnfractions .20 .80 | |
4761 | @item @emph{Prototype}: @tab @code{acc_update_self(h_void *a, size_t len);} | |
4762 | @item @emph{Prototype}: @tab @code{acc_update_self_async(h_void *a, size_t len, int async);} | |
4763 | @end multitable | |
4764 | ||
4765 | @item @emph{Fortran}: | |
4766 | @multitable @columnfractions .20 .80 | |
4767 | @item @emph{Interface}: @tab @code{subroutine acc_update_self(a)} | |
4768 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4769 | @item @emph{Interface}: @tab @code{subroutine acc_update_self(a, len)} | |
4770 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4771 | @item @tab @code{integer len} | |
4772 | @item @emph{Interface}: @tab @code{subroutine acc_update_self_async(a, async)} | |
4773 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4774 | @item @tab @code{integer(acc_handle_kind) :: async} | |
4775 | @item @emph{Interface}: @tab @code{subroutine acc_update_self_async(a, len, async)} | |
4776 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4777 | @item @tab @code{integer len} | |
4778 | @item @tab @code{integer(acc_handle_kind) :: async} | |
4779 | @end multitable | |
4780 | ||
4781 | @item @emph{Reference}: | |
4782 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
4783 | 3.2.25. | |
4784 | @end table | |
4785 | ||
4786 | ||
4787 | ||
4788 | @node acc_map_data | |
4789 | @section @code{acc_map_data} -- Map previously allocated device memory to host memory. | |
4790 | @table @asis | |
4791 | @item @emph{Description} | |
4792 | This function maps previously allocated device and host memory. The device | |
4793 | memory is specified with the device address @var{d}. The host memory is | |
4794 | specified with the host address @var{h} and a length of @var{len}. | |
4795 | ||
4796 | @item @emph{C/C++}: | |
4797 | @multitable @columnfractions .20 .80 | |
4798 | @item @emph{Prototype}: @tab @code{acc_map_data(h_void *h, d_void *d, size_t len);} | |
4799 | @end multitable | |
4800 | ||
4801 | @item @emph{Reference}: | |
4802 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
4803 | 3.2.26. | |
4804 | @end table | |
4805 | ||
4806 | ||
4807 | ||
4808 | @node acc_unmap_data | |
4809 | @section @code{acc_unmap_data} -- Unmap device memory from host memory. | |
4810 | @table @asis | |
4811 | @item @emph{Description} | |
4812 | This function unmaps previously mapped device and host memory. The latter | |
4813 | specified by @var{h}. | |
4814 | ||
4815 | @item @emph{C/C++}: | |
4816 | @multitable @columnfractions .20 .80 | |
4817 | @item @emph{Prototype}: @tab @code{acc_unmap_data(h_void *h);} | |
4818 | @end multitable | |
4819 | ||
4820 | @item @emph{Reference}: | |
4821 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
4822 | 3.2.27. | |
4823 | @end table | |
4824 | ||
4825 | ||
4826 | ||
4827 | @node acc_deviceptr | |
4828 | @section @code{acc_deviceptr} -- Get device pointer associated with specific host address. | |
4829 | @table @asis | |
4830 | @item @emph{Description} | |
4831 | This function returns the device address that has been mapped to the | |
4832 | host address specified by @var{h}. | |
4833 | ||
4834 | @item @emph{C/C++}: | |
4835 | @multitable @columnfractions .20 .80 | |
4836 | @item @emph{Prototype}: @tab @code{void *acc_deviceptr(h_void *h);} | |
4837 | @end multitable | |
4838 | ||
4839 | @item @emph{Reference}: | |
4840 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
4841 | 3.2.28. | |
4842 | @end table | |
4843 | ||
4844 | ||
4845 | ||
4846 | @node acc_hostptr | |
4847 | @section @code{acc_hostptr} -- Get host pointer associated with specific device address. | |
4848 | @table @asis | |
4849 | @item @emph{Description} | |
4850 | This function returns the host address that has been mapped to the | |
4851 | device address specified by @var{d}. | |
4852 | ||
4853 | @item @emph{C/C++}: | |
4854 | @multitable @columnfractions .20 .80 | |
4855 | @item @emph{Prototype}: @tab @code{void *acc_hostptr(d_void *d);} | |
4856 | @end multitable | |
4857 | ||
4858 | @item @emph{Reference}: | |
4859 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
4860 | 3.2.29. | |
4861 | @end table | |
4862 | ||
4863 | ||
4864 | ||
4865 | @node acc_is_present | |
4866 | @section @code{acc_is_present} -- Indicate whether host variable / array is present on device. | |
4867 | @table @asis | |
4868 | @item @emph{Description} | |
4869 | This function indicates whether the specified host address in @var{a} and a | |
4870 | length of @var{len} bytes is present on the device. In C/C++, a non-zero | |
4871 | value is returned to indicate the presence of the mapped memory on the | |
4872 | device. A zero is returned to indicate the memory is not mapped on the | |
4873 | device. | |
4874 | ||
4875 | In Fortran, two (2) forms are supported. In the first form, @var{a} specifies | |
4876 | a contiguous array section. The second form @var{a} specifies a variable or | |
4877 | array element and @var{len} specifies the length in bytes. If the host | |
4878 | memory is mapped to device memory, then a @code{true} is returned. Otherwise, | |
4879 | a @code{false} is return to indicate the mapped memory is not present. | |
4880 | ||
4881 | @item @emph{C/C++}: | |
4882 | @multitable @columnfractions .20 .80 | |
4883 | @item @emph{Prototype}: @tab @code{int acc_is_present(h_void *a, size_t len);} | |
4884 | @end multitable | |
4885 | ||
4886 | @item @emph{Fortran}: | |
4887 | @multitable @columnfractions .20 .80 | |
4888 | @item @emph{Interface}: @tab @code{function acc_is_present(a)} | |
4889 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4890 | @item @tab @code{logical acc_is_present} | |
4891 | @item @emph{Interface}: @tab @code{function acc_is_present(a, len)} | |
4892 | @item @tab @code{type, dimension(:[,:]...) :: a} | |
4893 | @item @tab @code{integer len} | |
4894 | @item @tab @code{logical acc_is_present} | |
4895 | @end multitable | |
4896 | ||
4897 | @item @emph{Reference}: | |
4898 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
4899 | 3.2.30. | |
4900 | @end table | |
4901 | ||
4902 | ||
4903 | ||
4904 | @node acc_memcpy_to_device | |
4905 | @section @code{acc_memcpy_to_device} -- Copy host memory to device memory. | |
4906 | @table @asis | |
4907 | @item @emph{Description} | |
4908 | This function copies host memory specified by host address of @var{src} to | |
4909 | device memory specified by the device address @var{dest} for a length of | |
4910 | @var{bytes} bytes. | |
4911 | ||
4912 | @item @emph{C/C++}: | |
4913 | @multitable @columnfractions .20 .80 | |
4914 | @item @emph{Prototype}: @tab @code{acc_memcpy_to_device(d_void *dest, h_void *src, size_t bytes);} | |
4915 | @end multitable | |
4916 | ||
4917 | @item @emph{Reference}: | |
4918 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
4919 | 3.2.31. | |
4920 | @end table | |
4921 | ||
4922 | ||
4923 | ||
4924 | @node acc_memcpy_from_device | |
4925 | @section @code{acc_memcpy_from_device} -- Copy device memory to host memory. | |
4926 | @table @asis | |
4927 | @item @emph{Description} | |
4928 | This function copies host memory specified by host address of @var{src} from | |
4929 | device memory specified by the device address @var{dest} for a length of | |
4930 | @var{bytes} bytes. | |
4931 | ||
4932 | @item @emph{C/C++}: | |
4933 | @multitable @columnfractions .20 .80 | |
4934 | @item @emph{Prototype}: @tab @code{acc_memcpy_from_device(d_void *dest, h_void *src, size_t bytes);} | |
4935 | @end multitable | |
4936 | ||
4937 | @item @emph{Reference}: | |
4938 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
4939 | 3.2.32. | |
4940 | @end table | |
4941 | ||
4942 | ||
4943 | ||
4944 | @node acc_attach | |
4945 | @section @code{acc_attach} -- Let device pointer point to device-pointer target. | |
4946 | @table @asis | |
4947 | @item @emph{Description} | |
4948 | This function updates a pointer on the device from pointing to a host-pointer | |
4949 | address to pointing to the corresponding device data. | |
4950 | ||
4951 | @item @emph{C/C++}: | |
4952 | @multitable @columnfractions .20 .80 | |
4953 | @item @emph{Prototype}: @tab @code{acc_attach(h_void **ptr);} | |
4954 | @item @emph{Prototype}: @tab @code{acc_attach_async(h_void **ptr, int async);} | |
4955 | @end multitable | |
4956 | ||
4957 | @item @emph{Reference}: | |
4958 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
4959 | 3.2.34. | |
4960 | @end table | |
4961 | ||
4962 | ||
4963 | ||
4964 | @node acc_detach | |
4965 | @section @code{acc_detach} -- Let device pointer point to host-pointer target. | |
4966 | @table @asis | |
4967 | @item @emph{Description} | |
4968 | This function updates a pointer on the device from pointing to a device-pointer | |
4969 | address to pointing to the corresponding host data. | |
4970 | ||
4971 | @item @emph{C/C++}: | |
4972 | @multitable @columnfractions .20 .80 | |
4973 | @item @emph{Prototype}: @tab @code{acc_detach(h_void **ptr);} | |
4974 | @item @emph{Prototype}: @tab @code{acc_detach_async(h_void **ptr, int async);} | |
4975 | @item @emph{Prototype}: @tab @code{acc_detach_finalize(h_void **ptr);} | |
4976 | @item @emph{Prototype}: @tab @code{acc_detach_finalize_async(h_void **ptr, int async);} | |
4977 | @end multitable | |
4978 | ||
4979 | @item @emph{Reference}: | |
4980 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
4981 | 3.2.35. | |
4982 | @end table | |
4983 | ||
4984 | ||
4985 | ||
4986 | @node acc_get_current_cuda_device | |
4987 | @section @code{acc_get_current_cuda_device} -- Get CUDA device handle. | |
4988 | @table @asis | |
4989 | @item @emph{Description} | |
4990 | This function returns the CUDA device handle. This handle is the same | |
4991 | as used by the CUDA Runtime or Driver API's. | |
4992 | ||
4993 | @item @emph{C/C++}: | |
4994 | @multitable @columnfractions .20 .80 | |
4995 | @item @emph{Prototype}: @tab @code{void *acc_get_current_cuda_device(void);} | |
4996 | @end multitable | |
4997 | ||
4998 | @item @emph{Reference}: | |
4999 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
5000 | A.2.1.1. | |
5001 | @end table | |
5002 | ||
5003 | ||
5004 | ||
5005 | @node acc_get_current_cuda_context | |
5006 | @section @code{acc_get_current_cuda_context} -- Get CUDA context handle. | |
5007 | @table @asis | |
5008 | @item @emph{Description} | |
5009 | This function returns the CUDA context handle. This handle is the same | |
5010 | as used by the CUDA Runtime or Driver API's. | |
5011 | ||
5012 | @item @emph{C/C++}: | |
5013 | @multitable @columnfractions .20 .80 | |
5014 | @item @emph{Prototype}: @tab @code{void *acc_get_current_cuda_context(void);} | |
5015 | @end multitable | |
5016 | ||
5017 | @item @emph{Reference}: | |
5018 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
5019 | A.2.1.2. | |
5020 | @end table | |
5021 | ||
5022 | ||
5023 | ||
5024 | @node acc_get_cuda_stream | |
5025 | @section @code{acc_get_cuda_stream} -- Get CUDA stream handle. | |
5026 | @table @asis | |
5027 | @item @emph{Description} | |
5028 | This function returns the CUDA stream handle for the queue @var{async}. | |
5029 | This handle is the same as used by the CUDA Runtime or Driver API's. | |
5030 | ||
5031 | @item @emph{C/C++}: | |
5032 | @multitable @columnfractions .20 .80 | |
5033 | @item @emph{Prototype}: @tab @code{void *acc_get_cuda_stream(int async);} | |
5034 | @end multitable | |
5035 | ||
5036 | @item @emph{Reference}: | |
5037 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
5038 | A.2.1.3. | |
5039 | @end table | |
5040 | ||
5041 | ||
5042 | ||
5043 | @node acc_set_cuda_stream | |
5044 | @section @code{acc_set_cuda_stream} -- Set CUDA stream handle. | |
5045 | @table @asis | |
5046 | @item @emph{Description} | |
5047 | This function associates the stream handle specified by @var{stream} with | |
5048 | the queue @var{async}. | |
5049 | ||
5050 | This cannot be used to change the stream handle associated with | |
5051 | @code{acc_async_sync}. | |
5052 | ||
5053 | The return value is not specified. | |
5054 | ||
5055 | @item @emph{C/C++}: | |
5056 | @multitable @columnfractions .20 .80 | |
5057 | @item @emph{Prototype}: @tab @code{int acc_set_cuda_stream(int async, void *stream);} | |
5058 | @end multitable | |
5059 | ||
5060 | @item @emph{Reference}: | |
5061 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
5062 | A.2.1.4. | |
5063 | @end table | |
5064 | ||
5065 | ||
5066 | ||
5067 | @node acc_prof_register | |
5068 | @section @code{acc_prof_register} -- Register callbacks. | |
5069 | @table @asis | |
5070 | @item @emph{Description}: | |
5071 | This function registers callbacks. | |
5072 | ||
5073 | @item @emph{C/C++}: | |
5074 | @multitable @columnfractions .20 .80 | |
5075 | @item @emph{Prototype}: @tab @code{void acc_prof_register (acc_event_t, acc_prof_callback, acc_register_t);} | |
5076 | @end multitable | |
5077 | ||
5078 | @item @emph{See also}: | |
5079 | @ref{OpenACC Profiling Interface} | |
5080 | ||
5081 | @item @emph{Reference}: | |
5082 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
5083 | 5.3. | |
5084 | @end table | |
5085 | ||
5086 | ||
5087 | ||
5088 | @node acc_prof_unregister | |
5089 | @section @code{acc_prof_unregister} -- Unregister callbacks. | |
5090 | @table @asis | |
5091 | @item @emph{Description}: | |
5092 | This function unregisters callbacks. | |
5093 | ||
5094 | @item @emph{C/C++}: | |
5095 | @multitable @columnfractions .20 .80 | |
5096 | @item @emph{Prototype}: @tab @code{void acc_prof_unregister (acc_event_t, acc_prof_callback, acc_register_t);} | |
5097 | @end multitable | |
5098 | ||
5099 | @item @emph{See also}: | |
5100 | @ref{OpenACC Profiling Interface} | |
5101 | ||
5102 | @item @emph{Reference}: | |
5103 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
5104 | 5.3. | |
5105 | @end table | |
5106 | ||
5107 | ||
5108 | ||
5109 | @node acc_prof_lookup | |
5110 | @section @code{acc_prof_lookup} -- Obtain inquiry functions. | |
5111 | @table @asis | |
5112 | @item @emph{Description}: | |
5113 | Function to obtain inquiry functions. | |
5114 | ||
5115 | @item @emph{C/C++}: | |
5116 | @multitable @columnfractions .20 .80 | |
5117 | @item @emph{Prototype}: @tab @code{acc_query_fn acc_prof_lookup (const char *);} | |
5118 | @end multitable | |
5119 | ||
5120 | @item @emph{See also}: | |
5121 | @ref{OpenACC Profiling Interface} | |
5122 | ||
5123 | @item @emph{Reference}: | |
5124 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
5125 | 5.3. | |
5126 | @end table | |
5127 | ||
5128 | ||
5129 | ||
5130 | @node acc_register_library | |
5131 | @section @code{acc_register_library} -- Library registration. | |
5132 | @table @asis | |
5133 | @item @emph{Description}: | |
5134 | Function for library registration. | |
5135 | ||
5136 | @item @emph{C/C++}: | |
5137 | @multitable @columnfractions .20 .80 | |
5138 | @item @emph{Prototype}: @tab @code{void acc_register_library (acc_prof_reg, acc_prof_reg, acc_prof_lookup_func);} | |
5139 | @end multitable | |
5140 | ||
5141 | @item @emph{See also}: | |
5142 | @ref{OpenACC Profiling Interface}, @ref{ACC_PROFLIB} | |
5143 | ||
5144 | @item @emph{Reference}: | |
5145 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
5146 | 5.3. | |
5147 | @end table | |
5148 | ||
5149 | ||
5150 | ||
5151 | @c --------------------------------------------------------------------- | |
5152 | @c OpenACC Environment Variables | |
5153 | @c --------------------------------------------------------------------- | |
5154 | ||
5155 | @node OpenACC Environment Variables | |
5156 | @chapter OpenACC Environment Variables | |
5157 | ||
5158 | The variables @env{ACC_DEVICE_TYPE} and @env{ACC_DEVICE_NUM} | |
5159 | are defined by section 4 of the OpenACC specification in version 2.0. | |
5160 | The variable @env{ACC_PROFLIB} | |
5161 | is defined by section 4 of the OpenACC specification in version 2.6. | |
d77de738 ML |
5162 | |
5163 | @menu | |
5164 | * ACC_DEVICE_TYPE:: | |
5165 | * ACC_DEVICE_NUM:: | |
5166 | * ACC_PROFLIB:: | |
d77de738 ML |
5167 | @end menu |
5168 | ||
5169 | ||
5170 | ||
5171 | @node ACC_DEVICE_TYPE | |
5172 | @section @code{ACC_DEVICE_TYPE} | |
5173 | @table @asis | |
67f5d368 TB |
5174 | @item @emph{Description}: |
5175 | Control the default device type to use when executing compute regions. | |
5176 | If unset, the code can be run on any device type, favoring a non-host | |
5177 | device type. | |
5178 | ||
5179 | Supported values in GCC (if compiled in) are | |
5180 | @itemize | |
5181 | @item @code{host} | |
5182 | @item @code{nvidia} | |
5183 | @item @code{radeon} | |
5184 | @end itemize | |
d77de738 ML |
5185 | @item @emph{Reference}: |
5186 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
5187 | 4.1. | |
5188 | @end table | |
5189 | ||
5190 | ||
5191 | ||
5192 | @node ACC_DEVICE_NUM | |
5193 | @section @code{ACC_DEVICE_NUM} | |
5194 | @table @asis | |
67f5d368 TB |
5195 | @item @emph{Description}: |
5196 | Control which device, identified by device number, is the default device. | |
5197 | The value must be a nonnegative integer less than the number of devices. | |
5198 | If unset, device number zero is used. | |
d77de738 ML |
5199 | @item @emph{Reference}: |
5200 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
5201 | 4.2. | |
5202 | @end table | |
5203 | ||
5204 | ||
5205 | ||
5206 | @node ACC_PROFLIB | |
5207 | @section @code{ACC_PROFLIB} | |
5208 | @table @asis | |
67f5d368 TB |
5209 | @item @emph{Description}: |
5210 | Semicolon-separated list of dynamic libraries that are loaded as profiling | |
5211 | libraries. Each library must provide at least the @code{acc_register_library} | |
5212 | routine. Each library file is found as described by the documentation of | |
5213 | @code{dlopen} of your operating system. | |
d77de738 ML |
5214 | @item @emph{See also}: |
5215 | @ref{acc_register_library}, @ref{OpenACC Profiling Interface} | |
5216 | ||
5217 | @item @emph{Reference}: | |
5218 | @uref{https://www.openacc.org, OpenACC specification v2.6}, section | |
5219 | 4.3. | |
5220 | @end table | |
5221 | ||
5222 | ||
5223 | ||
d77de738 ML |
5224 | @c --------------------------------------------------------------------- |
5225 | @c CUDA Streams Usage | |
5226 | @c --------------------------------------------------------------------- | |
5227 | ||
5228 | @node CUDA Streams Usage | |
5229 | @chapter CUDA Streams Usage | |
5230 | ||
5231 | This applies to the @code{nvptx} plugin only. | |
5232 | ||
5233 | The library provides elements that perform asynchronous movement of | |
5234 | data and asynchronous operation of computing constructs. This | |
5235 | asynchronous functionality is implemented by making use of CUDA | |
5236 | streams@footnote{See "Stream Management" in "CUDA Driver API", | |
5237 | TRM-06703-001, Version 5.5, for additional information}. | |
5238 | ||
5239 | The primary means by that the asynchronous functionality is accessed | |
5240 | is through the use of those OpenACC directives which make use of the | |
5241 | @code{async} and @code{wait} clauses. When the @code{async} clause is | |
5242 | first used with a directive, it creates a CUDA stream. If an | |
5243 | @code{async-argument} is used with the @code{async} clause, then the | |
5244 | stream is associated with the specified @code{async-argument}. | |
5245 | ||
5246 | Following the creation of an association between a CUDA stream and the | |
5247 | @code{async-argument} of an @code{async} clause, both the @code{wait} | |
5248 | clause and the @code{wait} directive can be used. When either the | |
5249 | clause or directive is used after stream creation, it creates a | |
5250 | rendezvous point whereby execution waits until all operations | |
5251 | associated with the @code{async-argument}, that is, stream, have | |
5252 | completed. | |
5253 | ||
5254 | Normally, the management of the streams that are created as a result of | |
5255 | using the @code{async} clause, is done without any intervention by the | |
5256 | caller. This implies the association between the @code{async-argument} | |
15886c03 | 5257 | and the CUDA stream is maintained for the lifetime of the program. |
d77de738 ML |
5258 | However, this association can be changed through the use of the library |
5259 | function @code{acc_set_cuda_stream}. When the function | |
5260 | @code{acc_set_cuda_stream} is called, the CUDA stream that was | |
15886c03 | 5261 | originally associated with the @code{async} clause is destroyed. |
d77de738 ML |
5262 | Caution should be taken when changing the association as subsequent |
5263 | references to the @code{async-argument} refer to a different | |
5264 | CUDA stream. | |
5265 | ||
5266 | ||
5267 | ||
5268 | @c --------------------------------------------------------------------- | |
5269 | @c OpenACC Library Interoperability | |
5270 | @c --------------------------------------------------------------------- | |
5271 | ||
5272 | @node OpenACC Library Interoperability | |
5273 | @chapter OpenACC Library Interoperability | |
5274 | ||
5275 | @section Introduction | |
5276 | ||
5277 | The OpenACC library uses the CUDA Driver API, and may interact with | |
5278 | programs that use the Runtime library directly, or another library | |
5279 | based on the Runtime library, e.g., CUBLAS@footnote{See section 2.26, | |
5280 | "Interactions with the CUDA Driver API" in | |
5281 | "CUDA Runtime API", Version 5.5, and section 2.27, "VDPAU | |
5282 | Interoperability", in "CUDA Driver API", TRM-06703-001, Version 5.5, | |
5283 | for additional information on library interoperability.}. | |
5284 | This chapter describes the use cases and what changes are | |
5285 | required in order to use both the OpenACC library and the CUBLAS and Runtime | |
5286 | libraries within a program. | |
5287 | ||
5288 | @section First invocation: NVIDIA CUBLAS library API | |
5289 | ||
5290 | In this first use case (see below), a function in the CUBLAS library is called | |
5291 | prior to any of the functions in the OpenACC library. More specifically, the | |
5292 | function @code{cublasCreate()}. | |
5293 | ||
5294 | When invoked, the function initializes the library and allocates the | |
5295 | hardware resources on the host and the device on behalf of the caller. Once | |
5296 | the initialization and allocation has completed, a handle is returned to the | |
5297 | caller. The OpenACC library also requires initialization and allocation of | |
5298 | hardware resources. Since the CUBLAS library has already allocated the | |
5299 | hardware resources for the device, all that is left to do is to initialize | |
5300 | the OpenACC library and acquire the hardware resources on the host. | |
5301 | ||
5302 | Prior to calling the OpenACC function that initializes the library and | |
5303 | allocate the host hardware resources, you need to acquire the device number | |
5304 | that was allocated during the call to @code{cublasCreate()}. The invoking of the | |
5305 | runtime library function @code{cudaGetDevice()} accomplishes this. Once | |
5306 | acquired, the device number is passed along with the device type as | |
5307 | parameters to the OpenACC library function @code{acc_set_device_num()}. | |
5308 | ||
5309 | Once the call to @code{acc_set_device_num()} has completed, the OpenACC | |
5310 | library uses the context that was created during the call to | |
15886c03 | 5311 | @code{cublasCreate()}. In other words, both libraries share the |
d77de738 ML |
5312 | same context. |
5313 | ||
5314 | @smallexample | |
5315 | /* Create the handle */ | |
5316 | s = cublasCreate(&h); | |
5317 | if (s != CUBLAS_STATUS_SUCCESS) | |
5318 | @{ | |
5319 | fprintf(stderr, "cublasCreate failed %d\n", s); | |
5320 | exit(EXIT_FAILURE); | |
5321 | @} | |
5322 | ||
5323 | /* Get the device number */ | |
5324 | e = cudaGetDevice(&dev); | |
5325 | if (e != cudaSuccess) | |
5326 | @{ | |
5327 | fprintf(stderr, "cudaGetDevice failed %d\n", e); | |
5328 | exit(EXIT_FAILURE); | |
5329 | @} | |
5330 | ||
5331 | /* Initialize OpenACC library and use device 'dev' */ | |
5332 | acc_set_device_num(dev, acc_device_nvidia); | |
5333 | ||
5334 | @end smallexample | |
5335 | @center Use Case 1 | |
5336 | ||
5337 | @section First invocation: OpenACC library API | |
5338 | ||
5339 | In this second use case (see below), a function in the OpenACC library is | |
eda38850 | 5340 | called prior to any of the functions in the CUBLAS library. More specifically, |
d77de738 ML |
5341 | the function @code{acc_set_device_num()}. |
5342 | ||
5343 | In the use case presented here, the function @code{acc_set_device_num()} | |
5344 | is used to both initialize the OpenACC library and allocate the hardware | |
5345 | resources on the host and the device. In the call to the function, the | |
5346 | call parameters specify which device to use and what device | |
5347 | type to use, i.e., @code{acc_device_nvidia}. It should be noted that this | |
5348 | is but one method to initialize the OpenACC library and allocate the | |
5349 | appropriate hardware resources. Other methods are available through the | |
15886c03 | 5350 | use of environment variables and these is discussed in the next section. |
d77de738 ML |
5351 | |
5352 | Once the call to @code{acc_set_device_num()} has completed, other OpenACC | |
5353 | functions can be called as seen with multiple calls being made to | |
5354 | @code{acc_copyin()}. In addition, calls can be made to functions in the | |
5355 | CUBLAS library. In the use case a call to @code{cublasCreate()} is made | |
5356 | subsequent to the calls to @code{acc_copyin()}. | |
5357 | As seen in the previous use case, a call to @code{cublasCreate()} | |
5358 | initializes the CUBLAS library and allocates the hardware resources on the | |
5359 | host and the device. However, since the device has already been allocated, | |
15886c03 | 5360 | @code{cublasCreate()} only initializes the CUBLAS library and allocates |
d77de738 ML |
5361 | the appropriate hardware resources on the host. The context that was created |
5362 | as part of the OpenACC initialization is shared with the CUBLAS library, | |
5363 | similarly to the first use case. | |
5364 | ||
5365 | @smallexample | |
5366 | dev = 0; | |
5367 | ||
5368 | acc_set_device_num(dev, acc_device_nvidia); | |
5369 | ||
5370 | /* Copy the first set to the device */ | |
5371 | d_X = acc_copyin(&h_X[0], N * sizeof (float)); | |
5372 | if (d_X == NULL) | |
5373 | @{ | |
5374 | fprintf(stderr, "copyin error h_X\n"); | |
5375 | exit(EXIT_FAILURE); | |
5376 | @} | |
5377 | ||
5378 | /* Copy the second set to the device */ | |
5379 | d_Y = acc_copyin(&h_Y1[0], N * sizeof (float)); | |
5380 | if (d_Y == NULL) | |
5381 | @{ | |
5382 | fprintf(stderr, "copyin error h_Y1\n"); | |
5383 | exit(EXIT_FAILURE); | |
5384 | @} | |
5385 | ||
5386 | /* Create the handle */ | |
5387 | s = cublasCreate(&h); | |
5388 | if (s != CUBLAS_STATUS_SUCCESS) | |
5389 | @{ | |
5390 | fprintf(stderr, "cublasCreate failed %d\n", s); | |
5391 | exit(EXIT_FAILURE); | |
5392 | @} | |
5393 | ||
5394 | /* Perform saxpy using CUBLAS library function */ | |
5395 | s = cublasSaxpy(h, N, &alpha, d_X, 1, d_Y, 1); | |
5396 | if (s != CUBLAS_STATUS_SUCCESS) | |
5397 | @{ | |
5398 | fprintf(stderr, "cublasSaxpy failed %d\n", s); | |
5399 | exit(EXIT_FAILURE); | |
5400 | @} | |
5401 | ||
5402 | /* Copy the results from the device */ | |
5403 | acc_memcpy_from_device(&h_Y1[0], d_Y, N * sizeof (float)); | |
5404 | ||
5405 | @end smallexample | |
5406 | @center Use Case 2 | |
5407 | ||
5408 | @section OpenACC library and environment variables | |
5409 | ||
5410 | There are two environment variables associated with the OpenACC library | |
5411 | that may be used to control the device type and device number: | |
5412 | @env{ACC_DEVICE_TYPE} and @env{ACC_DEVICE_NUM}, respectively. These two | |
5413 | environment variables can be used as an alternative to calling | |
5414 | @code{acc_set_device_num()}. As seen in the second use case, the device | |
5415 | type and device number were specified using @code{acc_set_device_num()}. | |
5416 | If however, the aforementioned environment variables were set, then the | |
5417 | call to @code{acc_set_device_num()} would not be required. | |
5418 | ||
5419 | ||
5420 | The use of the environment variables is only relevant when an OpenACC function | |
5421 | is called prior to a call to @code{cudaCreate()}. If @code{cudaCreate()} | |
5422 | is called prior to a call to an OpenACC function, then you must call | |
5423 | @code{acc_set_device_num()}@footnote{More complete information | |
5424 | about @env{ACC_DEVICE_TYPE} and @env{ACC_DEVICE_NUM} can be found in | |
5425 | sections 4.1 and 4.2 of the @uref{https://www.openacc.org, OpenACC} | |
5426 | Application Programming Interface”, Version 2.6.} | |
5427 | ||
5428 | ||
5429 | ||
5430 | @c --------------------------------------------------------------------- | |
5431 | @c OpenACC Profiling Interface | |
5432 | @c --------------------------------------------------------------------- | |
5433 | ||
5434 | @node OpenACC Profiling Interface | |
5435 | @chapter OpenACC Profiling Interface | |
5436 | ||
5437 | @section Implementation Status and Implementation-Defined Behavior | |
5438 | ||
5439 | We're implementing the OpenACC Profiling Interface as defined by the | |
5440 | OpenACC 2.6 specification. We're clarifying some aspects here as | |
5441 | @emph{implementation-defined behavior}, while they're still under | |
5442 | discussion within the OpenACC Technical Committee. | |
5443 | ||
5444 | This implementation is tuned to keep the performance impact as low as | |
5445 | possible for the (very common) case that the Profiling Interface is | |
5446 | not enabled. This is relevant, as the Profiling Interface affects all | |
5447 | the @emph{hot} code paths (in the target code, not in the offloaded | |
5448 | code). Users of the OpenACC Profiling Interface can be expected to | |
15886c03 TB |
5449 | understand that performance is impacted to some degree once the |
5450 | Profiling Interface is enabled: for example, because of the | |
d77de738 ML |
5451 | @emph{runtime} (libgomp) calling into a third-party @emph{library} for |
5452 | every event that has been registered. | |
5453 | ||
5454 | We're not yet accounting for the fact that @cite{OpenACC events may | |
5455 | occur during event processing}. | |
5456 | We just handle one case specially, as required by CUDA 9.0 | |
5457 | @command{nvprof}, that @code{acc_get_device_type} | |
5458 | (@ref{acc_get_device_type})) may be called from | |
5459 | @code{acc_ev_device_init_start}, @code{acc_ev_device_init_end} | |
5460 | callbacks. | |
5461 | ||
5462 | We're not yet implementing initialization via a | |
5463 | @code{acc_register_library} function that is either statically linked | |
5464 | in, or dynamically via @env{LD_PRELOAD}. | |
5465 | Initialization via @code{acc_register_library} functions dynamically | |
5466 | loaded via the @env{ACC_PROFLIB} environment variable does work, as | |
5467 | does directly calling @code{acc_prof_register}, | |
5468 | @code{acc_prof_unregister}, @code{acc_prof_lookup}. | |
5469 | ||
5470 | As currently there are no inquiry functions defined, calls to | |
15886c03 | 5471 | @code{acc_prof_lookup} always returns @code{NULL}. |
d77de738 ML |
5472 | |
5473 | There aren't separate @emph{start}, @emph{stop} events defined for the | |
5474 | event types @code{acc_ev_create}, @code{acc_ev_delete}, | |
5475 | @code{acc_ev_alloc}, @code{acc_ev_free}. It's not clear if these | |
5476 | should be triggered before or after the actual device-specific call is | |
5477 | made. We trigger them after. | |
5478 | ||
5479 | Remarks about data provided to callbacks: | |
5480 | ||
5481 | @table @asis | |
5482 | ||
5483 | @item @code{acc_prof_info.event_type} | |
5484 | It's not clear if for @emph{nested} event callbacks (for example, | |
5485 | @code{acc_ev_enqueue_launch_start} as part of a parent compute | |
5486 | construct), this should be set for the nested event | |
5487 | (@code{acc_ev_enqueue_launch_start}), or if the value of the parent | |
5488 | construct should remain (@code{acc_ev_compute_construct_start}). In | |
15886c03 | 5489 | this implementation, the value generally corresponds to the |
d77de738 ML |
5490 | innermost nested event type. |
5491 | ||
5492 | @item @code{acc_prof_info.device_type} | |
5493 | @itemize | |
5494 | ||
5495 | @item | |
5496 | For @code{acc_ev_compute_construct_start}, and in presence of an | |
15886c03 | 5497 | @code{if} clause with @emph{false} argument, this still refers to |
d77de738 ML |
5498 | the offloading device type. |
5499 | It's not clear if that's the expected behavior. | |
5500 | ||
5501 | @item | |
5502 | Complementary to the item before, for | |
5503 | @code{acc_ev_compute_construct_end}, this is set to | |
5504 | @code{acc_device_host} in presence of an @code{if} clause with | |
5505 | @emph{false} argument. | |
5506 | It's not clear if that's the expected behavior. | |
5507 | ||
5508 | @end itemize | |
5509 | ||
5510 | @item @code{acc_prof_info.thread_id} | |
5511 | Always @code{-1}; not yet implemented. | |
5512 | ||
5513 | @item @code{acc_prof_info.async} | |
5514 | @itemize | |
5515 | ||
5516 | @item | |
5517 | Not yet implemented correctly for | |
5518 | @code{acc_ev_compute_construct_start}. | |
5519 | ||
5520 | @item | |
5521 | In a compute construct, for host-fallback | |
15886c03 | 5522 | execution/@code{acc_device_host} it always is |
d77de738 | 5523 | @code{acc_async_sync}. |
15886c03 | 5524 | It is unclear if that is the expected behavior. |
d77de738 ML |
5525 | |
5526 | @item | |
5527 | For @code{acc_ev_device_init_start} and @code{acc_ev_device_init_end}, | |
5528 | it will always be @code{acc_async_sync}. | |
15886c03 | 5529 | It is unclear if that is the expected behavior. |
d77de738 ML |
5530 | |
5531 | @end itemize | |
5532 | ||
5533 | @item @code{acc_prof_info.async_queue} | |
5534 | There is no @cite{limited number of asynchronous queues} in libgomp. | |
15886c03 | 5535 | This always has the same value as @code{acc_prof_info.async}. |
d77de738 ML |
5536 | |
5537 | @item @code{acc_prof_info.src_file} | |
5538 | Always @code{NULL}; not yet implemented. | |
5539 | ||
5540 | @item @code{acc_prof_info.func_name} | |
5541 | Always @code{NULL}; not yet implemented. | |
5542 | ||
5543 | @item @code{acc_prof_info.line_no} | |
5544 | Always @code{-1}; not yet implemented. | |
5545 | ||
5546 | @item @code{acc_prof_info.end_line_no} | |
5547 | Always @code{-1}; not yet implemented. | |
5548 | ||
5549 | @item @code{acc_prof_info.func_line_no} | |
5550 | Always @code{-1}; not yet implemented. | |
5551 | ||
5552 | @item @code{acc_prof_info.func_end_line_no} | |
5553 | Always @code{-1}; not yet implemented. | |
5554 | ||
5555 | @item @code{acc_event_info.event_type}, @code{acc_event_info.*.event_type} | |
5556 | Relating to @code{acc_prof_info.event_type} discussed above, in this | |
5557 | implementation, this will always be the same value as | |
5558 | @code{acc_prof_info.event_type}. | |
5559 | ||
5560 | @item @code{acc_event_info.*.parent_construct} | |
5561 | @itemize | |
5562 | ||
5563 | @item | |
5564 | Will be @code{acc_construct_parallel} for all OpenACC compute | |
5565 | constructs as well as many OpenACC Runtime API calls; should be the | |
5566 | one matching the actual construct, or | |
5567 | @code{acc_construct_runtime_api}, respectively. | |
5568 | ||
5569 | @item | |
5570 | Will be @code{acc_construct_enter_data} or | |
5571 | @code{acc_construct_exit_data} when processing variable mappings | |
5572 | specified in OpenACC @emph{declare} directives; should be | |
5573 | @code{acc_construct_declare}. | |
5574 | ||
5575 | @item | |
5576 | For implicit @code{acc_ev_device_init_start}, | |
5577 | @code{acc_ev_device_init_end}, and explicit as well as implicit | |
5578 | @code{acc_ev_alloc}, @code{acc_ev_free}, | |
5579 | @code{acc_ev_enqueue_upload_start}, @code{acc_ev_enqueue_upload_end}, | |
5580 | @code{acc_ev_enqueue_download_start}, and | |
5581 | @code{acc_ev_enqueue_download_end}, will be | |
5582 | @code{acc_construct_parallel}; should reflect the real parent | |
5583 | construct. | |
5584 | ||
5585 | @end itemize | |
5586 | ||
5587 | @item @code{acc_event_info.*.implicit} | |
5588 | For @code{acc_ev_alloc}, @code{acc_ev_free}, | |
5589 | @code{acc_ev_enqueue_upload_start}, @code{acc_ev_enqueue_upload_end}, | |
5590 | @code{acc_ev_enqueue_download_start}, and | |
5591 | @code{acc_ev_enqueue_download_end}, this currently will be @code{1} | |
5592 | also for explicit usage. | |
5593 | ||
5594 | @item @code{acc_event_info.data_event.var_name} | |
5595 | Always @code{NULL}; not yet implemented. | |
5596 | ||
5597 | @item @code{acc_event_info.data_event.host_ptr} | |
5598 | For @code{acc_ev_alloc}, and @code{acc_ev_free}, this is always | |
5599 | @code{NULL}. | |
5600 | ||
5601 | @item @code{typedef union acc_api_info} | |
5602 | @dots{} as printed in @cite{5.2.3. Third Argument: API-Specific | |
5603 | Information}. This should obviously be @code{typedef @emph{struct} | |
5604 | acc_api_info}. | |
5605 | ||
5606 | @item @code{acc_api_info.device_api} | |
5607 | Possibly not yet implemented correctly for | |
5608 | @code{acc_ev_compute_construct_start}, | |
5609 | @code{acc_ev_device_init_start}, @code{acc_ev_device_init_end}: | |
5610 | will always be @code{acc_device_api_none} for these event types. | |
5611 | For @code{acc_ev_enter_data_start}, it will be | |
5612 | @code{acc_device_api_none} in some cases. | |
5613 | ||
5614 | @item @code{acc_api_info.device_type} | |
5615 | Always the same as @code{acc_prof_info.device_type}. | |
5616 | ||
5617 | @item @code{acc_api_info.vendor} | |
5618 | Always @code{-1}; not yet implemented. | |
5619 | ||
5620 | @item @code{acc_api_info.device_handle} | |
5621 | Always @code{NULL}; not yet implemented. | |
5622 | ||
5623 | @item @code{acc_api_info.context_handle} | |
5624 | Always @code{NULL}; not yet implemented. | |
5625 | ||
5626 | @item @code{acc_api_info.async_handle} | |
5627 | Always @code{NULL}; not yet implemented. | |
5628 | ||
5629 | @end table | |
5630 | ||
5631 | Remarks about certain event types: | |
5632 | ||
5633 | @table @asis | |
5634 | ||
5635 | @item @code{acc_ev_device_init_start}, @code{acc_ev_device_init_end} | |
5636 | @itemize | |
5637 | ||
5638 | @item | |
5639 | @c See 'DEVICE_INIT_INSIDE_COMPUTE_CONSTRUCT' in | |
5640 | @c 'libgomp.oacc-c-c++-common/acc_prof-kernels-1.c', | |
5641 | @c 'libgomp.oacc-c-c++-common/acc_prof-parallel-1.c'. | |
5642 | When a compute construct triggers implicit | |
5643 | @code{acc_ev_device_init_start} and @code{acc_ev_device_init_end} | |
5644 | events, they currently aren't @emph{nested within} the corresponding | |
5645 | @code{acc_ev_compute_construct_start} and | |
5646 | @code{acc_ev_compute_construct_end}, but they're currently observed | |
5647 | @emph{before} @code{acc_ev_compute_construct_start}. | |
5648 | It's not clear what to do: the standard asks us provide a lot of | |
5649 | details to the @code{acc_ev_compute_construct_start} callback, without | |
5650 | (implicitly) initializing a device before? | |
5651 | ||
5652 | @item | |
5653 | Callbacks for these event types will not be invoked for calls to the | |
5654 | @code{acc_set_device_type} and @code{acc_set_device_num} functions. | |
5655 | It's not clear if they should be. | |
5656 | ||
5657 | @end itemize | |
5658 | ||
5659 | @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} | |
5660 | @itemize | |
5661 | ||
5662 | @item | |
5663 | Callbacks for these event types will also be invoked for OpenACC | |
5664 | @emph{host_data} constructs. | |
5665 | It's not clear if they should be. | |
5666 | ||
5667 | @item | |
5668 | Callbacks for these event types will also be invoked when processing | |
5669 | variable mappings specified in OpenACC @emph{declare} directives. | |
5670 | It's not clear if they should be. | |
5671 | ||
5672 | @end itemize | |
5673 | ||
5674 | @end table | |
5675 | ||
5676 | Callbacks for the following event types will be invoked, but dispatch | |
5677 | and information provided therein has not yet been thoroughly reviewed: | |
5678 | ||
5679 | @itemize | |
5680 | @item @code{acc_ev_alloc} | |
5681 | @item @code{acc_ev_free} | |
5682 | @item @code{acc_ev_update_start}, @code{acc_ev_update_end} | |
5683 | @item @code{acc_ev_enqueue_upload_start}, @code{acc_ev_enqueue_upload_end} | |
5684 | @item @code{acc_ev_enqueue_download_start}, @code{acc_ev_enqueue_download_end} | |
5685 | @end itemize | |
5686 | ||
5687 | During device initialization, and finalization, respectively, | |
5688 | callbacks for the following event types will not yet be invoked: | |
5689 | ||
5690 | @itemize | |
5691 | @item @code{acc_ev_alloc} | |
5692 | @item @code{acc_ev_free} | |
5693 | @end itemize | |
5694 | ||
5695 | Callbacks for the following event types have not yet been implemented, | |
5696 | so currently won't be invoked: | |
5697 | ||
5698 | @itemize | |
5699 | @item @code{acc_ev_device_shutdown_start}, @code{acc_ev_device_shutdown_end} | |
5700 | @item @code{acc_ev_runtime_shutdown} | |
5701 | @item @code{acc_ev_create}, @code{acc_ev_delete} | |
5702 | @item @code{acc_ev_wait_start}, @code{acc_ev_wait_end} | |
5703 | @end itemize | |
5704 | ||
5705 | For the following runtime library functions, not all expected | |
5706 | callbacks will be invoked (mostly concerning implicit device | |
5707 | initialization): | |
5708 | ||
5709 | @itemize | |
5710 | @item @code{acc_get_num_devices} | |
5711 | @item @code{acc_set_device_type} | |
5712 | @item @code{acc_get_device_type} | |
5713 | @item @code{acc_set_device_num} | |
5714 | @item @code{acc_get_device_num} | |
5715 | @item @code{acc_init} | |
5716 | @item @code{acc_shutdown} | |
5717 | @end itemize | |
5718 | ||
5719 | Aside from implicit device initialization, for the following runtime | |
5720 | library functions, no callbacks will be invoked for shared-memory | |
5721 | offloading devices (it's not clear if they should be): | |
5722 | ||
5723 | @itemize | |
5724 | @item @code{acc_malloc} | |
5725 | @item @code{acc_free} | |
5726 | @item @code{acc_copyin}, @code{acc_present_or_copyin}, @code{acc_copyin_async} | |
5727 | @item @code{acc_create}, @code{acc_present_or_create}, @code{acc_create_async} | |
5728 | @item @code{acc_copyout}, @code{acc_copyout_async}, @code{acc_copyout_finalize}, @code{acc_copyout_finalize_async} | |
5729 | @item @code{acc_delete}, @code{acc_delete_async}, @code{acc_delete_finalize}, @code{acc_delete_finalize_async} | |
5730 | @item @code{acc_update_device}, @code{acc_update_device_async} | |
5731 | @item @code{acc_update_self}, @code{acc_update_self_async} | |
5732 | @item @code{acc_map_data}, @code{acc_unmap_data} | |
5733 | @item @code{acc_memcpy_to_device}, @code{acc_memcpy_to_device_async} | |
5734 | @item @code{acc_memcpy_from_device}, @code{acc_memcpy_from_device_async} | |
5735 | @end itemize | |
5736 | ||
5737 | @c --------------------------------------------------------------------- | |
5738 | @c OpenMP-Implementation Specifics | |
5739 | @c --------------------------------------------------------------------- | |
5740 | ||
5741 | @node OpenMP-Implementation Specifics | |
5742 | @chapter OpenMP-Implementation Specifics | |
5743 | ||
5744 | @menu | |
2cd0689a | 5745 | * Implementation-defined ICV Initialization:: |
d77de738 | 5746 | * OpenMP Context Selectors:: |
450b05ce | 5747 | * Memory allocation:: |
d77de738 ML |
5748 | @end menu |
5749 | ||
2cd0689a TB |
5750 | @node Implementation-defined ICV Initialization |
5751 | @section Implementation-defined ICV Initialization | |
5752 | @cindex Implementation specific setting | |
5753 | ||
5754 | @multitable @columnfractions .30 .70 | |
5755 | @item @var{affinity-format-var} @tab See @ref{OMP_AFFINITY_FORMAT}. | |
5756 | @item @var{def-allocator-var} @tab See @ref{OMP_ALLOCATOR}. | |
5757 | @item @var{max-active-levels-var} @tab See @ref{OMP_MAX_ACTIVE_LEVELS}. | |
5758 | @item @var{dyn-var} @tab See @ref{OMP_DYNAMIC}. | |
819f3d36 | 5759 | @item @var{nthreads-var} @tab See @ref{OMP_NUM_THREADS}. |
2cd0689a TB |
5760 | @item @var{num-devices-var} @tab Number of non-host devices found |
5761 | by GCC's run-time library | |
5762 | @item @var{num-procs-var} @tab The number of CPU cores on the | |
5763 | initial device, except that affinity settings might lead to a | |
5764 | smaller number. On non-host devices, the value of the | |
5765 | @var{nthreads-var} ICV. | |
5766 | @item @var{place-partition-var} @tab See @ref{OMP_PLACES}. | |
5767 | @item @var{run-sched-var} @tab See @ref{OMP_SCHEDULE}. | |
5768 | @item @var{stacksize-var} @tab See @ref{OMP_STACKSIZE}. | |
5769 | @item @var{thread-limit-var} @tab See @ref{OMP_TEAMS_THREAD_LIMIT} | |
5770 | @item @var{wait-policy-var} @tab See @ref{OMP_WAIT_POLICY} and | |
5771 | @ref{GOMP_SPINCOUNT} | |
5772 | @end multitable | |
5773 | ||
d77de738 ML |
5774 | @node OpenMP Context Selectors |
5775 | @section OpenMP Context Selectors | |
5776 | ||
5777 | @code{vendor} is always @code{gnu}. References are to the GCC manual. | |
5778 | ||
75e3773b TB |
5779 | @c NOTE: Only the following selectors have been implemented. To add |
5780 | @c additional traits for target architecture, TARGET_OMP_DEVICE_KIND_ARCH_ISA | |
5781 | @c has to be implemented; cf. also PR target/105640. | |
5782 | @c For offload devices, add *additionally* gcc/config/*/t-omp-device. | |
5783 | ||
5784 | For the host compiler, @code{kind} always matches @code{host}; for the | |
5785 | offloading architectures AMD GCN and Nvidia PTX, @code{kind} always matches | |
5786 | @code{gpu}. For the x86 family of computers, AMD GCN and Nvidia PTX | |
5787 | the following traits are supported in addition; while OpenMP is supported | |
5788 | on more architectures, GCC currently does not match any @code{arch} or | |
5789 | @code{isa} traits for those. | |
5790 | ||
5791 | @multitable @columnfractions .65 .30 | |
5792 | @headitem @code{arch} @tab @code{isa} | |
d77de738 ML |
5793 | @item @code{x86}, @code{x86_64}, @code{i386}, @code{i486}, |
5794 | @code{i586}, @code{i686}, @code{ia32} | |
d77de738 ML |
5795 | @tab See @code{-m...} flags in ``x86 Options'' (without @code{-m}) |
5796 | @item @code{amdgcn}, @code{gcn} | |
e0b95c2e TB |
5797 | @tab See @code{-march=} in ``AMD GCN Options''@footnote{Additionally, |
5798 | @code{gfx803} is supported as an alias for @code{fiji}.} | |
d77de738 | 5799 | @item @code{nvptx} |
d77de738 ML |
5800 | @tab See @code{-march=} in ``Nvidia PTX Options'' |
5801 | @end multitable | |
5802 | ||
450b05ce TB |
5803 | @node Memory allocation |
5804 | @section Memory allocation | |
d77de738 | 5805 | |
bc238c40 TB |
5806 | The description below applies to: |
5807 | ||
5808 | @itemize | |
5809 | @item Explicit use of the OpenMP API routines, see | |
5810 | @ref{Memory Management Routines}. | |
5811 | @item The @code{allocate} clause, except when the @code{allocator} modifier is a | |
5812 | constant expression with value @code{omp_default_mem_alloc} and no | |
5813 | @code{align} modifier has been specified. (In that case, the normal | |
5814 | @code{malloc} allocation is used.) | |
5815 | @item Using the @code{allocate} directive for automatic/stack variables, except | |
5816 | when the @code{allocator} clause is a constant expression with value | |
5817 | @code{omp_default_mem_alloc} and no @code{align} clause has been | |
5818 | specified. (In that case, the normal allocation is used: stack allocation | |
5819 | and, sometimes for Fortran, also @code{malloc} [depending on flags such as | |
5820 | @option{-fstack-arrays}].) | |
5821 | @item Using the @code{allocate} directive for variable in static memory is | |
5822 | currently not supported (compile time error). | |
d4b6d147 TB |
5823 | @item In Fortran, the @code{allocators} directive and the executable |
5824 | @code{allocate} directive for Fortran pointers and allocatables is | |
5825 | supported, but requires that files containing those directives has to be | |
5826 | compiled with @option{-fopenmp-allocators}. Additionally, all files that | |
5827 | might explicitly or implicitly deallocate memory allocated that way must | |
5828 | also be compiled with that option. | |
bc238c40 TB |
5829 | @end itemize |
5830 | ||
a85a106c TB |
5831 | For the available predefined allocators and, as applicable, their associated |
5832 | predefined memory spaces and for the available traits and their default values, | |
5833 | see @ref{OMP_ALLOCATOR}. Predefined allocators without an associated memory | |
5834 | space use the @code{omp_default_mem_space} memory space. | |
5835 | ||
8c2fc744 TB |
5836 | For the memory spaces, the following applies: |
5837 | @itemize | |
5838 | @item @code{omp_default_mem_space} is supported | |
5839 | @item @code{omp_const_mem_space} maps to @code{omp_default_mem_space} | |
30486fab AS |
5840 | @item @code{omp_low_lat_mem_space} is only available on supported devices, |
5841 | and maps to @code{omp_default_mem_space} otherwise. | |
8c2fc744 TB |
5842 | @item @code{omp_large_cap_mem_space} maps to @code{omp_default_mem_space}, |
5843 | unless the memkind library is available | |
5844 | @item @code{omp_high_bw_mem_space} maps to @code{omp_default_mem_space}, | |
5845 | unless the memkind library is available | |
5846 | @end itemize | |
5847 | ||
d77de738 ML |
5848 | On Linux systems, where the @uref{https://github.com/memkind/memkind, memkind |
5849 | library} (@code{libmemkind.so.0}) is available at runtime, it is used when | |
5850 | creating memory allocators requesting | |
5851 | ||
5852 | @itemize | |
5853 | @item the memory space @code{omp_high_bw_mem_space} | |
5854 | @item the memory space @code{omp_large_cap_mem_space} | |
450b05ce | 5855 | @item the @code{partition} trait @code{interleaved}; note that for |
8c2fc744 | 5856 | @code{omp_large_cap_mem_space} the allocation will not be interleaved |
d77de738 ML |
5857 | @end itemize |
5858 | ||
450b05ce TB |
5859 | On Linux systems, where the @uref{https://github.com/numactl/numactl, numa |
5860 | library} (@code{libnuma.so.1}) is available at runtime, it used when creating | |
5861 | memory allocators requesting | |
5862 | ||
5863 | @itemize | |
5864 | @item the @code{partition} trait @code{nearest}, except when both the | |
5865 | libmemkind library is available and the memory space is either | |
5866 | @code{omp_large_cap_mem_space} or @code{omp_high_bw_mem_space} | |
5867 | @end itemize | |
5868 | ||
5869 | Note that the numa library will round up the allocation size to a multiple of | |
5870 | the system page size; therefore, consider using it only with large data or | |
5871 | by sharing allocations via the @code{pool_size} trait. Furthermore, the Linux | |
5872 | kernel does not guarantee that an allocation will always be on the nearest NUMA | |
5873 | node nor that after reallocation the same node will be used. Note additionally | |
5874 | that, on Linux, the default setting of the memory placement policy is to use the | |
5875 | current node; therefore, unless the memory placement policy has been overridden, | |
5876 | the @code{partition} trait @code{environment} (the default) will be effectively | |
5877 | a @code{nearest} allocation. | |
5878 | ||
a85a106c | 5879 | Additional notes regarding the traits: |
8c2fc744 | 5880 | @itemize |
348874f0 AS |
5881 | @item The @code{pinned} trait is supported on Linux hosts, but is subject to |
5882 | the OS @code{ulimit}/@code{rlimit} locked memory settings. | |
a85a106c TB |
5883 | @item The default for the @code{pool_size} trait is no pool and for every |
5884 | (re)allocation the associated library routine is called, which might | |
5885 | internally use a memory pool. | |
8c2fc744 TB |
5886 | @item For the @code{partition} trait, the partition part size will be the same |
5887 | as the requested size (i.e. @code{interleaved} or @code{blocked} has no | |
5888 | effect), except for @code{interleaved} when the memkind library is | |
450b05ce TB |
5889 | available. Furthermore, for @code{nearest} and unless the numa library |
5890 | is available, the memory might not be on the same NUMA node as thread | |
5891 | that allocated the memory; on Linux, this is in particular the case when | |
5892 | the memory placement policy is set to preferred. | |
8c2fc744 TB |
5893 | @item The @code{access} trait has no effect such that memory is always |
5894 | accessible by all threads. | |
5895 | @item The @code{sync_hint} trait has no effect. | |
5896 | @end itemize | |
d77de738 | 5897 | |
e9a19ead AS |
5898 | See also: |
5899 | @ref{Offload-Target Specifics} | |
5900 | ||
d77de738 ML |
5901 | @c --------------------------------------------------------------------- |
5902 | @c Offload-Target Specifics | |
5903 | @c --------------------------------------------------------------------- | |
5904 | ||
5905 | @node Offload-Target Specifics | |
5906 | @chapter Offload-Target Specifics | |
5907 | ||
5908 | The following sections present notes on the offload-target specifics | |
5909 | ||
5910 | @menu | |
5911 | * AMD Radeon:: | |
5912 | * nvptx:: | |
5913 | @end menu | |
5914 | ||
5915 | @node AMD Radeon | |
5916 | @section AMD Radeon (GCN) | |
5917 | ||
5918 | On the hardware side, there is the hierarchy (fine to coarse): | |
5919 | @itemize | |
5920 | @item work item (thread) | |
5921 | @item wavefront | |
5922 | @item work group | |
81476bc4 | 5923 | @item compute unit (CU) |
d77de738 ML |
5924 | @end itemize |
5925 | ||
5926 | All OpenMP and OpenACC levels are used, i.e. | |
5927 | @itemize | |
5928 | @item OpenMP's simd and OpenACC's vector map to work items (thread) | |
5929 | @item OpenMP's threads (``parallel'') and OpenACC's workers map | |
5930 | to wavefronts | |
5931 | @item OpenMP's teams and OpenACC's gang use a threadpool with the | |
5932 | size of the number of teams or gangs, respectively. | |
5933 | @end itemize | |
5934 | ||
5935 | The used sizes are | |
5936 | @itemize | |
5937 | @item Number of teams is the specified @code{num_teams} (OpenMP) or | |
81476bc4 MV |
5938 | @code{num_gangs} (OpenACC) or otherwise the number of CU. It is limited |
5939 | by two times the number of CU. | |
d77de738 ML |
5940 | @item Number of wavefronts is 4 for gfx900 and 16 otherwise; |
5941 | @code{num_threads} (OpenMP) and @code{num_workers} (OpenACC) | |
5942 | overrides this if smaller. | |
5943 | @item The wavefront has 102 scalars and 64 vectors | |
5944 | @item Number of workitems is always 64 | |
5945 | @item The hardware permits maximally 40 workgroups/CU and | |
5946 | 16 wavefronts/workgroup up to a limit of 40 wavefronts in total per CU. | |
5947 | @item 80 scalars registers and 24 vector registers in non-kernel functions | |
5948 | (the chosen procedure-calling API). | |
5949 | @item For the kernel itself: as many as register pressure demands (number of | |
5950 | teams and number of threads, scaled down if registers are exhausted) | |
5951 | @end itemize | |
5952 | ||
5953 | The implementation remark: | |
5954 | @itemize | |
5955 | @item I/O within OpenMP target regions and OpenACC parallel/kernels is supported | |
5956 | using the C library @code{printf} functions and the Fortran | |
5957 | @code{print}/@code{write} statements. | |
243fa488 | 5958 | @item Reverse offload regions (i.e. @code{target} regions with |
f84fdb13 TB |
5959 | @code{device(ancestor:1)}) are processed serially per @code{target} region |
5960 | such that the next reverse offload region is only executed after the previous | |
5961 | one returned. | |
f1af7d65 | 5962 | @item OpenMP code that has a @code{requires} directive with |
f84fdb13 TB |
5963 | @code{unified_shared_memory} will remove any GCN device from the list of |
5964 | available devices (``host fallback''). | |
2e3dd14d TB |
5965 | @item The available stack size can be changed using the @code{GCN_STACK_SIZE} |
5966 | environment variable; the default is 32 kiB per thread. | |
e7d6c277 AS |
5967 | @item Low-latency memory (@code{omp_low_lat_mem_space}) is supported when the |
5968 | the @code{access} trait is set to @code{cgroup}. The default pool size | |
5969 | is automatically scaled to share the 64 kiB LDS memory between the number | |
5970 | of teams configured to run on each compute-unit, but may be adjusted at | |
5971 | runtime by setting environment variable | |
5972 | @code{GOMP_GCN_LOWLAT_POOL=@var{bytes}}. | |
5973 | @item @code{omp_low_lat_mem_alloc} cannot be used with true low-latency memory | |
5974 | because the definition implies the @code{omp_atv_all} trait; main | |
5975 | graphics memory is used instead. | |
5976 | @item @code{omp_cgroup_mem_alloc}, @code{omp_pteam_mem_alloc}, and | |
5977 | @code{omp_thread_mem_alloc}, all use low-latency memory as first | |
5978 | preference, and fall back to main graphics memory when the low-latency | |
5979 | pool is exhausted. | |
d77de738 ML |
5980 | @end itemize |
5981 | ||
5982 | ||
5983 | ||
5984 | @node nvptx | |
5985 | @section nvptx | |
5986 | ||
5987 | On the hardware side, there is the hierarchy (fine to coarse): | |
5988 | @itemize | |
5989 | @item thread | |
5990 | @item warp | |
5991 | @item thread block | |
5992 | @item streaming multiprocessor | |
5993 | @end itemize | |
5994 | ||
5995 | All OpenMP and OpenACC levels are used, i.e. | |
5996 | @itemize | |
5997 | @item OpenMP's simd and OpenACC's vector map to threads | |
5998 | @item OpenMP's threads (``parallel'') and OpenACC's workers map to warps | |
5999 | @item OpenMP's teams and OpenACC's gang use a threadpool with the | |
6000 | size of the number of teams or gangs, respectively. | |
6001 | @end itemize | |
6002 | ||
6003 | The used sizes are | |
6004 | @itemize | |
6005 | @item The @code{warp_size} is always 32 | |
6006 | @item CUDA kernel launched: @code{dim=@{#teams,1,1@}, blocks=@{#threads,warp_size,1@}}. | |
81476bc4 MV |
6007 | @item The number of teams is limited by the number of blocks the device can |
6008 | host simultaneously. | |
d77de738 ML |
6009 | @end itemize |
6010 | ||
6011 | Additional information can be obtained by setting the environment variable to | |
6012 | @code{GOMP_DEBUG=1} (very verbose; grep for @code{kernel.*launch} for launch | |
6013 | parameters). | |
6014 | ||
6015 | GCC generates generic PTX ISA code, which is just-in-time compiled by CUDA, | |
6016 | which caches the JIT in the user's directory (see CUDA documentation; can be | |
6017 | tuned by the environment variables @code{CUDA_CACHE_@{DISABLE,MAXSIZE,PATH@}}. | |
6018 | ||
6019 | Note: While PTX ISA is generic, the @code{-mptx=} and @code{-march=} commandline | |
eda38850 | 6020 | options still affect the used PTX ISA code and, thus, the requirements on |
d77de738 ML |
6021 | CUDA version and hardware. |
6022 | ||
6023 | The implementation remark: | |
6024 | @itemize | |
6025 | @item I/O within OpenMP target regions and OpenACC parallel/kernels is supported | |
6026 | using the C library @code{printf} functions. Note that the Fortran | |
6027 | @code{print}/@code{write} statements are not supported, yet. | |
6028 | @item Compilation OpenMP code that contains @code{requires reverse_offload} | |
6029 | requires at least @code{-march=sm_35}, compiling for @code{-march=sm_30} | |
6030 | is not supported. | |
eda38850 TB |
6031 | @item For code containing reverse offload (i.e. @code{target} regions with |
6032 | @code{device(ancestor:1)}), there is a slight performance penalty | |
6033 | for @emph{all} target regions, consisting mostly of shutdown delay | |
6034 | Per device, reverse offload regions are processed serially such that | |
6035 | the next reverse offload region is only executed after the previous | |
6036 | one returned. | |
f1af7d65 TB |
6037 | @item OpenMP code that has a @code{requires} directive with |
6038 | @code{unified_shared_memory} will remove any nvptx device from the | |
eda38850 | 6039 | list of available devices (``host fallback''). |
2cd0689a TB |
6040 | @item The default per-warp stack size is 128 kiB; see also @code{-msoft-stack} |
6041 | in the GCC manual. | |
25072a47 TB |
6042 | @item The OpenMP routines @code{omp_target_memcpy_rect} and |
6043 | @code{omp_target_memcpy_rect_async} and the @code{target update} | |
6044 | directive for non-contiguous list items will use the 2D and 3D | |
6045 | memory-copy functions of the CUDA library. Higher dimensions will | |
6046 | call those functions in a loop and are therefore supported. | |
e9a19ead AS |
6047 | @item Low-latency memory (@code{omp_low_lat_mem_space}) is supported when the |
6048 | the @code{access} trait is set to @code{cgroup}, the ISA is at least | |
6049 | @code{sm_53}, and the PTX version is at least 4.1. The default pool size | |
6050 | is 8 kiB per team, but may be adjusted at runtime by setting environment | |
6051 | variable @code{GOMP_NVPTX_LOWLAT_POOL=@var{bytes}}. The maximum value is | |
6052 | limited by the available hardware, and care should be taken that the | |
6053 | selected pool size does not unduly limit the number of teams that can | |
6054 | run simultaneously. | |
6055 | @item @code{omp_low_lat_mem_alloc} cannot be used with true low-latency memory | |
6056 | because the definition implies the @code{omp_atv_all} trait; main | |
6057 | graphics memory is used instead. | |
6058 | @item @code{omp_cgroup_mem_alloc}, @code{omp_pteam_mem_alloc}, and | |
6059 | @code{omp_thread_mem_alloc}, all use low-latency memory as first | |
6060 | preference, and fall back to main graphics memory when the low-latency | |
6061 | pool is exhausted. | |
d77de738 ML |
6062 | @end itemize |
6063 | ||
6064 | ||
6065 | @c --------------------------------------------------------------------- | |
6066 | @c The libgomp ABI | |
6067 | @c --------------------------------------------------------------------- | |
6068 | ||
6069 | @node The libgomp ABI | |
6070 | @chapter The libgomp ABI | |
6071 | ||
6072 | The following sections present notes on the external ABI as | |
6073 | presented by libgomp. Only maintainers should need them. | |
6074 | ||
6075 | @menu | |
6076 | * Implementing MASTER construct:: | |
6077 | * Implementing CRITICAL construct:: | |
6078 | * Implementing ATOMIC construct:: | |
6079 | * Implementing FLUSH construct:: | |
6080 | * Implementing BARRIER construct:: | |
6081 | * Implementing THREADPRIVATE construct:: | |
6082 | * Implementing PRIVATE clause:: | |
6083 | * Implementing FIRSTPRIVATE LASTPRIVATE COPYIN and COPYPRIVATE clauses:: | |
6084 | * Implementing REDUCTION clause:: | |
6085 | * Implementing PARALLEL construct:: | |
6086 | * Implementing FOR construct:: | |
6087 | * Implementing ORDERED construct:: | |
6088 | * Implementing SECTIONS construct:: | |
6089 | * Implementing SINGLE construct:: | |
6090 | * Implementing OpenACC's PARALLEL construct:: | |
6091 | @end menu | |
6092 | ||
6093 | ||
6094 | @node Implementing MASTER construct | |
6095 | @section Implementing MASTER construct | |
6096 | ||
6097 | @smallexample | |
6098 | if (omp_get_thread_num () == 0) | |
6099 | block | |
6100 | @end smallexample | |
6101 | ||
6102 | Alternately, we generate two copies of the parallel subfunction | |
6103 | and only include this in the version run by the primary thread. | |
6104 | Surely this is not worthwhile though... | |
6105 | ||
6106 | ||
6107 | ||
6108 | @node Implementing CRITICAL construct | |
6109 | @section Implementing CRITICAL construct | |
6110 | ||
6111 | Without a specified name, | |
6112 | ||
6113 | @smallexample | |
6114 | void GOMP_critical_start (void); | |
6115 | void GOMP_critical_end (void); | |
6116 | @end smallexample | |
6117 | ||
6118 | so that we don't get COPY relocations from libgomp to the main | |
6119 | application. | |
6120 | ||
6121 | With a specified name, use omp_set_lock and omp_unset_lock with | |
6122 | name being transformed into a variable declared like | |
6123 | ||
6124 | @smallexample | |
6125 | omp_lock_t gomp_critical_user_<name> __attribute__((common)) | |
6126 | @end smallexample | |
6127 | ||
6128 | Ideally the ABI would specify that all zero is a valid unlocked | |
6129 | state, and so we wouldn't need to initialize this at | |
6130 | startup. | |
6131 | ||
6132 | ||
6133 | ||
6134 | @node Implementing ATOMIC construct | |
6135 | @section Implementing ATOMIC construct | |
6136 | ||
6137 | The target should implement the @code{__sync} builtins. | |
6138 | ||
6139 | Failing that we could add | |
6140 | ||
6141 | @smallexample | |
6142 | void GOMP_atomic_enter (void) | |
6143 | void GOMP_atomic_exit (void) | |
6144 | @end smallexample | |
6145 | ||
6146 | which reuses the regular lock code, but with yet another lock | |
6147 | object private to the library. | |
6148 | ||
6149 | ||
6150 | ||
6151 | @node Implementing FLUSH construct | |
6152 | @section Implementing FLUSH construct | |
6153 | ||
6154 | Expands to the @code{__sync_synchronize} builtin. | |
6155 | ||
6156 | ||
6157 | ||
6158 | @node Implementing BARRIER construct | |
6159 | @section Implementing BARRIER construct | |
6160 | ||
6161 | @smallexample | |
6162 | void GOMP_barrier (void) | |
6163 | @end smallexample | |
6164 | ||
6165 | ||
6166 | @node Implementing THREADPRIVATE construct | |
6167 | @section Implementing THREADPRIVATE construct | |
6168 | ||
6169 | In _most_ cases we can map this directly to @code{__thread}. Except | |
6170 | that OMP allows constructors for C++ objects. We can either | |
6171 | refuse to support this (how often is it used?) or we can | |
6172 | implement something akin to .ctors. | |
6173 | ||
6174 | Even more ideally, this ctor feature is handled by extensions | |
6175 | to the main pthreads library. Failing that, we can have a set | |
6176 | of entry points to register ctor functions to be called. | |
6177 | ||
6178 | ||
6179 | ||
6180 | @node Implementing PRIVATE clause | |
6181 | @section Implementing PRIVATE clause | |
6182 | ||
6183 | In association with a PARALLEL, or within the lexical extent | |
6184 | of a PARALLEL block, the variable becomes a local variable in | |
6185 | the parallel subfunction. | |
6186 | ||
6187 | In association with FOR or SECTIONS blocks, create a new | |
6188 | automatic variable within the current function. This preserves | |
6189 | the semantic of new variable creation. | |
6190 | ||
6191 | ||
6192 | ||
6193 | @node Implementing FIRSTPRIVATE LASTPRIVATE COPYIN and COPYPRIVATE clauses | |
6194 | @section Implementing FIRSTPRIVATE LASTPRIVATE COPYIN and COPYPRIVATE clauses | |
6195 | ||
6196 | This seems simple enough for PARALLEL blocks. Create a private | |
6197 | struct for communicating between the parent and subfunction. | |
6198 | In the parent, copy in values for scalar and "small" structs; | |
6199 | copy in addresses for others TREE_ADDRESSABLE types. In the | |
6200 | subfunction, copy the value into the local variable. | |
6201 | ||
6202 | It is not clear what to do with bare FOR or SECTION blocks. | |
6203 | The only thing I can figure is that we do something like: | |
6204 | ||
6205 | @smallexample | |
6206 | #pragma omp for firstprivate(x) lastprivate(y) | |
6207 | for (int i = 0; i < n; ++i) | |
6208 | body; | |
6209 | @end smallexample | |
6210 | ||
6211 | which becomes | |
6212 | ||
6213 | @smallexample | |
6214 | @{ | |
6215 | int x = x, y; | |
6216 | ||
6217 | // for stuff | |
6218 | ||
6219 | if (i == n) | |
6220 | y = y; | |
6221 | @} | |
6222 | @end smallexample | |
6223 | ||
6224 | where the "x=x" and "y=y" assignments actually have different | |
6225 | uids for the two variables, i.e. not something you could write | |
6226 | directly in C. Presumably this only makes sense if the "outer" | |
6227 | x and y are global variables. | |
6228 | ||
6229 | COPYPRIVATE would work the same way, except the structure | |
6230 | broadcast would have to happen via SINGLE machinery instead. | |
6231 | ||
6232 | ||
6233 | ||
6234 | @node Implementing REDUCTION clause | |
6235 | @section Implementing REDUCTION clause | |
6236 | ||
6237 | The private struct mentioned in the previous section should have | |
6238 | a pointer to an array of the type of the variable, indexed by the | |
6239 | thread's @var{team_id}. The thread stores its final value into the | |
6240 | array, and after the barrier, the primary thread iterates over the | |
6241 | array to collect the values. | |
6242 | ||
6243 | ||
6244 | @node Implementing PARALLEL construct | |
6245 | @section Implementing PARALLEL construct | |
6246 | ||
6247 | @smallexample | |
6248 | #pragma omp parallel | |
6249 | @{ | |
6250 | body; | |
6251 | @} | |
6252 | @end smallexample | |
6253 | ||
6254 | becomes | |
6255 | ||
6256 | @smallexample | |
6257 | void subfunction (void *data) | |
6258 | @{ | |
6259 | use data; | |
6260 | body; | |
6261 | @} | |
6262 | ||
6263 | setup data; | |
6264 | GOMP_parallel_start (subfunction, &data, num_threads); | |
6265 | subfunction (&data); | |
6266 | GOMP_parallel_end (); | |
6267 | @end smallexample | |
6268 | ||
6269 | @smallexample | |
6270 | void GOMP_parallel_start (void (*fn)(void *), void *data, unsigned num_threads) | |
6271 | @end smallexample | |
6272 | ||
6273 | The @var{FN} argument is the subfunction to be run in parallel. | |
6274 | ||
6275 | The @var{DATA} argument is a pointer to a structure used to | |
6276 | communicate data in and out of the subfunction, as discussed | |
6277 | above with respect to FIRSTPRIVATE et al. | |
6278 | ||
6279 | The @var{NUM_THREADS} argument is 1 if an IF clause is present | |
6280 | and false, or the value of the NUM_THREADS clause, if | |
6281 | present, or 0. | |
6282 | ||
6283 | The function needs to create the appropriate number of | |
6284 | threads and/or launch them from the dock. It needs to | |
6285 | create the team structure and assign team ids. | |
6286 | ||
6287 | @smallexample | |
6288 | void GOMP_parallel_end (void) | |
6289 | @end smallexample | |
6290 | ||
6291 | Tears down the team and returns us to the previous @code{omp_in_parallel()} state. | |
6292 | ||
6293 | ||
6294 | ||
6295 | @node Implementing FOR construct | |
6296 | @section Implementing FOR construct | |
6297 | ||
6298 | @smallexample | |
6299 | #pragma omp parallel for | |
6300 | for (i = lb; i <= ub; i++) | |
6301 | body; | |
6302 | @end smallexample | |
6303 | ||
6304 | becomes | |
6305 | ||
6306 | @smallexample | |
6307 | void subfunction (void *data) | |
6308 | @{ | |
6309 | long _s0, _e0; | |
6310 | while (GOMP_loop_static_next (&_s0, &_e0)) | |
6311 | @{ | |
6312 | long _e1 = _e0, i; | |
6313 | for (i = _s0; i < _e1; i++) | |
6314 | body; | |
6315 | @} | |
6316 | GOMP_loop_end_nowait (); | |
6317 | @} | |
6318 | ||
6319 | GOMP_parallel_loop_static (subfunction, NULL, 0, lb, ub+1, 1, 0); | |
6320 | subfunction (NULL); | |
6321 | GOMP_parallel_end (); | |
6322 | @end smallexample | |
6323 | ||
6324 | @smallexample | |
6325 | #pragma omp for schedule(runtime) | |
6326 | for (i = 0; i < n; i++) | |
6327 | body; | |
6328 | @end smallexample | |
6329 | ||
6330 | becomes | |
6331 | ||
6332 | @smallexample | |
6333 | @{ | |
6334 | long i, _s0, _e0; | |
6335 | if (GOMP_loop_runtime_start (0, n, 1, &_s0, &_e0)) | |
6336 | do @{ | |
6337 | long _e1 = _e0; | |
6338 | for (i = _s0, i < _e0; i++) | |
6339 | body; | |
6340 | @} while (GOMP_loop_runtime_next (&_s0, _&e0)); | |
6341 | GOMP_loop_end (); | |
6342 | @} | |
6343 | @end smallexample | |
6344 | ||
6345 | Note that while it looks like there is trickiness to propagating | |
6346 | a non-constant STEP, there isn't really. We're explicitly allowed | |
6347 | to evaluate it as many times as we want, and any variables involved | |
6348 | should automatically be handled as PRIVATE or SHARED like any other | |
6349 | variables. So the expression should remain evaluable in the | |
6350 | subfunction. We can also pull it into a local variable if we like, | |
6351 | but since its supposed to remain unchanged, we can also not if we like. | |
6352 | ||
6353 | If we have SCHEDULE(STATIC), and no ORDERED, then we ought to be | |
6354 | able to get away with no work-sharing context at all, since we can | |
6355 | simply perform the arithmetic directly in each thread to divide up | |
6356 | the iterations. Which would mean that we wouldn't need to call any | |
6357 | of these routines. | |
6358 | ||
6359 | There are separate routines for handling loops with an ORDERED | |
6360 | clause. Bookkeeping for that is non-trivial... | |
6361 | ||
6362 | ||
6363 | ||
6364 | @node Implementing ORDERED construct | |
6365 | @section Implementing ORDERED construct | |
6366 | ||
6367 | @smallexample | |
6368 | void GOMP_ordered_start (void) | |
6369 | void GOMP_ordered_end (void) | |
6370 | @end smallexample | |
6371 | ||
6372 | ||
6373 | ||
6374 | @node Implementing SECTIONS construct | |
6375 | @section Implementing SECTIONS construct | |
6376 | ||
6377 | A block as | |
6378 | ||
6379 | @smallexample | |
6380 | #pragma omp sections | |
6381 | @{ | |
6382 | #pragma omp section | |
6383 | stmt1; | |
6384 | #pragma omp section | |
6385 | stmt2; | |
6386 | #pragma omp section | |
6387 | stmt3; | |
6388 | @} | |
6389 | @end smallexample | |
6390 | ||
6391 | becomes | |
6392 | ||
6393 | @smallexample | |
6394 | for (i = GOMP_sections_start (3); i != 0; i = GOMP_sections_next ()) | |
6395 | switch (i) | |
6396 | @{ | |
6397 | case 1: | |
6398 | stmt1; | |
6399 | break; | |
6400 | case 2: | |
6401 | stmt2; | |
6402 | break; | |
6403 | case 3: | |
6404 | stmt3; | |
6405 | break; | |
6406 | @} | |
6407 | GOMP_barrier (); | |
6408 | @end smallexample | |
6409 | ||
6410 | ||
6411 | @node Implementing SINGLE construct | |
6412 | @section Implementing SINGLE construct | |
6413 | ||
6414 | A block like | |
6415 | ||
6416 | @smallexample | |
6417 | #pragma omp single | |
6418 | @{ | |
6419 | body; | |
6420 | @} | |
6421 | @end smallexample | |
6422 | ||
6423 | becomes | |
6424 | ||
6425 | @smallexample | |
6426 | if (GOMP_single_start ()) | |
6427 | body; | |
6428 | GOMP_barrier (); | |
6429 | @end smallexample | |
6430 | ||
6431 | while | |
6432 | ||
6433 | @smallexample | |
6434 | #pragma omp single copyprivate(x) | |
6435 | body; | |
6436 | @end smallexample | |
6437 | ||
6438 | becomes | |
6439 | ||
6440 | @smallexample | |
6441 | datap = GOMP_single_copy_start (); | |
6442 | if (datap == NULL) | |
6443 | @{ | |
6444 | body; | |
6445 | data.x = x; | |
6446 | GOMP_single_copy_end (&data); | |
6447 | @} | |
6448 | else | |
6449 | x = datap->x; | |
6450 | GOMP_barrier (); | |
6451 | @end smallexample | |
6452 | ||
6453 | ||
6454 | ||
6455 | @node Implementing OpenACC's PARALLEL construct | |
6456 | @section Implementing OpenACC's PARALLEL construct | |
6457 | ||
6458 | @smallexample | |
6459 | void GOACC_parallel () | |
6460 | @end smallexample | |
6461 | ||
6462 | ||
6463 | ||
6464 | @c --------------------------------------------------------------------- | |
6465 | @c Reporting Bugs | |
6466 | @c --------------------------------------------------------------------- | |
6467 | ||
6468 | @node Reporting Bugs | |
6469 | @chapter Reporting Bugs | |
6470 | ||
6471 | Bugs in the GNU Offloading and Multi Processing Runtime Library should | |
6472 | be reported via @uref{https://gcc.gnu.org/bugzilla/, Bugzilla}. Please add | |
6473 | "openacc", or "openmp", or both to the keywords field in the bug | |
6474 | report, as appropriate. | |
6475 | ||
6476 | ||
6477 | ||
6478 | @c --------------------------------------------------------------------- | |
6479 | @c GNU General Public License | |
6480 | @c --------------------------------------------------------------------- | |
6481 | ||
6482 | @include gpl_v3.texi | |
6483 | ||
6484 | ||
6485 | ||
6486 | @c --------------------------------------------------------------------- | |
6487 | @c GNU Free Documentation License | |
6488 | @c --------------------------------------------------------------------- | |
6489 | ||
6490 | @include fdl.texi | |
6491 | ||
6492 | ||
6493 | ||
6494 | @c --------------------------------------------------------------------- | |
6495 | @c Funding Free Software | |
6496 | @c --------------------------------------------------------------------- | |
6497 | ||
6498 | @include funding.texi | |
6499 | ||
6500 | @c --------------------------------------------------------------------- | |
6501 | @c Index | |
6502 | @c --------------------------------------------------------------------- | |
6503 | ||
6504 | @node Library Index | |
6505 | @unnumbered Library Index | |
6506 | ||
6507 | @printindex cp | |
6508 | ||
6509 | @bye |