Skip to content

Commit 73f791b

Browse files
committed
Merge pull request #10 from HenryJin/ticket381+history
Ticket381+history
2 parents d392a3b + 77194f2 commit 73f791b

15 files changed

+101
-20
lines changed

Changes.log

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,32 @@ Example_SIMD.7f.f
2323
Example_SIMD.8c.c
2424
Example_SIMD.8f.f
2525

26-
3. Other changes
26+
3. Misc modifications to examples (Tickets #180 and #295)
27+
28+
- Use C++ only header for the following C++ specific examples:
29+
threadprivate.4c
30+
threadprivate.5c
31+
pra_iterator.1c
32+
declare_target.2c
33+
34+
- Text description change in
35+
Examples_lock_owner.tex
36+
Examples_default_none.tex
37+
38+
4. Other changes (Ticket #381)
39+
40+
- openmp.sty
41+
use mnemonics for example naming
42+
added the \cppexample macro
2743

2844
- Move task depedence examples from tasking to a separate chapter.
29-
tasking.15-19 -> task_dep.1-5
45+
tasking.15-19 -> task_dep.1-5
46+
47+
Rename chapters:
48+
"Tasking Constructs" to "The task and taskwait Constructs"
49+
"The taskyield Directive" to "The taskyield Consutrcts"
50+
51+
- Add revision history
3052

3153
- Fix broken links
3254
-Chap-4 (icv), page 11: "According to $"

Examples_declare_target.tex

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@ \section{\code{declare} \code{target} and \code{end} \code{declare} \code{target
3838

3939
\section{\code{declare} \code{target} Construct for Class Type}
4040

41+
\cppspecificstart
4142
The following example shows how the \code{declare} \code{target} and \code{end}
4243
\code{declare} \code{target} directives are used to enclose the declaration
4344
of a variable \plc{varY} with a class type \code{typeY}. The member function \code{typeY::foo()} cannot
4445
be accessed on a target device because its declaration did not appear between \code{declare}
4546
\code{target} and \code{end} \code{declare} \code{target} directives.
4647

47-
\cexample{declare_target}{2c}
48+
\cnexample{declare_target}{2c}
49+
\cppspecificend
4850

4951
\section{\code{declare} \code{target} and \code{end} \code{declare} \code{target} for Variables}
5052

Examples_default_none.tex

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@ \chapter{The \code{default(none)} Clause}
55
The following example distinguishes the variables that are affected by the \code{default(none)}
66
clause from those that are not.
77

8-
\cexample{default_none}{1c}
8+
\ccppspecificstart
9+
Beginning with OpenMP 4.0, variables with \code{const}-qualified type and no mutable member
10+
are no longer predetermined shared. Thus, these variables (variable \plc{c} in the example)
11+
need to be explicitly listed
12+
in data-sharing attribute clauses when the \code{default(none)} clause is specified.
13+
14+
\cnexample{default_none}{1c}
15+
\ccppspecificend
916

1017
\fexample{default_none}{1f}
1118

Examples_lock_owner.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ \chapter{Ownership of Locks}
44

55
Ownership of locks has changed since OpenMP 2.5. In OpenMP 2.5, locks are owned
66
by threads; so a lock released by the \code{omp\_unset\_lock} routine must be
7-
owned by the same thread executing the routine. With OpenMP 3.0, locks are owned
7+
owned by the same thread executing the routine. Beginning with OpenMP 3.0, locks are owned
88
by task regions; so a lock released by the \code{omp\_unset\_lock} routine in
99
a task region must be owned by the same task region.
1010

1111
This change in ownership requires extra care when using locks. The following program
1212
is conforming in OpenMP 2.5 because the thread that releases the lock \code{lck}
1313
in the parallel region is the same thread that acquired the lock in the sequential
1414
part of the program (master thread of parallel region and the initial thread are
15-
the same). However, it is not conforming in OpenMP 3.0 and 3.1, because the task
15+
the same). However, it is not conforming beginning with OpenMP 3.0, because the task
1616
region that releases the lock \code{lck} is different from the task region that
1717
acquires the lock.
1818

Examples_pra_iterator.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
\pagebreak
22
\chapter{Parallel Random Access Iterator Loop}
3-
\ccppspecificstart
3+
\cppspecificstart
44
\label{chap:pra_iterator}
55

66
The following example shows a parallel random access iterator loop.
77

88
\cnexample{pra_iterator}{1c}
9-
\ccppspecificend
9+
\cppspecificend
1010

1111

Examples_tasking.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
\pagebreak
2-
\chapter{Tasking Constructs}
2+
\chapter{The \code{task} and \code{taskwait} Constructs}
33
\label{chap:tasking}
44

55
The following example shows how to traverse a tree-like structure using explicit

Examples_taskyield.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
\pagebreak
2-
\chapter{The \code{taskyield} Directive}
2+
\chapter{The \code{taskyield} Construct}
33
\label{chap:taskyield}
44

55
The following example illustrates the use of the \code{taskyield} directive.

Examples_threadprivate.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ \chapter{The \code{threadprivate} Directive}
8989
\fnexample{threadprivate}{6f}
9090
\fortranspecificend
9191

92-
\ccppspecificstart
92+
\cppspecificstart
9393
The following example illustrates initialization of \code{threadprivate} variables
9494
for class-type \code{T}. \code{t1} is default constructed, \code{t2} is constructed
9595
taking a constructor accepting one argument of integer type, \code{t3} is copy
@@ -102,5 +102,5 @@ \chapter{The \code{threadprivate} Directive}
102102
be placed inside the class definition.
103103

104104
\cnexample{threadprivate}{5c}
105-
\ccppspecificend
105+
\cppspecificend
106106

History.tex

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
\chapter{Document Revision History}
2+
\label{chap:history}
3+
4+
\section{Changes from 4.0.1 to 4.0.2}
5+
6+
\begin{itemize}
7+
\item Names of examples were changed from numbers to mnemonics
8+
\item Added SIMD examples (\specref{chap:SIMD})
9+
\item Applied miscellaneous fixes in several source codes
10+
\item Added the revision history
11+
\end{itemize}
12+
13+
\section{Changes from 4.0 to 4.0.1}
14+
15+
Added the following new examples:
16+
\begin{itemize}
17+
\item the \code{proc\_bind} clause (\specref{chap:affinity})
18+
\item the \code{taskgroup} construct (\specref{chap:taskgroup})
19+
\end{itemize}
20+
21+
\section{Changes from 3.1 to 4.0}
22+
23+
Beginning with OpenMP 4.0, examples were placed in a separate document
24+
from the specification document.
25+
26+
Version 4.0 added the following new examples:
27+
\begin{itemize}
28+
\item task dependences (\specref{chap:task_dep})
29+
\item cancellation constructs (\specref{chap:cancellation})
30+
\item \code{target} construct (\specref{chap:target})
31+
\item \code{target} \code{data} construct (\specref{chap:target_data})
32+
\item \code{target} \code{update} construct (\specref{chap:target_update})
33+
\item \code{declare} \code{target} construct (\specref{chap:declare_target})
34+
\item \code{teams} constructs (\specref{chap:teams})
35+
\item asynchronous execution of a \code{target} region using tasks
36+
(\specref{chap:async_target})
37+
\item array sections in device constructs (\specref{chap:array_sections})
38+
\item device runtime routines (\specref{chap:device})
39+
\item Fortran ASSOCIATE construct (\specref{chap:associate})
40+
\end{itemize}

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ CHAPTERS=Title_Page.tex \
6767
Examples_async_target.tex \
6868
Examples_array_sections.tex \
6969
Examples_device.tex \
70-
Examples_associate.tex
70+
Examples_associate.tex \
71+
History.tex
7172

7273
INTERMEDIATE_FILES=openmp-examples.pdf \
7374
openmp-examples.toc \

README

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ For a brief revision history, please see Changes.log.
5353
\fnexample{<ename>}{<seq-no>f}
5454

5555
- Language h-rules
56-
\cspecificbegin, \cspecificend
57-
\cppspecificbegin, \cppspecificend
58-
\fortranspecificbegin, \fortranspecificend
56+
\cspecificstart, \cspecificend
57+
\cppspecificstart, \cppspecificend
58+
\ccppspecificstart, \ccppspecificend
59+
\fortranspecificstart, \fortranspecificend
5960

6061
- See openmp.sty for more information
6162

Title_Page.tex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
\vspace{1.0in}
1919

20-
\textbf{Version 4.0.2rv1 -- February, 2015}
20+
\textbf{Version 4.0.2rv3 -- February, 2015}
2121
\end{center}
2222
\end{adjustwidth}
2323

@@ -39,6 +39,7 @@
3939
\phantom{a}
4040
\emph{This page intentionally left blank}
4141

42-
This working version enacted the following tickets: 299, 342, and a few other editorial changes.
42+
This working version enacted the following tickets: 180, 295, 299, 342, 381,
43+
and a few other editorial changes.
4344
\vfill
4445

openmp-examples.tex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,5 +135,6 @@
135135
\input{Examples_array_sections}
136136
\input{Examples_device}
137137
\input{Examples_associate}
138+
\input{History}
138139
\end{document}
139140

openmp.sty

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,12 @@
470470
\ccppspecificend
471471
}
472472

473+
\newcommand\cppexample[2]{%
474+
\needspace{5\baselineskip}\cppspecificstart
475+
\cnexample{#1}{#2}
476+
\cppspecificend
477+
}
478+
473479
\newcommand\fexample[2]{%
474480
\needspace{5\baselineskip}\fortranspecificstart
475481
\fnexample{#1}{#2}

sources/Example_default_none.1c.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ void default_none(int a) {
1313
const int c = 1;
1414
int i = 0;
1515

16-
#pragma omp parallel default(none) private(a) shared(z)
16+
#pragma omp parallel default(none) private(a) shared(z, c)
1717
{
1818
int j = omp_get_num_threads();
1919
/* O.K. - j is declared within parallel region */
2020
a = z[j]; /* O.K. - a is listed in private clause */
2121
/* - z is listed in shared clause */
2222
x = c; /* O.K. - x is threadprivate */
23-
/* - c has const-qualified type */
23+
/* - c has const-qualified type and is listed in shared */
2424
z[i] = y; /* Error - cannot reference i or y here */
2525

2626
#pragma omp for firstprivate(y)

0 commit comments

Comments
 (0)