Skip to content

Commit a5e3d8b

Browse files
author
Henry Jin
committed
v5.2 release
1 parent fb0edc8 commit a5e3d8b

File tree

674 files changed

+5318
-1612
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

674 files changed

+5318
-1612
lines changed

Chap_SIMD.tex

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
directive. Clauses provide argument specifications (\code{linear},
3232
\code{uniform}, and \code{aligned}), a requested vector length
3333
(\code{simdlen}), and designate whether the function is always/never
34-
called conditionally in a loop (\code{branch}/\code{inbranch}).
34+
called conditionally in a loop (\code{notinbranch}/\code{inbranch}).
3535
The latter is for optimizing performance.
3636

3737
Also, the \code{simd} construct has been combined with the worksharing loop

Chap_data_environment.tex

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
Certain variables and objects have predetermined attributes.
2323
A commonly found case is the loop iteration variable in associated loops
2424
of a \code{for} or \code{do} construct. It has a private data-sharing attribute.
25-
Variables with predetermined data-sharing attributes can not be listed in a data-sharing clause; but there are some
25+
Variables with predetermined data-sharing attributes cannot be listed in a data-sharing clause; but there are some
2626
exceptions (mainly concerning loop iteration variables).
2727

2828
Variables with explicitly determined data-sharing attributes are those that are
@@ -50,7 +50,7 @@
5050
structure elements (members).
5151

5252
Procedures and global variables have predetermined data mapping if they appear
53-
within the list or block of a \code{declare target} directive. Also, a C/C++ pointer
53+
within the list or block of a \code{declare}~\code{target} directive. Also, a C/C++ pointer
5454
is mapped as a zero-length array section, as is a C++ variable that is a reference to a pointer.
5555
% Waiting for response from Eric on this.
5656

Chap_devices.tex

+5-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
The constructs that explicitly
1717
create storage, transfer data, and free storage on the device
18-
are catagorized as structured and unstructured. The
18+
are categorized as structured and unstructured. The
1919
\code{target} \code{data} construct is structured. It creates
2020
a data region around \code{target} constructs, and is
2121
convenient for providing persistent data throughout multiple
@@ -33,14 +33,14 @@
3333
There is an important change in the OpenMP 4.5 specification
3434
that alters the data model for scalar variables and C/C++ pointer variables.
3535
The default behavior for scalar variables and C/C++ pointer variables
36-
in an 4.5 compliant code is \code{firstprivate}. Example
36+
in a 4.5 compliant code is \code{firstprivate}. Example
3737
codes that have been updated to reflect this new behavior are
3838
annotated with a description that describes changes required
3939
for correct execution. Often it is a simple matter of mapping
4040
the variable as \code{tofrom} to obtain the intended 4.0 behavior.
4141

4242
In OpenMP version 4.5 the mechanism for target
43-
execution is specified as occuring through a \plc{target task}.
43+
execution is specified as occurring through a \plc{target task}.
4444
When the \code{target} construct is encountered a new
4545
\plc{target task} is generated. The \plc{target task}
4646
completes after the \code{target} region has executed and all data
@@ -59,13 +59,14 @@
5959
\input{devices/target_structure_mapping}
6060
\input{devices/target_fort_allocatable_array_mapping}
6161
\input{devices/array_sections}
62+
\input{devices/C++_virtual_functions}
6263
\input{devices/array_shaping}
6364
\input{devices/target_mapper}
6465
\input{devices/target_data}
6566
\input{devices/target_unstructured_data}
6667
\input{devices/target_update}
67-
\input{devices/target_associate_ptr}
6868
\input{devices/declare_target}
69+
\input{devices/lambda_expressions}
6970
\input{devices/teams}
7071
\input{devices/async_target_depend}
7172
\input{devices/async_target_with_tasks}

Chap_directives.tex

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
\cchapter{OpenMP Directive Syntax}{directives}
22
\label{chap:directive_syntax}
3+
\index{directive syntax}
34

45
OpenMP \emph{directives} use base-language mechanisms to specify OpenMP program behavior.
56
In C code, the directives are formed exclusively with pragmas, whereas in C++
67
code, directives are formed from either pragmas or attributes.
78
Fortran directives are formed with comments in free form and fixed form sources (codes).
8-
All of these mechanism allow the compilation to ignore the OpenMP directives if
9+
All of these mechanisms allow the compilation to ignore the OpenMP directives if
910
OpenMP is not supported or enabled.
1011

1112

@@ -35,6 +36,18 @@
3536

3637
where \code{c\$omp} and \code{*\$omp} may be used in Fortran fixed form sources.
3738

39+
Most OpenMP directives accept clauses that alter the semantics of the directive in some way,
40+
and some directives also accept parenthesized arguments that follow the directive name.
41+
A clause may just be a keyword (e.g., \scode{untied}) or it may also accept argument lists
42+
(e.g., \scode{shared(x,y,z)}) and/or optional modifiers (e.g., \scode{tofrom} in
43+
\scode{map(tofrom:}~\scode{x,y,z)}).
44+
Clause modifiers may be "simple" or "complex" -- a complex modifier consists of a
45+
keyword followed by one or more parameters, bracketed by parentheses, while a simple
46+
modifier does not. An example of a complex modifier is the \scode{iterator} modifier,
47+
as in \scode{map(iterator(i=0:n),}~\scode{tofrom:}~\scode{p[i])}, or the \scode{step} modifier, as in
48+
\scode{linear(x:}~\scode{ref,}~\scode{step(4))}.
49+
In the preceding examples, \scode{tofrom} and \scode{ref} are simple modifiers.
50+
3851

3952
%===== Examples Sections =====
4053
\input{directives/pragmas}

Chap_introduction.tex

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
% This is the introduction for the OpenMP Examples document.
2+
% This is an included file. See the main file (openmp-examples.tex) for more information.
3+
%
4+
% When editing this file:
5+
%
6+
% 1. To change formatting, appearance, or style, please edit openmp.sty.
7+
%
8+
% 2. Custom commands and macros are defined in openmp.sty.
9+
%
10+
% 3. Be kind to other editors -- keep a consistent style by copying-and-pasting to
11+
% create new content.
12+
%
13+
% 4. We use semantic markup, e.g. (see openmp.sty for a full list):
14+
% \code{} % for bold monospace keywords, code, operators, etc.
15+
% \plc{} % for italic placeholder names, grammar, etc.
16+
%
17+
% 5. Other recommendations:
18+
% Use the convenience macros defined in openmp.sty for the minor headers
19+
% such as Comments, Syntax, etc.
20+
%
21+
% To keep items together on the same page, prefer the use of
22+
% \begin{samepage}.... Avoid \parbox for text blocks as it interrupts line numbering.
23+
% When possible, avoid \filbreak, \pagebreak, \newpage, \clearpage unless that's
24+
% what you mean. Use \needspace{} cautiously for troublesome paragraphs.
25+
%
26+
% Avoid absolute lengths and measures in this file; use relative units when possible.
27+
% Vertical space can be relative to \baselineskip or ex units. Horizontal space
28+
% can be relative to \linewidth or em units.
29+
%
30+
% Prefer \emph{} to italicize terminology, e.g.:
31+
% This is a \emph{definition}, not a placeholder.
32+
% This is a \plc{var-name}.
33+
%
34+
35+
\cchapter{Introduction}{introduction}
36+
\label{chap:introduction}
37+
38+
This collection of programming examples supplements the OpenMP API for Shared
39+
Memory Parallelization specifications, and is not part of the formal specifications. It
40+
assumes familiarity with the OpenMP specifications, and shares the typographical
41+
conventions used in that document.
42+
43+
The OpenMP API specification provides a model for parallel programming that is
44+
portable across shared memory architectures from different vendors. Compilers from
45+
numerous vendors support the OpenMP API.
46+
47+
The directives, library routines, and environment variables demonstrated in this
48+
document allow users to create and manage parallel programs while permitting
49+
portability. The directives extend the C, C++ and Fortran base languages with single
50+
program multiple data (SPMD) constructs, tasking constructs, device constructs,
51+
worksharing constructs, and synchronization constructs, and they provide support for
52+
sharing and privatizing data. The functionality to control the runtime environment is
53+
provided by library routines and environment variables. Compilers that support the
54+
OpenMP API often include a command line option to the compiler that activates and
55+
allows interpretation of all OpenMP directives.
56+
57+
The documents and source codes for OpenMP Examples can be downloaded from
58+
\href{https://github.com/OpenMP/Examples}{https://github.com/OpenMP/Examples}.
59+
Each directory holds the contents of a chapter and has a \splc{sources} subdirectory of its codes.
60+
The codes for this OpenMP \VER{} Examples document have the tag
61+
\href{https://github.com/OpenMP/Examples/tree/v\VER}{\plc{v\PVER}}.
62+
63+
Complete information about the OpenMP API and a list of the compilers that support
64+
the OpenMP API can be found at the OpenMP.org web site
65+
66+
\code{https://www.openmp.org}
67+
68+
\clearpage
69+
70+
\input{introduction/Examples}
71+
72+
% This is the end of introduction.tex of the OpenMP Examples document.
73+

Chap_loop_transformations.tex

+1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@
2222
%===== Examples Sections =====
2323
\input{loop_transformations/tile}
2424
\input{loop_transformations/unroll}
25+
\input{loop_transformations/partial_tile}
2526

Chap_memory_model.tex

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
flushes, a \emph{flush-set}.
2626

2727
A \emph{strong} flush will force consistency between the temporary view and the
28-
memory for all variables in its \emph{flush-set}. Furthermore all strong flushes in a
28+
memory for all variables in its \emph{flush-set}. Furthermore, all strong flushes in a
2929
program that have intersecting flush-sets will execute in some total order, and
3030
within a thread strong flushes may not be reordered with respect to other
3131
memory operations on variables in its flush-set. \emph{Release} and
@@ -53,7 +53,7 @@
5353
races in OpenMP programs result in undefined behavior, and so they should
5454
generally be avoided for programs to be correct. The completion order of
5555
accesses to a shared variable is guaranteed in OpenMP through a set of memory
56-
consistency rules that are described in the \plc{OpenMP Memory Consitency}
56+
consistency rules that are described in the \plc{OpenMP Memory Consistency}
5757
section of the OpenMP Specifications document.
5858

5959
%This chapter also includes examples that exhibit non-sequentially consistent

Chap_parallel_execution.tex

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@
102102
executed only by the primary thread. There is no implicit barrier (and flush)
103103
at the end of the \code{masked} region; hence the other threads of the team continue
104104
execution beyond code statements beyond the \code{masked} region.
105-
The \code{master} contruct, which has been deprecated in OpenMP 5.1, has identical semantics
106-
to the \code{masked} contruct with no \code{filter} clause.
105+
The \code{master} construct, which has been deprecated in OpenMP 5.1, has identical semantics
106+
to the \code{masked} construct with no \code{filter} clause.
107107

108108

109109
%===== Examples Sections =====

Chap_program_control.tex

+1
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
\input{program_control/nested_loop}
109109
\input{program_control/nesting_restrict}
110110
\input{program_control/target_offload}
111+
\input{program_control/reproducible}
111112
\input{program_control/interop}
112113
\input{program_control/utilities}
113114

Chap_synchronization.tex

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
Since OpenMP 4.5 the \code{ordered} construct can also be a stand-alone
3838
directive that specifies cross-iteration dependences in a doacross loop nest.
39-
The \code{depend} clause uses a \code{sink} \plc{dependence-type}, along with a
39+
The \code{depend} clause uses a \code{sink} \plc{dependence-type}, along with an
4040
iteration vector argument (vec) to indicate the iteration that satisfies the
4141
dependence. The \code{depend} clause with a \code{source}
4242
\plc{dependence-type} specifies dependence satisfaction.

Contributions.md

+44-21
Original file line numberDiff line numberDiff line change
@@ -54,25 +54,28 @@ For a brief revision history, see `Changes.log` in the repo.
5454
* Insert the code in the sources directory for each chapter, and include the following metadata:
5555
* Metadata Tags for example sources:
5656
```
57-
@@name: <ename>.<seq-no>[c|cpp|f|f90]
57+
@@name: <ename>.<seq-no>
5858
@@type: C|C++|F-fixed|F-free
59+
@@requires: preprocessing
5960
@@compilable: yes|no|maybe
6061
@@linkable: yes|no|maybe
61-
@@expect: success|failure|nothing|rt-error
62+
@@expect: success|compile-time-error|runtime-error|undefined-behavior
6263
@@version: omp_<verno>
6364
```
6465
* **name**
6566
is the name of an example
6667
* **type**
67-
is the source code type, which can be translated into or from proper file extension (c,cpp,f,f90)
68+
is the source code type, which can be translated into or from proper file extension (C:c,C++:cpp,F-fixed:f,F-free:f90)
69+
* **requires**
70+
any additional requirements, currently `preprocessing` for requiring preprocessing
6871
* **compilable**
6972
indicates whether the source code is compilable
7073
* **linkable**
7174
indicates whether the source code is linkable
7275
* **expect**
73-
indicates some expected result for testing purpose "`success|failure|nothing`" applies
74-
to the result of code compilation "`rt-error`" is for a case where compilation may be
75-
successful, but the code contains potential runtime issues (such as race condition).
76+
indicates some expected result for testing purpose "`success|compile-time-error|ct-error`" applies
77+
to the result of code compilation; "`runtime-error|rt-error`" is for a case where compilation may be
78+
successful, but the code contains potential runtime issues (such as race condition); `undefined-behavior` could result from a non-conforming code.
7679
Alternative would be to just use "`conforming`" or "`non-conforming`".
7780
* **version**
7881
indicates features for a specific OpenMP version, such as "`omp_5.0`"
@@ -94,23 +97,30 @@ For a brief revision history, see `Changes.log` in the repo.
9497
9598
9699
97-
# LaTeX macros for examples
100+
## LaTeX macros for examples
98101
102+
The following describes LaTeX macros defined specifically for examples.
99103
* Source code with language h-rules
104+
* Source code without language h-rules
105+
* Language h-rules
106+
* Other macros
107+
* See `openmp.sty` for more information
108+
109+
### Source code with language h-rules
100110
```
101-
\cexample[<verno>]{<ename>}{<seq-no>} % for C/C++ examples
102-
\cppexample[<verno>]{<ename>}{<seq-no>} % for C++ examples
103-
\fexample[<verno>]{<ename>}{<seq-no>} % for fixed-form Fortran examples
104-
\ffreeexample[<verno>]{<ename>}{<seq-no>} % for free-form Fortran examples
111+
\cexample[<verno>]{<ename>}{<seq-no>}[<s>] % for C/C++ examples
112+
\cppexample[<verno>]{<ename>}{<seq-no>}[<s>] % for C++ examples
113+
\fexample[<verno>]{<ename>}{<seq-no>}[<s>] % for fixed-form Fortran examples
114+
\ffreeexample[<verno>]{<ename>}{<seq-no>}[<s>] % for free-form Fortran examples
105115
```
106116
107-
* Source code without language h-rules
117+
### Source code without language h-rules
108118
```
109-
\cnexample[<verno>]{<ename>}{<seq-no>}
110-
\cppnexample[<verno>]{<ename>}{<seq-no>}
111-
\fnexample[<verno>]{<ename>}{<seq-no>}
112-
\ffreenexample[<verno>]{<ename>}{<seq-no>}
113-
\srcnexample[<verno>]{<ename>}{<seq-no>}{<ext>}
119+
\cnexample[<verno>]{<ename>}{<seq-no>}[<s>]
120+
\cppnexample[<verno>]{<ename>}{<seq-no>}[<s>]
121+
\fnexample[<verno>]{<ename>}{<seq-no>}[<s>]
122+
\ffreenexample[<verno>]{<ename>}{<seq-no>}[<s>]
123+
\srcnexample[<verno>]{<ename>}{<seq-no>}{<ext>}[<s>]
114124
```
115125
116126
Optional `<verno>` can be supplied in a macro to include a specific OpenMP
@@ -123,17 +133,23 @@ For a brief revision history, see `Changes.log` in the repo.
123133
source code should not contain any `@@` metadata tags. The `ext` argument
124134
to this macro is the file extension (such as `h`, `hpp`, `inc`).
125135
126-
* Language h-rules
136+
The `<s>` option to each macro allows finer-control of any additional lines
137+
to be skipped due to addition of new `@@` tags, such as `@@requires`.
138+
The default value for `<s>` is 0.
139+
140+
### Language h-rules
127141
```
128142
\cspecificstart, \cspecificend
129143
\cppspecificstart, \cppspecificend
130144
\ccppspecificstart, \ccppspecificend
131145
\fortranspecificstart, \fortranspecificend
132146
```
133147
134-
* Chapter and section macros
148+
### Other macros
135149
```
136150
\cchapter{<Chapter Name>}{<chap_directory>}
151+
\hexentry[ext1]{<example_name>}[ext2]{<earlier_tag>}
152+
\hexmentry[ext1]{<example_name>}[ext2]{<earlier_tag>}{<prior_name>}
137153
```
138154
139155
The `\cchapter` macro is used for starting a chapter with proper page spacing.
@@ -146,8 +162,15 @@ A previously-defined macro `\sinput{<section_file>}` to import a section
146162
file from `<chap_directory>` is no longer supported. Please use
147163
`\input{<chap_directory>/<section_file>}` explicitly.
148164
149-
* See `openmp.sty` for more information
165+
The two macros `\hexentry` and `\hexmentry` are defined for simplifying
166+
entries in the feature deprecation and update tables. Option `[ext1]` is
167+
the file extension with a default value of `c` and option `[ext2]` is
168+
the file extension for the associated second file if present.
169+
`<earlier_tag>` is the version tag of the corresponding example
170+
in the earlier version. `\hexentry` assumes no name change for an example
171+
in different versions; `\hexmentry` can be used to specify a prior name
172+
if it is different.
150173
151-
### License
174+
## License
152175
153176
For copyright information, please see `omp_copyright.txt`.

0 commit comments

Comments
 (0)