diff --git a/Changes.log b/Changes.log index aad560f..62647db 100644 --- a/Changes.log +++ b/Changes.log @@ -23,10 +23,32 @@ Example_SIMD.7f.f Example_SIMD.8c.c Example_SIMD.8f.f -3. Other changes +3. Misc modifications to examples (Tickets #180 and #295) + +- Use C++ only header for the following C++ specific examples: + threadprivate.4c + threadprivate.5c + pra_iterator.1c + declare_target.2c + +- Text description change in + Examples_lock_owner.tex + Examples_default_none.tex + +4. Other changes (Ticket #381) + +- openmp.sty + use mnemonics for example naming + added the \cppexample macro - Move task depedence examples from tasking to a separate chapter. - tasking.15-19 -> task_dep.1-5 + tasking.15-19 -> task_dep.1-5 + + Rename chapters: + "Tasking Constructs" to "The task and taskwait Constructs" + "The taskyield Directive" to "The taskyield Consutrcts" + +- Add revision history - Fix broken links -Chap-4 (icv), page 11: "According to $" diff --git a/Examples_declare_target.tex b/Examples_declare_target.tex index 9802b3e..e5c7c4b 100644 --- a/Examples_declare_target.tex +++ b/Examples_declare_target.tex @@ -38,13 +38,15 @@ scope for the compiler to determine that a target binary should be available. \section{\code{declare} \code{target} Construct for Class Type} +\cppspecificstart The following example shows how the \code{declare} \code{target} and \code{end} \code{declare} \code{target} directives are used to enclose the declaration of a variable \plc{varY} with a class type \code{typeY}. The member function \code{typeY::foo()} cannot be accessed on a target device because its declaration did not appear between \code{declare} \code{target} and \code{end} \code{declare} \code{target} directives. -\cexample{declare_target}{2c} +\cnexample{declare_target}{2c} +\cppspecificend \section{\code{declare} \code{target} and \code{end} \code{declare} \code{target} for Variables} diff --git a/Examples_default_none.tex b/Examples_default_none.tex index e745df1..c590da5 100644 --- a/Examples_default_none.tex +++ b/Examples_default_none.tex @@ -5,7 +5,14 @@ The following example distinguishes the variables that are affected by the \code{default(none)} clause from those that are not. -\cexample{default_none}{1c} +\ccppspecificstart +Beginning with OpenMP 4.0, variables with \code{const}-qualified type and no mutable member +are no longer predetermined shared. Thus, these variables (variable \plc{c} in the example) +need to be explicitly listed +in data-sharing attribute clauses when the \code{default(none)} clause is specified. + +\cnexample{default_none}{1c} +\ccppspecificend \fexample{default_none}{1f} diff --git a/Examples_lock_owner.tex b/Examples_lock_owner.tex index 0a6dab4..d6c9623 100644 --- a/Examples_lock_owner.tex +++ b/Examples_lock_owner.tex @@ -4,7 +4,7 @@ Ownership of locks has changed since OpenMP 2.5. In OpenMP 2.5, locks are owned by threads; so a lock released by the \code{omp\_unset\_lock} routine must be -owned by the same thread executing the routine. With OpenMP 3.0, locks are owned +owned by the same thread executing the routine. Beginning with OpenMP 3.0, locks are owned by task regions; so a lock released by the \code{omp\_unset\_lock} routine in a task region must be owned by the same task region. @@ -12,7 +12,7 @@ This change in ownership requires extra care when using locks. The following pro is conforming in OpenMP 2.5 because the thread that releases the lock \code{lck} in the parallel region is the same thread that acquired the lock in the sequential part of the program (master thread of parallel region and the initial thread are -the same). However, it is not conforming in OpenMP 3.0 and 3.1, because the task +the same). However, it is not conforming beginning with OpenMP 3.0, because the task region that releases the lock \code{lck} is different from the task region that acquires the lock. diff --git a/Examples_pra_iterator.tex b/Examples_pra_iterator.tex index 390971a..60e5e2b 100644 --- a/Examples_pra_iterator.tex +++ b/Examples_pra_iterator.tex @@ -1,11 +1,11 @@ \pagebreak \chapter{Parallel Random Access Iterator Loop} -\ccppspecificstart +\cppspecificstart \label{chap:pra_iterator} The following example shows a parallel random access iterator loop. \cnexample{pra_iterator}{1c} -\ccppspecificend +\cppspecificend diff --git a/Examples_tasking.tex b/Examples_tasking.tex index e2d6b76..0432493 100644 --- a/Examples_tasking.tex +++ b/Examples_tasking.tex @@ -1,5 +1,5 @@ \pagebreak -\chapter{Tasking Constructs} +\chapter{The \code{task} and \code{taskwait} Constructs} \label{chap:tasking} The following example shows how to traverse a tree-like structure using explicit diff --git a/Examples_taskyield.tex b/Examples_taskyield.tex index 8cca5bf..88a8dfd 100644 --- a/Examples_taskyield.tex +++ b/Examples_taskyield.tex @@ -1,5 +1,5 @@ \pagebreak -\chapter{The \code{taskyield} Directive} +\chapter{The \code{taskyield} Construct} \label{chap:taskyield} The following example illustrates the use of the \code{taskyield} directive. diff --git a/Examples_threadprivate.tex b/Examples_threadprivate.tex index 27e582a..e507d10 100644 --- a/Examples_threadprivate.tex +++ b/Examples_threadprivate.tex @@ -89,7 +89,7 @@ The following is an example of the use of \code{threadprivate} for module variab \fnexample{threadprivate}{6f} \fortranspecificend -\ccppspecificstart +\cppspecificstart The following example illustrates initialization of \code{threadprivate} variables for class-type \code{T}. \code{t1} is default constructed, \code{t2} is constructed taking a constructor accepting one argument of integer type, \code{t3} is copy @@ -102,5 +102,5 @@ class members. The \code{threadprivate} directive for a static class member must be placed inside the class definition. \cnexample{threadprivate}{5c} -\ccppspecificend +\cppspecificend diff --git a/History.tex b/History.tex new file mode 100644 index 0000000..4e577f7 --- /dev/null +++ b/History.tex @@ -0,0 +1,40 @@ +\chapter{Document Revision History} +\label{chap:history} + +\section{Changes from 4.0.1 to 4.0.2} + +\begin{itemize} +\item Names of examples were changed from numbers to mnemonics +\item Added SIMD examples (\specref{chap:SIMD}) +\item Applied miscellaneous fixes in several source codes +\item Added the revision history +\end{itemize} + +\section{Changes from 4.0 to 4.0.1} + +Added the following new examples: +\begin{itemize} +\item the \code{proc\_bind} clause (\specref{chap:affinity}) +\item the \code{taskgroup} construct (\specref{chap:taskgroup}) +\end{itemize} + +\section{Changes from 3.1 to 4.0} + +Beginning with OpenMP 4.0, examples were placed in a separate document +from the specification document. + +Version 4.0 added the following new examples: +\begin{itemize} +\item task dependences (\specref{chap:task_dep}) +\item cancellation constructs (\specref{chap:cancellation}) +\item \code{target} construct (\specref{chap:target}) +\item \code{target} \code{data} construct (\specref{chap:target_data}) +\item \code{target} \code{update} construct (\specref{chap:target_update}) +\item \code{declare} \code{target} construct (\specref{chap:declare_target}) +\item \code{teams} constructs (\specref{chap:teams}) +\item asynchronous execution of a \code{target} region using tasks + (\specref{chap:async_target}) +\item array sections in device constructs (\specref{chap:array_sections}) +\item device runtime routines (\specref{chap:device}) +\item Fortran ASSOCIATE construct (\specref{chap:associate}) +\end{itemize} diff --git a/Makefile b/Makefile index f472daf..8babd70 100644 --- a/Makefile +++ b/Makefile @@ -67,7 +67,8 @@ CHAPTERS=Title_Page.tex \ Examples_async_target.tex \ Examples_array_sections.tex \ Examples_device.tex \ - Examples_associate.tex + Examples_associate.tex \ + History.tex INTERMEDIATE_FILES=openmp-examples.pdf \ openmp-examples.toc \ diff --git a/README b/README index 769c34f..71d7817 100644 --- a/README +++ b/README @@ -53,9 +53,10 @@ For a brief revision history, please see Changes.log. \fnexample{}{f} - Language h-rules - \cspecificbegin, \cspecificend - \cppspecificbegin, \cppspecificend - \fortranspecificbegin, \fortranspecificend + \cspecificstart, \cspecificend + \cppspecificstart, \cppspecificend + \ccppspecificstart, \ccppspecificend + \fortranspecificstart, \fortranspecificend - See openmp.sty for more information diff --git a/Title_Page.tex b/Title_Page.tex index bcd08eb..7ae8845 100644 --- a/Title_Page.tex +++ b/Title_Page.tex @@ -17,7 +17,7 @@ \vspace{1.0in} - \textbf{Version 4.0.2rv1 -- February, 2015} + \textbf{Version 4.0.2rv3 -- February, 2015} \end{center} \end{adjustwidth} @@ -39,6 +39,7 @@ permission of OpenMP Architecture Review Board.\end{adjustwidth} \phantom{a} \emph{This page intentionally left blank} -This working version enacted the following tickets: 299, 342, and a few other editorial changes. +This working version enacted the following tickets: 180, 295, 299, 342, 381, +and a few other editorial changes. \vfill diff --git a/openmp-examples.tex b/openmp-examples.tex index 194fdfb..d73adc9 100644 --- a/openmp-examples.tex +++ b/openmp-examples.tex @@ -135,5 +135,6 @@ \input{Examples_array_sections} \input{Examples_device} \input{Examples_associate} + \input{History} \end{document} diff --git a/openmp.sty b/openmp.sty index f1de19b..4bfa384 100644 --- a/openmp.sty +++ b/openmp.sty @@ -470,6 +470,12 @@ \ccppspecificend } +\newcommand\cppexample[2]{% +\needspace{5\baselineskip}\cppspecificstart +\cnexample{#1}{#2} +\cppspecificend +} + \newcommand\fexample[2]{% \needspace{5\baselineskip}\fortranspecificstart \fnexample{#1}{#2} diff --git a/sources/Example_default_none.1c.c b/sources/Example_default_none.1c.c index d3809a8..f5ca968 100644 --- a/sources/Example_default_none.1c.c +++ b/sources/Example_default_none.1c.c @@ -13,14 +13,14 @@ void default_none(int a) { const int c = 1; int i = 0; - #pragma omp parallel default(none) private(a) shared(z) + #pragma omp parallel default(none) private(a) shared(z, c) { int j = omp_get_num_threads(); /* O.K. - j is declared within parallel region */ a = z[j]; /* O.K. - a is listed in private clause */ /* - z is listed in shared clause */ x = c; /* O.K. - x is threadprivate */ - /* - c has const-qualified type */ + /* - c has const-qualified type and is listed in shared */ z[i] = y; /* Error - cannot reference i or y here */ #pragma omp for firstprivate(y)