diff --git a/Chap_affinity.tex b/Chap_affinity.tex index c465b97..d2ec343 100644 --- a/Chap_affinity.tex +++ b/Chap_affinity.tex @@ -2,7 +2,7 @@ \label{chap:openmp_affinity} OpenMP Affinity consists of a \code{proc\_bind} policy (thread affinity policy) and a specification of -places (\texttt{"}location units\texttt{"} or \plc{processors} that may be cores, hardware +places (``location units'' or \plc{processors} that may be cores, hardware threads, sockets, etc.). OpenMP Affinity enables users to bind computations on specific places. The placement will hold for the duration of the parallel region. @@ -26,7 +26,7 @@ SMT is enabled, a processor is a hardware thread (HW-thread). (This is the usual case; but actually, the execution unit is implementation defined.) Processor numbers are numbered sequentially from 0 to the number of cores less one (without SMT), or 0 to the number HW-threads less one (with SMT). OpenMP places use the processor number to designate -binding locations (unless an \texttt{"}abstract name\texttt{"} is used.) +binding locations (unless an ``abstract name'' is used.) The processors available to a process may be a subset of the system's diff --git a/Chap_devices.tex b/Chap_devices.tex index 7647f03..4d1c791 100644 --- a/Chap_devices.tex +++ b/Chap_devices.tex @@ -21,7 +21,7 @@ a data region around \code{target} constructs, and is convenient for providing persistent data throughout multiple \code{target} regions. The \code{target} \code{enter} \code{data} and \code{target} \code{exit} \code{data} constructs are unstructured, because -they can occur anywhere and do not support a "structure" +they can occur anywhere and do not support a ``structure'' (a region) for enclosing \code{target} constructs, as does the \code{target} \code{data} construct. diff --git a/Chap_directives.tex b/Chap_directives.tex index 7a997cc..ef0b6e9 100644 --- a/Chap_directives.tex +++ b/Chap_directives.tex @@ -41,13 +41,17 @@ and some directives also accept parenthesized arguments that follow the directiv A clause may just be a keyword (e.g., \scode{untied}) or it may also accept argument lists (e.g., \scode{shared(x,y,z)}) and/or optional modifiers (e.g., \scode{tofrom} in \scode{map(tofrom:}~\scode{x,y,z)}). -Clause modifiers may be "simple" or "complex" -- a complex modifier consists of a +Clause modifiers may be ``simple'' or ``complex'' -- a complex modifier consists of a keyword followed by one or more parameters, bracketed by parentheses, while a simple modifier does not. An example of a complex modifier is the \scode{iterator} modifier, as in \scode{map(iterator(i=0:n),}~\scode{tofrom:}~\scode{p[i])}, or the \scode{step} modifier, as in \scode{linear(x:}~\scode{ref,}~\scode{step(4))}. In the preceding examples, \scode{tofrom} and \scode{ref} are simple modifiers. +For Fortran, a declarative directive (such as \code{declare}~\code{reduction}) +must appear after any \code{USE}, \code{IMPORT}, and \code{IMPLICIT} statements +in the specification part. + %===== Examples Sections ===== \input{directives/pragmas} diff --git a/Chap_introduction.tex b/Chap_introduction.tex index aa75d8b..ac9703a 100644 --- a/Chap_introduction.tex +++ b/Chap_introduction.tex @@ -57,8 +57,8 @@ allows interpretation of all OpenMP directives. The documents and source codes for OpenMP Examples can be downloaded from \href{https://github.com/OpenMP/Examples}{https://github.com/OpenMP/Examples}. Each directory holds the contents of a chapter and has a \splc{sources} subdirectory of its codes. -The codes for this OpenMP \VER{} Examples document have the tag -\href{https://github.com/OpenMP/Examples/tree/v\VER}{\plc{v\PVER}}. +This OpenMP Examples \VER{} document and its codes are tagged as +\href{https://github.com/OpenMP/Examples/tree/v\VER}{\plc{v\VER}}. Complete information about the OpenMP API and a list of the compilers that support the OpenMP API can be found at the OpenMP.org web site diff --git a/Chap_parallel_execution.tex b/Chap_parallel_execution.tex index 37e28e5..a639051 100644 --- a/Chap_parallel_execution.tex +++ b/Chap_parallel_execution.tex @@ -49,8 +49,10 @@ WORKSHARING CONSTRUCTS A worksharing construct distributes the execution of the associated region among the members of the team that encounter it. There is an implied barrier at the end of the worksharing region -(there is no barrier at the beginning). The worksharing -constructs are: +(there is no barrier at the beginning). + +\newpage +The worksharing constructs are: \begin{compactitem} @@ -66,10 +68,10 @@ consisting of a loop. A loop controlled by a loop construct is called an \plc{associated} loop. Nested loops can form a single region when the \code{collapse} clause (with an integer argument) designates the number of \plc{associated} loops to be executed in parallel, by forming a -"single iteration space" for the specified number of nested loops. +``single iteration space'' for the specified number of nested loops. The \code{ordered} clause can also control multiple associated loops. -An associated loop must adhere to a "canonical form" (specified in the +An associated loop must adhere to a ``canonical form'' (specified in the \plc{Canonical Loop Form} of the OpenMP Specifications document) which allows the iteration count (of all associated loops) to be computed before the (outermost) loop is executed. %[58:27-29]. diff --git a/Chap_program_control.tex b/Chap_program_control.tex index a8fd458..0367eae 100644 --- a/Chap_program_control.tex +++ b/Chap_program_control.tex @@ -36,7 +36,7 @@ continues execution at the end of the named region. The \code{cancel} construct is also a cancellation point for any other thread of the team to also continue execution at the end of the named region. -Also, once the specified region has been activated for cancellation any thread that encounnters +Also, once the specified region has been activated for cancellation any thread that encounters a \code{cancellation}~\code{point} construct with the same named region (\plc{construct-type-clause}), continues execution at the end of the region. @@ -80,7 +80,7 @@ modified or restricted meaning, relative to when the constructs are uncombined. %construct with one of the loops constructs \code{do} or \code{for}. The %\code{parallel do SIMD} and \code{parallel for SIMD} constructs are composite constructs (composed from %the parallel loop constructs and the \code{SIMD} construct), because the \code{collapse} clause must -%explicitly address the ordering of loop chunking \plc{and} SIMD "combined" execution. +%explicitly address the ordering of loop chunking \plc{and} SIMD ``combined'' execution. Certain nestings are forbidden, and often the reasoning is obvious. For example, worksharing constructs cannot be nested, and the \code{barrier} construct cannot be nested inside a worksharing construct, or a \code{critical} construct. @@ -108,6 +108,7 @@ chapter in the OpenMP Specifications document. \input{program_control/nested_loop} \input{program_control/nesting_restrict} \input{program_control/target_offload} +\input{program_control/pause_resource} \input{program_control/reproducible} \input{program_control/interop} \input{program_control/utilities} diff --git a/Chap_synchronization.tex b/Chap_synchronization.tex index 7ebf3e2..dfe93d9 100644 --- a/Chap_synchronization.tex +++ b/Chap_synchronization.tex @@ -85,6 +85,7 @@ in the OpenMP Specifications document. %(DO REF. RIGHT.) \input{synchronization/worksharing_critical} \input{synchronization/barrier_regions} \input{synchronization/atomic} +\input{synchronization/atomic_cas} \input{synchronization/atomic_restrict} \input{synchronization/flush_nolist} \input{synchronization/acquire_release} diff --git a/Chap_tasking.tex b/Chap_tasking.tex index a8b6692..06134ad 100644 --- a/Chap_tasking.tex +++ b/Chap_tasking.tex @@ -7,8 +7,8 @@ Worksharing constructs do this, too (e.g. \code{for}, \code{do}, but the work units are tightly controlled by an iteration limit and limited scheduling, or a limited number of \code{sections} or \code{single} regions. Worksharing was designed -with \texttt{"}data parallel\texttt{"} computing in mind. Tasking was designed for -\texttt{"}task parallel\texttt{"} computing and often involves non-locality or irregularity +with ``data parallel'' computing in mind. Tasking was designed for +``task parallel'' computing and often involves non-locality or irregularity in memory access. The \code{task} construct can be used to execute work chunks: in a while loop; diff --git a/Contributions.md b/Contributions.md index f5d79b4..eb69dc1 100644 --- a/Contributions.md +++ b/Contributions.md @@ -26,18 +26,18 @@ For a brief revision history, see `Changes.log` in the repo. * Clone your fork locally * If you are working on generic or old-version updates, create a branch off master. * If you are working on an example for a release candidate for version #.#, create a branch off work_#.#. - 1.) `git clone --branch https://github.com//examples-internal` - 2.) `git checkout -b ` - 3.) ... `add`, `commit` - 4.) `git push -u origin ` - 5.) `make` or `make diff` will create a full-document pdf or just a pdf with differences (do this at any point). + 1) `git clone --branch https://github.com//examples-internal` + 2) `git checkout -b ` + 3) ... `add`, `commit` + 4) `git push -u origin ` + 5) `make` or `make diff` will create a full-document pdf or just a pdf with differences (do this at any point). * `git status` and `git branch -a` are your friends * Submit an issue for your work (usually with a diff pdf), and then you will be asked to submit a pull request * Create an issue by selecting the (issue tab)[https://github.com/openmp/examples-internal/issues] and clicking on `new issue`. * Use this MarkDown Cheatsheet for (issue formatting)[https://wordpress.com/support/markdown-quick-reference/] * More MarkDown details are available (here)[https://markdown-it.github.io] * You can cut and paste markdown formatted text in a (reader)[https://dillinger.io] to see formatting effects. - * Forced spaces are available in Markdown. On a Mac is is "option+space". + * Forced spaces are available in Markdown. On a Mac it is "option+space". * Polling is available. Go to (gh-poll)[https://app.gh-polls.com/]. Type an option on each line, then click `copy markdown`, and paste the contents into the issue. (Use preview to check your poll, and then submit it.) * Create a pull request @@ -45,8 +45,8 @@ For a brief revision history, see `Changes.log` in the repo. ## Processing source code * Prepare source code (C/C++ and Fortran) and a text description (use similar styles found in recent examples) - * Determine the *example* name ``, *sequence* number `` and *compiler* suffix `` for the example - * The syntax is: `..` (e.g. `affinity_display.1.f90`) + * Determine the *example* name ``, *sequence* identifier `` and *compiler* suffix `` for the example + * The syntax is: `..` (e.g. `affinity_display.1.f90`) * The example name may be a Section name (e.g. affinity), or a Subsection name (affinity_display) * If you are creating a new Chapter, it may be the chapter name. * New examples are usually added at the end of a Section or Subsection. Number it as the next number in the sequence numbers for examples in that Section or Subsection. @@ -56,29 +56,42 @@ For a brief revision history, see `Changes.log` in the repo. ``` @@name: . @@type: C|C++|F-fixed|F-free - @@requires: preprocessing - @@compilable: yes|no|maybe - @@linkable: yes|no|maybe - @@expect: success|compile-time-error|runtime-error|undefined-behavior - @@version: omp_ + @@operation: view|compile|link|run + @@expect: success|ct-error|rt-error|unspecified + @@version: [pre_]omp_ + @@env: + @@depend: ``` * **name** is the name of an example * **type** 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) - * **requires** - any additional requirements, currently `preprocessing` for requiring preprocessing - * **compilable** - indicates whether the source code is compilable - * **linkable** - indicates whether the source code is linkable + * **operation** + indicates how the source code is treated. Possible values are: + `view` - code for illustration only, not compilable; + `compile` - incomplete program, such as function or subroutine; + `link` - complete program, but no verification value; + `run` - complete program with verification value. * **expect** - indicates some expected result for testing purpose "`success|compile-time-error|ct-error`" applies - to the result of code compilation; "`runtime-error|rt-error`" is for a case where compilation may be - successful, but the code contains potential runtime issues (such as race condition); `undefined-behavior` could result from a non-conforming code. - Alternative would be to just use "`conforming`" or "`non-conforming`". + indicates some expected result for testing purpose. + `success` means no issue; + `ct-error` applies to the result of code compilation; + `rt-error` is for a case where compilation may be successful, but the code + contains potential runtime issues (including race condition); + `unspecified` could result from a non-conforming code or is for code + that is viewable only. * **version** - indicates features for a specific OpenMP version, such as "`omp_5.0`" + indicates that the example uses features in a specific OpenMP version, such as "`omp_5.0`" + The prefix `pre_` indicates that the example uses features prior to a specific version, such as "`pre_omp_3.0`". + * **env** + specifies any environment variables needed to run the code. + This tag is optional and can be repeated. + * **depend** + specifies a source code file on which the current code depends. + This tag is optional and can be repeated. + * For **env** and **depend**, make sure to specify + a proper skipping number `` in the LaTeX macros described below + to match with the number of `env` and `depend` tags. ## Process for text @@ -134,7 +147,7 @@ The following describes LaTeX macros defined specifically for examples. to this macro is the file extension (such as `h`, `hpp`, `inc`). The `` option to each macro allows finer-control of any additional lines - to be skipped due to addition of new `@@` tags, such as `@@requires`. + to be skipped due to addition of new `@@` tags, such as `@@env`. The default value for `` is 0. ### Language h-rules @@ -173,4 +186,4 @@ if it is different. ## License -For copyright information, please see `omp_copyright.txt`. +For copyright information, please see [omp_copyright.txt](omp_copyright.txt). diff --git a/Deprecated_Features_Chapt.tex b/Deprecated_Features_Chapt.tex deleted file mode 100644 index de35e00..0000000 --- a/Deprecated_Features_Chapt.tex +++ /dev/null @@ -1,21 +0,0 @@ -\bchapter{Deprecated Features} -\label{chap:deprecated_features} - -Deprecation of features began in OpenMP 5.0. -Examples that use a deprecated feature have been updated with an equivalent replacement feature. - -Deprecations affecting examples are the following: -\begin{description}[labelindent=5mm,font=\normalfont] -\item[5.1] -- \ \scode{masked} construct replaces \scode{master} construct. -\item[5.1] -- \ \scode{primary} affinity policy replaces \scode{master} affinity policy. -\item[5.0] -- \ \scode{omp_sync_hint_*} constants replace \scode{omp_lock_hint_*} constants. -\end{description} - -These replacements appear in examples that illustrate, otherwise, earlier features. -When using a compiler that is compliant with a version prior to -the indicated version, the earlier form of -an example is restored by a C-style conditional compilation using the \scode{_OPENMP} macro. - -Since Fortran compilers do not preprocess codes by default, a Fortran preprocessor -flag will be required to compile Fortran examples with the C-style conditional -compilation statements. diff --git a/Examples_Chapt.tex b/Examples_Chapt.tex deleted file mode 100644 index f022693..0000000 --- a/Examples_Chapt.tex +++ /dev/null @@ -1,24 +0,0 @@ -\bchapter{Examples} -\label{chap:examples} - -The following are examples of the OpenMP API directives, constructs, and routines. -\ccppspecificstart -A statement following a directive is compound only when necessary, and a -non-compound statement is indented with respect to a directive preceding it. -\ccppspecificend - -Each example is labeled as \plc{ename.seqno.ext}, where \plc{ename} is -the example name, \plc{seqno} is the sequence number in a section, and -\plc{ext} is the source file extension to indicate the code type and -source form. \plc{ext} is one of the following: -\begin{description}[noitemsep,labelindent=5mm,widest=f90] -\item[\plc{c}] -- \ C code, -\item[\plc{cpp}] -- \ C++ code, -\item[\plc{f}] -- \ Fortran code in fixed form, and -\item[\plc{f90}] -- \ Fortran code in free form. -\end{description} - -Some of the example labels may include version information -(\code{\small{}omp\_\plc{verno}}) to indicate features that are illustrated -by an example for a specific OpenMP version, such as ``\plc{scan.1.c} -\;(\code{\small{}omp\_5.0}).'' diff --git a/Foreword_Chapt.tex b/Foreword_Chapt.tex index 522e07b..3298858 100644 --- a/Foreword_Chapt.tex +++ b/Foreword_Chapt.tex @@ -2,16 +2,16 @@ \label{chap:foreword} The OpenMP Examples document has been updated with new features -found in the OpenMP \VER\ Specification. The additional examples and updates +found in the OpenMP \PVER\ Specification. The additional examples and updates are referenced in the Document Revision History of the Appendix on page~\pageref{chap:history}. -Text describing an example with a \VER\ feature specifically states -that the feature support begins in the OpenMP \VER\ Specification. Also, -an \code{\small omp\_\VER} keyword is included in the metadata of the source code. -These distinctions are presented to remind readers that a \VER\ compliant +Text describing an example with a \PVER\ feature specifically states +that the feature support begins in the OpenMP \PVER\ Specification. Also, +an \code{\small omp\_\PVER} keyword is included in the metadata of the source code. +These distinctions are presented to remind readers that a \PVER\ compliant OpenMP implementation is necessary to use these features in codes. -Examples for most of the \VER\ features are included in this document, +Examples for most of the \PVER\ features are included in this document, and incremental releases will become available as more feature examples and updates are submitted and approved by the OpenMP Examples Subcommittee. @@ -28,6 +28,6 @@ actively participated and contributed in weekly meetings over the years. \bigskip Examples Subcommittee Co-chairs: \smallskip\linebreak Henry Jin (\textsc{NASA} Ames Research Center) \linebreak -Kent Milfeld (\textsc{TACC}, Texas Advanced Computing Center) +Swaroop Pophale (Oak Ridge National Labortory) diff --git a/History.tex b/History.tex index 63c766b..a1eabb1 100644 --- a/History.tex +++ b/History.tex @@ -1,6 +1,54 @@ \cchapter{Document Revision History}{history} \label{chap:history} +%===================================== +\section{Changes from 5.2 to 5.2.1} +\label{sec:history_52_to_521} + +\begin{itemize} +\item General changes: +\begin{itemize} +\item Updated source metadata tags for all examples to use an improved form + (see \href{https://github.com/OpenMP/Examples/blob/v\VER/Contributions.md}% + {https://github.com/OpenMP/Examples/blob/v\VER/Contributions.md}) +\item Explicitly included the version tag \verlabel[pre\_]{3.0} in those + examples that did not contain a version tag previously +\end{itemize} + +\item Added the following examples for the 5.2 features: +\begin{itemize} + \item \scode{uses_allocators} clause for the use of allocators in + \code{target} regions (\specref{sec:allocators}) +\end{itemize} +\item Added the following examples for the 5.1 features: +\begin{itemize} + \item The \scode{inoutset} dependence type (\specref{subsec:task_concurrent_depend}) + \item Atomic compare and capture (\specref{sec:cas}) +\end{itemize} +\item Added other examples: +\begin{itemize} + \item \scode{omp_pause_resource} and \scode{omp_pause_resource_all} + routines (\specref{sec:pause_resource}) +\end{itemize} + +\item Miscellaneous fixes: +\begin{itemize} +\item Fixed an inconsistent use of mapper in \splc{Example target_mapper.3.f90} + (\specref{sec:declare_mapper}) +\item Fixed mismatched argument list in \splc{Example fort_sa_private.5.f} + (\specref{sec:fort_sa_private}) +\item Moved the placement of \code{declare}~\code{target}~\code{enter} + directive after function declaration + (\specref{subsec:target_task_reduction}) +\item Fixed an incorrect use of \scode{omp_in_parallel} routine in + \splc{Example metadirective.4} + (\specref{sec:metadirective}) +\item Fixed an incorrect value for \code{at} clause + (\specref{subsec:error}) +\end{itemize} + +\end{itemize} + %===================================== \section{Changes from 5.1 to 5.2} \label{sec:history_51_to_52} diff --git a/Introduction_Chapt.tex b/Introduction_Chapt.tex deleted file mode 100644 index 22e0455..0000000 --- a/Introduction_Chapt.tex +++ /dev/null @@ -1,71 +0,0 @@ -% This is the introduction for the OpenMP Examples document. -% This is an included file. See the main file (openmp-examples.tex) for more information. -% -% When editing this file: -% -% 1. To change formatting, appearance, or style, please edit openmp.sty. -% -% 2. Custom commands and macros are defined in openmp.sty. -% -% 3. Be kind to other editors -- keep a consistent style by copying-and-pasting to -% create new content. -% -% 4. We use semantic markup, e.g. (see openmp.sty for a full list): -% \code{} % for bold monospace keywords, code, operators, etc. -% \plc{} % for italic placeholder names, grammar, etc. -% -% 5. Other recommendations: -% Use the convenience macros defined in openmp.sty for the minor headers -% such as Comments, Syntax, etc. -% -% To keep items together on the same page, prefer the use of -% \begin{samepage}.... Avoid \parbox for text blocks as it interrupts line numbering. -% When possible, avoid \filbreak, \pagebreak, \newpage, \clearpage unless that's -% what you mean. Use \needspace{} cautiously for troublesome paragraphs. -% -% Avoid absolute lengths and measures in this file; use relative units when possible. -% Vertical space can be relative to \baselineskip or ex units. Horizontal space -% can be relative to \linewidth or em units. -% -% Prefer \emph{} to italicize terminology, e.g.: -% This is a \emph{definition}, not a placeholder. -% This is a \plc{var-name}. -% - -\bchapter{Introduction} -\label{chap:introduction} - -This collection of programming examples supplements the OpenMP API for Shared -Memory Parallelization specifications, and is not part of the formal specifications. It -assumes familiarity with the OpenMP specifications, and shares the typographical -conventions used in that document. - -The OpenMP API specification provides a model for parallel programming that is -portable across shared memory architectures from different vendors. Compilers from -numerous vendors support the OpenMP API. - -The directives, library routines, and environment variables demonstrated in this -document allow users to create and manage parallel programs while permitting -portability. The directives extend the C, C++ and Fortran base languages with single -program multiple data (SPMD) constructs, tasking constructs, device constructs, -worksharing constructs, and synchronization constructs, and they provide support for -sharing and privatizing data. The functionality to control the runtime environment is -provided by library routines and environment variables. Compilers that support the -OpenMP API often include a command line option to the compiler that activates and -allows interpretation of all OpenMP directives. - -The latest source codes for OpenMP Examples can be downloaded from the \code{sources} -directory at -\href{https://github.com/OpenMP/Examples}{https://github.com/OpenMP/Examples}. -The codes for this OpenMP \VER{} Examples document have the tag \plc{v\VER}. - -%\href{https://github.com/OpenMP/Examples/tree/main/sources}{https://github.com/OpenMP/Examples/sources}. - -Complete information about the OpenMP API and a list of the compilers that support -the OpenMP API can be found at the OpenMP.org web site - -\code{http://www.openmp.org} - - -% This is the end of introduction.tex of the OpenMP Examples document. - diff --git a/Makefile b/Makefile index 3156ec1..4c74dd0 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,13 @@ # Makefile for the OpenMP Examples document in LaTex format. # For more information, see the main document, openmp-examples.tex. -version=5.2 +version=5.2.1 default: openmp-examples.pdf diff: openmp-diff-abridged.pdf book: BOOK_BUILD="\\\\def\\\\bookbuild{1}" book: clean openmp-examples.pdf - cp openmp-examples-${version}.pdf openmp-examples-${version}-book.pdf + mv openmp-examples-${version}.pdf openmp-examples-${version}-book.pdf CHAPTERS=Title_Page.tex \ Foreword_Chapt.tex \ @@ -53,6 +53,7 @@ clean: rm -f openmp-diff-full.pdf openmp-diff-abridged.pdf rm -rf *.tmpdir cd util; make clean + rm -f chk_tags.log sources/*.log realclean: clean rm -f openmp-examples-${version}.pdf openmp-examples-${version}-book.pdf @@ -83,6 +84,7 @@ VC_DIFF_MINIMAL_OPTS:= --only-changes --force generated-include.tex: echo "$(BOOK_BUILD)" echo "$(BOOK_BUILD)" > $@ + util/list_tags -vtag */sources/* >> $@ %.tmpdir: $(wildcard *.sty) $(wildcard *.png) $(wildcard *.aux) openmp-examples.pdf mkdir -p $@/sources diff --git a/SIMD/sources/SIMD.1.c b/SIMD/sources/SIMD.1.c index aa799db..da7efca 100644 --- a/SIMD/sources/SIMD.1.c +++ b/SIMD/sources/SIMD.1.c @@ -1,8 +1,7 @@ /* * @@name: SIMD.1 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ diff --git a/SIMD/sources/SIMD.1.f90 b/SIMD/sources/SIMD.1.f90 index e87f889..f070a07 100644 --- a/SIMD/sources/SIMD.1.f90 +++ b/SIMD/sources/SIMD.1.f90 @@ -1,7 +1,6 @@ ! @@name: SIMD.1 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_4.0 subroutine star(a,b,c,n,ioff_ptr) diff --git a/SIMD/sources/SIMD.2.c b/SIMD/sources/SIMD.2.c index 18e8982..1d407a8 100644 --- a/SIMD/sources/SIMD.2.c +++ b/SIMD/sources/SIMD.2.c @@ -1,8 +1,7 @@ /* * @@name: SIMD.2 * @@type: C -* @@compilable: yes -* @@linkable: yes +* @@operation: link * @@expect: success * @@version: omp_4.0 */ diff --git a/SIMD/sources/SIMD.2.f90 b/SIMD/sources/SIMD.2.f90 index d822c46..e30fd96 100644 --- a/SIMD/sources/SIMD.2.f90 +++ b/SIMD/sources/SIMD.2.f90 @@ -1,7 +1,6 @@ ! @@name: SIMD.2 ! @@type: F-free -! @@compilable: yes -! @@linkable: yes +! @@operation: link ! @@expect: success ! @@version: omp_4.0 program main diff --git a/SIMD/sources/SIMD.3.c b/SIMD/sources/SIMD.3.c index 8f94fc2..a2719b5 100644 --- a/SIMD/sources/SIMD.3.c +++ b/SIMD/sources/SIMD.3.c @@ -1,8 +1,7 @@ /* * @@name: SIMD.3 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ diff --git a/SIMD/sources/SIMD.3.f90 b/SIMD/sources/SIMD.3.f90 index 27abe90..6462690 100644 --- a/SIMD/sources/SIMD.3.f90 +++ b/SIMD/sources/SIMD.3.f90 @@ -1,7 +1,6 @@ ! @@name: SIMD.3 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_4.0 subroutine work( a, b, n, sum ) diff --git a/SIMD/sources/SIMD.4.c b/SIMD/sources/SIMD.4.c index 09d5e4c..c504f4f 100644 --- a/SIMD/sources/SIMD.4.c +++ b/SIMD/sources/SIMD.4.c @@ -1,8 +1,7 @@ /* * @@name: SIMD.4 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ diff --git a/SIMD/sources/SIMD.4.f90 b/SIMD/sources/SIMD.4.f90 index 22d0a1a..758770c 100644 --- a/SIMD/sources/SIMD.4.f90 +++ b/SIMD/sources/SIMD.4.f90 @@ -1,7 +1,6 @@ ! @@name: SIMD.4 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_4.0 subroutine work( b, n, m ) diff --git a/SIMD/sources/SIMD.5.c b/SIMD/sources/SIMD.5.c index ced3381..3ff5547 100644 --- a/SIMD/sources/SIMD.5.c +++ b/SIMD/sources/SIMD.5.c @@ -1,8 +1,7 @@ /* * @@name: SIMD.5 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ diff --git a/SIMD/sources/SIMD.5.f90 b/SIMD/sources/SIMD.5.f90 index bfc8103..c9f6885 100644 --- a/SIMD/sources/SIMD.5.f90 +++ b/SIMD/sources/SIMD.5.f90 @@ -1,7 +1,6 @@ ! @@name: SIMD.5 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_4.0 subroutine work( a, b, c, n ) diff --git a/SIMD/sources/SIMD.6.c b/SIMD/sources/SIMD.6.c index d9ab14e..578ba5a 100644 --- a/SIMD/sources/SIMD.6.c +++ b/SIMD/sources/SIMD.6.c @@ -1,8 +1,7 @@ /* * @@name: SIMD.6 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ diff --git a/SIMD/sources/SIMD.6.f90 b/SIMD/sources/SIMD.6.f90 index 104346a..9d13777 100644 --- a/SIMD/sources/SIMD.6.f90 +++ b/SIMD/sources/SIMD.6.f90 @@ -1,7 +1,6 @@ ! @@name: SIMD.6 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_4.0 function foo(p) result(r) diff --git a/SIMD/sources/SIMD.7.c b/SIMD/sources/SIMD.7.c index f4789dd..cf3986f 100644 --- a/SIMD/sources/SIMD.7.c +++ b/SIMD/sources/SIMD.7.c @@ -1,8 +1,7 @@ /* * @@name: SIMD.7 * @@type: C -* @@compilable: yes -* @@linkable: yes +* @@operation: run * @@expect: success * @@version: omp_4.0 */ @@ -33,6 +32,6 @@ int main(void) for (i=0; i < N; i++) { a[i] = fib(b[i]); } - printf("Done a[%d] = %d\n", N-1, a[N-1]); + printf("Done a[%d] = %d\n", N-1, a[N-1]); //Done a[44] = 701408733 return 0; } diff --git a/SIMD/sources/SIMD.7.f90 b/SIMD/sources/SIMD.7.f90 index c82d74d..04cc841 100644 --- a/SIMD/sources/SIMD.7.f90 +++ b/SIMD/sources/SIMD.7.f90 @@ -1,7 +1,6 @@ ! @@name: SIMD.7 ! @@type: F-free -! @@compilable: yes -! @@linkable: yes +! @@operation: run ! @@expect: success ! @@version: omp_4.0 program fibonacci diff --git a/SIMD/sources/SIMD.8.c b/SIMD/sources/SIMD.8.c index d89b357..0f8b1e6 100644 --- a/SIMD/sources/SIMD.8.c +++ b/SIMD/sources/SIMD.8.c @@ -1,8 +1,7 @@ /* * @@name: SIMD.8 * @@type: C -* @@compilable: yes -* @@linkable: yes +* @@operation: run * @@expect: success * @@version: omp_4.0 */ diff --git a/SIMD/sources/SIMD.8.f90 b/SIMD/sources/SIMD.8.f90 index 13ebc72..8175f34 100644 --- a/SIMD/sources/SIMD.8.f90 +++ b/SIMD/sources/SIMD.8.f90 @@ -1,7 +1,6 @@ ! @@name: SIMD.8 ! @@type: F-free -! @@compilable: yes -! @@linkable: yes +! @@operation: run ! @@expect: success ! @@version: omp_4.0 module work diff --git a/SIMD/sources/linear_modifier.1.cpp b/SIMD/sources/linear_modifier.1.cpp index d6f300e..7c81c24 100644 --- a/SIMD/sources/linear_modifier.1.cpp +++ b/SIMD/sources/linear_modifier.1.cpp @@ -1,10 +1,9 @@ /* * @@name: linear_modifier.1 * @@type: C++ -* @@compilable: yes -* @@linkable: yes +* @@operation: run * @@expect: success -* @@version: omp_5.1 +* @@version: omp_5.2 */ #include diff --git a/SIMD/sources/linear_modifier.1.f90 b/SIMD/sources/linear_modifier.1.f90 index 5b55bf9..4395b8b 100644 --- a/SIMD/sources/linear_modifier.1.f90 +++ b/SIMD/sources/linear_modifier.1.f90 @@ -1,7 +1,6 @@ ! @@name: linear_modifier.1 ! @@type: F-free -! @@compilable: yes -! @@linkable: yes +! @@operation: run ! @@expect: success ! @@version: omp_5.2 module m @@ -10,8 +9,9 @@ module m contains subroutine add_one2(p) - !$omp declare simd(add_one2) linear(p: ref) simdlen(8) implicit none + !$omp declare simd(add_one2) linear(p: ref) simdlen(8) + integer :: p p = p + 1 @@ -45,4 +45,3 @@ program main end do print *, "passed" end program - diff --git a/SIMD/sources/linear_modifier.2.cpp b/SIMD/sources/linear_modifier.2.cpp index a150e49..4a6c8b6 100644 --- a/SIMD/sources/linear_modifier.2.cpp +++ b/SIMD/sources/linear_modifier.2.cpp @@ -1,8 +1,7 @@ /* * @@name: linear_modifier.2 * @@type: C++ -* @@compilable: yes -* @@linkable: yes +* @@operation: run * @@expect: success * @@version: omp_5.2 */ diff --git a/SIMD/sources/linear_modifier.2.f90 b/SIMD/sources/linear_modifier.2.f90 index 6f22937..25075c6 100644 --- a/SIMD/sources/linear_modifier.2.f90 +++ b/SIMD/sources/linear_modifier.2.f90 @@ -1,7 +1,6 @@ ! @@name: linear_modifier.2 ! @@type: F-free -! @@compilable: yes -! @@linkable: yes +! @@operation: run ! @@expect: success ! @@version: omp_5.2 module m @@ -10,8 +9,9 @@ module m contains subroutine add_one2(p, i) - !$omp declare simd(add_one2) linear(p: ref) linear(i: uval) implicit none + !$omp declare simd(add_one2) linear(p: ref) linear(i: uval) + integer :: p integer, intent(in) :: i diff --git a/SIMD/sources/linear_modifier.3.c b/SIMD/sources/linear_modifier.3.c index 422a2e0..68cdbc0 100644 --- a/SIMD/sources/linear_modifier.3.c +++ b/SIMD/sources/linear_modifier.3.c @@ -1,8 +1,7 @@ /* * @@name: linear_modifier.3 * @@type: C -* @@compilable: yes -* @@linkable: yes +* @@operation: run * @@expect: success * @@version: omp_5.2 */ diff --git a/SIMD/sources/linear_modifier.3.f90 b/SIMD/sources/linear_modifier.3.f90 index f47f84f..1c83621 100644 --- a/SIMD/sources/linear_modifier.3.f90 +++ b/SIMD/sources/linear_modifier.3.f90 @@ -1,14 +1,14 @@ ! @@name: linear_modifier.3 ! @@type: F-free -! @@compilable: yes -! @@linkable: yes +! @@operation: run ! @@expect: success ! @@version: omp_5.2 module func_mod contains real(8) function func(x, y, i) + implicit none !$omp declare simd(func) simdlen(4) uniform(x, y) linear(i:val,step(1)) - implicit none + real(8), intent(in) :: x(*), y(*) integer, intent(in) :: i diff --git a/Title_Page.tex b/Title_Page.tex index ab4d1f6..31a295f 100644 --- a/Title_Page.tex +++ b/Title_Page.tex @@ -17,13 +17,13 @@ \vspace{1.0in} - \textbf{Version \PVER{} -- \VERDATE} + \textbf{Version \VER{} -- \VERDATE} \end{center} \end{adjustwidth} \vspace{2.3in} %was 3.0 -Source codes for OpenMP \VER{} Examples are available at +Source codes for OpenMP Examples \VER{} are available at \href{https://github.com/OpenMP/Examples/tree/v\VER}% {github (https://github.com/OpenMP/Examples/tree/v\VER)}.\\ diff --git a/affinity/affinity.tex b/affinity/affinity.tex index 1402331..d42753c 100644 --- a/affinity/affinity.tex +++ b/affinity/affinity.tex @@ -236,9 +236,9 @@ The following example shows the result of the \code{primary} affinity policy on the partition list for the machine architecture depicted above. The place partition is not changed by the primary policy. -\cexample[4.0]{affinity}{5} +\cexample[5.1]{affinity}{5} -\fexample[4.0]{affinity}{5} +\fexample[5.1]{affinity}{5} \clearpage It is unspecified on which place the primary thread is initially started. If the diff --git a/affinity/affinity_display.tex b/affinity/affinity_display.tex index fc33de3..0a619fd 100644 --- a/affinity/affinity_display.tex +++ b/affinity/affinity_display.tex @@ -37,9 +37,9 @@ not changed, so affinity is NOT reported. In the last parallel region, the thread affinities are reported because the thread affinity has changed. -\cexample[5.0]{affinity_display}{1} +\cexample[5.0]{affinity_display}{1}[1] -\ffreeexample[5.0]{affinity_display}{1} +\ffreeexample[5.0]{affinity_display}{1}[1] In the following example 2 threads are forked, and each executes on a socket. Next, @@ -69,10 +69,11 @@ the parallel nesting level (\%L), the ancestor thread number (\%a), the thread n and the thread affinity (\%A). In the nested parallel region within the \plc{socket\_work} routine the affinities for the threads on each socket are printed according to this format. -\cexample[5.0]{affinity_display}{2} +\cexample[5.0]{affinity_display}{2}[3] -\ffreeexample[5.0]{affinity_display}{2} +\ffreeexample[5.0]{affinity_display}{2}[3] +%\newpage \index{affinity display!omp_get_affinity_format routine@\scode{omp_get_affinity_format} routine} \index{routines!omp_get_affinity_format@\scode{omp_get_affinity_format}} \index{omp_get_affinity_format routine@\scode{omp_get_affinity_format} routine} @@ -87,14 +88,14 @@ Next, the \code{omp\_set\_affinity\_format()} API routine sets a user-defined format: \plc{host=\%20H thrd\_num=\%0.4n binds\_to=\%A}. The host, thread number and affinity fields are specified by \plc{\%20H}, -\plc{\%0.4n} and \plc{\%A}: \plc{H}, \plc{n} and \plc{A} are single character "short names" +\plc{\%0.4n} and \plc{\%A}: \plc{H}, \plc{n} and \plc{A} are single character ``short names'' for the host, thread\_num and thread\_affinity data to be printed, -with format sizes of \plc{20}, \plc{4}, and "size as needed". +with format sizes of \plc{20}, \plc{4}, and ``size as needed''. The period (.) indicates that the field is displayed right-justified (default is left-justified) -and the "0" indicates that any unused space is to be prefixed with zeros -(e.g. instead of "1", "0001" is displayed for the field size of 4). +and the ``0'' indicates that any unused space is to be prefixed with zeros +(e.g. instead of ``1'', ``0001'' is displayed for the field size of 4). -%The period (.) indicates that the field is displayed left-justified and the "0" indicates +%The period (.) indicates that the field is displayed left-justified and the ``0'' indicates %that leading zeros are to be added so that the total length for the display of this ā€œnā€ (thread_num) field is 4. %The period (\plc{.}) indicates right justified and \plc{0} leading zeros. @@ -118,7 +119,6 @@ The maximum value for the number of characters (\plc{nchars}) returned by clause and the \plc{if(nchars >= max\_req\_store) max\_req\_store=nchars} statement. It is used to report possible truncation (if \plc{max\_req\_store} > \plc{buffer\_store}). -\newpage \cexample[5.0]{affinity_display}{3} \ffreeexample[5.0]{affinity_display}{3} diff --git a/affinity/affinity_query.tex b/affinity/affinity_query.tex index 5db9d3d..b78b4ed 100644 --- a/affinity/affinity_query.tex +++ b/affinity/affinity_query.tex @@ -1,3 +1,4 @@ +\newpage \section{Affinity Query Functions} \label{sec: affinity_query} \index{affinity query!omp_get_num_places routine@\scode{omp_get_num_places} routine} diff --git a/affinity/sources/affinity.1.c b/affinity/sources/affinity.1.c index 6a408fe..4db1d96 100644 --- a/affinity/sources/affinity.1.c +++ b/affinity/sources/affinity.1.c @@ -1,12 +1,10 @@ /* * @@name: affinity.1 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ - void work(); int main() diff --git a/affinity/sources/affinity.1.f b/affinity/sources/affinity.1.f index c4420f2..9a69dd9 100644 --- a/affinity/sources/affinity.1.f +++ b/affinity/sources/affinity.1.f @@ -1,7 +1,6 @@ ! @@name: affinity.1 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_4.0 PROGRAM EXAMPLE diff --git a/affinity/sources/affinity.2.c b/affinity/sources/affinity.2.c index 00291f6..9a23799 100644 --- a/affinity/sources/affinity.2.c +++ b/affinity/sources/affinity.2.c @@ -1,8 +1,7 @@ /* * @@name: affinity.2 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ diff --git a/affinity/sources/affinity.2.f90 b/affinity/sources/affinity.2.f90 index d87bb6f..a1ee9a9 100644 --- a/affinity/sources/affinity.2.f90 +++ b/affinity/sources/affinity.2.f90 @@ -1,7 +1,6 @@ ! @@name: affinity.2 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_4.0 subroutine foo diff --git a/affinity/sources/affinity.3.c b/affinity/sources/affinity.3.c index eff8467..cd67c7e 100644 --- a/affinity/sources/affinity.3.c +++ b/affinity/sources/affinity.3.c @@ -1,8 +1,7 @@ /* * @@name: affinity.3 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ diff --git a/affinity/sources/affinity.3.f b/affinity/sources/affinity.3.f index 072a976..ac264fa 100644 --- a/affinity/sources/affinity.3.f +++ b/affinity/sources/affinity.3.f @@ -1,7 +1,6 @@ ! @@name: affinity.3 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_4.0 PROGRAM EXAMPLE diff --git a/affinity/sources/affinity.4.c b/affinity/sources/affinity.4.c index 40af217..325f1f8 100644 --- a/affinity/sources/affinity.4.c +++ b/affinity/sources/affinity.4.c @@ -1,8 +1,7 @@ /* * @@name: affinity.4 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ diff --git a/affinity/sources/affinity.4.f90 b/affinity/sources/affinity.4.f90 index ab9686e..ed4371e 100644 --- a/affinity/sources/affinity.4.f90 +++ b/affinity/sources/affinity.4.f90 @@ -1,7 +1,6 @@ ! @@name: affinity.4 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_4.0 subroutine foo diff --git a/affinity/sources/affinity.5.c b/affinity/sources/affinity.5.c index 94500ee..8d2ace3 100644 --- a/affinity/sources/affinity.5.c +++ b/affinity/sources/affinity.5.c @@ -1,8 +1,7 @@ /* * @@name: affinity.5 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_5.1 */ diff --git a/affinity/sources/affinity.5.f b/affinity/sources/affinity.5.f index 81531e7..add60ba 100644 --- a/affinity/sources/affinity.5.f +++ b/affinity/sources/affinity.5.f @@ -1,7 +1,6 @@ ! @@name: affinity.5 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_5.1 PROGRAM EXAMPLE diff --git a/affinity/sources/affinity.6.c b/affinity/sources/affinity.6.c index 829c665..f97c8dc 100644 --- a/affinity/sources/affinity.6.c +++ b/affinity/sources/affinity.6.c @@ -1,10 +1,9 @@ /* -* @@name: affinity.6 -* @@type: C -* @@compilable: yes -* @@linkable: no -* @@expect: success -* @@version: omp_5.0 +* @@name: affinity.6 +* @@type: C +* @@operation: compile +* @@expect: success +* @@version: omp_5.0 */ double * alloc_init_B(double *A, int N); void compute_on_B(double *B, int N); @@ -24,4 +23,3 @@ void task_affinity(double *A, int N) #pragma omp taskwait } - diff --git a/affinity/sources/affinity.6.f90 b/affinity/sources/affinity.6.f90 index 45f7e2b..8714cd8 100644 --- a/affinity/sources/affinity.6.f90 +++ b/affinity/sources/affinity.6.f90 @@ -1,8 +1,7 @@ -! @@name: affinity.6 -! @@type: F-free -! @@compilable: yes -! @@linkable: no -! @@expect: success +! @@name: affinity.6 +! @@type: F-free +! @@operation: compile +! @@expect: success ! @@version: omp_5.0 subroutine task_affinity(A, N) @@ -21,4 +20,3 @@ subroutine task_affinity(A, N) !$omp taskwait end subroutine - diff --git a/affinity/sources/affinity_display.1.c b/affinity/sources/affinity_display.1.c index 2ebefee..53da404 100644 --- a/affinity/sources/affinity_display.1.c +++ b/affinity/sources/affinity_display.1.c @@ -1,10 +1,10 @@ /* -* @@name: affinity_display.1 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.0 +* @@name: affinity_display.1 +* @@type: C +* @@operation: run +* @@expect: success +* @@version: omp_5.0 +* @@env: OMP_DISPLAY_AFFINITY=TRUE OMP_NUM_THREADS=8 */ #include #include diff --git a/affinity/sources/affinity_display.1.f90 b/affinity/sources/affinity_display.1.f90 index 2bbc971..1565657 100644 --- a/affinity/sources/affinity_display.1.f90 +++ b/affinity/sources/affinity_display.1.f90 @@ -1,9 +1,9 @@ -! @@name: affinity_display.1 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_5.0 +! @@name: affinity_display.1 +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: omp_5.0 +! @@env: OMP_DISPLAY_AFFINITY=TRUE OMP_NUM_THREADS=8 program affinity_display ! MAX threads = 8, single socket system use omp_lib diff --git a/affinity/sources/affinity_display.2.c b/affinity/sources/affinity_display.2.c index 0e4b329..9fe1c1f 100644 --- a/affinity/sources/affinity_display.2.c +++ b/affinity/sources/affinity_display.2.c @@ -1,10 +1,12 @@ /* -* @@name: affinity_display.2 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success +* @@name: affinity_display.2 +* @@type: C +* @@operation: run +* @@expect: success * @@version: omp_5.0 +* @@env: OMP_PROC_BIND=TRUE OMP_NUM_THREADS="2,4" +* @@env: OMP_PLACES="{0,2,4,6},{1,3,5,7}" +* @@env: OMP_AFFINITY_FORMAT="nest_level= %L, parent_thrd_num= %a, thrd_num= %n, thrd_affinity= %A" */ #include #include @@ -57,8 +59,8 @@ void socket_work(int socket_num, int n_thrds) printf(" LEVEL 2 AFFINITIES, %d threads on socket %d\n", n_thrds, socket_num); - // not needed if OMP_DISPLAY_AFFINITY=TRUE - omp_display_affinity(NULL); + // not needed if OMP_DISPLAY_AFFINITY=TRUE + omp_display_affinity(NULL); // OUTPUT: // LEVEL 2 AFFINITIES, 4 threads on socket 0 diff --git a/affinity/sources/affinity_display.2.f90 b/affinity/sources/affinity_display.2.f90 index 3750aa8..7b5ca39 100644 --- a/affinity/sources/affinity_display.2.f90 +++ b/affinity/sources/affinity_display.2.f90 @@ -1,9 +1,11 @@ -! @@name: affinity_display.2 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_5.0 +! @@name: affinity_display.2 +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: omp_5.0 +! @@env: OMP_PROC_BIND=TRUE OMP_NUM_THREADS="2,4" +! @@env: OMP_PLACES="{0,2,4,6},{1,3,5,7}" +! @@env: OMP_AFFINITY_FORMAT="nest_level= %L, parent_thrd_num= %a, thrd_num= %n, thrd_affinity= %A" program affinity_display use omp_lib diff --git a/affinity/sources/affinity_display.3.c b/affinity/sources/affinity_display.3.c index c09e6c3..610fb2c 100644 --- a/affinity/sources/affinity_display.3.c +++ b/affinity/sources/affinity_display.3.c @@ -1,10 +1,9 @@ /* -* @@name: affinity_display.3 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.0 +* @@name: affinity_display.3 +* @@type: C +* @@operation: run +* @@expect: success +* @@version: omp_5.0 */ #include #include // also null is in diff --git a/affinity/sources/affinity_display.3.f90 b/affinity/sources/affinity_display.3.f90 index 5a012a3..55a31d5 100644 --- a/affinity/sources/affinity_display.3.f90 +++ b/affinity/sources/affinity_display.3.f90 @@ -1,9 +1,8 @@ -! @@name: affinity_display.3 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_5.0 +! @@name: affinity_display.3 +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: omp_5.0 program affinity_display use omp_lib implicit none diff --git a/affinity/sources/affinity_query.1.c b/affinity/sources/affinity_query.1.c index e10f6f4..cc56c6b 100644 --- a/affinity/sources/affinity_query.1.c +++ b/affinity/sources/affinity_query.1.c @@ -1,8 +1,7 @@ /* * @@name: affinity_query.1 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: run * @@expect: success * @@version: omp_4.5 */ diff --git a/affinity/sources/affinity_query.1.f90 b/affinity/sources/affinity_query.1.f90 index dc494de..7ecb1ef 100644 --- a/affinity/sources/affinity_query.1.f90 +++ b/affinity/sources/affinity_query.1.f90 @@ -1,7 +1,6 @@ ! @@name: affinity_query.1 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: run ! @@expect: success ! @@version: omp_4.5 subroutine socket_init(socket_num) diff --git a/affinity/task_affinity.tex b/affinity/task_affinity.tex index b3cd77d..767d0cb 100644 --- a/affinity/task_affinity.tex +++ b/affinity/task_affinity.tex @@ -9,7 +9,7 @@ The next example illustrates the use of the \code{affinity} clause with a \code{task} construct. The variables in the \code{affinity} clause provide a hint to the runtime that the task should execute -"close" to the physical storage location of the variables. For example, +``close'' to the physical storage location of the variables. For example, on a two-socket platform with a local memory component close to each processor socket, the runtime will attempt to schedule the task execution on the socket where the storage is located. @@ -27,7 +27,7 @@ the \code{affinity} clause \plc{affinity(B[:N])} on the second \code{task} const However, the storage behind \plc{B} is created in the first task, and the array section reference may not be valid when the second task is generated. The use of the \plc{A} array is sufficient for this case, because one -would expect the storage for \plc{A} and \plc{B} would be physically "close" +would expect the storage for \plc{A} and \plc{B} would be physically ``close'' (as provided by the hint in the first task). \cexample[5.0]{affinity}{6} diff --git a/data_environment/reduction.tex b/data_environment/reduction.tex index 2a6b4dd..df321e1 100644 --- a/data_environment/reduction.tex +++ b/data_environment/reduction.tex @@ -305,7 +305,7 @@ In the OpenMP 5.0 Specification, \code{reduction} clauses for the \index{taskloop simd construct@\code{taskloop}~\code{simd} construct} The examples below compare reductions for the \code{taskloop} and the \code{taskloop}~\code{simd} constructs. These examples illustrate the use of \code{reduction} clauses within -"stand-alone" \code{taskloop} constructs, and the use of \code{in\_reduction} clauses for tasks of taskloops to participate +``stand-alone'' \code{taskloop} constructs, and the use of \code{in\_reduction} clauses for tasks of taskloops to participate with other reductions within the scope of a parallel region. \textbf{taskloop reductions:} diff --git a/data_environment/sources/associate.1.f b/data_environment/sources/associate.1.f index f528b0d..d88d0fb 100644 --- a/data_environment/sources/associate.1.f +++ b/data_environment/sources/associate.1.f @@ -1,8 +1,7 @@ ! @@name: associate.1 ! @@type: F-fixed -! @@compilable: no -! @@linkable: no -! @@expect: failure +! @@operation: compile +! @@expect: ct-error ! @@version: omp_4.0 program example_broken real :: a, c diff --git a/data_environment/sources/associate.2.f b/data_environment/sources/associate.2.f index f740181..b7c42b3 100644 --- a/data_environment/sources/associate.2.f +++ b/data_environment/sources/associate.2.f @@ -1,7 +1,6 @@ ! @@name: associate.2 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: yes +! @@operation: link ! @@expect: success ! @@version: omp_4.0 program example diff --git a/data_environment/sources/associate.3.f90 b/data_environment/sources/associate.3.f90 index 4eac6eb..f1a9ebb 100644 --- a/data_environment/sources/associate.3.f90 +++ b/data_environment/sources/associate.3.f90 @@ -1,7 +1,6 @@ ! @@name: associate.3 ! @@type: F-free -! @@compilable: yes -! @@linkable: yes +! @@operation: run ! @@expect: success ! @@version: omp_4.0 program example @@ -10,8 +9,8 @@ program example associate(u => v) !$omp parallel private(v) v = -1 - print *, v ! private v=-1 - print *, u ! original v=15 + print *, "v=", v ! private v=-1 + print *, "u=", u ! original v=15 !$omp end parallel end associate end program diff --git a/data_environment/sources/associate.4.f90 b/data_environment/sources/associate.4.f90 index f586721..b60c098 100644 --- a/data_environment/sources/associate.4.f90 +++ b/data_environment/sources/associate.4.f90 @@ -1,7 +1,6 @@ ! @@name: associate.4 ! @@type: F-free -! @@compilable: yes -! @@linkable: yes +! @@operation: link ! @@expect: success ! @@version: omp_5.1 program main @@ -18,7 +17,7 @@ program main !$omp target !! TARGET 2 a_aray = [4,5,6] !$omp end target - print *, a_aray, aray !! 4 5 6 4 5 6 + print *, a_aray, aray !! 4 5 6 4 5 6 !!!$omp target !! TARGET 3 !! !! mapping, in this case implicit, @@ -31,7 +30,7 @@ program main !$omp target !! TARGET 4 scalr = 1 !! scalr is firstprivate !$omp end target - print *, a_scalr, scalr !! -1 -1 + print *, a_scalr, scalr !! -1 -1 !$omp target !! TARGET 5 a_scalr = 2 !! a_scalr implicitly mapped diff --git a/data_environment/sources/carrays_fpriv.1.c b/data_environment/sources/carrays_fpriv.1.c index fa0d0b6..8515884 100644 --- a/data_environment/sources/carrays_fpriv.1.c +++ b/data_environment/sources/carrays_fpriv.1.c @@ -1,9 +1,9 @@ /* * @@name: carrays_fpriv.1 * @@type: C -* @@compilable: yes -* @@linkable: yes +* @@operation: run * @@expect: success +* @@version: pre_omp_3.0 */ #include diff --git a/data_environment/sources/copyin.1.c b/data_environment/sources/copyin.1.c index 888f746..2ee7bb5 100644 --- a/data_environment/sources/copyin.1.c +++ b/data_environment/sources/copyin.1.c @@ -1,9 +1,9 @@ /* * @@name: copyin.1 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success +* @@version: pre_omp_3.0 */ #include diff --git a/data_environment/sources/copyin.1.f b/data_environment/sources/copyin.1.f index 9f86c49..105925b 100644 --- a/data_environment/sources/copyin.1.f +++ b/data_environment/sources/copyin.1.f @@ -1,8 +1,8 @@ ! @@name: copyin.1 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success +! @@version: pre_omp_3.0 MODULE M REAL, POINTER, SAVE :: WORK(:) INTEGER :: SIZE diff --git a/data_environment/sources/copyprivate.1.c b/data_environment/sources/copyprivate.1.c index 25a4cf3..d6595d3 100644 --- a/data_environment/sources/copyprivate.1.c +++ b/data_environment/sources/copyprivate.1.c @@ -1,9 +1,9 @@ /* * @@name: copyprivate.1 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success +* @@version: pre_omp_3.0 */ #include float x, y; diff --git a/data_environment/sources/copyprivate.1.f b/data_environment/sources/copyprivate.1.f index dde5e73..9ced322 100644 --- a/data_environment/sources/copyprivate.1.f +++ b/data_environment/sources/copyprivate.1.f @@ -1,8 +1,8 @@ ! @@name: copyprivate.1 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success +! @@version: pre_omp_3.0 SUBROUTINE INIT(A,B) REAL A, B COMMON /XY/ X,Y diff --git a/data_environment/sources/copyprivate.2.c b/data_environment/sources/copyprivate.2.c index 1c27ca8..55390c7 100644 --- a/data_environment/sources/copyprivate.2.c +++ b/data_environment/sources/copyprivate.2.c @@ -1,10 +1,9 @@ /* * @@name: copyprivate.2 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success -* @@version: omp_5.1 +* @@version: omp_5.1 */ #include #include diff --git a/data_environment/sources/copyprivate.2.f b/data_environment/sources/copyprivate.2.f index e7c87a5..7ee7d67 100644 --- a/data_environment/sources/copyprivate.2.f +++ b/data_environment/sources/copyprivate.2.f @@ -1,9 +1,8 @@ ! @@name: copyprivate.2 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success -! @@version: omp_5.1 +! @@version: omp_5.1 REAL FUNCTION READ_NEXT() REAL, POINTER :: TMP diff --git a/data_environment/sources/copyprivate.3.c b/data_environment/sources/copyprivate.3.c index 8e9d4a0..c7faab2 100644 --- a/data_environment/sources/copyprivate.3.c +++ b/data_environment/sources/copyprivate.3.c @@ -1,9 +1,9 @@ /* * @@name: copyprivate.3 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success +* @@version: pre_omp_3.0 */ #include #include diff --git a/data_environment/sources/copyprivate.3.f b/data_environment/sources/copyprivate.3.f index c83b990..5660ccf 100644 --- a/data_environment/sources/copyprivate.3.f +++ b/data_environment/sources/copyprivate.3.f @@ -1,8 +1,8 @@ ! @@name: copyprivate.3 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success +! @@version: pre_omp_3.0 FUNCTION NEW_LOCK() USE OMP_LIB ! or INCLUDE "omp_lib.h" INTEGER(OMP_LOCK_KIND), POINTER :: NEW_LOCK diff --git a/data_environment/sources/copyprivate.4.f b/data_environment/sources/copyprivate.4.f index a6affa0..7098b97 100644 --- a/data_environment/sources/copyprivate.4.f +++ b/data_environment/sources/copyprivate.4.f @@ -1,8 +1,8 @@ ! @@name: copyprivate.4 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success +! @@version: pre_omp_3.0 SUBROUTINE S(N) INTEGER N diff --git a/data_environment/sources/cpp_reference.1.cpp b/data_environment/sources/cpp_reference.1.cpp index 0d47862..065637d 100644 --- a/data_environment/sources/cpp_reference.1.cpp +++ b/data_environment/sources/cpp_reference.1.cpp @@ -1,12 +1,10 @@ /* * @@name: cpp_reference.1 * @@type: C++ -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.5 */ - void task_body (int &); void gen_task (int &x) { // on orphaned task construct reference argument #pragma omp task // x is implicitly determined firstprivate(x) @@ -23,4 +21,3 @@ void test (int &y, int &z) { gen_task (y); } } - diff --git a/data_environment/sources/default_none.1.c b/data_environment/sources/default_none.1.c index c382a81..bf00d01 100644 --- a/data_environment/sources/default_none.1.c +++ b/data_environment/sources/default_none.1.c @@ -1,9 +1,9 @@ /* * @@name: default_none.1 * @@type: C -* @@compilable: no -* @@linkable: no -* @@expect: failure +* @@operation: compile +* @@expect: ct-error +* @@version: pre_omp_3.0 */ #include int x, y, z[1000]; diff --git a/data_environment/sources/default_none.1.f b/data_environment/sources/default_none.1.f index 38e74e8..05863cd 100644 --- a/data_environment/sources/default_none.1.f +++ b/data_environment/sources/default_none.1.f @@ -1,8 +1,8 @@ ! @@name: default_none.1 ! @@type: F-fixed -! @@compilable: no -! @@linkable: no -! @@expect: failure +! @@operation: compile +! @@expect: ct-error +! @@version: pre_omp_3.0 SUBROUTINE DEFAULT_NONE(A) INCLUDE "omp_lib.h" ! or USE OMP_LIB diff --git a/data_environment/sources/fort_loopvar.1.f90 b/data_environment/sources/fort_loopvar.1.f90 index 8505a4b..cb423a0 100644 --- a/data_environment/sources/fort_loopvar.1.f90 +++ b/data_environment/sources/fort_loopvar.1.f90 @@ -1,8 +1,8 @@ ! @@name: fort_loopvar.1 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success +! @@version: pre_omp_3.0 SUBROUTINE PLOOP_1(A,N) INCLUDE "omp_lib.h" ! or USE OMP_LIB diff --git a/data_environment/sources/fort_loopvar.2.f90 b/data_environment/sources/fort_loopvar.2.f90 index 6275e13..072686f 100644 --- a/data_environment/sources/fort_loopvar.2.f90 +++ b/data_environment/sources/fort_loopvar.2.f90 @@ -1,8 +1,8 @@ ! @@name: fort_loopvar.2 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success +! @@version: pre_omp_3.0 SUBROUTINE PLOOP_2(A,B,N,I1,I2) REAL A(*), B(*) INTEGER I1, I2, N diff --git a/data_environment/sources/fort_sa_private.1.f b/data_environment/sources/fort_sa_private.1.f index 2e22734..1fd1df1 100644 --- a/data_environment/sources/fort_sa_private.1.f +++ b/data_environment/sources/fort_sa_private.1.f @@ -1,8 +1,8 @@ ! @@name: fort_sa_private.1 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: yes -! @@expect: rt-error +! @@operation: run +! @@expect: unspecified +! @@version: pre_omp_3.0 SUBROUTINE SUB() COMMON /BLOCK/ X PRINT *,X ! X is undefined diff --git a/data_environment/sources/fort_sa_private.2.f b/data_environment/sources/fort_sa_private.2.f index ffc53bc..fef689b 100644 --- a/data_environment/sources/fort_sa_private.2.f +++ b/data_environment/sources/fort_sa_private.2.f @@ -1,8 +1,8 @@ ! @@name: fort_sa_private.2 ! @@type: F-fixed -! @@compilable: maybe -! @@linkable: maybe -! @@expect: rt-error +! @@operation: run +! @@expect: unspecified +! @@version: pre_omp_3.0 PROGRAM PRIV_RESTRICT2 COMMON /BLOCK2/ X X = 1.0 diff --git a/data_environment/sources/fort_sa_private.3.f b/data_environment/sources/fort_sa_private.3.f index cf802ed..21074ac 100644 --- a/data_environment/sources/fort_sa_private.3.f +++ b/data_environment/sources/fort_sa_private.3.f @@ -1,8 +1,8 @@ ! @@name: fort_sa_private.3 ! @@type: F-fixed -! @@compilable: maybe -! @@linkable: maybe -! @@expect: rt-error +! @@operation: run +! @@expect: unspecified +! @@version: pre_omp_3.0 PROGRAM PRIV_RESTRICT3 EQUIVALENCE (X,Y) X = 1.0 diff --git a/data_environment/sources/fort_sa_private.4.f b/data_environment/sources/fort_sa_private.4.f index bffa19a..264323e 100644 --- a/data_environment/sources/fort_sa_private.4.f +++ b/data_environment/sources/fort_sa_private.4.f @@ -1,8 +1,8 @@ ! @@name: fort_sa_private.4 ! @@type: F-fixed -! @@compilable: maybe -! @@linkable: maybe -! @@expect: rt-error +! @@operation: run +! @@expect: unspecified +! @@version: pre_omp_3.0 PROGRAM PRIV_RESTRICT4 INTEGER I, J INTEGER A(100), B(100) diff --git a/data_environment/sources/fort_sa_private.5.f b/data_environment/sources/fort_sa_private.5.f index d2e31ae..f313f1e 100644 --- a/data_environment/sources/fort_sa_private.5.f +++ b/data_environment/sources/fort_sa_private.5.f @@ -1,11 +1,10 @@ ! @@name: fort_sa_private.5 ! @@type: F-fixed -! @@compilable: maybe -! @@linkable: maybe -! @@expect: rt-error -! @@version: omp_5.1 +! @@operation: run +! @@expect: unspecified +! @@version: omp_5.1 SUBROUTINE SUB1(X) - DIMENSION X(10) + DIMENSION X(*) ! This use of X does not conform to the ! specification. It would be legal Fortran 90, @@ -19,7 +18,7 @@ PROGRAM PRIV_RESTRICT5 COMMON /BLOCK5/ A - DIMENSION B(10) + DIMENSION A(1),B(10) EQUIVALENCE (A,B(1)) ! the common block has to be at least 10 words @@ -39,3 +38,4 @@ !$OMP END MASKED !$OMP END PARALLEL + END PROGRAM PRIV_RESTRICT5 diff --git a/data_environment/sources/fort_sp_common.1.f b/data_environment/sources/fort_sp_common.1.f index b19ccba..8e5d8dc 100644 --- a/data_environment/sources/fort_sp_common.1.f +++ b/data_environment/sources/fort_sp_common.1.f @@ -1,8 +1,8 @@ ! @@name: fort_sp_common.1 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success +! @@version: pre_omp_3.0 SUBROUTINE COMMON_GOOD() COMMON /C/ X,Y REAL X, Y diff --git a/data_environment/sources/fort_sp_common.2.f b/data_environment/sources/fort_sp_common.2.f index 2ac615e..76c9531 100644 --- a/data_environment/sources/fort_sp_common.2.f +++ b/data_environment/sources/fort_sp_common.2.f @@ -1,8 +1,8 @@ ! @@name: fort_sp_common.2 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success +! @@version: pre_omp_3.0 SUBROUTINE COMMON_GOOD2() COMMON /C/ X,Y REAL X, Y diff --git a/data_environment/sources/fort_sp_common.3.f b/data_environment/sources/fort_sp_common.3.f index 699beb6..bbefa32 100644 --- a/data_environment/sources/fort_sp_common.3.f +++ b/data_environment/sources/fort_sp_common.3.f @@ -1,8 +1,8 @@ ! @@name: fort_sp_common.3 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success +! @@version: pre_omp_3.0 SUBROUTINE COMMON_GOOD3() COMMON /C/ X,Y !$OMP PARALLEL PRIVATE (/C/) diff --git a/data_environment/sources/fort_sp_common.4.f b/data_environment/sources/fort_sp_common.4.f index fbb4410..bab80f5 100644 --- a/data_environment/sources/fort_sp_common.4.f +++ b/data_environment/sources/fort_sp_common.4.f @@ -1,8 +1,8 @@ ! @@name: fort_sp_common.4 ! @@type: F-fixed -! @@compilable: no -! @@linkable: no -! @@expect: failure +! @@operation: compile +! @@expect: ct-error +! @@version: pre_omp_3.0 SUBROUTINE COMMON_WRONG() COMMON /C/ X,Y ! Incorrect because X is a constituent element of C diff --git a/data_environment/sources/fort_sp_common.5.f b/data_environment/sources/fort_sp_common.5.f index 6e9590b..61dd69b 100644 --- a/data_environment/sources/fort_sp_common.5.f +++ b/data_environment/sources/fort_sp_common.5.f @@ -1,8 +1,8 @@ ! @@name: fort_sp_common.5 ! @@type: F-fixed -! @@compilable: no -! @@linkable: no -! @@expect: failure +! @@operation: compile +! @@expect: ct-error +! @@version: pre_omp_3.0 SUBROUTINE COMMON_WRONG2() COMMON /C/ X,Y ! Incorrect: common block C cannot be declared both diff --git a/data_environment/sources/lastprivate.1.c b/data_environment/sources/lastprivate.1.c index a271e8c..e25f4cf 100644 --- a/data_environment/sources/lastprivate.1.c +++ b/data_environment/sources/lastprivate.1.c @@ -1,9 +1,9 @@ /* * @@name: lastprivate.1 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success +* @@version: pre_omp_3.0 */ void lastpriv (int n, float *a, float *b) { diff --git a/data_environment/sources/lastprivate.1.f b/data_environment/sources/lastprivate.1.f index 97fa9c4..da592a7 100644 --- a/data_environment/sources/lastprivate.1.f +++ b/data_environment/sources/lastprivate.1.f @@ -1,8 +1,8 @@ ! @@name: lastprivate.1 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success +! @@version: pre_omp_3.0 SUBROUTINE LASTPRIV(N, A, B) INTEGER N diff --git a/data_environment/sources/lastprivate.2.c b/data_environment/sources/lastprivate.2.c index 76dffa4..3d3fd21 100644 --- a/data_environment/sources/lastprivate.2.c +++ b/data_environment/sources/lastprivate.2.c @@ -1,10 +1,9 @@ /* * @@name: lastprivate.2 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success -* @@version: omp_5.0 +* @@version: omp_5.0 */ #include diff --git a/data_environment/sources/lastprivate.2.f90 b/data_environment/sources/lastprivate.2.f90 index f60c1f7..f222ed1 100644 --- a/data_environment/sources/lastprivate.2.f90 +++ b/data_environment/sources/lastprivate.2.f90 @@ -1,9 +1,8 @@ ! @@name: lastprivate.2 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success -! @@version: omp_5.0 +! @@version: omp_5.0 function condlastprivate(a, n) result(x) implicit none real a(*), x diff --git a/data_environment/sources/private.1.c b/data_environment/sources/private.1.c index 74096fb..dab6dda 100644 --- a/data_environment/sources/private.1.c +++ b/data_environment/sources/private.1.c @@ -1,9 +1,9 @@ /* * @@name: private.1 * @@type: C -* @@compilable: yes -* @@linkable: yes +* @@operation: run * @@expect: success +* @@version: pre_omp_3.0 */ #include #include diff --git a/data_environment/sources/private.1.f b/data_environment/sources/private.1.f index 86217c3..97fe371 100644 --- a/data_environment/sources/private.1.f +++ b/data_environment/sources/private.1.f @@ -1,8 +1,8 @@ ! @@name: private.1 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: yes +! @@operation: run ! @@expect: success +! @@version: pre_omp_3.0 PROGRAM PRIV_EXAMPLE INTEGER I, J diff --git a/data_environment/sources/private.2.c b/data_environment/sources/private.2.c index 4c3ade2..2527030 100644 --- a/data_environment/sources/private.2.c +++ b/data_environment/sources/private.2.c @@ -1,9 +1,9 @@ /* * @@name: private.2 * @@type: C -* @@compilable: yes -* @@linkable: no -* @@expect: success +* @@operation: compile +* @@expect: unspecified +* @@version: pre_omp_3.0 */ int a; diff --git a/data_environment/sources/private.2.f b/data_environment/sources/private.2.f index df45188..fd4a412 100644 --- a/data_environment/sources/private.2.f +++ b/data_environment/sources/private.2.f @@ -1,8 +1,8 @@ ! @@name: private.2 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no -! @@expect: success +! @@operation: compile +! @@expect: unspecified +! @@version: pre_omp_3.0 MODULE PRIV_EXAMPLE2 REAL A diff --git a/data_environment/sources/private.3.c b/data_environment/sources/private.3.c index 17aa197..b214ac9 100644 --- a/data_environment/sources/private.3.c +++ b/data_environment/sources/private.3.c @@ -1,9 +1,9 @@ /* * @@name: private.3 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success +* @@version: pre_omp_3.0 */ #include void priv_example3() diff --git a/data_environment/sources/private.3.f b/data_environment/sources/private.3.f index 6103f2b..1c841d1 100644 --- a/data_environment/sources/private.3.f +++ b/data_environment/sources/private.3.f @@ -1,8 +1,8 @@ ! @@name: private.3 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success +! @@version: pre_omp_3.0 SUBROUTINE PRIV_EXAMPLE3() INTEGER I, A diff --git a/data_environment/sources/reduction.1.c b/data_environment/sources/reduction.1.c index a0df572..546cab0 100644 --- a/data_environment/sources/reduction.1.c +++ b/data_environment/sources/reduction.1.c @@ -1,8 +1,7 @@ /* * @@name: reduction.1 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_3.1 */ diff --git a/data_environment/sources/reduction.1.f90 b/data_environment/sources/reduction.1.f90 index 5e3eb0d..fc2c1f2 100644 --- a/data_environment/sources/reduction.1.f90 +++ b/data_environment/sources/reduction.1.f90 @@ -1,8 +1,8 @@ ! @@name: reduction.1 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success +! @@version: pre_omp_3.0 SUBROUTINE REDUCTION1(A, B, C, D, X, Y, N) REAL :: X(*), A, D INTEGER :: Y(*), N, B, C diff --git a/data_environment/sources/reduction.2.c b/data_environment/sources/reduction.2.c index 73aa73b..57283d8 100644 --- a/data_environment/sources/reduction.2.c +++ b/data_environment/sources/reduction.2.c @@ -1,9 +1,9 @@ /* * @@name: reduction.2 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success +* @@version: pre_omp_3.0 */ #include #include diff --git a/data_environment/sources/reduction.2.f90 b/data_environment/sources/reduction.2.f90 index 4f4afa9..a89cd8b 100644 --- a/data_environment/sources/reduction.2.f90 +++ b/data_environment/sources/reduction.2.f90 @@ -1,8 +1,8 @@ ! @@name: reduction.2 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success +! @@version: pre_omp_3.0 SUBROUTINE REDUCTION2(A, B, C, D, X, Y, N) REAL :: X(*), A, D INTEGER :: Y(*), N, B, C diff --git a/data_environment/sources/reduction.3.c b/data_environment/sources/reduction.3.c deleted file mode 100644 index e2eb68d..0000000 --- a/data_environment/sources/reduction.3.c +++ /dev/null @@ -1,31 +0,0 @@ -/* -* @@name: reduction.3 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: rt-error -* @@version: omp_5.1 -*/ -#include - -int main (void) -{ - int a, i; - - #pragma omp parallel shared(a) private(i) - { - #pragma omp masked - a = 0; - - // To avoid race conditions, add a barrier here. - - #pragma omp for reduction(+:a) - for (i = 0; i < 10; i++) { - a += i; - } - - #pragma omp single - printf ("Sum is %d\n", a); - } - return 0; -} diff --git a/data_environment/sources/reduction.3.f90 b/data_environment/sources/reduction.3.f90 index 1ed3fb4..c743dc9 100644 --- a/data_environment/sources/reduction.3.f90 +++ b/data_environment/sources/reduction.3.f90 @@ -1,8 +1,8 @@ ! @@name: reduction.3 ! @@type: F-free -! @@compilable: no -! @@linkable: no -! @@expect: failure +! @@operation: compile +! @@expect: ct-error +! @@version: pre_omp_3.0 PROGRAM REDUCTION_WRONG MAX = HUGE(0) M = 0 diff --git a/data_environment/sources/reduction.4.f90 b/data_environment/sources/reduction.4.f90 index 5e6f81c..9437bb9 100644 --- a/data_environment/sources/reduction.4.f90 +++ b/data_environment/sources/reduction.4.f90 @@ -1,8 +1,8 @@ ! @@name: reduction.4 ! @@type: F-free -! @@compilable: yes -! @@linkable: yes +! @@operation: run ! @@expect: success +! @@version: pre_omp_3.0 MODULE M INTRINSIC MAX END MODULE M diff --git a/data_environment/sources/reduction.5.f90 b/data_environment/sources/reduction.5.f90 index b2b32a2..19145a5 100644 --- a/data_environment/sources/reduction.5.f90 +++ b/data_environment/sources/reduction.5.f90 @@ -1,8 +1,8 @@ ! @@name: reduction.5 ! @@type: F-free -! @@compilable: yes -! @@linkable: yes +! @@operation: run ! @@expect: success +! @@version: pre_omp_3.0 MODULE MOD INTRINSIC MAX, MIN END MODULE MOD diff --git a/data_environment/sources/reduction.6.c b/data_environment/sources/reduction.6.c index 95a75b1..3051024 100644 --- a/data_environment/sources/reduction.6.c +++ b/data_environment/sources/reduction.6.c @@ -1,10 +1,9 @@ /* * @@name: reduction.6 * @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: rt-error -* @@version: omp_5.1 +* @@operation: run +* @@expect: unspecified +* @@version: omp_5.1 */ #include diff --git a/data_environment/sources/reduction.6.f b/data_environment/sources/reduction.6.f index c6669d9..5cea4d7 100644 --- a/data_environment/sources/reduction.6.f +++ b/data_environment/sources/reduction.6.f @@ -1,9 +1,8 @@ ! @@name: reduction.6 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: yes -! @@expect: rt-error -! @@version: omp_5.1 +! @@operation: run +! @@expect: unspecified +! @@version: omp_5.1 INTEGER A, I !$OMP PARALLEL SHARED(A) PRIVATE(I) diff --git a/data_environment/sources/reduction.7.c b/data_environment/sources/reduction.7.c index a9299f2..da8ae00 100644 --- a/data_environment/sources/reduction.7.c +++ b/data_environment/sources/reduction.7.c @@ -1,8 +1,7 @@ /* * @@name: reduction.7 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.5 */ diff --git a/data_environment/sources/reduction.7.f90 b/data_environment/sources/reduction.7.f90 index f1c7407..7bb326c 100644 --- a/data_environment/sources/reduction.7.f90 +++ b/data_environment/sources/reduction.7.f90 @@ -1,8 +1,8 @@ ! @@name: reduction.7 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success +! @@version: pre_omp_3.0 program array_red integer,parameter :: n=100 diff --git a/data_environment/sources/scan.1.c b/data_environment/sources/scan.1.c index 58ce56e..c2d8d4a 100644 --- a/data_environment/sources/scan.1.c +++ b/data_environment/sources/scan.1.c @@ -1,10 +1,9 @@ /* -* @@name: scan.1 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.0 +* @@name: scan.1 +* @@type: C +* @@operation: run +* @@expect: success +* @@version: omp_5.0 */ #include #define N 100 diff --git a/data_environment/sources/scan.1.f90 b/data_environment/sources/scan.1.f90 index 7b09f17..a4df242 100644 --- a/data_environment/sources/scan.1.f90 +++ b/data_environment/sources/scan.1.f90 @@ -1,9 +1,8 @@ -! @@name: scan.1 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_5.0 +! @@name: scan.1 +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: omp_5.0 program inclusive_scan implicit none integer, parameter :: n = 100 diff --git a/data_environment/sources/scan.2.c b/data_environment/sources/scan.2.c index ea59ade..40ef7d8 100644 --- a/data_environment/sources/scan.2.c +++ b/data_environment/sources/scan.2.c @@ -1,10 +1,9 @@ /* -* @@name: scan.2 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.0 +* @@name: scan.2 +* @@type: C +* @@operation: run +* @@expect: success +* @@version: omp_5.0 */ #include #define N 100 diff --git a/data_environment/sources/scan.2.f90 b/data_environment/sources/scan.2.f90 index 18642bf..a01c060 100644 --- a/data_environment/sources/scan.2.f90 +++ b/data_environment/sources/scan.2.f90 @@ -1,9 +1,8 @@ -! @@name: scan.2 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_5.0 +! @@name: scan.2 +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: omp_5.0 program exclusive_scan implicit none integer, parameter :: n = 100 diff --git a/data_environment/sources/scope_reduction.1.cpp b/data_environment/sources/scope_reduction.1.cpp index 0ef5f39..10afb20 100644 --- a/data_environment/sources/scope_reduction.1.cpp +++ b/data_environment/sources/scope_reduction.1.cpp @@ -1,8 +1,7 @@ /* * @@name: scope_reduction.1 * @@type: C++ -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_5.1 */ diff --git a/data_environment/sources/scope_reduction.1.f90 b/data_environment/sources/scope_reduction.1.f90 index 945af3e..408159e 100644 --- a/data_environment/sources/scope_reduction.1.f90 +++ b/data_environment/sources/scope_reduction.1.f90 @@ -1,7 +1,6 @@ ! @@name: scope_reduction.1 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_5.1 subroutine do_work(n, a, s) diff --git a/data_environment/sources/target_reduction.1.c b/data_environment/sources/target_reduction.1.c index d465357..ebc6726 100644 --- a/data_environment/sources/target_reduction.1.c +++ b/data_environment/sources/target_reduction.1.c @@ -1,10 +1,9 @@ /* -* @@name: target_reduction.1 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.0 +* @@name: target_reduction.1 +* @@type: C +* @@operation: run +* @@expect: success +* @@version: omp_5.0 */ #include int f(int); @@ -12,7 +11,6 @@ int g(int); int main() { int sum1=0, sum2=0; - int i; const int n = 100; #pragma omp target teams distribute reduction(+:sum1) diff --git a/data_environment/sources/target_reduction.1.f90 b/data_environment/sources/target_reduction.1.f90 index e2a63ac..122a797 100644 --- a/data_environment/sources/target_reduction.1.f90 +++ b/data_environment/sources/target_reduction.1.f90 @@ -1,9 +1,8 @@ -! @@name: target_reduction.1 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_5.0 +! @@name: target_reduction.1 +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: omp_5.0 program target_reduction_ex1 interface function f(res) diff --git a/data_environment/sources/target_reduction.2.c b/data_environment/sources/target_reduction.2.c index 06d3898..042c750 100644 --- a/data_environment/sources/target_reduction.2.c +++ b/data_environment/sources/target_reduction.2.c @@ -1,10 +1,9 @@ /* -* @@name: target_reduction.2 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.0 +* @@name: target_reduction.2 +* @@type: C +* @@operation: run +* @@expect: success +* @@version: omp_5.0 */ #include int f(int); @@ -12,7 +11,6 @@ int g(int); int main() { int sum1=0, sum2=0; - int i; const int n = 100; #pragma omp target data map(sum1,sum2) diff --git a/data_environment/sources/target_reduction.2.f90 b/data_environment/sources/target_reduction.2.f90 index 5cf14e7..3a7a911 100644 --- a/data_environment/sources/target_reduction.2.f90 +++ b/data_environment/sources/target_reduction.2.f90 @@ -1,10 +1,8 @@ -! @@name: target_reduction.2 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_5.0 - +! @@name: target_reduction.2 +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: omp_5.0 program target_reduction_ex2 interface function f(res) diff --git a/data_environment/sources/target_task_reduction.1.c b/data_environment/sources/target_task_reduction.1.c index 19604cc..771a784 100644 --- a/data_environment/sources/target_task_reduction.1.c +++ b/data_environment/sources/target_task_reduction.1.c @@ -1,15 +1,13 @@ /* -* @@name: target_task_reduction.1 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.2 +* @@name: target_task_reduction.1 +* @@type: C +* @@operation: run +* @@expect: success +* @@version: omp_5.2 */ - #include -#pragma omp declare target enter(device_compute) void device_compute(int *); +#pragma omp declare target enter(device_compute) void host_compute(int *); int main() { diff --git a/data_environment/sources/target_task_reduction.1.f90 b/data_environment/sources/target_task_reduction.1.f90 index 60de459..b1f4d57 100644 --- a/data_environment/sources/target_task_reduction.1.f90 +++ b/data_environment/sources/target_task_reduction.1.f90 @@ -1,10 +1,8 @@ ! @@name: target_task_reduction.1 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: run ! @@expect: success ! @@version: omp_5.2 - program target_task_reduction_ex1 interface subroutine device_compute(res) diff --git a/data_environment/sources/target_task_reduction.2a.c b/data_environment/sources/target_task_reduction.2a.c index ceaab06..3ce0c3d 100644 --- a/data_environment/sources/target_task_reduction.2a.c +++ b/data_environment/sources/target_task_reduction.2a.c @@ -1,14 +1,13 @@ /* -* @@name: target_task_reduction.2a -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.2 +* @@name: target_task_reduction.2a +* @@type: C +* @@operation: run +* @@expect: success +* @@version: omp_5.2 */ #include -#pragma omp declare target enter(device_compute) extern void device_compute(int *); +#pragma omp declare target enter(device_compute) extern void host_compute(int *); int main() { diff --git a/data_environment/sources/target_task_reduction.2a.f90 b/data_environment/sources/target_task_reduction.2a.f90 index 94fbd61..1ef81b7 100644 --- a/data_environment/sources/target_task_reduction.2a.f90 +++ b/data_environment/sources/target_task_reduction.2a.f90 @@ -1,10 +1,8 @@ -! @@name: target_task_reduction.2a -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_5.2 - +! @@name: target_task_reduction.2a +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: omp_5.2 program target_task_reduction_ex2 interface subroutine device_compute(res) diff --git a/data_environment/sources/target_task_reduction.2b.c b/data_environment/sources/target_task_reduction.2b.c index a27dcc8..c56a2a1 100644 --- a/data_environment/sources/target_task_reduction.2b.c +++ b/data_environment/sources/target_task_reduction.2b.c @@ -1,14 +1,13 @@ /* -* @@name: target_task_reduction.2b -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.2 +* @@name: target_task_reduction.2b +* @@type: C +* @@operation: run +* @@expect: success +* @@version: omp_5.2 */ #include -#pragma omp declare target enter(device_compute) extern void device_compute(int *); +#pragma omp declare target enter(device_compute) extern void host_compute(int *); int main() { diff --git a/data_environment/sources/target_task_reduction.2b.f90 b/data_environment/sources/target_task_reduction.2b.f90 index 3e919af..882f166 100644 --- a/data_environment/sources/target_task_reduction.2b.f90 +++ b/data_environment/sources/target_task_reduction.2b.f90 @@ -1,10 +1,8 @@ ! @@name: target_task_reduction.2b ! @@type: F-free -! @@compilable: yes -! @@linkable: yes +! @@operation: run ! @@expect: success ! @@version: omp_5.2 - program target_task_reduction_ex2b interface subroutine device_compute(res) @@ -36,4 +34,3 @@ subroutine host_compute(sum) integer :: sum sum = 1 end subroutine - diff --git a/data_environment/sources/task_reduction.1.c b/data_environment/sources/task_reduction.1.c index c5f880d..19051dc 100644 --- a/data_environment/sources/task_reduction.1.c +++ b/data_environment/sources/task_reduction.1.c @@ -1,11 +1,10 @@ /* -* @@name: task_reduction.1 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success +* @@name: task_reduction.1 +* @@type: C +* @@operation: run +* @@expect: success +* @@version: omp_5.0 */ - #include #include #define N 10 @@ -34,7 +33,7 @@ int linked_list_sum(node_t *p) } -int main(int argc, char *argv[]) { +int main() { int i; // Create the root node. node_t* root = (node_t*) malloc(sizeof(node_t)); @@ -60,4 +59,3 @@ int main(int argc, char *argv[]) { return 0; } - diff --git a/data_environment/sources/task_reduction.1.f90 b/data_environment/sources/task_reduction.1.f90 index 7c0bea0..4943781 100644 --- a/data_environment/sources/task_reduction.1.f90 +++ b/data_environment/sources/task_reduction.1.f90 @@ -1,9 +1,8 @@ -! @@name: task_reduction.1 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success - +! @@name: task_reduction.1 +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: omp_5.0 module m type node_t integer :: val @@ -69,4 +68,3 @@ program main !$omp end parallel end program main - diff --git a/data_environment/sources/task_reduction.2.c b/data_environment/sources/task_reduction.2.c index 263f578..3309625 100644 --- a/data_environment/sources/task_reduction.2.c +++ b/data_environment/sources/task_reduction.2.c @@ -1,9 +1,8 @@ /* -* @@name: task_reduction.2 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success +* @@name: task_reduction.2 +* @@type: C +* @@operation: run +* @@expect: success * @@version: omp_5.0 */ #include diff --git a/data_environment/sources/task_reduction.2.f90 b/data_environment/sources/task_reduction.2.f90 index e6ddd0b..31a31fa 100644 --- a/data_environment/sources/task_reduction.2.f90 +++ b/data_environment/sources/task_reduction.2.f90 @@ -1,10 +1,8 @@ -! @@name: task_reduction.2 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_5.0 - +! @@name: task_reduction.2 +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: omp_5.0 program task_modifier integer :: N=100, M=10 diff --git a/data_environment/sources/taskloop_reduction.1.c b/data_environment/sources/taskloop_reduction.1.c index 66b8250..4592c26 100644 --- a/data_environment/sources/taskloop_reduction.1.c +++ b/data_environment/sources/taskloop_reduction.1.c @@ -1,10 +1,9 @@ /* -* @@name: taskloop_reduction.1 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.0 +* @@name: taskloop_reduction.1 +* @@type: C +* @@operation: run +* @@expect: success +* @@version: omp_5.0 */ #include diff --git a/data_environment/sources/taskloop_reduction.1.f90 b/data_environment/sources/taskloop_reduction.1.f90 index c810b28..8e57426 100644 --- a/data_environment/sources/taskloop_reduction.1.f90 +++ b/data_environment/sources/taskloop_reduction.1.f90 @@ -1,9 +1,8 @@ ! @@name: taskloop_reduction.1 ! @@type: F-free -! @@compilable: yes -! @@linkable: yes +! @@operation: run ! @@expect: success -! @@version: omp_5.0 +! @@version: omp_5.0 function array_sum(n, v) result(res) implicit none integer :: n, v(n), res diff --git a/data_environment/sources/taskloop_reduction.2.c b/data_environment/sources/taskloop_reduction.2.c index 7461949..6b539aa 100644 --- a/data_environment/sources/taskloop_reduction.2.c +++ b/data_environment/sources/taskloop_reduction.2.c @@ -1,10 +1,9 @@ /* -* @@name: taskloop_reduction.2 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.0 +* @@name: taskloop_reduction.2 +* @@type: C +* @@operation: run +* @@expect: success +* @@version: omp_5.0 */ #include @@ -27,7 +26,7 @@ int array_sum(int n, int *v) { return res; } -int main(int argc, char *argv[]) { +int main() { int n = 10; int v[10] = {1,2,3,4,5,6,7,8,9,10}; diff --git a/data_environment/sources/taskloop_reduction.2.f90 b/data_environment/sources/taskloop_reduction.2.f90 index 41c919a..0b6cc34 100644 --- a/data_environment/sources/taskloop_reduction.2.f90 +++ b/data_environment/sources/taskloop_reduction.2.f90 @@ -1,9 +1,8 @@ ! @@name: taskloop_reduction.2 ! @@type: F-free -! @@compilable: yes -! @@linkable: yes +! @@operation: run ! @@expect: success -! @@version: omp_5.0 +! @@version: omp_5.0 function array_sum(n, v) result(res) implicit none integer :: n, v(n), res diff --git a/data_environment/sources/taskloop_simd_reduction.1.c b/data_environment/sources/taskloop_simd_reduction.1.c index e18f06a..e03c898 100644 --- a/data_environment/sources/taskloop_simd_reduction.1.c +++ b/data_environment/sources/taskloop_simd_reduction.1.c @@ -1,8 +1,7 @@ /* * @@name: taskloop_simd_reduction.1 * @@type: C -* @@compilable: yes -* @@linkable: yes +* @@operation: run * @@expect: success * @@version: omp_5.1 */ diff --git a/data_environment/sources/taskloop_simd_reduction.1.f90 b/data_environment/sources/taskloop_simd_reduction.1.f90 index 66f9770..639ec18 100644 --- a/data_environment/sources/taskloop_simd_reduction.1.f90 +++ b/data_environment/sources/taskloop_simd_reduction.1.f90 @@ -1,7 +1,6 @@ ! @@name: taskloop_simd_reduction.1 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: run ! @@expect: success ! @@version: omp_5.1 program main diff --git a/data_environment/sources/threadprivate.1.c b/data_environment/sources/threadprivate.1.c index c73cd9e..f700ddc 100644 --- a/data_environment/sources/threadprivate.1.c +++ b/data_environment/sources/threadprivate.1.c @@ -1,9 +1,9 @@ /* * @@name: threadprivate.1 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success +* @@version: pre_omp_3.0 */ int counter = 0; #pragma omp threadprivate(counter) diff --git a/data_environment/sources/threadprivate.1.f b/data_environment/sources/threadprivate.1.f index fd3b9fa..6245bd8 100644 --- a/data_environment/sources/threadprivate.1.f +++ b/data_environment/sources/threadprivate.1.f @@ -1,8 +1,8 @@ ! @@name: threadprivate.1 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success +! @@version: pre_omp_3.0 INTEGER FUNCTION INCREMENT_COUNTER() COMMON/INC_COMMON/COUNTER !$OMP THREADPRIVATE(/INC_COMMON/) diff --git a/data_environment/sources/threadprivate.2.c b/data_environment/sources/threadprivate.2.c index 51c994f..57daa74 100644 --- a/data_environment/sources/threadprivate.2.c +++ b/data_environment/sources/threadprivate.2.c @@ -1,9 +1,9 @@ /* * @@name: threadprivate.2 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success +* @@version: pre_omp_3.0 */ int increment_counter_2() { diff --git a/data_environment/sources/threadprivate.2.f b/data_environment/sources/threadprivate.2.f index 812d2b1..4cd76f1 100644 --- a/data_environment/sources/threadprivate.2.f +++ b/data_environment/sources/threadprivate.2.f @@ -1,8 +1,8 @@ ! @@name: threadprivate.2 ! @@type: F-fixed -! @@compilable: no -! @@linkable: no -! @@expect: failure +! @@operation: compile +! @@expect: ct-error +! @@version: pre_omp_3.0 MODULE INC_MODULE COMMON /T/ A END MODULE INC_MODULE diff --git a/data_environment/sources/threadprivate.3.cpp b/data_environment/sources/threadprivate.3.cpp index 62cb9fa..80c766e 100644 --- a/data_environment/sources/threadprivate.3.cpp +++ b/data_environment/sources/threadprivate.3.cpp @@ -1,9 +1,9 @@ /* * @@name: threadprivate.3 * @@type: C++ -* @@compilable: maybe -* @@linkable: no -* @@expect: failure +* @@operation: compile +* @@expect: unspecified +* @@version: pre_omp_3.0 */ class T { public: diff --git a/data_environment/sources/threadprivate.3.f b/data_environment/sources/threadprivate.3.f index 03f657d..58a0cb1 100644 --- a/data_environment/sources/threadprivate.3.f +++ b/data_environment/sources/threadprivate.3.f @@ -1,8 +1,8 @@ ! @@name: threadprivate.3 ! @@type: F-fixed -! @@compilable: no -! @@linkable: no -! @@expect: failure +! @@operation: compile +! @@expect: ct-error +! @@version: pre_omp_3.0 SUBROUTINE INC_WRONG() COMMON /T/ A !$OMP THREADPRIVATE(/T/) diff --git a/data_environment/sources/threadprivate.4.cpp b/data_environment/sources/threadprivate.4.cpp index 1b4ad7a..6dbeb47 100644 --- a/data_environment/sources/threadprivate.4.cpp +++ b/data_environment/sources/threadprivate.4.cpp @@ -1,9 +1,9 @@ /* * @@name: threadprivate.4 * @@type: C++ -* @@compilable: no -* @@linkable: no -* @@expect: nothing +* @@operation: view +* @@expect: unspecified +* @@version: pre_omp_3.0 */ struct T { T (); T (int); ~T (); int t; }; int f(); diff --git a/data_environment/sources/threadprivate.4.f b/data_environment/sources/threadprivate.4.f index 596c2ec..500a917 100644 --- a/data_environment/sources/threadprivate.4.f +++ b/data_environment/sources/threadprivate.4.f @@ -1,8 +1,8 @@ ! @@name: threadprivate.4 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success +! @@version: pre_omp_3.0 SUBROUTINE INC_GOOD() COMMON /T/ A !$OMP THREADPRIVATE(/T/) diff --git a/data_environment/sources/threadprivate.5.cpp b/data_environment/sources/threadprivate.5.cpp index 4c549c2..b132947 100644 --- a/data_environment/sources/threadprivate.5.cpp +++ b/data_environment/sources/threadprivate.5.cpp @@ -1,9 +1,9 @@ /* * @@name: threadprivate.5 * @@type: C++ -* @@compilable: no -* @@linkable: no -* @@expect: nothing +* @@operation: view +* @@expect: unspecified +* @@version: pre_omp_3.0 */ class T { public: diff --git a/data_environment/sources/threadprivate.5.f b/data_environment/sources/threadprivate.5.f index dfd7622..a3f0357 100644 --- a/data_environment/sources/threadprivate.5.f +++ b/data_environment/sources/threadprivate.5.f @@ -1,8 +1,8 @@ ! @@name: threadprivate.5 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: yes +! @@operation: run ! @@expect: success +! @@version: pre_omp_3.0 PROGRAM INC_GOOD2 INTEGER, ALLOCATABLE, SAVE :: A(:) INTEGER, POINTER, SAVE :: PTR diff --git a/data_environment/sources/threadprivate.6.f b/data_environment/sources/threadprivate.6.f index aff1020..5432406 100644 --- a/data_environment/sources/threadprivate.6.f +++ b/data_environment/sources/threadprivate.6.f @@ -1,8 +1,8 @@ ! @@name: threadprivate.6 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: yes +! @@operation: run ! @@expect: success +! @@version: pre_omp_3.0 MODULE INC_MODULE_GOOD3 REAL, POINTER :: WORK(:) SAVE WORK diff --git a/data_environment/sources/udr.1.c b/data_environment/sources/udr.1.c index 7acb015..a2fc5c6 100644 --- a/data_environment/sources/udr.1.c +++ b/data_environment/sources/udr.1.c @@ -1,8 +1,7 @@ /* * @@name: udr.1 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ diff --git a/data_environment/sources/udr.1.f90 b/data_environment/sources/udr.1.f90 index a07fd93..7c21720 100644 --- a/data_environment/sources/udr.1.f90 +++ b/data_environment/sources/udr.1.f90 @@ -1,7 +1,6 @@ ! @@name: udr.1 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_4.0 module data_type diff --git a/data_environment/sources/udr.2.c b/data_environment/sources/udr.2.c index 817d97e..7fbbedd 100644 --- a/data_environment/sources/udr.2.c +++ b/data_environment/sources/udr.2.c @@ -1,8 +1,7 @@ /* * @@name: udr.2 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ diff --git a/data_environment/sources/udr.2.f90 b/data_environment/sources/udr.2.f90 index dfa6f2a..f334b25 100644 --- a/data_environment/sources/udr.2.f90 +++ b/data_environment/sources/udr.2.f90 @@ -1,7 +1,6 @@ ! @@name: udr.2 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_4.0 module data_type diff --git a/data_environment/sources/udr.3.c b/data_environment/sources/udr.3.c index 86f169b..aee8efc 100644 --- a/data_environment/sources/udr.3.c +++ b/data_environment/sources/udr.3.c @@ -1,12 +1,10 @@ /* * @@name: udr.3 * @@type: C -* @@compilable: yes -* @@linkable: yes +* @@operation: run * @@expect: success * @@version: omp_4.0 */ - #include #define N 100 diff --git a/data_environment/sources/udr.3.f90 b/data_environment/sources/udr.3.f90 index 8f9fb27..dfb374b 100644 --- a/data_environment/sources/udr.3.f90 +++ b/data_environment/sources/udr.3.f90 @@ -1,7 +1,6 @@ ! @@name: udr.3 ! @@type: F-free -! @@compilable: yes -! @@linkable: yes +! @@operation: run ! @@expect: success ! @@version: omp_4.0 program max_loc diff --git a/data_environment/sources/udr.4.f90 b/data_environment/sources/udr.4.f90 index 3d7727d..f136b39 100644 --- a/data_environment/sources/udr.4.f90 +++ b/data_environment/sources/udr.4.f90 @@ -1,7 +1,6 @@ ! @@name: udr.4 ! @@type: F-free -! @@compilable: yes -! @@linkable: yes +! @@operation: run ! @@expect: success ! @@version: omp_4.0 module data_red diff --git a/data_environment/sources/udr.5.cpp b/data_environment/sources/udr.5.cpp index eccfd5b..bde4dee 100644 --- a/data_environment/sources/udr.5.cpp +++ b/data_environment/sources/udr.5.cpp @@ -1,8 +1,7 @@ /* * @@name: udr.5 * @@type: C++ -* @@compilable: no -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ diff --git a/data_environment/sources/udr.6.cpp b/data_environment/sources/udr.6.cpp index 257a5b5..76a7b52 100644 --- a/data_environment/sources/udr.6.cpp +++ b/data_environment/sources/udr.6.cpp @@ -1,9 +1,8 @@ /* * @@name: udr.6 * @@type: C++ -* @@compilable: no -* @@linkable: no -* @@expect: success +* @@operation: view +* @@expect: unspecified * @@version: omp_4.0 */ #include diff --git a/data_environment/udr.tex b/data_environment/udr.tex index 77f5a10..6eabd02 100644 --- a/data_environment/udr.tex +++ b/data_environment/udr.tex @@ -32,7 +32,7 @@ declaration list is the data type (\plc{struct} \plc{point}) used in the reducti followed by the combiner, here the functions \plc{minproc} and \plc{maxproc} perform the min and max operations, respectively, on the user data (of type \plc{struct} \plc{point}). In the function argument list are two special OpenMP variable identifiers, \code{omp\_in} and \code{omp\_out}, -that denote the two values to be combined in the "real" function; +that denote the two values to be combined in the ``real'' function; the \code{omp\_out} identifier indicates which one is to hold the result. The initializer of the \code{declare}~\code{reduction} directive specifies diff --git a/devices/C++_virtual_functions.tex b/devices/C++_virtual_functions.tex index 7daac0f..c989258 100644 --- a/devices/C++_virtual_functions.tex +++ b/devices/C++_virtual_functions.tex @@ -24,9 +24,9 @@ therefore the restriction does not apply. The second section illustrates the restriction: -\emph{"Invoking a virtual member function of an object on a device other than the device on which the +\emph{``Invoking a virtual member function of an object on a device other than the device on which the object was constructed results in unspecified behavior, unless the object is accessible and was -constructed on the host device."} +constructed on the host device.''} An instantiation of a polymorphic class (\splc{A}) occurs in the \scode{target} region, and access of its virtual function diff --git a/devices/array_shaping.tex b/devices/array_shaping.tex index 94c9f1a..6615ebb 100644 --- a/devices/array_shaping.tex +++ b/devices/array_shaping.tex @@ -24,7 +24,7 @@ of the \code{target}~\code{update} directive or the \code{depend} clause. The following example shows the use of the shape-operator in the \code{target}~\code{update} directive. The shape-operator \code{([nx][ny+2])} -casts pointer variable $a$ to a 2-dimentional array of size +casts pointer variable $a$ to a 2-dimensional array of size \plc{nx}$\times$\plc{(ny+2)}. The resulting array is then accessed as array sections (such as \code{[0:nx][1]} and \code{[0:nx][ny]}) in the \code{from} or \code{to} clause for transferring two columns of diff --git a/devices/declare_target.tex b/devices/declare_target.tex index 9de5556..febbccc 100644 --- a/devices/declare_target.tex +++ b/devices/declare_target.tex @@ -104,9 +104,9 @@ separately and linking them, will create appropriate executable device functions \srcnexample[5.1]{declare_target}{2b_classes}{hpp} \smallskip -\cppnexample[5.1]{declare_target}{2b_functions} +\cppnexample[5.1]{declare_target}{2b_functions}[1] \smallskip -\cppnexample[5.1]{declare_target}{2b_main} +\cppnexample[5.1]{declare_target}{2b_main}[1] %\cppspecificend % blue line floater at top of this page for "C++, cont." diff --git a/devices/sources/array_sections.1.c b/devices/sources/array_sections.1.c index 7a08979..f2dcffb 100644 --- a/devices/sources/array_sections.1.c +++ b/devices/sources/array_sections.1.c @@ -1,9 +1,8 @@ /* * @@name: array_sections.1 * @@type: C -* @@compilable: no -* @@linkable: no -* @@expect: failure +* @@operation: compile +* @@expect: ct-error * @@version: omp_4.0 */ void foo () diff --git a/devices/sources/array_sections.1.f90 b/devices/sources/array_sections.1.f90 index ec13592..5380546 100644 --- a/devices/sources/array_sections.1.f90 +++ b/devices/sources/array_sections.1.f90 @@ -1,8 +1,7 @@ ! @@name: array_sections.1 ! @@type: F-free -! @@compilable: no -! @@linkable: no -! @@expect: failure +! @@operation: compile +! @@expect: ct-error ! @@version: omp_4.0 subroutine foo() integer :: A(30) diff --git a/devices/sources/array_sections.2.c b/devices/sources/array_sections.2.c index b608e1a..6ff046f 100644 --- a/devices/sources/array_sections.2.c +++ b/devices/sources/array_sections.2.c @@ -1,9 +1,8 @@ /* * @@name: array_sections.2 * @@type: C -* @@compilable: no -* @@linkable: no -* @@expect: failure +* @@operation: compile +* @@expect: ct-error * @@version: omp_4.0 */ void foo () diff --git a/devices/sources/array_sections.2.f90 b/devices/sources/array_sections.2.f90 index 6ec328a..1b85709 100644 --- a/devices/sources/array_sections.2.f90 +++ b/devices/sources/array_sections.2.f90 @@ -1,8 +1,7 @@ ! @@name: array_sections.2 ! @@type: F-free -! @@compilable: no -! @@linkable: no -! @@expect: failure +! @@operation: compile +! @@expect: ct-error ! @@version: omp_4.0 subroutine foo() integer,target :: A(30) diff --git a/devices/sources/array_sections.3.c b/devices/sources/array_sections.3.c index bc5da8b..ccf868e 100644 --- a/devices/sources/array_sections.3.c +++ b/devices/sources/array_sections.3.c @@ -1,8 +1,7 @@ /* * @@name: array_sections.3 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ diff --git a/devices/sources/array_sections.3.f90 b/devices/sources/array_sections.3.f90 index 3f7d77d..878936e 100644 --- a/devices/sources/array_sections.3.f90 +++ b/devices/sources/array_sections.3.f90 @@ -1,7 +1,6 @@ ! @@name: array_sections.3 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_4.0 subroutine foo() diff --git a/devices/sources/array_sections.4.c b/devices/sources/array_sections.4.c index abb1e3f..b404fce 100644 --- a/devices/sources/array_sections.4.c +++ b/devices/sources/array_sections.4.c @@ -1,8 +1,7 @@ /* * @@name: array_sections.4 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ diff --git a/devices/sources/array_sections.4.f90 b/devices/sources/array_sections.4.f90 index 74a7272..7674df7 100644 --- a/devices/sources/array_sections.4.f90 +++ b/devices/sources/array_sections.4.f90 @@ -1,7 +1,6 @@ ! @@name: array_sections.4 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_4.0 subroutine foo() diff --git a/devices/sources/array_shaping.1.c b/devices/sources/array_shaping.1.c index f92d257..23cae30 100644 --- a/devices/sources/array_shaping.1.c +++ b/devices/sources/array_shaping.1.c @@ -1,10 +1,9 @@ /* -* @@name: array_shaping.1 -* @@type: C -* @@compilable: yes -* @@linkable: no -* @@expect: success -* @@version: omp_5.1 +* @@name: array_shaping.1 +* @@type: C +* @@operation: compile +* @@expect: success +* @@version: omp_5.1 */ #pragma omp begin declare target int do_work(double *a, int nx, int ny); diff --git a/devices/sources/array_shaping.1.f90 b/devices/sources/array_shaping.1.f90 index 790e45d..ef53c75 100644 --- a/devices/sources/array_shaping.1.f90 +++ b/devices/sources/array_shaping.1.f90 @@ -1,10 +1,8 @@ -! @@name: array_shaping.1 -! @@type: F-free -! @@compilable: yes -! @@linkable: no -! @@expect: success -! @@version: omp_5.2 - +! @@name: array_shaping.1 +! @@type: F-free +! @@operation: compile +! @@expect: success +! @@version: omp_5.2 module m interface subroutine do_work(a, nx, ny) diff --git a/devices/sources/async_target.1.c b/devices/sources/async_target.1.c index 821739b..2a4da5f 100644 --- a/devices/sources/async_target.1.c +++ b/devices/sources/async_target.1.c @@ -1,8 +1,7 @@ /* * @@name: async_target.1 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_5.1 */ diff --git a/devices/sources/async_target.1.f90 b/devices/sources/async_target.1.f90 index 678194a..1d0b616 100644 --- a/devices/sources/async_target.1.f90 +++ b/devices/sources/async_target.1.f90 @@ -1,7 +1,6 @@ ! @@name: async_target.1 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_4.0 module parameters diff --git a/devices/sources/async_target.2.c b/devices/sources/async_target.2.c index ead4392..252db83 100644 --- a/devices/sources/async_target.2.c +++ b/devices/sources/async_target.2.c @@ -1,8 +1,7 @@ /* * @@name: async_target.2 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_5.1 */ diff --git a/devices/sources/async_target.2.f90 b/devices/sources/async_target.2.f90 index 8ad6cb2..01dde4d 100644 --- a/devices/sources/async_target.2.f90 +++ b/devices/sources/async_target.2.f90 @@ -1,7 +1,6 @@ ! @@name: async_target.2 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_4.0 subroutine mult(p, N, idev) diff --git a/devices/sources/async_target.3.c b/devices/sources/async_target.3.c index 93d8c51..81faf26 100644 --- a/devices/sources/async_target.3.c +++ b/devices/sources/async_target.3.c @@ -1,8 +1,7 @@ /* * @@name: async_target.3 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_5.1 */ diff --git a/devices/sources/async_target.3.f90 b/devices/sources/async_target.3.f90 index 9eed410..49f7a41 100644 --- a/devices/sources/async_target.3.f90 +++ b/devices/sources/async_target.3.f90 @@ -1,7 +1,6 @@ ! @@name: async_target.3 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_5.1 program concurrent_async diff --git a/devices/sources/async_target.4.c b/devices/sources/async_target.4.c index 6b21367..949f6e9 100644 --- a/devices/sources/async_target.4.c +++ b/devices/sources/async_target.4.c @@ -1,12 +1,10 @@ /* * @@name: async_target.4 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.5 */ - extern void init( float*, int); extern void output(float*, int); diff --git a/devices/sources/async_target.4.f90 b/devices/sources/async_target.4.f90 index d97b46f..1f9fbf8 100644 --- a/devices/sources/async_target.4.f90 +++ b/devices/sources/async_target.4.f90 @@ -1,10 +1,8 @@ ! @@name: async_target.4 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_4.5 - subroutine vec_mult(N) implicit none integer :: i, N diff --git a/devices/sources/declare_target.1.c b/devices/sources/declare_target.1.c index 778958b..7cae998 100644 --- a/devices/sources/declare_target.1.c +++ b/devices/sources/declare_target.1.c @@ -1,8 +1,7 @@ /* * @@name: declare_target.1 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_5.1 */ diff --git a/devices/sources/declare_target.1.f90 b/devices/sources/declare_target.1.f90 index 9cf6ead..c4b7399 100644 --- a/devices/sources/declare_target.1.f90 +++ b/devices/sources/declare_target.1.f90 @@ -1,10 +1,10 @@ ! @@name: declare_target.1 ! @@type: F-free -! @@compilable: yes -! @@linkable: yes +! @@operation: compile ! @@expect: success ! @@version: omp_4.0 module module_fib +integer :: THRESHOLD=1000000 contains subroutine fib(N) integer :: N @@ -12,13 +12,10 @@ contains !... end subroutine end module -module params -integer :: THRESHOLD=1000000 -end module -program my_fib -use params +subroutine my_fib(N) use module_fib +integer :: N !$omp target if( N > THRESHOLD ) call fib(N) !$omp end target -end program +end subroutine diff --git a/devices/sources/declare_target.2.f90 b/devices/sources/declare_target.2.f90 index b1e335a..7bdcc73 100644 --- a/devices/sources/declare_target.2.f90 +++ b/devices/sources/declare_target.2.f90 @@ -1,7 +1,6 @@ ! @@name: declare_target.2 ! @@type: F-free -! @@compilable: yes -! @@linkable: yes +! @@operation: link ! @@expect: success ! @@version: omp_4.0 program my_fib diff --git a/devices/sources/declare_target.2a.cpp b/devices/sources/declare_target.2a.cpp index c7c3b3b..110124b 100644 --- a/devices/sources/declare_target.2a.cpp +++ b/devices/sources/declare_target.2a.cpp @@ -1,10 +1,9 @@ /* -* @@name: declare_target.2a -* @@type: C++ -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.1 +* @@name: declare_target.2a +* @@type: C++ +* @@operation: run +* @@expect: success +* @@version: omp_5.1 */ #include using namespace std; @@ -16,7 +15,7 @@ using namespace std; public: XOR1(int arg): a(arg) {}; int foo(); - } + }; int XOR1::foo() { return a^0x01;} #pragma omp end declare target diff --git a/devices/sources/declare_target.2b_functions.cpp b/devices/sources/declare_target.2b_functions.cpp index 7fb1e22..2d4558a 100644 --- a/devices/sources/declare_target.2b_functions.cpp +++ b/devices/sources/declare_target.2b_functions.cpp @@ -1,10 +1,10 @@ /* -* @@name: declare_target.2b_functions -* @@type: C++ -* @@compilable: yes -* @@linkable: no -* @@expect: failure -* @@version: omp_5.1 +* @@name: declare_target.2b_functions +* @@type: C++ +* @@operation: compile +* @@expect: success +* @@version: omp_5.1 +* @@depend: declare_target.2b_classes.hpp */ -#include "classes.hpp" +#include "declare_target.2b_classes.hpp" int XOR1::foo() { return a^0x01;} diff --git a/devices/sources/declare_target.2b_main.cpp b/devices/sources/declare_target.2b_main.cpp index cdbbdc7..82fdc5f 100644 --- a/devices/sources/declare_target.2b_main.cpp +++ b/devices/sources/declare_target.2b_main.cpp @@ -1,15 +1,15 @@ /* -* @@name: declare_target.2b_main -* @@type: C++ -* @@compilable: yes -* @@linkable: no -* @@expect: failure -* @@version: omp_5.1 +* @@name: declare_target.2b_main +* @@type: C++ +* @@operation: run +* @@expect: success +* @@version: omp_5.1 +* @@depend: declare_target.2b_classes.hpp */ #include using namespace std; -#include "classes.hpp" +#include "declare_target.2b_classes.hpp" int main (){ diff --git a/devices/sources/declare_target.2c.cpp b/devices/sources/declare_target.2c.cpp index 075c561..6fb3707 100644 --- a/devices/sources/declare_target.2c.cpp +++ b/devices/sources/declare_target.2c.cpp @@ -1,10 +1,9 @@ /* * @@name: declare_target.2c * @@type: C++ -* @@compilable: no -* @@linkable: no -* @@expect: failure -* @@version: omp_5.2 +* @@operation: compile +* @@expect: ct-error +* @@version: omp_5.1 */ struct typeX { diff --git a/devices/sources/declare_target.3.c b/devices/sources/declare_target.3.c index a1773a3..5f0daa8 100644 --- a/devices/sources/declare_target.3.c +++ b/devices/sources/declare_target.3.c @@ -1,8 +1,7 @@ /* * @@name: declare_target.3 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_5.1 */ diff --git a/devices/sources/declare_target.3.f90 b/devices/sources/declare_target.3.f90 index aa05f9b..89be77c 100644 --- a/devices/sources/declare_target.3.f90 +++ b/devices/sources/declare_target.3.f90 @@ -1,7 +1,6 @@ ! @@name: declare_target.3 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_4.0 module my_arrays diff --git a/devices/sources/declare_target.4.c b/devices/sources/declare_target.4.c index 7b8670f..b462963 100644 --- a/devices/sources/declare_target.4.c +++ b/devices/sources/declare_target.4.c @@ -1,8 +1,7 @@ /* * @@name: declare_target.4 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_5.1 */ diff --git a/devices/sources/declare_target.4.f90 b/devices/sources/declare_target.4.f90 index 89b6c83..9597cbc 100644 --- a/devices/sources/declare_target.4.f90 +++ b/devices/sources/declare_target.4.f90 @@ -1,7 +1,6 @@ ! @@name: declare_target.4 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_4.0 module my_global_array diff --git a/devices/sources/declare_target.5.c b/devices/sources/declare_target.5.c index 66d3cfb..3187905 100644 --- a/devices/sources/declare_target.5.c +++ b/devices/sources/declare_target.5.c @@ -1,8 +1,7 @@ /* * @@name: declare_target.5 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_5.1 */ diff --git a/devices/sources/declare_target.5.f90 b/devices/sources/declare_target.5.f90 index 306dbdf..2997148 100644 --- a/devices/sources/declare_target.5.f90 +++ b/devices/sources/declare_target.5.f90 @@ -1,7 +1,6 @@ ! @@name: declare_target.5 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_4.0 module my_global_array diff --git a/devices/sources/declare_target.6.c b/devices/sources/declare_target.6.c index a693f56..25bbc94 100644 --- a/devices/sources/declare_target.6.c +++ b/devices/sources/declare_target.6.c @@ -1,10 +1,9 @@ /* -* @@name: declare_target.6 -* @@type: C -* @@compilable: yes -* @@linkable: no -* @@expect: success -* @@version: omp_5.1 +* @@name: declare_target.6 +* @@type: C +* @@operation: compile +* @@expect: success +* @@version: omp_5.1 */ #define N 100000000 diff --git a/devices/sources/declare_target.6.f90 b/devices/sources/declare_target.6.f90 index b957b3b..25d14ef 100644 --- a/devices/sources/declare_target.6.f90 +++ b/devices/sources/declare_target.6.f90 @@ -1,9 +1,8 @@ -! @@name: declare_target.6 -! @@type: F-free -! @@compilable: yes -! @@linkable: no -! @@expect: success -! @@version: omp_4.5 +! @@name: declare_target.6 +! @@type: F-free +! @@operation: compile +! @@expect: success +! @@version: omp_4.5 module m_dat integer, parameter :: N=100000000 !$omp declare target link(sp,sv1,sv2) diff --git a/devices/sources/device.1.c b/devices/sources/device.1.c index 162f7de..39fbb20 100644 --- a/devices/sources/device.1.c +++ b/devices/sources/device.1.c @@ -1,8 +1,7 @@ /* * @@name: device.1 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_5.1 */ diff --git a/devices/sources/device.1.f90 b/devices/sources/device.1.f90 index 29ff01e..e999d18 100644 --- a/devices/sources/device.1.f90 +++ b/devices/sources/device.1.f90 @@ -1,9 +1,8 @@ ! @@name: device.1 ! @@type: F-free -! @@compilable: yes -! @@linkable: yes +! @@operation: compile ! @@expect: success -! @@version: omp_4.0 +! @@version: omp_4.0 module params integer,parameter :: N=1024 end module params diff --git a/devices/sources/device.2.c b/devices/sources/device.2.c index 5656da7..0b7922b 100644 --- a/devices/sources/device.2.c +++ b/devices/sources/device.2.c @@ -1,8 +1,7 @@ /* * @@name: device.2 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ diff --git a/devices/sources/device.2.f90 b/devices/sources/device.2.f90 index 82e8bc6..2d4b77d 100644 --- a/devices/sources/device.2.f90 +++ b/devices/sources/device.2.f90 @@ -1,9 +1,8 @@ ! @@name: device.2 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success -! @@version: omp_4.0 +! @@version: omp_4.0 subroutine vec_mult(p, v1, v2, N) use omp_lib, ONLY : omp_get_num_devices real :: p(N), v1(N), v2(N) diff --git a/devices/sources/device.3.c b/devices/sources/device.3.c index 22f5fc6..3591dbe 100644 --- a/devices/sources/device.3.c +++ b/devices/sources/device.3.c @@ -1,8 +1,7 @@ /* * @@name: device.3 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ diff --git a/devices/sources/device.3.f90 b/devices/sources/device.3.f90 index 83888e5..19b35b3 100644 --- a/devices/sources/device.3.f90 +++ b/devices/sources/device.3.f90 @@ -1,9 +1,8 @@ ! @@name: device.3 ! @@type: F-free -! @@compilable: yes -! @@linkable: yes +! @@operation: link ! @@expect: success -! @@version: omp_4.0 +! @@version: omp_4.0 program foo use omp_lib, ONLY : omp_get_default_device, omp_set_default_device integer :: old_default_device, new_default_device diff --git a/devices/sources/device.4.c b/devices/sources/device.4.c index 3c8b093..69fc2c2 100644 --- a/devices/sources/device.4.c +++ b/devices/sources/device.4.c @@ -1,8 +1,7 @@ /* * @@name: device.4 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.5 */ @@ -11,7 +10,7 @@ #include #include -void get_dev_cos(double *mem, size_t s) +void get_dev_cos(double *mem, int s) { int h, t, i; double * mem_dev_cpy; diff --git a/devices/sources/device.4.f90 b/devices/sources/device.4.f90 index 09faec7..404a5b3 100644 --- a/devices/sources/device.4.f90 +++ b/devices/sources/device.4.f90 @@ -1,7 +1,6 @@ ! @@name: device.4 ! @@type: F-free -! @@compilable: yes -! @@linkable: yes +! @@operation: run ! @@expect: success ! @@version: omp_5.0 program device_mem diff --git a/devices/sources/lambda_expressions.1.cpp b/devices/sources/lambda_expressions.1.cpp index fad53c6..ce271b0 100644 --- a/devices/sources/lambda_expressions.1.cpp +++ b/devices/sources/lambda_expressions.1.cpp @@ -1,10 +1,9 @@ /* -* @@name: lambda_expressions.1 -* @@type: C++ -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.0 +* @@name: lambda_expressions.1 +* @@type: C++ +* @@operation: run +* @@expect: success +* @@version: omp_5.0 */ #include using namespace std; diff --git a/devices/sources/target.1.c b/devices/sources/target.1.c index 972dd00..c297c9a 100644 --- a/devices/sources/target.1.c +++ b/devices/sources/target.1.c @@ -1,8 +1,7 @@ /* * @@name: target.1 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ diff --git a/devices/sources/target.1.f90 b/devices/sources/target.1.f90 index b6362d0..17783eb 100644 --- a/devices/sources/target.1.f90 +++ b/devices/sources/target.1.f90 @@ -1,9 +1,8 @@ ! @@name: target.1 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success -! @@version: omp_4.0 +! @@version: omp_4.0 subroutine vec_mult(N) integer :: i,N real :: p(N), v1(N), v2(N) diff --git a/devices/sources/target.2.c b/devices/sources/target.2.c index e4bec9f..6633032 100644 --- a/devices/sources/target.2.c +++ b/devices/sources/target.2.c @@ -1,8 +1,7 @@ /* * @@name: target.2 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ diff --git a/devices/sources/target.2.f90 b/devices/sources/target.2.f90 index 3097078..62fd9be 100644 --- a/devices/sources/target.2.f90 +++ b/devices/sources/target.2.f90 @@ -1,9 +1,8 @@ ! @@name: target.2 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success -! @@version: omp_4.0 +! @@version: omp_4.0 subroutine vec_mult(N) integer :: i,N real :: p(N), v1(N), v2(N) diff --git a/devices/sources/target.3.c b/devices/sources/target.3.c index f3bb62d..7fbba28 100644 --- a/devices/sources/target.3.c +++ b/devices/sources/target.3.c @@ -1,8 +1,7 @@ /* * @@name: target.3 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ diff --git a/devices/sources/target.3.f90 b/devices/sources/target.3.f90 index 130cb49..f158467 100644 --- a/devices/sources/target.3.f90 +++ b/devices/sources/target.3.f90 @@ -1,9 +1,8 @@ ! @@name: target.3 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success -! @@version: omp_4.0 +! @@version: omp_4.0 subroutine vec_mult(N) integer :: i,N real :: p(N), v1(N), v2(N) diff --git a/devices/sources/target.4.c b/devices/sources/target.4.c index 406393a..24c4cdf 100644 --- a/devices/sources/target.4.c +++ b/devices/sources/target.4.c @@ -1,8 +1,7 @@ /* * @@name: target.4 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ diff --git a/devices/sources/target.4.f90 b/devices/sources/target.4.f90 index ac00941..0cb589d 100644 --- a/devices/sources/target.4.f90 +++ b/devices/sources/target.4.f90 @@ -1,9 +1,8 @@ ! @@name: target.4 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success -! @@version: omp_4.0 +! @@version: omp_4.0 module mults contains subroutine vec_mult(p,v1,v2,N) diff --git a/devices/sources/target.4b.f90 b/devices/sources/target.4b.f90 index dbef3da..3ea1c1b 100644 --- a/devices/sources/target.4b.f90 +++ b/devices/sources/target.4b.f90 @@ -1,9 +1,8 @@ ! @@name: target.4b ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success -! @@version: omp_4.0 +! @@version: omp_4.0 module mults contains subroutine vec_mult(p,v1,v2,N) diff --git a/devices/sources/target.5.c b/devices/sources/target.5.c index 6d8a14b..fef8dc9 100644 --- a/devices/sources/target.5.c +++ b/devices/sources/target.5.c @@ -1,8 +1,7 @@ /* * @@name: target.5 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ diff --git a/devices/sources/target.5.f90 b/devices/sources/target.5.f90 index 8472623..5a68318 100644 --- a/devices/sources/target.5.f90 +++ b/devices/sources/target.5.f90 @@ -1,9 +1,8 @@ ! @@name: target.5 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success -! @@version: omp_4.0 +! @@version: omp_4.0 module params integer,parameter :: THRESHOLD1=1000000, THRESHHOLD2=1000 end module diff --git a/devices/sources/target.6.c b/devices/sources/target.6.c index fdc77b6..742b662 100644 --- a/devices/sources/target.6.c +++ b/devices/sources/target.6.c @@ -1,8 +1,7 @@ /* * @@name: target.6 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.5 */ diff --git a/devices/sources/target.6.f90 b/devices/sources/target.6.f90 index 66c8b4d..6e93f5e 100644 --- a/devices/sources/target.6.f90 +++ b/devices/sources/target.6.f90 @@ -1,9 +1,8 @@ ! @@name: target.6 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success -! @@version: omp_4.5 +! @@version: omp_4.5 module params integer,parameter :: THRESHOLD1=1000000, THRESHHOLD2=1000 end module diff --git a/devices/sources/target_associate_ptr.1.c b/devices/sources/target_associate_ptr.1.c index edb061a..d7cd00f 100644 --- a/devices/sources/target_associate_ptr.1.c +++ b/devices/sources/target_associate_ptr.1.c @@ -1,9 +1,8 @@ /* -* @@name: target_associate_ptr.1 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success +* @@name: target_associate_ptr.1 +* @@type: C +* @@operation: run +* @@expect: success * @@version: omp_4.5 */ #include diff --git a/devices/sources/target_associate_ptr.1.f90 b/devices/sources/target_associate_ptr.1.f90 index c2bc1b8..76d623d 100644 --- a/devices/sources/target_associate_ptr.1.f90 +++ b/devices/sources/target_associate_ptr.1.f90 @@ -1,8 +1,7 @@ -! @@name: target_associate_ptr.1 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success +! @@name: target_associate_ptr.1 +! @@type: F-free +! @@operation: run +! @@expect: success ! @@version: omp_5.1 program target_associate use omp_lib diff --git a/devices/sources/target_data.1.c b/devices/sources/target_data.1.c index d845806..58648e8 100644 --- a/devices/sources/target_data.1.c +++ b/devices/sources/target_data.1.c @@ -1,8 +1,7 @@ /* * @@name: target_data.1 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ diff --git a/devices/sources/target_data.1.f90 b/devices/sources/target_data.1.f90 index f205693..07c80fa 100644 --- a/devices/sources/target_data.1.f90 +++ b/devices/sources/target_data.1.f90 @@ -1,9 +1,8 @@ ! @@name: target_data.1 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success -! @@version: omp_4.0 +! @@version: omp_4.0 subroutine vec_mult(p, v1, v2, N) real :: p(N), v1(N), v2(N) integer :: i diff --git a/devices/sources/target_data.2.c b/devices/sources/target_data.2.c index 78c82c8..d98fa81 100644 --- a/devices/sources/target_data.2.c +++ b/devices/sources/target_data.2.c @@ -1,8 +1,7 @@ /* * @@name: target_data.2 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ diff --git a/devices/sources/target_data.2.f90 b/devices/sources/target_data.2.f90 index 08e1169..6f4bde0 100644 --- a/devices/sources/target_data.2.f90 +++ b/devices/sources/target_data.2.f90 @@ -1,9 +1,8 @@ ! @@name: target_data.2 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success -! @@version: omp_4.0 +! @@version: omp_4.0 subroutine vec_mult(p, v1, v2, N) real :: p(N), v1(N), v2(N) integer :: i diff --git a/devices/sources/target_data.3.c b/devices/sources/target_data.3.c index 8da0582..a7f56ab 100644 --- a/devices/sources/target_data.3.c +++ b/devices/sources/target_data.3.c @@ -1,12 +1,10 @@ /* * @@name: target_data.3 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ - #include #define COLS 100 diff --git a/devices/sources/target_data.3.f90 b/devices/sources/target_data.3.f90 index 272ccb3..3f738db 100644 --- a/devices/sources/target_data.3.f90 +++ b/devices/sources/target_data.3.f90 @@ -1,9 +1,8 @@ ! @@name: target_data.3 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success -! @@version: omp_4.0 +! @@version: omp_4.0 subroutine gramSchmidt(Q,rows,cols) integer :: rows,cols, i,k double precision :: Q(rows,cols), tmp diff --git a/devices/sources/target_data.4.c b/devices/sources/target_data.4.c index 0b20044..a8df727 100644 --- a/devices/sources/target_data.4.c +++ b/devices/sources/target_data.4.c @@ -1,8 +1,7 @@ /* * @@name: target_data.4 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ diff --git a/devices/sources/target_data.4.f90 b/devices/sources/target_data.4.f90 index c5ee88b..1d936d8 100644 --- a/devices/sources/target_data.4.f90 +++ b/devices/sources/target_data.4.f90 @@ -1,9 +1,8 @@ ! @@name: target_data.4 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success -! @@version: omp_4.0 +! @@version: omp_4.0 module mults contains subroutine foo(p0,v1,v2,N) diff --git a/devices/sources/target_data.5.cpp b/devices/sources/target_data.5.cpp index 1e6fee3..8d5c3de 100644 --- a/devices/sources/target_data.5.cpp +++ b/devices/sources/target_data.5.cpp @@ -1,8 +1,7 @@ /* * @@name: target_data.5 * @@type: C++ -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ diff --git a/devices/sources/target_data.5.f90 b/devices/sources/target_data.5.f90 index b35f5df..8f09382 100644 --- a/devices/sources/target_data.5.f90 +++ b/devices/sources/target_data.5.f90 @@ -1,9 +1,8 @@ ! @@name: target_data.5 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success -! @@version: omp_4.0 +! @@version: omp_4.0 module my_mult contains subroutine foo(p0,v1,v2,N) diff --git a/devices/sources/target_data.6.c b/devices/sources/target_data.6.c index 6b7b39e..741db55 100644 --- a/devices/sources/target_data.6.c +++ b/devices/sources/target_data.6.c @@ -1,8 +1,7 @@ /* * @@name: target_data.6 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ diff --git a/devices/sources/target_data.6.f90 b/devices/sources/target_data.6.f90 index a5dd554..0eb3cde 100644 --- a/devices/sources/target_data.6.f90 +++ b/devices/sources/target_data.6.f90 @@ -1,9 +1,8 @@ ! @@name: target_data.6 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success -! @@version: omp_4.0 +! @@version: omp_4.0 module params integer,parameter :: THRESHOLD=1000000 end module diff --git a/devices/sources/target_data.7.c b/devices/sources/target_data.7.c index 89680f5..5d0dbcb 100644 --- a/devices/sources/target_data.7.c +++ b/devices/sources/target_data.7.c @@ -1,8 +1,7 @@ /* * @@name: target_data.7 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ diff --git a/devices/sources/target_data.7.f90 b/devices/sources/target_data.7.f90 index 6ac68a4..1da6992 100644 --- a/devices/sources/target_data.7.f90 +++ b/devices/sources/target_data.7.f90 @@ -1,9 +1,8 @@ ! @@name: target_data.7 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success -! @@version: omp_4.0 +! @@version: omp_4.0 module params integer, parameter :: THRESHOLD=1000000 end module diff --git a/devices/sources/target_defaultmap.1.c b/devices/sources/target_defaultmap.1.c index b7558de..3b497d2 100644 --- a/devices/sources/target_defaultmap.1.c +++ b/devices/sources/target_defaultmap.1.c @@ -1,9 +1,8 @@ /* -* @@name: target_defaultmap.1 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success +* @@name: target_defaultmap.1 +* @@type: C +* @@operation: run +* @@expect: success * @@version: omp_5.0 */ #include @@ -30,10 +29,9 @@ int main(){ // Uses defaultmap to set scalars, aggregates & // pointers to normal defaults. #pragma omp target \ - defaultmap(firstprivate: scalar) //could also be default \ - defaultmap(tofrom: aggregate)//could also be default \ - defaultmap(default: pointer) //must be default \ - map(ptr2m[:N]) + defaultmap(firstprivate: scalar) /* could also be default */ \ + defaultmap(tofrom: aggregate)/* could also be default */ \ + defaultmap(default: pointer) /* must be default */ { s = 3; //SCALAR firstprivate, value not returned @@ -65,9 +63,10 @@ int main(){ // Target Region 3 - // defaultmap & explicit map with variables in same category + // defaultmap & explicit data-sharing clause + // with variables in same category s1=s2=s3=1; - #pragma omp defaultmap(tofrom: scalar) map(firstprivate: s1,s2) + #pragma omp target defaultmap(tofrom: scalar) firstprivate(s1,s2) { s1 += 5; // firstprivate (s1 value not returned to host) s2 += 5; // firstprivate (s2 value not returned to host) diff --git a/devices/sources/target_defaultmap.1.f90 b/devices/sources/target_defaultmap.1.f90 index b5cc96f..d36dfdc 100644 --- a/devices/sources/target_defaultmap.1.f90 +++ b/devices/sources/target_defaultmap.1.f90 @@ -1,9 +1,8 @@ -! @@name: target_defaultmap.1 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_5.0 +! @@name: target_defaultmap.1 +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: omp_5.0 program defaultmap integer, parameter :: N=2 @@ -13,15 +12,12 @@ program defaultmap end type integer :: s,s1,s2,s3 !! SCALAR: variable (integer) - integer,target :: A(N) !! AGGREGATE: Array type(DDT_sA) :: D !! AGGREGATE: Derived Data Type (D) - integer,allocatable :: H(:) !! ALLOCATABLE: Heap allocated array - - integer,pointer :: ptrA(:) !! POINTER: points to Array - - ! Assign vaues to scalar, Array, Allocatable, and Pointers + integer,pointer :: ptrA(:) !! POINTER: points to array + + ! Assign values to scalar, array, allocatable, and pointers s=2; s1=0; s2=0; s3=0 @@ -72,9 +68,10 @@ program defaultmap print*," PASSED 2 of 4" !! Target Region 3 - !!defaultmap & explicit map with variables in same category + !! defaultmap & explicit data-sharing clause + !! with variables in same category s1=1; s2=1; s3=1 - !$omp defaultmap(tofrom: scalar) map(firstprivate: s1,s2) + !$omp target defaultmap(tofrom: scalar) firstprivate(s1,s2) s1 = s1+5; !! firstprivate (s1 value not returned to host) s2 = s2+5; !! firstprivate (s2 value not returned to host) @@ -87,15 +84,15 @@ program defaultmap A(1)=0; A(2)=0 D%A(1)=0; D%A(2)=0 H(1)=0; H(2)=0 - !! non-allocated arrays & derived types are in AGGREGATE cat. - !! Allocatable Arrays are in ALLOCATABLE category + !! non-allocated arrays & derived types are in AGGREGATE cat + !! Allocatable arrays are in ALLOCATABLE category !! Scalars are explicitly mapped from !$omp target defaultmap(firstprivate: aggregate ) & !$omp& defaultmap(firstprivate: allocatable) & !$omp& map(from: s1, s2) A(1)=A(1)+1; D%A(1)=D%A(1)+1; H(1)=H(1)+1 !! changes to A, D%A, H - A(2)=A(2)+1; D%A(2)=D%A(2)+1; H(2)=H(2)+1 !! not returned to host + A(2)=A(2)+1; D%A(2)=D%A(2)+1; H(2)=H(2)+1 !! not returned to host s1 = A(1)+D%A(1)+H(1) !! s1 returned to host s2 = A(2)+D%A(2)+H(1) !! s2 returned to host diff --git a/devices/sources/target_fort_allocatable_map.1.f90 b/devices/sources/target_fort_allocatable_map.1.f90 index c20a18e..14920c5 100644 --- a/devices/sources/target_fort_allocatable_map.1.f90 +++ b/devices/sources/target_fort_allocatable_map.1.f90 @@ -1,9 +1,8 @@ -! @@name: target_fort_allocatable_map.1 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_5.1 +! @@name: target_fort_allocatable_map.1 +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: omp_5.1 program main implicit none integer :: i diff --git a/devices/sources/target_fort_allocatable_map.2.f90 b/devices/sources/target_fort_allocatable_map.2.f90 index 6c31bcb..295594e 100644 --- a/devices/sources/target_fort_allocatable_map.2.f90 +++ b/devices/sources/target_fort_allocatable_map.2.f90 @@ -1,9 +1,8 @@ -! @@name: target_fort_allocatable_map.2 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: unspecified -! @@version: omp_5.1 +! @@name: target_fort_allocatable_map.2 +! @@type: F-free +! @@operation: run +! @@expect: unspecified +! @@version: omp_5.1 program main implicit none diff --git a/devices/sources/target_fort_allocatable_map.3.f90 b/devices/sources/target_fort_allocatable_map.3.f90 index daf471a..8532836 100644 --- a/devices/sources/target_fort_allocatable_map.3.f90 +++ b/devices/sources/target_fort_allocatable_map.3.f90 @@ -1,9 +1,8 @@ -! @@name: target_fort_allocatable_map.3 -! @@type: F-free -! @@compilable: yes -! @@linkable: no -! @@expect: fail -! @@version: omp_5.1 +! @@name: target_fort_allocatable_map.3 +! @@type: F-free +! @@operation: compile +! @@expect: unspecified +! @@version: omp_5.1 module corfu contains subroutine foo(ain,bout) diff --git a/devices/sources/target_mapper.1.c b/devices/sources/target_mapper.1.c index 0a01a80..12fa7ff 100644 --- a/devices/sources/target_mapper.1.c +++ b/devices/sources/target_mapper.1.c @@ -1,10 +1,9 @@ /* -* @@name: target_mapper.1 -* @@type: C -* @@compilable: yes -* @@linkable: no -* @@expect: success -* @@version: omp_5.0 +* @@name: target_mapper.1 +* @@type: C +* @@operation: run +* @@expect: success +* @@version: omp_5.0 */ #include #include @@ -32,4 +31,4 @@ int main(){ } void init(myvec_t *s) -{ for(int i=0; ilen; i++) s->data[i]=i; } +{ for(size_t i=0; ilen; i++) s->data[i]=i; } diff --git a/devices/sources/target_mapper.1.f90 b/devices/sources/target_mapper.1.f90 index 7ffea0a..08f1b8c 100644 --- a/devices/sources/target_mapper.1.f90 +++ b/devices/sources/target_mapper.1.f90 @@ -1,10 +1,8 @@ -! @@name: target_mapper.1 -! @@type: F-free -! @@compilable: yes -! @@linkable: no -! @@expect: success -! @@version: omp_5.0 - +! @@name: target_mapper.1 +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: omp_5.0 module my_structures type myvec_t integer :: len diff --git a/devices/sources/target_mapper.2.c b/devices/sources/target_mapper.2.c index db2b0bf..38a8811 100644 --- a/devices/sources/target_mapper.2.c +++ b/devices/sources/target_mapper.2.c @@ -1,10 +1,9 @@ /* -* @@name: target_mapper.2 -* @@type: C -* @@compilable: yes -* @@linkable: no -* @@expect: success -* @@version: omp_5.0 +* @@name: target_mapper.2 +* @@type: C +* @@operation: compile +* @@expect: success +* @@version: omp_5.0 */ #include // N MUST BE EVEN diff --git a/devices/sources/target_mapper.2.f90 b/devices/sources/target_mapper.2.f90 index 709d00a..0abae22 100644 --- a/devices/sources/target_mapper.2.f90 +++ b/devices/sources/target_mapper.2.f90 @@ -1,9 +1,8 @@ -! @@name: target_mapper.2 -! @@type: F-free -! @@compilable: yes -! @@linkable: no -! @@expect: success -! @@version: omp_5.0 +! @@name: target_mapper.2 +! @@type: F-free +! @@operation: compile +! @@expect: success +! @@version: omp_5.0 module complex_mats integer, parameter :: N=100 !N must be even diff --git a/devices/sources/target_mapper.3.c b/devices/sources/target_mapper.3.c index e716519..4061f5b 100644 --- a/devices/sources/target_mapper.3.c +++ b/devices/sources/target_mapper.3.c @@ -1,12 +1,10 @@ /* -* @@name: target_mapper.3 -* @@type: C -* @@compilable: yes -* @@linkable: no -* @@expect: success -* @@version: omp_5.0 +* @@name: target_mapper.3 +* @@type: C +* @@operation: compile +* @@expect: success +* @@version: omp_5.0 */ - #include #include diff --git a/devices/sources/target_mapper.3.f90 b/devices/sources/target_mapper.3.f90 index 4f954f2..b24a1ba 100644 --- a/devices/sources/target_mapper.3.f90 +++ b/devices/sources/target_mapper.3.f90 @@ -1,17 +1,15 @@ -! @@name: target_mapper.3 -! @@type: F-free -! @@compilable: yes -! @@linkable: no -! @@expect: success -! @@version: omp_5.0 - +! @@name: target_mapper.3 +! @@type: F-free +! @@operation: compile +! @@expect: success +! @@version: omp_5.0 module my_structures type myvec_t integer :: len double precision, pointer :: data(:) end type !$omp declare mapper(myvec_t :: v) & - !$omp& map(v) + !$omp& map(v, v%data(:)) type mypoints_t type(myvec_t) :: scratch @@ -36,4 +34,3 @@ program main call eval_mypts_array(P) end program - diff --git a/devices/sources/target_ptr_map.1.c b/devices/sources/target_ptr_map.1.c index 64d3693..9194831 100644 --- a/devices/sources/target_ptr_map.1.c +++ b/devices/sources/target_ptr_map.1.c @@ -1,9 +1,8 @@ /* -* @@name: target_ptr_map.1 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success +* @@name: target_ptr_map.1 +* @@type: C +* @@operation: run +* @@expect: success * @@version: omp_5.0 */ #include diff --git a/devices/sources/target_ptr_map.2.c b/devices/sources/target_ptr_map.2.c index d953761..c6399c9 100644 --- a/devices/sources/target_ptr_map.2.c +++ b/devices/sources/target_ptr_map.2.c @@ -1,9 +1,8 @@ /* -* @@name: target_ptr_map.2 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success +* @@name: target_ptr_map.2 +* @@type: C +* @@operation: run +* @@expect: success * @@version: omp_5.1 */ #include diff --git a/devices/sources/target_ptr_map.3a.c b/devices/sources/target_ptr_map.3a.c index 957ed38..b7355c8 100644 --- a/devices/sources/target_ptr_map.3a.c +++ b/devices/sources/target_ptr_map.3a.c @@ -1,9 +1,8 @@ /* -* @@name: target_ptr_map.3a -* @@type: C -* @@compilable: yes -* @@linkable: no -* @@expect: failure +* @@name: target_ptr_map.3a +* @@type: C +* @@operation: compile +* @@expect: unspecified * @@version: omp_5.1 */ #define N 100 @@ -37,7 +36,7 @@ int foo() // The initial value of p2 in the target region is undefined // because map(y) may occur after map(p2[:0]). p2[1] = 4; // accessing p2 is undefined - } + } return 0; } diff --git a/devices/sources/target_ptr_map.3b.c b/devices/sources/target_ptr_map.3b.c index c60db54..ba3efde 100644 --- a/devices/sources/target_ptr_map.3b.c +++ b/devices/sources/target_ptr_map.3b.c @@ -1,9 +1,8 @@ /* -* @@name: target_ptr_map.3b -* @@type: C -* @@compilable: yes -* @@linkable: no -* @@expect: success +* @@name: target_ptr_map.3b +* @@type: C +* @@operation: compile +* @@expect: success * @@version: omp_5.1 */ #define N 100 diff --git a/devices/sources/target_ptr_map.4.c b/devices/sources/target_ptr_map.4.c index f0ea502..2590783 100644 --- a/devices/sources/target_ptr_map.4.c +++ b/devices/sources/target_ptr_map.4.c @@ -1,9 +1,8 @@ /* -* @@name: target_ptr_map.4 -* @@type: C -* @@compilable: yes -* @@linkable: no -* @@expect: success +* @@name: target_ptr_map.4 +* @@type: C +* @@operation: compile +* @@expect: success * @@version: omp_5.2 */ #include diff --git a/devices/sources/target_ptr_map.5.c b/devices/sources/target_ptr_map.5.c index 91457de..c47f82a 100644 --- a/devices/sources/target_ptr_map.5.c +++ b/devices/sources/target_ptr_map.5.c @@ -1,9 +1,8 @@ /* -* @@name: target_ptr_map.5 -* @@type: C -* @@compilable: yes -* @@linkable: no -* @@expect: success +* @@name: target_ptr_map.5 +* @@type: C +* @@operation: compile +* @@expect: success * @@version: omp_5.2 */ #include diff --git a/devices/sources/target_ptr_map.5.f90 b/devices/sources/target_ptr_map.5.f90 index 5795974..7cc3953 100644 --- a/devices/sources/target_ptr_map.5.f90 +++ b/devices/sources/target_ptr_map.5.f90 @@ -1,9 +1,8 @@ -! @@name: target_ptr_map.5 -! @@type: F-free -! @@compilable: yes -! @@linkable: no -! @@expect: success -! @@version: omp_5.2 +! @@name: target_ptr_map.5 +! @@type: F-free +! @@operation: compile +! @@expect: success +! @@version: omp_5.2 program main use omp_lib diff --git a/devices/sources/target_reverse_offload.7.c b/devices/sources/target_reverse_offload.7.c index 604b811..c995a52 100644 --- a/devices/sources/target_reverse_offload.7.c +++ b/devices/sources/target_reverse_offload.7.c @@ -1,12 +1,10 @@ /* * @@name: target_reverse_offload.7 * @@type: C -* @@compilable: yes -* @@linkable: yes +* @@operation: run * @@expect: success * @@version: omp_5.2 */ - #include #include diff --git a/devices/sources/target_reverse_offload.7.f90 b/devices/sources/target_reverse_offload.7.f90 index 5f8b0e8..e9bd189 100644 --- a/devices/sources/target_reverse_offload.7.f90 +++ b/devices/sources/target_reverse_offload.7.f90 @@ -1,14 +1,12 @@ -! @@name: target_reverse_offload.7 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_5.0 - -!$omp requires reverse_offload - +! @@name: target_reverse_offload.7 +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: omp_5.0 subroutine error_handler(wrong_value, index) + implicit none integer :: wrong_value,index + !$omp requires reverse_offload !$omp declare target device_type(host) write( *,'("Error in offload: A(",i3,")=",i3)' ) index,wrong_value @@ -19,8 +17,10 @@ subroutine error_handler(wrong_value, index) end subroutine program rev_off - use omp_lib + implicit none + !$omp requires reverse_offload integer, parameter :: N=100 + integer :: i integer :: A(N) = (/ (i, i=1,100) /) A(N-1)=-1 @@ -28,7 +28,7 @@ program rev_off !$omp target map(A) do i=1,N if (A(i) /= i) then - !$omp target device(ancestor: 1) map(always,to :A(i)) + !$omp target device(ancestor: 1) map(always,to: A(i)) call error_handler(A(i), i) !$omp end target endif diff --git a/devices/sources/target_struct_map.1.c b/devices/sources/target_struct_map.1.c index baa6797..7041366 100644 --- a/devices/sources/target_struct_map.1.c +++ b/devices/sources/target_struct_map.1.c @@ -1,9 +1,8 @@ /* -* @@name: target_struct_map.1 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success +* @@name: target_struct_map.1 +* @@type: C +* @@operation: run +* @@expect: success * @@version: omp_5.1 */ #include diff --git a/devices/sources/target_struct_map.2.c b/devices/sources/target_struct_map.2.c deleted file mode 100644 index f769436..0000000 --- a/devices/sources/target_struct_map.2.c +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @@name: target_struct_map.2 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.0 -*/ -#include -#include -#define N 100 - -#pragma omp declare target -int a; -#pragma omp end declare target - -int main(){ - int i; - int *p; - - #pragma omp target data map(p) - { - p = (int *)malloc(sizeof(int)*N); - for (i=0; i diff --git a/devices/sources/target_struct_map.3.c b/devices/sources/target_struct_map.3.c index d5f4fad..9a8161f 100644 --- a/devices/sources/target_struct_map.3.c +++ b/devices/sources/target_struct_map.3.c @@ -1,9 +1,8 @@ /* -* @@name: target_struct_map.3 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: failure +* @@name: target_struct_map.3 +* @@type: C +* @@operation: run +* @@expect: rt-error * @@version: omp_5.1 */ #include diff --git a/devices/sources/target_struct_map.4.c b/devices/sources/target_struct_map.4.c index 34bea98..f0f1e5c 100644 --- a/devices/sources/target_struct_map.4.c +++ b/devices/sources/target_struct_map.4.c @@ -1,9 +1,8 @@ /* -* @@name: target_struct_map.4 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success +* @@name: target_struct_map.4 +* @@type: C +* @@operation: run +* @@expect: success * @@version: omp_5.1 */ #include @@ -84,4 +83,3 @@ int main() free(S3.p); return 0; } - diff --git a/devices/sources/target_unstructured_data.1.c b/devices/sources/target_unstructured_data.1.c index ce8135f..cdd9cfc 100644 --- a/devices/sources/target_unstructured_data.1.c +++ b/devices/sources/target_unstructured_data.1.c @@ -1,10 +1,9 @@ /* - * @@name: target_unstructured_data.1 - * @@type: C - * @@compilable: yes - * @@linkable: no - * @@expect: success - * @@version: omp_4.5 +* @@name: target_unstructured_data.1 +* @@type: C +* @@operation: compile +* @@expect: success +* @@version: omp_4.5 */ #include typedef struct { diff --git a/devices/sources/target_unstructured_data.1.cpp b/devices/sources/target_unstructured_data.1.cpp index 4febde4..d6fd899 100644 --- a/devices/sources/target_unstructured_data.1.cpp +++ b/devices/sources/target_unstructured_data.1.cpp @@ -1,10 +1,9 @@ /* -* @@name: target_unstructured_data.1 -* @@type: C++ -* @@compilable: yes -* @@linkable: no -* @@expect: success -* @@version: omp_4.5 +* @@name: target_unstructured_data.1 +* @@type: C++ +* @@operation: compile +* @@expect: success +* @@version: omp_4.5 */ class Matrix { @@ -17,7 +16,7 @@ class Matrix ~Matrix() { // NOTE: delete map type should be used, since the corresponding - // host data will cease to exist after the deconstructor is called. + // host data will cease to exist after the destructor is called. #pragma omp target exit data map(delete:v[0:len]) delete[] v; diff --git a/devices/sources/target_unstructured_data.1.f90 b/devices/sources/target_unstructured_data.1.f90 index 763dc67..38f54e8 100644 --- a/devices/sources/target_unstructured_data.1.f90 +++ b/devices/sources/target_unstructured_data.1.f90 @@ -1,9 +1,8 @@ -! @@name: target_unstructured_data.1 -! @@type: F-free -! @@compilable: yes -! @@linkable: no -! @@expect: success -! @@version: omp_4.5 +! @@name: target_unstructured_data.1 +! @@type: F-free +! @@operation: compile +! @@expect: success +! @@version: omp_4.5 module example real(8), allocatable :: A(:) diff --git a/devices/sources/target_update.1.c b/devices/sources/target_update.1.c index b0adbe9..da14a17 100644 --- a/devices/sources/target_update.1.c +++ b/devices/sources/target_update.1.c @@ -1,8 +1,7 @@ /* * @@name: target_update.1 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ diff --git a/devices/sources/target_update.1.f90 b/devices/sources/target_update.1.f90 index 41f2530..b9edf8b 100644 --- a/devices/sources/target_update.1.f90 +++ b/devices/sources/target_update.1.f90 @@ -1,9 +1,8 @@ ! @@name: target_update.1 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success -! @@version: omp_4.0 +! @@version: omp_4.0 subroutine vec_mult(p, v1, v2, N) real :: p(N), v1(N), v2(N) integer :: i diff --git a/devices/sources/target_update.2.c b/devices/sources/target_update.2.c index c7c508e..851a148 100644 --- a/devices/sources/target_update.2.c +++ b/devices/sources/target_update.2.c @@ -1,8 +1,7 @@ /* * @@name: target_update.2 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ diff --git a/devices/sources/target_update.2.f90 b/devices/sources/target_update.2.f90 index 9c264e4..0ffb9f3 100644 --- a/devices/sources/target_update.2.f90 +++ b/devices/sources/target_update.2.f90 @@ -1,9 +1,8 @@ ! @@name: target_update.2 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success -! @@version: omp_4.0 +! @@version: omp_4.0 subroutine vec_mult(p, v1, v2, N) interface logical function maybe_init_again (v1, N) diff --git a/devices/sources/teams.1.c b/devices/sources/teams.1.c index 8ddfbbd..a25835c 100644 --- a/devices/sources/teams.1.c +++ b/devices/sources/teams.1.c @@ -1,8 +1,7 @@ /* * @@name: teams.1 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ diff --git a/devices/sources/teams.1.f90 b/devices/sources/teams.1.f90 index a77f424..df0b453 100644 --- a/devices/sources/teams.1.f90 +++ b/devices/sources/teams.1.f90 @@ -1,9 +1,8 @@ ! @@name: teams.1 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success -! @@version: omp_4.0 +! @@version: omp_4.0 function dotprod(B,C,N) result(sum) use omp_lib, ONLY : omp_get_num_teams, omp_get_team_num real :: B(N), C(N), sum,sum0, sum1 diff --git a/devices/sources/teams.2.c b/devices/sources/teams.2.c index d0275a1..eaeb823 100644 --- a/devices/sources/teams.2.c +++ b/devices/sources/teams.2.c @@ -1,8 +1,7 @@ /* * @@name: teams.2 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ diff --git a/devices/sources/teams.2.f90 b/devices/sources/teams.2.f90 index d5ffd82..edaa966 100644 --- a/devices/sources/teams.2.f90 +++ b/devices/sources/teams.2.f90 @@ -1,7 +1,6 @@ ! @@name: teams.2 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_4.0 function dotprod(B,C,N, block_size, num_teams, block_threads) result(sum) diff --git a/devices/sources/teams.3.c b/devices/sources/teams.3.c index 0bf9383..a0f602e 100644 --- a/devices/sources/teams.3.c +++ b/devices/sources/teams.3.c @@ -1,8 +1,7 @@ /* * @@name: teams.3 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.5 */ diff --git a/devices/sources/teams.3.f90 b/devices/sources/teams.3.f90 index 9ddeab5..bd761d8 100644 --- a/devices/sources/teams.3.f90 +++ b/devices/sources/teams.3.f90 @@ -1,7 +1,6 @@ ! @@name: teams.3 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_4.5 function dotprod(B,C,N) result(sum) diff --git a/devices/sources/teams.4.c b/devices/sources/teams.4.c index 47255c3..380ed6d 100644 --- a/devices/sources/teams.4.c +++ b/devices/sources/teams.4.c @@ -1,8 +1,7 @@ /* * @@name: teams.4 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ diff --git a/devices/sources/teams.4.f90 b/devices/sources/teams.4.f90 index 9807dc4..8325b6b 100644 --- a/devices/sources/teams.4.f90 +++ b/devices/sources/teams.4.f90 @@ -1,7 +1,6 @@ ! @@name: teams.4 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_4.0 module arrays diff --git a/devices/sources/teams.5.c b/devices/sources/teams.5.c index 2be677e..d03a9cc 100644 --- a/devices/sources/teams.5.c +++ b/devices/sources/teams.5.c @@ -1,8 +1,7 @@ /* * @@name: teams.5 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ diff --git a/devices/sources/teams.5.f90 b/devices/sources/teams.5.f90 index c6480d6..256be9c 100644 --- a/devices/sources/teams.5.f90 +++ b/devices/sources/teams.5.f90 @@ -1,7 +1,6 @@ ! @@name: teams.5 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_4.0 subroutine vec_mult(p, v1, v2, N) diff --git a/devices/sources/teams.6.c b/devices/sources/teams.6.c index 636e904..6c70a1b 100644 --- a/devices/sources/teams.6.c +++ b/devices/sources/teams.6.c @@ -1,8 +1,7 @@ /* * @@name: teams.6 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ diff --git a/devices/sources/teams.6.f90 b/devices/sources/teams.6.f90 index 3f61b01..9ead900 100644 --- a/devices/sources/teams.6.f90 +++ b/devices/sources/teams.6.f90 @@ -1,7 +1,6 @@ ! @@name: teams.6 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_4.0 subroutine vec_mult(p, v1, v2, N) diff --git a/devices/sources/virtual_functions.1.cpp b/devices/sources/virtual_functions.1.cpp index 7955315..5f06620 100644 --- a/devices/sources/virtual_functions.1.cpp +++ b/devices/sources/virtual_functions.1.cpp @@ -1,9 +1,8 @@ /* -* @@name: virtual_functions.1 -* @@type: C++ -* @@compilable: yes -* @@linkable: no -* @@expect: success +* @@name: virtual_functions.1 +* @@type: C++ +* @@operation: link +* @@expect: rt-error * @@version: omp_5.2 */ #include diff --git a/devices/target_defaultmap.tex b/devices/target_defaultmap.tex index e553d5c..b268c50 100644 --- a/devices/target_defaultmap.tex +++ b/devices/target_defaultmap.tex @@ -7,54 +7,53 @@ \index{defaultmap clause@\code{defaultmap} clause!implicit behavior} \index{defaultmap clause@\code{defaultmap} clause!variable category} -The implicitly-determined, data-mapping and data-sharing attribute +The implicitly determined data-mapping and data-sharing attribute rules of variables referenced in a \code{target} construct can be -changed by the \code{defaultmap} clause introduced in OpenMP 5.0. -The implicit behavior is specified as +changed by the \code{defaultmap} clause. +As of OpenMP 5.0, the implicit behavior is specified as \code{alloc}, \code{to}, \code{from}, \code{tofrom}, \code{firstprivate}, \code{none}, \code{default} or \code{present}, -and is applied to a variable-category, where -\code{scalar}, \code{aggregate}, \code{allocatable}, -and \code{pointer} are the variable categories. +and is optionally applied to a variable category specified as \code{scalar}, \code{aggregate}, \code{allocatable}, +or \code{pointer}. -In OpenMP, a ``category'' has a common data-mapping and data-sharing -behavior for variable types within the category. -In C/C++, \code{scalar} refers to base-language scalar variables, except pointers. -In Fortran it refers to a scalar variable, as defined by the base language, -with intrinsic type, and excludes character type. +A referenced variable that is in a specified ``category`` is treated as having +the specified implicit behavior. In C/C++, \code{scalar} refers to +base-language scalar variables, except pointers. In Fortran it refers to a +scalar variable, as defined by the base language, of intrinsic type but +excluding the character type. The \code{aggregate} category refers to arrays and +structures (which includes variables of any derived type and of character type for Fortran). Fortran +has the additional category of \code{allocatable} for variables that have the +allocatable attribute. The \code{pointer} category refers to pointers, which +for Fortran are variables that have the pointer attribute. -Also, \code{aggregate} refers to arrays and structures (C/C++) and -derived types (Fortran). Fortran has the additional category of \code{allocatable}. - -%In the example below, the first \code{target} construct uses \code{defaultmap} -%clauses to explicitly set data-mapping attributes that reproduce -%the default implicit mapping (data-mapping and data-sharing attributes). That is, -%if the \code{defaultmap} clauses were removed, the results would be identical. In the example below, the first \code{target} construct uses \code{defaultmap} clauses to set data-mapping and possibly data-sharing attributes that reproduce -the default implicit mapping (data-mapping and data-sharing attributes). That is, -if the \code{defaultmap} clauses were removed, the results would be identical. +the default rules for implicitly determined data-mapping and data-sharing +attributes for variables in the construct. That is, if the \code{defaultmap} +clauses were removed, the results would be identical. In the second \code{target} construct all implicit behavior is removed by specifying the \code{none} implicit behavior in the \code{defaultmap} clause. -Hence, all variables must be explicitly mapped. -In the C/C++ code a scalar (\texttt{s}), an array (\texttt{A}) and a structure -(\texttt{S}) are explicitly mapped \code{tofrom}. -The Fortran code uses a derived type (\texttt{D}) in lieu of structure. +Hence, all variables that don't have predetermined attributes must be given an +explicit data-mapping or data-sharing attribute. A scalar (\texttt{s}), an +array (\texttt{A}) and a structure (\texttt{S} for the C/C++ example and +\texttt{D} for the Fortran example) are explicitly mapped with the +\code{tofrom} map type. -The third \code{target} construct shows another usual case for using the \code{defaultmap} clause. -The default mapping for (non-pointer) scalar variables is specified as \code{tofrom}. -Here, the default implicit mapping for \texttt{s3} is \code{tofrom} as specified -in the \code{defaultmap} clause, and \texttt{s1} and \texttt{s2} are explicitly -mapped with the \code{firstprivate} data-sharing attribute. +The third \code{target} construct shows another usual case for using the +\code{defaultmap} clause. The default mapping for (non-pointer) scalar +variables is specified. Here, the default implicit mapping for \texttt{s3} is +\code{tofrom} as specified in the \code{defaultmap} clause, while \texttt{s1} +and \texttt{s2} are instead explicitly treated as \code{firstprivate}. -In the fourth \code{target} construct all arrays, structures (C/C++) and derived -types (Fortran) are mapped with \code{firstprivate} data-sharing behavior by a -\code{defaultmap} clause with an \code{aggregate} variable category. -For the \texttt{H} allocated array in the Fortran code, the \code{allocable} -category must be used in a separate \code{defaultmap} clause to acquire -\code{firsprivate} data-sharing behavior (\texttt{H} has the Fortran allocatable attribute). -% (Common use cases for C/C++ heap storage can be found in \specref{sec:pointer_mapping}.) +In the fourth \code{target} construct all arrays and structures are given +\code{firstprivate} implicit behavior by default with the use of the +\code{aggregate} variable category. For the Fortran example, the +\code{allocatable} category is used in a separate \code{defaultmap} clause to +specify default \code{firstprivate} implicit behavior for referenced +allocatable variables (in this case, \texttt{H}). +% (Common use cases for C/C++ heap storage can be found in +% \specref{sec:pointer_mapping}.) \cexample[5.0]{target_defaultmap}{1} diff --git a/devices/target_mapper.tex b/devices/target_mapper.tex index 8a1d802..e1dd9ef 100644 --- a/devices/target_mapper.tex +++ b/devices/target_mapper.tex @@ -61,9 +61,9 @@ Note, the \plc{is} and \plc{ie} scalars are firstprivate by default for a target region, but are declared firstprivate anyway to remind the user of important firstprivate data-sharing properties required here. -\cexample[5.1]{target_mapper}{2} +\cexample[5.0]{target_mapper}{2} -\ffreeexample[5.1]{target_mapper}{2} +\ffreeexample[5.0]{target_mapper}{2} %\pagebreak In the third example \plc{myvec} structures are diff --git a/devices/target_pointer_mapping.tex b/devices/target_pointer_mapping.tex index b0d9457..5bccfee 100644 --- a/devices/target_pointer_mapping.tex +++ b/devices/target_pointer_mapping.tex @@ -28,7 +28,7 @@ associated storage on the host. Storage for pointers \plc{ptr1} and \plc{ptr2} is created on the host. To map storage that is associated with a pointer on the host, the data can be explicitly mapped as an array section so that the compiler knows -the amount of data to be assigned in the device (to the "corresponding" data storage area). +the amount of data to be assigned in the device (to the ``corresponding'' data storage area). On the \code{target} construct array sections are mapped; however, the pointer \plc{ptr1} is mapped, while \plc{ptr2} is not. Since \plc{ptr2} is not explicitly mapped, it is firstprivate. This creates a subtle difference in the way these pointers can be used. diff --git a/directives/attributes.tex b/directives/attributes.tex index 757a00a..e57ea96 100644 --- a/directives/attributes.tex +++ b/directives/attributes.tex @@ -53,4 +53,4 @@ form of the \code{simd} directive is used for loops calling the \plc{Q} function in combination with the attribute form of the \code{declare}~\code{simd} directives declaring the variants for \plc{Q}. -\cppexample[5.0]{directive_syntax_attribute}{1} +\cppexample[5.1]{directive_syntax_attribute}{1} diff --git a/directives/sources/directive_syntax_F_block.1.f90 b/directives/sources/directive_syntax_F_block.1.f90 index db372fe..ab59310 100644 --- a/directives/sources/directive_syntax_F_block.1.f90 +++ b/directives/sources/directive_syntax_F_block.1.f90 @@ -1,9 +1,8 @@ -! @@name: directive_syntax_F_block.1 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_5.1 +! @@name: directive_syntax_F_block.1 +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: omp_5.1 program main use omp_lib diff --git a/directives/sources/directive_syntax_F_block.2.f90 b/directives/sources/directive_syntax_F_block.2.f90 index 6f32472..aec7068 100644 --- a/directives/sources/directive_syntax_F_block.2.f90 +++ b/directives/sources/directive_syntax_F_block.2.f90 @@ -1,9 +1,8 @@ -! @@name: directive_syntax_F_block.2 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_5.1 +! @@name: directive_syntax_F_block.2 +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: omp_5.1 program main use omp_lib diff --git a/directives/sources/directive_syntax_F_fixed_comment.1.f b/directives/sources/directive_syntax_F_fixed_comment.1.f index 8daf1a5..c561053 100644 --- a/directives/sources/directive_syntax_F_fixed_comment.1.f +++ b/directives/sources/directive_syntax_F_fixed_comment.1.f @@ -1,8 +1,8 @@ -! @@name: directive_syntax_F_fixed_comment.1 -! @@type: F-fixed -! @@compilable: yes -! @@linkable: yes -! @@expect: success +! @@name: directive_syntax_F_fixed_comment.1 +! @@type: F-fixed +! @@operation: run +! @@expect: success +! @@version: pre_omp_3.0 program main include 'omp_lib.h' integer NT diff --git a/directives/sources/directive_syntax_F_free_comment.1.f90 b/directives/sources/directive_syntax_F_free_comment.1.f90 index 6c8cf71..54b77c8 100644 --- a/directives/sources/directive_syntax_F_free_comment.1.f90 +++ b/directives/sources/directive_syntax_F_free_comment.1.f90 @@ -1,8 +1,8 @@ -! @@name: directive_syntax_F_free_comment.1 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success +! @@name: directive_syntax_F_free_comment.1 +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: pre_omp_3.0 program main use omp_lib integer,parameter :: NT = 4 diff --git a/directives/sources/directive_syntax_attribute.1.cpp b/directives/sources/directive_syntax_attribute.1.cpp index 855e631..cabb38e 100644 --- a/directives/sources/directive_syntax_attribute.1.cpp +++ b/directives/sources/directive_syntax_attribute.1.cpp @@ -1,10 +1,9 @@ /* -* @@name: directive_syntax_attribute.1 -* @@type: C++ -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.0 +* @@name: directive_syntax_attribute.1 +* @@type: C++ +* @@operation: run +* @@expect: success +* @@version: omp_5.1 */ #include #include @@ -80,4 +79,3 @@ int main() { // repeated 3 time: // OUTPUT: 656700.000000 - diff --git a/directives/sources/directive_syntax_pragma.1.c b/directives/sources/directive_syntax_pragma.1.c index f554a4a..7b37bf7 100644 --- a/directives/sources/directive_syntax_pragma.1.c +++ b/directives/sources/directive_syntax_pragma.1.c @@ -1,9 +1,9 @@ /* -* @@name: directive_syntax_pragma.1 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success +* @@name: directive_syntax_pragma.1 +* @@type: C +* @@operation: run +* @@expect: success +* @@version: pre_omp_3.0 */ #include #include diff --git a/introduction/Examples.tex b/introduction/Examples.tex index df393c1..724259a 100644 --- a/introduction/Examples.tex +++ b/introduction/Examples.tex @@ -7,8 +7,8 @@ This document includes examples of the OpenMP API directives, constructs, and routines. -Each example is labeled as \plc{ename.seqno.ext}, where \plc{ename} is -the example name, \plc{seqno} is the sequence number in a section, and +Each example is labeled with \plc{ename.seq-id.ext}, where \plc{ename} is +the example name, \plc{seq-id} is the sequence identifier in a section, and \plc{ext} is the source file extension to indicate the code type and source form. \plc{ext} is one of the following: \begin{description}[noitemsep,labelindent=5mm,widest=f90] @@ -18,12 +18,22 @@ source form. \plc{ext} is one of the following: \item[\plc{f90}] -- \ Fortran code in free form. \end{description} -Some of the example labels may include version information -(\code{\small{}omp\_\plc{verno}}) to indicate features that are illustrated -by an example for a specific OpenMP version, such as ``\plc{scan.1.c} -\;(\code{\small{}omp\_5.0}).'' +Example labels include version information of the form +\verlabel{\plc{verno}} to indicate features that are illustrated +by an example for a specific OpenMP version, such as +``\plc{scan.1.c} \;\verlabel{5.0}.'' +Some of the example labels include version information of the form +\verlabel[pre\_]{3.0} to indicate features that are specified +prior to OpenMP version 3.0, such as +``\plc{ploop.1.c} \;\verlabel[pre\_]{3.0}.'' +Language markers may be used to indicate text or codes that are specific +to a particular base language. \ccppspecificstart +This is C/C++ specific: A statement following a directive is compound only when necessary, and a non-compound statement is indented with respect to a directive preceding it. \ccppspecificend +\fortranspecificstart +This is Fortran specific... +\fortranspecificend diff --git a/loop_transformations/sources/partial_tile.1.c b/loop_transformations/sources/partial_tile.1.c index 4ffa3c0..c383110 100644 --- a/loop_transformations/sources/partial_tile.1.c +++ b/loop_transformations/sources/partial_tile.1.c @@ -1,10 +1,9 @@ /* -* @@name: partial_tile.1 -* @@type: C -* @@compilable: yes -* @@linkable: no -* @@expect: success -* @@version: omp_5.1 +* @@name: partial_tile.1 +* @@type: C +* @@operation: compile +* @@expect: success +* @@version: omp_5.1 */ int min(int a, int b){ return (a < b)? a : b; } diff --git a/loop_transformations/sources/partial_tile.1.f90 b/loop_transformations/sources/partial_tile.1.f90 index c7ab427..d471797 100644 --- a/loop_transformations/sources/partial_tile.1.f90 +++ b/loop_transformations/sources/partial_tile.1.f90 @@ -1,10 +1,8 @@ -! @@name: partial_tile.1 -! @@type: F-free -! @@compilable: yes -! @@linkable: no -! @@expect: success -! @@version: omp_5.1 - +! @@name: partial_tile.1 +! @@type: F-free +! @@operation: compile +! @@expect: success +! @@version: omp_5.1 subroutine func1(A) implicit none double precision :: A(100,100) diff --git a/loop_transformations/sources/partial_tile.2.c b/loop_transformations/sources/partial_tile.2.c index e52888a..fbdf627 100644 --- a/loop_transformations/sources/partial_tile.2.c +++ b/loop_transformations/sources/partial_tile.2.c @@ -1,8 +1,7 @@ /* * @@name: partial_tile.2 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_5.1 */ diff --git a/loop_transformations/sources/partial_tile.2.f90 b/loop_transformations/sources/partial_tile.2.f90 index 8591fae..6f14207 100644 --- a/loop_transformations/sources/partial_tile.2.f90 +++ b/loop_transformations/sources/partial_tile.2.f90 @@ -1,10 +1,8 @@ -! @@name: partial_tile.2 -! @@type: F-free -! @@compilable: yes -! @@linkable: no -! @@expect: success -! @@version: omp_5.1 - +! @@name: partial_tile.2 +! @@type: F-free +! @@operation: compile +! @@expect: success +! @@version: omp_5.1 subroutine func7(A) implicit none double precision :: A(100,100) diff --git a/loop_transformations/sources/tile.1.c b/loop_transformations/sources/tile.1.c index 1727b57..7932e3b 100644 --- a/loop_transformations/sources/tile.1.c +++ b/loop_transformations/sources/tile.1.c @@ -1,10 +1,9 @@ /* -* @@name: tile.1 -* @@type: C -* @@compilable: yes -* @@linkable: no -* @@expect: success -* @@version: omp_5.1 +* @@name: tile.1 +* @@type: C +* @@operation: compile +* @@expect: success +* @@version: omp_5.1 */ void func1(int A[100][128]) { diff --git a/loop_transformations/sources/tile.1.f90 b/loop_transformations/sources/tile.1.f90 index 7e3f715..8d3817a 100644 --- a/loop_transformations/sources/tile.1.f90 +++ b/loop_transformations/sources/tile.1.f90 @@ -1,10 +1,8 @@ -! @@name: tile.1 -! @@type: F-free -! @@compilable: yes -! @@linkable: no -! @@expect: success -! @@version: omp_5.1 - +! @@name: tile.1 +! @@type: F-free +! @@operation: compile +! @@expect: success +! @@version: omp_5.1 subroutine func1(A) integer :: A(128,100) integer :: i, j diff --git a/loop_transformations/sources/tile.2.c b/loop_transformations/sources/tile.2.c index f2b81d4..d804c4e 100644 --- a/loop_transformations/sources/tile.2.c +++ b/loop_transformations/sources/tile.2.c @@ -1,10 +1,9 @@ /* -* @@name: tile.2 -* @@type: C -* @@compilable: yes -* @@linkable: no -* @@expect: success -* @@version: omp_5.1 +* @@name: tile.2 +* @@type: C +* @@operation: compile +* @@expect: success +* @@version: omp_5.1 */ void func1(int A[100][128]) { diff --git a/loop_transformations/sources/tile.2.f90 b/loop_transformations/sources/tile.2.f90 index 75e99e4..268ed14 100644 --- a/loop_transformations/sources/tile.2.f90 +++ b/loop_transformations/sources/tile.2.f90 @@ -1,10 +1,8 @@ -! @@name: tile.2 -! @@type: F-free -! @@compilable: yes -! @@linkable: no -! @@expect: success -! @@version: omp_5.1 - +! @@name: tile.2 +! @@type: F-free +! @@operation: compile +! @@expect: success +! @@version: omp_5.1 subroutine func1(A) integer :: A(128,100) integer :: i, j diff --git a/loop_transformations/sources/unroll.1.c b/loop_transformations/sources/unroll.1.c index c92d64a..7d50e83 100644 --- a/loop_transformations/sources/unroll.1.c +++ b/loop_transformations/sources/unroll.1.c @@ -1,10 +1,9 @@ /* * @@name: unroll.1 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success -* @@version: omp_5.1 +* @@version: omp_5.1 */ void unroll(double A[], int n) { @@ -27,4 +26,3 @@ void unroll_full_equivalent(double A[]) A[2] = 0; A[3] = 0; } - diff --git a/loop_transformations/sources/unroll.1.f90 b/loop_transformations/sources/unroll.1.f90 index 786b079..f8733c6 100644 --- a/loop_transformations/sources/unroll.1.f90 +++ b/loop_transformations/sources/unroll.1.f90 @@ -1,9 +1,8 @@ -! @@name: unroll.1 -! @@type: F-free -! @@compilable: yes -! @@linkable: no -! @@expect: success -! @@version: omp_5.1 +! @@name: unroll.1 +! @@type: F-free +! @@operation: compile +! @@expect: success +! @@version: omp_5.1 subroutine unroll(A, n) implicit none integer :: i,n diff --git a/loop_transformations/sources/unroll.2.c b/loop_transformations/sources/unroll.2.c index 0a66469..3a4c592 100644 --- a/loop_transformations/sources/unroll.2.c +++ b/loop_transformations/sources/unroll.2.c @@ -1,10 +1,9 @@ /* * @@name: unroll.2 * @@type: C -* @@compilable: no -* @@linkable: no -* @@expect: success -* @@version: omp_5.1 +* @@operation: compile +* @@expect: ct-error +* @@version: omp_5.1 */ void illegal_2a(double A[]) { diff --git a/loop_transformations/sources/unroll.2.f90 b/loop_transformations/sources/unroll.2.f90 index 6d646e3..eafc1d2 100644 --- a/loop_transformations/sources/unroll.2.f90 +++ b/loop_transformations/sources/unroll.2.f90 @@ -1,9 +1,8 @@ -! @@name: unroll.2 -! @@type: F-free -! @@compilable: yes -! @@linkable: no -! @@expect: success -! @@version: omp_5.1 +! @@name: unroll.2 +! @@type: F-free +! @@operation: compile +! @@expect: ct-error +! @@version: omp_5.1 subroutine illegal_2a(A) implicit none double precision :: A(*) diff --git a/loop_transformations/sources/unroll.3.c b/loop_transformations/sources/unroll.3.c index 975747e..b5c797e 100644 --- a/loop_transformations/sources/unroll.3.c +++ b/loop_transformations/sources/unroll.3.c @@ -1,10 +1,9 @@ /* * @@name: unroll.3 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success -* @@version: omp_5.1 +* @@version: omp_5.1 */ void unroll3_partial(double A[]) { diff --git a/loop_transformations/sources/unroll.3.f90 b/loop_transformations/sources/unroll.3.f90 index 71b2c2f..e7b56a2 100644 --- a/loop_transformations/sources/unroll.3.f90 +++ b/loop_transformations/sources/unroll.3.f90 @@ -1,9 +1,8 @@ -! @@name: unroll.3 -! @@type: F-free -! @@compilable: yes -! @@linkable: no -! @@expect: success -! @@version: omp_5.1 +! @@name: unroll.3 +! @@type: F-free +! @@operation: compile +! @@expect: success +! @@version: omp_5.1 subroutine unroll3_partial(A) implicit none double precision :: A(*) diff --git a/loop_transformations/sources/unroll.4.c b/loop_transformations/sources/unroll.4.c index 07ac604..79ab0e8 100644 --- a/loop_transformations/sources/unroll.4.c +++ b/loop_transformations/sources/unroll.4.c @@ -1,10 +1,9 @@ /* * @@name: unroll.4 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: run * @@expect: success -* @@version: omp_5.1 +* @@version: omp_5.1 */ void unroll_partial_remainder(int n, int A[]) { diff --git a/loop_transformations/sources/unroll.4.f90 b/loop_transformations/sources/unroll.4.f90 index e64fcc3..288893d 100644 --- a/loop_transformations/sources/unroll.4.f90 +++ b/loop_transformations/sources/unroll.4.f90 @@ -1,9 +1,8 @@ -! @@name: unroll.4 -! @@type: F-free -! @@compilable: yes -! @@linkable: no -! @@expect: success -! @@version: omp_5.1 +! @@name: unroll.4 +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: omp_5.1 subroutine unroll_partial_remainder(n, A) implicit none integer :: n, i diff --git a/loop_transformations/unroll.tex b/loop_transformations/unroll.tex index e63f17e..fbc67fe 100644 --- a/loop_transformations/unroll.tex +++ b/loop_transformations/unroll.tex @@ -63,7 +63,7 @@ In the latter case the construct generates a loop with a single iteration. When the iteration count is not a multiple of the \plc{unroll-factor}, iterations that should not produce executions must be conditionally protected from execution. In this example, the first function -unrolls a loop that has a variable iteraction count. Since the \code{unroll} +unrolls a loop that has a variable iteration count. Since the \code{unroll} construct uses a \code{partial(}~\plc{4}~\code{)} clause, the compiler will need to create code that can account for cases when the iteration count is not a multiple of 4. A brute-force, simple-to-understand approach for implementing diff --git a/memory_model/allocators.tex b/memory_model/allocators.tex index d1cfdda..579bab5 100644 --- a/memory_model/allocators.tex +++ b/memory_model/allocators.tex @@ -137,3 +137,51 @@ and \scode{omp_get_default_allocator} API routines. \cexample[5.1]{allocators}{4} \ffreeexample[5.1]{allocators}{4} + +\pagebreak +\index{uses_allocators clause@\scode{uses_allocators} clause} +\index{clauses!uses_allocators@\scode{uses_allocators}} + +The use of allocators in \scode{target} regions is facilitated by the +\scode{uses_allocators} clause as shown in the cases below. + +In CASE 1, the predefined \scode{omp_cgroup_mem_alloc} allocator is made available on the +device in the first \scode{target} construct as specified in the \scode{uses_allocators} clause. +The allocator is then used in the \scode{allocate} +clause of the \scode{teams} construct to allocate a private array for each +team (contention group). The private \splc{xbuf} arrays that are filled by each +team are reduced as specified in the \scode{reduction} clause on the \scode{teams} construct. + +In CASE 2, user-defined traits are specified in the \splc{cgroup_traits} variable. +An allocator is initialized for the \scode{target} region in the \scode{uses_allocators} clause, +and the traits specified in \splc{cgroup_traits} are included by the \scode{traits} modifier. + +As shown above, the \scode{uses_allocators} clause creates a new allocator for the +\scode{target} region, and uses only traits specified in the clause with a modifier. +In CASE 3, the \splc{cgroup_alloc} variable is initialized on the host with traits +and a memory space. However, these are ignored by the \scode{uses_allocators} clause, +because a new allocator is initialized, and has no traits specified within the clause. + +\cexample[5.2]{allocators}{5} +\ffreeexample[5.2]{allocators}{5} + +The following example shows how to make an allocator, defined on the host, available in a \scode{target} region. + +When the \scode{requires} directive is specified with a \scode{dynamic_allocators} +clause, allocators initialized on the host can be used in a \scode{target} region +without specifying a \scode{uses_allocators} clause. This applies to predefined +allocators and user-defined allocators. + +In CASE 1, the predefined \scode{omp_cgroup_mem_alloc} allocator is used in the \scode{target} +region as in CASE 1 of the previous example, but without specifying a \scode{uses_allocators} clause. +This is accomplished by specifying the \scode{requires} directive with a +\scode{dynamic_allocators} clause in the same compilation unit, to remove +restrictions on allocator usage in \scode{target} regions. + +CASE 2 also uses the \scode{dynamic_allocators} clause to remove allocator +restrictions in the \scode{target} region. Here, an allocator initialized +on the host is used for target array allocations of an \scode{allocate} clause. + + +\cexample[5.2]{allocators}{6} +\ffreeexample[5.2]{allocators}{6} diff --git a/memory_model/sources/allocators.1.c b/memory_model/sources/allocators.1.c index e6c4b8f..a10782e 100644 --- a/memory_model/sources/allocators.1.c +++ b/memory_model/sources/allocators.1.c @@ -1,10 +1,9 @@ /* -* @@name: allocators.1 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.0 +* @@name: allocators.1 +* @@type: C +* @@operation: run +* @@expect: success +* @@version: omp_5.0 */ #include #include diff --git a/memory_model/sources/allocators.1.f90 b/memory_model/sources/allocators.1.f90 index cd01238..d65da47 100644 --- a/memory_model/sources/allocators.1.f90 +++ b/memory_model/sources/allocators.1.f90 @@ -1,9 +1,8 @@ -! @@name: allocators.1 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_5.2 +! @@name: allocators.1 +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: omp_5.2 program main use omp_lib @@ -48,4 +47,3 @@ program main call omp_destroy_allocator(xy_alloc) end program - diff --git a/memory_model/sources/allocators.2.f90 b/memory_model/sources/allocators.2.f90 index f3fe610..58a77e7 100644 --- a/memory_model/sources/allocators.2.f90 +++ b/memory_model/sources/allocators.2.f90 @@ -1,9 +1,8 @@ -! @@name: allocators.2 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_5.2 +! @@name: allocators.2 +! @@type: F-free +! @@operation: link +! @@expect: success +! @@version: omp_5.2 program main use omp_lib implicit none diff --git a/memory_model/sources/allocators.3.f90 b/memory_model/sources/allocators.3.f90 index f85b900..e937bf1 100644 --- a/memory_model/sources/allocators.3.f90 +++ b/memory_model/sources/allocators.3.f90 @@ -1,9 +1,8 @@ -! @@name: allocators.3 -! @@type: F-free -! @@compilable: yes -! @@linkable: no -! @@expect: failure -! @@version: omp_5.2 +! @@name: allocators.3 +! @@type: F-free +! @@operation: compile +! @@expect: ct-error +! @@version: omp_5.2 subroutine broken_auto_deallocation use omp_lib implicit none diff --git a/memory_model/sources/allocators.4.c b/memory_model/sources/allocators.4.c index 7001342..81d484a 100644 --- a/memory_model/sources/allocators.4.c +++ b/memory_model/sources/allocators.4.c @@ -1,10 +1,9 @@ /* -* @@name: allocators.4 -* @@type: C -* @@compilable: yes -* @@linkable: no -* @@expect: success -* @@version: omp_5.1 +* @@name: allocators.4 +* @@type: C +* @@operation: compile +* @@expect: success +* @@version: omp_5.1 */ #include #include diff --git a/memory_model/sources/allocators.4.f90 b/memory_model/sources/allocators.4.f90 index 48ac7fa..b4ecf19 100644 --- a/memory_model/sources/allocators.4.f90 +++ b/memory_model/sources/allocators.4.f90 @@ -1,9 +1,8 @@ -! @@name: allocators.4 -! @@type: F-free -! @@compilable: yes -! @@linkable: no -! @@expect: success -! @@version: omp_5.1 +! @@name: allocators.4 +! @@type: F-free +! @@operation: compile +! @@expect: success +! @@version: omp_5.1 subroutine test_allocate use omp_lib diff --git a/memory_model/sources/allocators.5.c b/memory_model/sources/allocators.5.c new file mode 100644 index 0000000..7f3f5c6 --- /dev/null +++ b/memory_model/sources/allocators.5.c @@ -0,0 +1,97 @@ +/* +* @@name: allocators.5 +* @@type: C +* @@operation: run +* @@expect: success +* @@version: omp_5.2 +*/ +#include +#include + +int calc(int i, int j) { return i * j;} +#pragma omp declare target(calc) + +int main() +{ + #define N 256 + int sum; + int xbuf[N]; + + omp_allocator_handle_t cgroup_alloc; + const omp_alloctrait_t cgroup_traits[1]= + {{omp_atk_access,omp_atv_cgroup}}; + + for (int i = 0; i < N; i++) { xbuf[i] = 0; } + +/*** CASE 1: USING ALLOCATE DIRECTIVE ***/ + // uses predefined allocator omp_cgroup_mem_alloc + #pragma omp target uses_allocators(omp_cgroup_mem_alloc) + #pragma omp teams reduction(+:xbuf) thread_limit(N) \ + allocate(omp_cgroup_mem_alloc:xbuf) num_teams(4) + { + #pragma omp parallel for + for (int i = 0; i < N; i++) { + xbuf[i] += calc(i,omp_get_team_num()); + } + } + + sum = 0; + #pragma omp parallel for reduction(+:sum) + for (int i = 0; i < N; i++) { + sum += xbuf[i]; + } + if(sum == 3*(N-1)*N) printf("PASSED 1 of 3\n"); + +/*** CASE 2: ***/ + + for (int i = 0; i < N; i++) { xbuf[i] = 0; } + + cgroup_alloc = omp_null_allocator; + + // uses custom allocator with specified traits + #pragma omp target uses_allocators(traits(cgroup_traits): cgroup_alloc) + #pragma omp teams reduction(+:xbuf) thread_limit(N) \ + allocate(cgroup_alloc:xbuf) num_teams(4) + { + #pragma omp parallel for + for (int i = 0; i < N; i++) { + xbuf[i] += calc(i,omp_get_team_num()); + } + } + + sum = 0; + #pragma omp parallel for reduction(+:sum) + for (int i = 0; i < N; i++) { + sum += xbuf[i]; + } + if(sum == 3*(N-1)*N) printf("PASSED 2 of 3\n"); + + +/*** CASE 3: ***/ + + for (int i = 0; i < N; i++) { xbuf[i] = 0; } + + cgroup_alloc = omp_init_allocator( + omp_default_mem_space, 1, cgroup_traits); + + // WARNING: uses custom allocator but with DEFAULT traits + #pragma omp target uses_allocators(cgroup_alloc) + #pragma omp teams reduction(+:xbuf) thread_limit(N) \ + allocate(cgroup_alloc:xbuf) num_teams(4) + { + #pragma omp parallel for + for (int i = 0; i < N; i++) { + xbuf[i] += calc(i,omp_get_team_num()); + } + } + omp_destroy_allocator(cgroup_alloc); + + sum = 0; + #pragma omp parallel for reduction(+:sum) + for (int i = 0; i < N; i++) { + sum += xbuf[i]; + } + if(sum == 3*(N-1)*N) printf("PASSED 3 of 3\n"); + + return 0; +} diff --git a/memory_model/sources/allocators.5.f90 b/memory_model/sources/allocators.5.f90 new file mode 100644 index 0000000..ef7424e --- /dev/null +++ b/memory_model/sources/allocators.5.f90 @@ -0,0 +1,110 @@ +! @@name: allocators.5 +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: omp_5.2 +module functions +contains + function calc(i,j) result(ii) + implicit none + integer :: i,j,ii + !$omp declare target(calc) + + ii = i*j + end function +end module + +program main + + use omp_lib + use functions + implicit none + integer, parameter :: N=256 + integer :: sum, i + integer :: xbuf(N) + + integer( omp_allocator_handle_kind ) :: cgroup_alloc + type(omp_alloctrait),parameter :: cgroup_traits(1)= & + [omp_alloctrait(omp_atk_access,omp_atv_cgroup)] + + do i=1,N; xbuf(i)=0; end do + +!*** CASE 1: USING ALLOCATE DIRECTIVE ***! + + !! uses predefined allocator omp_cgroup_mem_alloc + + !$omp target uses_allocators(omp_cgroup_mem_alloc) + !$omp teams reduction(+:xbuf) thread_limit(N) & + !$omp& allocate(omp_cgroup_mem_alloc:xbuf) num_teams(4) + + !$omp parallel do + do i = 1,N + xbuf(i) = xbuf(i) + calc(i, omp_get_team_num()) + enddo + + !$omp end teams + !$omp end target + + sum = 0 + !$omp parallel do reduction(+:sum) + do i = 1,N + sum = sum + xbuf(i) + enddo + if(sum == 3*(N+1)*N) print*, "PASSED 1 of 3" + +!*** CASE 2: ***! + + do i=1,N; xbuf(i)=0; end do + + cgroup_alloc = omp_null_allocator + + !! uses custom allocator with specified traits + !$omp target uses_allocators(traits(cgroup_traits): cgroup_alloc) + !$omp teams reduction(+:xbuf) thread_limit(N) & + !$omp& allocate(cgroup_alloc:xbuf) num_teams(4) + + !$omp parallel do + do i = 1,N + xbuf(i) = xbuf(i) + calc(i,omp_get_team_num()) + enddo + + !$omp end teams + !$omp end target + + sum = 0 + !$omp parallel do reduction(+:sum) + do i = 1,N + sum = sum + xbuf(i) + enddo + if(sum == 3*(N+1)*N) print*, "PASSED 2 of 3" + +!*** CASE 3: ***! + + do i=1,N; xbuf(i)=0; end do + + cgroup_alloc = omp_init_allocator(omp_default_mem_space, 1, & + cgroup_traits) + + !! WARNING: uses custom allocator but with DEFAULT traits + !$omp target uses_allocators(cgroup_alloc) + !$omp teams reduction(+:xbuf) thread_limit(N) & + !$omp& allocate(cgroup_alloc:xbuf) num_teams(4) + + !$omp parallel do + do i = 1,N + xbuf(i) = xbuf(i) + calc(i,omp_get_team_num()) + enddo + + !$omp end teams + !$omp end target + + call omp_destroy_allocator(cgroup_alloc) + + sum = 0 + !$omp parallel do reduction(+:sum) + do i = 1,N + sum = sum + xbuf(i) + enddo + if(sum == 3*(N+1)*N) print*, "PASSED 3 of 3" + +end program main diff --git a/memory_model/sources/allocators.6.c b/memory_model/sources/allocators.6.c new file mode 100644 index 0000000..fb1b8fb --- /dev/null +++ b/memory_model/sources/allocators.6.c @@ -0,0 +1,76 @@ +/* +* @@name: allocators.6 +* @@type: C +* @@operation: run +* @@expect: success +* @@version: omp_5.2 +*/ +#include +#include + +#pragma omp requires dynamic_allocators + +int calc(int i, int j) { return i*j;} +#pragma omp declare target(calc) + + +int main() +{ + #define N 256 + int sum; + int xbuf[N]; + + omp_allocator_handle_t cgroup_alloc; + const omp_alloctrait_t cgroup_traits[1] = + {{omp_atk_access, omp_atv_cgroup}}; + +/*** CASE 1: ***/ + + for (int i = 0; i < N; i++) { xbuf[i] = 0;} + + // uses predefined allocator, no need to declare it in uses_allocators + #pragma omp target teams reduction(+:xbuf) thread_limit(N) \ + allocate(omp_cgroup_mem_alloc:xbuf) num_teams(4) + { + #pragma omp parallel for + for (int i = 0; i < N; i++) { + xbuf[i] += calc(i,omp_get_team_num()); + } + } + + sum = 0; + #pragma omp parallel for reduction(+:sum) + for (int i = 0; i < N; i++) { + sum += xbuf[i]; + } + if(sum == 3*(N-1)*N) printf("PASSED 1 of 2\n"); + + +/*** CASE 2: ***/ + + for (int i = 0; i < N; i++) { xbuf[i] = 0; } + + cgroup_alloc = omp_init_allocator( + omp_default_mem_space, 1, cgroup_traits); + + // WARNING: cgroup_alloc is in undefined state on target device! + #pragma omp target teams reduction(+:xbuf) thread_limit(N) \ + allocate(cgroup_alloc:xbuf) num_teams(4) + { + #pragma omp parallel for + for (int i = 0; i < N; i++) { + xbuf[i] += calc(i,omp_get_team_num()); + } + } + + omp_destroy_allocator(cgroup_alloc); + + sum = 0; + #pragma omp parallel for reduction(+:sum) + for (int i = 0; i < N; i++) { + sum += xbuf[i]; + } + if(sum == 3*(N-1)*N) printf("PASSED 2 of 2\n"); + + return 0; +} diff --git a/memory_model/sources/allocators.6.f90 b/memory_model/sources/allocators.6.f90 new file mode 100644 index 0000000..ae74189 --- /dev/null +++ b/memory_model/sources/allocators.6.f90 @@ -0,0 +1,81 @@ +! @@name: allocators.6 +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: omp_5.2 +module functions +contains + function calc(i,j) result(ii) + implicit none + integer :: i,j,ii + !$omp declare target(calc) + + ii = i*j + end function +end module + +program main + + use omp_lib + use functions + implicit none + integer, parameter :: N=256 + integer :: sum, i + integer :: xbuf(N) + + !$omp requires dynamic_allocators + + integer( omp_allocator_handle_kind ) :: cgroup_alloc + type(omp_alloctrait),parameter :: cgroup_traits(1)= & + [omp_alloctrait(omp_atk_access,omp_atv_cgroup)] + +!*** CASE 1: ***! + + do i=1,N; xbuf(i)=0; end do + + !! uses predefined allocator, no need to declare it in uses_allocators + !$omp target teams reduction(+:xbuf) thread_limit(N) & + !$omp& allocate(omp_cgroup_mem_alloc:xbuf) num_teams(4) + + !$omp parallel do + do i = 1,N + xbuf(i) = xbuf(i) + calc(i,omp_get_team_num()) + enddo + + !$omp end target teams + + sum = 0 + !$omp parallel do reduction(+:sum) + do i = 1,N + sum = sum + xbuf(i) + enddo + if(sum == 3*(N+1)*N) print*, "PASSED 1 of 2" + +!*** CASE 2: ***! + + do i=1,N; xbuf(i)=0; end do + + cgroup_alloc = omp_init_allocator(omp_default_mem_space, 1, & + cgroup_traits) + + !! WARNING: cgroup_alloc is in undefined state on target device! + !$omp target teams reduction(+:xbuf) thread_limit(N) & + !$omp& allocate(cgroup_alloc:xbuf) num_teams(4) + + !$omp parallel do + do i = 1,N + xbuf(i) = xbuf(i) + calc(i,omp_get_team_num()) + enddo + + !$omp end target teams + + call omp_destroy_allocator(cgroup_alloc) + + sum = 0 + !$omp parallel do reduction(+:sum) + do i = 1,N + sum = sum + xbuf(i) + enddo + if(sum == 3*(N+1)*N) print*, "PASSED 2 of 2" + +end program main diff --git a/memory_model/sources/fort_race.1.f90 b/memory_model/sources/fort_race.1.f90 index de69bd5..b5bf2c4 100644 --- a/memory_model/sources/fort_race.1.f90 +++ b/memory_model/sources/fort_race.1.f90 @@ -1,8 +1,8 @@ ! @@name: fort_race.1 ! @@type: F-free -! @@compilable: yes -! @@linkable: no -! @@expect: rt-error +! @@operation: compile +! @@expect: unspecified +! @@version: pre_omp_3.0 SUBROUTINE SHARED_RACE INCLUDE "omp_lib.h" ! or USE OMP_LIB diff --git a/memory_model/sources/mem_model.1.c b/memory_model/sources/mem_model.1.c index ff20f13..16fbe25 100644 --- a/memory_model/sources/mem_model.1.c +++ b/memory_model/sources/mem_model.1.c @@ -1,9 +1,8 @@ /* * @@name: mem_model.1 * @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: rt-error +* @@operation: run +* @@expect: success * @@version: omp_3.1 */ #include diff --git a/memory_model/sources/mem_model.1.f90 b/memory_model/sources/mem_model.1.f90 index 10d1194..dc23a42 100644 --- a/memory_model/sources/mem_model.1.f90 +++ b/memory_model/sources/mem_model.1.f90 @@ -1,8 +1,7 @@ ! @@name: mem_model.1 ! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: rt-error +! @@operation: run +! @@expect: success ! @@version: omp_3.1 PROGRAM MEMMODEL INCLUDE "omp_lib.h" ! or USE OMP_LIB diff --git a/memory_model/sources/mem_model.2.c b/memory_model/sources/mem_model.2.c index bc35df7..4faff93 100644 --- a/memory_model/sources/mem_model.2.c +++ b/memory_model/sources/mem_model.2.c @@ -1,9 +1,8 @@ /* * @@name: mem_model.2 * @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: rt-error +* @@operation: run +* @@expect: success * @@version: omp_3.1 */ #include diff --git a/memory_model/sources/mem_model.2.f b/memory_model/sources/mem_model.2.f index 1108d21..a10914f 100644 --- a/memory_model/sources/mem_model.2.f +++ b/memory_model/sources/mem_model.2.f @@ -1,8 +1,7 @@ ! @@name: mem_model.2 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: yes -! @@expect: rt-error +! @@operation: run +! @@expect: success ! @@version: omp_3.1 PROGRAM EXAMPLE INCLUDE "omp_lib.h" ! or USE OMP_LIB diff --git a/memory_model/sources/mem_model.3.c b/memory_model/sources/mem_model.3.c index 117ee56..a29a344 100644 --- a/memory_model/sources/mem_model.3.c +++ b/memory_model/sources/mem_model.3.c @@ -1,9 +1,8 @@ /* * @@name: mem_model.3 * @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: rt-error +* @@operation: run +* @@expect: unspecified * @@version: omp_3.1 */ #include @@ -30,12 +29,12 @@ int main() { int flag_val = 0; /* Loop until we see that flag reaches 1*/ - while(flag_val < 0) + while(flag_val < 1) { #pragma omp atomic read flag_val = flag; } - #pragma omp flush(data0) + #pragma omp flush /* data0 is 17 here */ printf("Thread 1 awoken (data0 = %d)\n", data0); data1 = 42; diff --git a/memory_model/sources/mem_model.3.f b/memory_model/sources/mem_model.3.f index 489a4a2..6fa6351 100644 --- a/memory_model/sources/mem_model.3.f +++ b/memory_model/sources/mem_model.3.f @@ -1,8 +1,7 @@ ! @@name: mem_model.3 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: yes -! @@expect: rt-error +! @@operation: run +! @@expect: unspecified ! @@version: omp_3.1 PROGRAM EXAMPLE INCLUDE "omp_lib.h" ! or USE OMP_LIB @@ -22,7 +21,6 @@ ELSE IF(OMP_GET_THREAD_NUM() .EQ. 1) THEN ! Loop until we see that FLAG reaches 1 -!$OMP FLUSH(FLAG, DATA) FLAG_VAL = 0 DO WHILE(FLAG_VAL .LT. 1) !$OMP ATOMIC READ diff --git a/memory_model/sources/mem_model.4a.c b/memory_model/sources/mem_model.4a.c index d5ae340..3dcb9d1 100644 --- a/memory_model/sources/mem_model.4a.c +++ b/memory_model/sources/mem_model.4a.c @@ -1,9 +1,8 @@ /* * @@name: mem_model.4a * @@type: C -* @@compilable: yes -* @@linkable: no -* @@expect: failure +* @@operation: compile +* @@expect: unspecified * @@version: omp_3.1 */ #include diff --git a/memory_model/sources/mem_model.4a.f90 b/memory_model/sources/mem_model.4a.f90 index 9659f70..01f33cf 100644 --- a/memory_model/sources/mem_model.4a.f90 +++ b/memory_model/sources/mem_model.4a.f90 @@ -1,8 +1,7 @@ ! @@name: mem_model.4a ! @@type: F-free -! @@compilable: yes -! @@linkable: no -! @@expect: failure +! @@operation: compile +! @@expect: unspecified ! @@version: omp_3.1 subroutine flush_incorrect use omp_lib diff --git a/memory_model/sources/mem_model.4b.c b/memory_model/sources/mem_model.4b.c index 74245ce..86a74d5 100644 --- a/memory_model/sources/mem_model.4b.c +++ b/memory_model/sources/mem_model.4b.c @@ -1,8 +1,7 @@ /* * @@name: mem_model.4b * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_3.1 */ diff --git a/memory_model/sources/mem_model.4b.f90 b/memory_model/sources/mem_model.4b.f90 index 75abf16..92d3e40 100644 --- a/memory_model/sources/mem_model.4b.f90 +++ b/memory_model/sources/mem_model.4b.f90 @@ -1,7 +1,6 @@ ! @@name: mem_model.4b ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_3.1 subroutine flush_correct diff --git a/ompt_interface/sources/ompt_start.1.c b/ompt_interface/sources/ompt_start.1.c index 60cd32e..b55c5dc 100644 --- a/ompt_interface/sources/ompt_start.1.c +++ b/ompt_interface/sources/ompt_start.1.c @@ -1,10 +1,9 @@ /* -* @@name: ompt_start.1 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.0 +* @@name: ompt_start.1 +* @@type: C +* @@operation: link +* @@expect: success +* @@version: omp_5.0 */ #include #include diff --git a/openmp-examples.tex b/openmp-examples.tex index ce5a64b..284ce18 100644 --- a/openmp-examples.tex +++ b/openmp-examples.tex @@ -47,10 +47,10 @@ \documentclass[10pt,letterpaper,twoside,makeidx,hidelinks]{scrreprt} % Text to appear in the footer on even-numbered pages: -\newcommand{\VER}{5.2} % Supported Spec Version -\newcommand{\PVER}{5.2} % Examples Document Version -\newcommand{\VERDATE}{April 2022} -\newcommand{\footerText}{OpenMP Examples Version \PVER{} - \VERDATE} +\newcommand{\VER}{5.2.1} % Examples Document Version +\newcommand{\PVER}{5.2} % Supported Spec Version +\newcommand{\VERDATE}{November 2022} +\newcommand{\footerText}{OpenMP Examples Version \VER{} - \VERDATE} % input a generated file with additional definitions \input{generated-include} diff --git a/openmp.sty b/openmp.sty index 05e52f7..26a281e 100644 --- a/openmp.sty +++ b/openmp.sty @@ -484,6 +484,7 @@ \DoReplace{#3}\egroup} \newcommand{\escstr}[1]{\myreplace{_}{\_}{#1}} +\newcommandx*\verlabel[2][1=]{(\code{\small{}#1omp\_#2})} \newcommand{\exampleheader}[6]{% \ifthenelse{ \equal{#1}{} }{ @@ -500,36 +501,42 @@ \cnt=#4 \ifthenelse{ \equal{#5}{0} }{}{\global\advance\cnt by #5} - \ifthenelse{ \equal{#6}{} }{ - \def\vername{} + \def\cverno{\ref{ex_vtag:\cname}} + \ifthenelse{ \equal{\cverno}{pre_3.0} }{\def\cverno{}}{} + \ifthenelse{ \equal{\cverno}{??} }{\def\cverno{#6}}{} + \def\stagcnt{\pageref{ex_vtag:\cname}} + \ifthenelse{ \equal{\cverno}{} }{ + \global\advance\cnt by 1 + \def\vername{\;\;\verlabel[pre\_]{3.0}} }{ \def\myver##1{\toolboxSplitAt{##1}{_}\lefttext\righttext \lefttext\toolboxIfElse{\ifx\righttext\undefined}% {\global\advance\cnt by 1}{\expandafter{\righttext}}} - \def\vername{\;\;(\code{\small{}omp\_\myver{#6}})} + \def\vername{\;\;\verlabel{\myver{\cverno}}} } + \def\fcnt{\the\cnt} +% \def\fcnt{\stagcnt} \noindent \hypertarget{ex:\cname}{\textit{Example \ename}}\vername - \def\fcnt{\the\cnt} %\vspace*{-3mm} \code{\VerbatimInput[numbers=left,numbersep=5ex,firstnumber=1,firstline=\fcnt,fontsize=\small]% {\chapdirname/sources/\cname}} } \newcommandx*\cnexample[4][1=,4=0]{% - \exampleheader{#2}{#3}{c}{8}{#4}{#1} + \exampleheader{#2}{#3}{c}{7}{#4}{#1} } \newcommandx*\cppnexample[4][1=,4=0]{% - \exampleheader{#2}{#3}{cpp}{8}{#4}{#1} + \exampleheader{#2}{#3}{cpp}{7}{#4}{#1} } \newcommandx*\fnexample[4][1=,4=0]{% - \exampleheader{#2}{#3}{f}{6}{#4}{#1} + \exampleheader{#2}{#3}{f}{5}{#4}{#1} } \newcommandx*\ffreenexample[4][1=,4=0]{% - \exampleheader{#2}{#3}{f90}{6}{#4}{#1} + \exampleheader{#2}{#3}{f90}{5}{#4}{#1} } \newcommandx*\srcnexample[5][1=,5=0]{% diff --git a/parallel_execution/nthrs_nesting.tex b/parallel_execution/nthrs_nesting.tex index 972f886..a1b5481 100644 --- a/parallel_execution/nthrs_nesting.tex +++ b/parallel_execution/nthrs_nesting.tex @@ -7,8 +7,8 @@ The following examples demonstrate how to use the \code{OMP\_NUM\_THREADS} environment variable to control the number of threads on multiple nesting levels: -\cexample{nthrs_nesting}{1} +\cexample{nthrs_nesting}{1}[1] -\fexample{nthrs_nesting}{1} +\fexample{nthrs_nesting}{1}[1] diff --git a/parallel_execution/order_clause.tex b/parallel_execution/order_clause.tex deleted file mode 100644 index 5b153b0..0000000 --- a/parallel_execution/order_clause.tex +++ /dev/null @@ -1,37 +0,0 @@ -\pagebreak -\section{Controlling Concurrency and Reproducibility with the \code{order} Clause} -\label{sec:order_clause} - -The \code{order} clause is used for controlling the parallel execution of loop -iterations for one or more loops that are associated with a directive. It is -specified with a clause argument and optional modifier. The only supported -argument as of OpenMP 5.2 is the keyword \code{concurrent} which indicates that -the loop iterations may execute concurrently, including iterations in the same -chunk per the loop schedule. Because of the relaxed execution permitted with an -\code{order(concurrent)} clause, codes must not assume that any cross-iteration -data dependences would be preserved or that any two iterations may execute on -the same thread. - -The first example in this section demonstrates the use of the -\code{order(concurrent)} clause, without any modifiers, for controlling the -parallel execution of loop iterations. - -\cexample[5.1]{order}{1} - -\fexample[5.1]{order}{1} - -Modifiers to the \code{order} clause may be specified to control the -reproducibility of the loop schedule for the associated loop(s). A reproducible -loop schedule will consistently yield the same mapping of iterations to threads -(or SIMD lanes) if the directive name, loop schedule, iteration space, and -binding region remain the same. The \code{reproducible} modifier indicates the -loop schedule must be reproducible, while the \code{unconstrained} modifier -indicates that the loop schedule is not reproducible. - -The next example demonstrates the use of the \code{order(concurrent)} clause -with modifiers for additionally controlling the reproducibility of a loop's -schedule. - -\cexample[5.1]{order}{2} - -\fexample[5.1]{order}{2} diff --git a/parallel_execution/sources/collapse.1.c b/parallel_execution/sources/collapse.1.c index b0741eb..c0e5873 100644 --- a/parallel_execution/sources/collapse.1.c +++ b/parallel_execution/sources/collapse.1.c @@ -1,12 +1,10 @@ /* * @@name: collapse.1 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_3.0 */ - void bar(float *a, int i, int j, int k); int kl, ku, ks, jl, ju, js, il, iu,is; diff --git a/parallel_execution/sources/collapse.1.f b/parallel_execution/sources/collapse.1.f index f8ac7f2..4cceca3 100644 --- a/parallel_execution/sources/collapse.1.f +++ b/parallel_execution/sources/collapse.1.f @@ -1,10 +1,8 @@ ! @@name: collapse.1 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_3.0 - subroutine sub(a) real a(*) diff --git a/parallel_execution/sources/collapse.2.c b/parallel_execution/sources/collapse.2.c index 57e6ed2..9475edb 100644 --- a/parallel_execution/sources/collapse.2.c +++ b/parallel_execution/sources/collapse.2.c @@ -1,14 +1,12 @@ /* * @@name: collapse.2 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: run * @@expect: success * @@version: omp_3.0 */ - #include -void test() +int main() { int j, k, jlast, klast; #pragma omp parallel @@ -21,6 +19,6 @@ void test() klast=k; } #pragma omp single - printf("%d %d\n", klast, jlast); + printf("%d %d\n", klast, jlast); //2 3 } } diff --git a/parallel_execution/sources/collapse.2.f b/parallel_execution/sources/collapse.2.f index b0e7853..00c715e 100644 --- a/parallel_execution/sources/collapse.2.f +++ b/parallel_execution/sources/collapse.2.f @@ -1,10 +1,8 @@ ! @@name: collapse.2 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: yes +! @@operation: run ! @@expect: success ! @@version: omp_3.0 - program test !$omp parallel !$omp do private(j,k) collapse(2) lastprivate(jlast, klast) @@ -16,7 +14,7 @@ enddo !$omp end do !$omp single - print *, klast, jlast + print *, klast, jlast !2, 3 !$omp end single !$omp end parallel end program test diff --git a/parallel_execution/sources/collapse.3.c b/parallel_execution/sources/collapse.3.c index 1d005b4..1bea25f 100644 --- a/parallel_execution/sources/collapse.3.c +++ b/parallel_execution/sources/collapse.3.c @@ -1,8 +1,7 @@ /* * @@name: collapse.3 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_3.0 */ @@ -11,7 +10,7 @@ void work(int a, int j, int k); void sub() { - int j, k, a; + int j, k, a = 5; #pragma omp parallel num_threads(2) { #pragma omp for collapse(2) ordered private(j,k) schedule(static,3) diff --git a/parallel_execution/sources/collapse.3.f b/parallel_execution/sources/collapse.3.f index 970ba6c..43615d4 100644 --- a/parallel_execution/sources/collapse.3.f +++ b/parallel_execution/sources/collapse.3.f @@ -1,7 +1,6 @@ ! @@name: collapse.3 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_3.0 program test diff --git a/parallel_execution/sources/collapse.4.c b/parallel_execution/sources/collapse.4.c index e25134b..593bf9f 100644 --- a/parallel_execution/sources/collapse.4.c +++ b/parallel_execution/sources/collapse.4.c @@ -1,8 +1,7 @@ /* * @@name: collapse.4 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_5.0 */ diff --git a/parallel_execution/sources/collapse.4.f90 b/parallel_execution/sources/collapse.4.f90 index 9595067..148b665 100644 --- a/parallel_execution/sources/collapse.4.f90 +++ b/parallel_execution/sources/collapse.4.f90 @@ -1,7 +1,6 @@ ! @@name: collapse.4 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_5.0 module calc_m diff --git a/parallel_execution/sources/fort_do.1.f b/parallel_execution/sources/fort_do.1.f index c0c03ca..6c22f24 100644 --- a/parallel_execution/sources/fort_do.1.f +++ b/parallel_execution/sources/fort_do.1.f @@ -1,8 +1,8 @@ ! @@name: fort_do.1 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success +! @@version: pre_omp_3.0 SUBROUTINE WORK(I, J) INTEGER I,J END SUBROUTINE WORK diff --git a/parallel_execution/sources/fort_do.2.f b/parallel_execution/sources/fort_do.2.f index 5bd2549..172ff19 100644 --- a/parallel_execution/sources/fort_do.2.f +++ b/parallel_execution/sources/fort_do.2.f @@ -1,8 +1,8 @@ ! @@name: fort_do.2 ! @@type: F-fixed -! @@compilable: no -! @@linkable: no -! @@expect: failure +! @@operation: compile +! @@expect: ct-error +! @@version: pre_omp_3.0 SUBROUTINE WORK(I, J) INTEGER I,J END SUBROUTINE WORK diff --git a/parallel_execution/sources/fpriv_sections.1.c b/parallel_execution/sources/fpriv_sections.1.c index 613d944..73db390 100644 --- a/parallel_execution/sources/fpriv_sections.1.c +++ b/parallel_execution/sources/fpriv_sections.1.c @@ -1,9 +1,9 @@ /* * @@name: fpriv_sections.1 * @@type: C -* @@compilable: yes -* @@linkable: yes +* @@operation: run * @@expect: success +* @@version: pre_omp_3.0 */ #include #include diff --git a/parallel_execution/sources/fpriv_sections.1.f90 b/parallel_execution/sources/fpriv_sections.1.f90 index 1417797..6aa0e3f 100644 --- a/parallel_execution/sources/fpriv_sections.1.f90 +++ b/parallel_execution/sources/fpriv_sections.1.f90 @@ -1,8 +1,8 @@ ! @@name: fpriv_sections.1 ! @@type: F-free -! @@compilable: yes -! @@linkable: yes +! @@operation: run ! @@expect: success +! @@version: pre_omp_3.0 program section use omp_lib integer :: section_count = 0 diff --git a/parallel_execution/sources/get_nthrs.1.c b/parallel_execution/sources/get_nthrs.1.c index d763de3..e91bc90 100644 --- a/parallel_execution/sources/get_nthrs.1.c +++ b/parallel_execution/sources/get_nthrs.1.c @@ -1,9 +1,9 @@ /* * @@name: get_nthrs.1 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: rt-error +* @@version: pre_omp_3.0 */ #include void work(int i); diff --git a/parallel_execution/sources/get_nthrs.1.f b/parallel_execution/sources/get_nthrs.1.f index 675ddf2..978dd6e 100644 --- a/parallel_execution/sources/get_nthrs.1.f +++ b/parallel_execution/sources/get_nthrs.1.f @@ -1,8 +1,8 @@ ! @@name: get_nthrs.1 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: rt-error +! @@version: pre_omp_3.0 SUBROUTINE WORK(I) INTEGER I I = I + 1 diff --git a/parallel_execution/sources/get_nthrs.2.c b/parallel_execution/sources/get_nthrs.2.c index 710a813..d548ce2 100644 --- a/parallel_execution/sources/get_nthrs.2.c +++ b/parallel_execution/sources/get_nthrs.2.c @@ -1,9 +1,9 @@ /* * @@name: get_nthrs.2 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success +* @@version: pre_omp_3.0 */ #include void work(int i); diff --git a/parallel_execution/sources/get_nthrs.2.f b/parallel_execution/sources/get_nthrs.2.f index ff1aa82..6b462ec 100644 --- a/parallel_execution/sources/get_nthrs.2.f +++ b/parallel_execution/sources/get_nthrs.2.f @@ -1,8 +1,8 @@ ! @@name: get_nthrs.2 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success +! @@version: pre_omp_3.0 SUBROUTINE WORK(I) INTEGER I diff --git a/parallel_execution/sources/host_teams.1.c b/parallel_execution/sources/host_teams.1.c index 23ca869..e7e40fe 100644 --- a/parallel_execution/sources/host_teams.1.c +++ b/parallel_execution/sources/host_teams.1.c @@ -1,10 +1,9 @@ /* -* @@name: host_teams.1 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.0 +* @@name: host_teams.1 +* @@type: C +* @@operation: run +* @@expect: success +* @@version: omp_5.0 */ #include #include diff --git a/parallel_execution/sources/host_teams.1.f90 b/parallel_execution/sources/host_teams.1.f90 index eb068b8..f956b61 100644 --- a/parallel_execution/sources/host_teams.1.f90 +++ b/parallel_execution/sources/host_teams.1.f90 @@ -1,10 +1,8 @@ -! @@name: host_teams.1 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_5.0 - +! @@name: host_teams.1 +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: omp_5.0 program main use omp_lib integer :: nteams_required=2, max_thrds, tm_id @@ -15,8 +13,8 @@ program main max_thrds = omp_get_num_procs()/nteams_required !! Create 2 teams, each team works in a different precision - !$omp teams num_teams(nteams_required) thread_limit(max_thrds) \ - private(tm_id) + !$omp teams num_teams(nteams_required) thread_limit(max_thrds) & + !$omp& private(tm_id) tm_id = omp_get_team_num() diff --git a/parallel_execution/sources/linear_in_loop.1.c b/parallel_execution/sources/linear_in_loop.1.c index 3875e47..c025693 100644 --- a/parallel_execution/sources/linear_in_loop.1.c +++ b/parallel_execution/sources/linear_in_loop.1.c @@ -1,8 +1,7 @@ /* * @@name: linear_in_loop.1 * @@type: C -* @@compilable: yes -* @@linkable: yes +* @@operation: run * @@expect: success * @@version: omp_4.5 */ diff --git a/parallel_execution/sources/linear_in_loop.1.f90 b/parallel_execution/sources/linear_in_loop.1.f90 index 92ebe9b..d23d3aa 100644 --- a/parallel_execution/sources/linear_in_loop.1.f90 +++ b/parallel_execution/sources/linear_in_loop.1.f90 @@ -1,9 +1,8 @@ ! @@name: linear_in_loop.1 ! @@type: F-free -! @@compilable: yes -! @@linkable: yes +! @@operation: run ! @@expect: success -! @@version: omp_4.5 +! @@version: omp_4.5 program linear_loop implicit none integer, parameter :: N = 100 diff --git a/parallel_execution/sources/loop.1.c b/parallel_execution/sources/loop.1.c index 4baffaf..33a562c 100644 --- a/parallel_execution/sources/loop.1.c +++ b/parallel_execution/sources/loop.1.c @@ -1,10 +1,9 @@ /* -* @@name: loop.1 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.0 +* @@name: loop.1 +* @@type: C +* @@operation: run +* @@expect: success +* @@version: omp_5.0 */ #include #define N 100 diff --git a/parallel_execution/sources/loop.1.f90 b/parallel_execution/sources/loop.1.f90 index 72c0ea8..cb6f067 100644 --- a/parallel_execution/sources/loop.1.f90 +++ b/parallel_execution/sources/loop.1.f90 @@ -1,16 +1,14 @@ -! @@name: loop.1 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_5.0 - +! @@name: loop.1 +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: omp_5.0 program main integer, parameter :: N=100 real :: x(N), y(N) real :: a = 2.0e0 - x=(/ (i,i=1,N) /); y=1.0e0 !! initialize + x=(/ (i,i=1,N) /); y=0.0e0 !! initialize !$omp parallel !$omp loop diff --git a/parallel_execution/sources/masked.1.c b/parallel_execution/sources/masked.1.c index 284cc7d..2894aa7 100644 --- a/parallel_execution/sources/masked.1.c +++ b/parallel_execution/sources/masked.1.c @@ -1,10 +1,9 @@ /* * @@name: masked.1 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success -* @@version: omp_5.1 +* @@version: omp_5.1 */ #include diff --git a/parallel_execution/sources/masked.1.f b/parallel_execution/sources/masked.1.f index 6af4ab2..b11e415 100644 --- a/parallel_execution/sources/masked.1.f +++ b/parallel_execution/sources/masked.1.f @@ -1,9 +1,8 @@ ! @@name: masked.1 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success -! @@version: omp_5.1 +! @@version: omp_5.1 SUBROUTINE MASKED_EXAMPLE( X, XOLD, N, TOL ) REAL X(*), XOLD(*), TOL INTEGER N diff --git a/parallel_execution/sources/nowait.1.c b/parallel_execution/sources/nowait.1.c index b715a74..fde9107 100644 --- a/parallel_execution/sources/nowait.1.c +++ b/parallel_execution/sources/nowait.1.c @@ -1,9 +1,9 @@ /* * @@name: nowait.1 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success +* @@version: pre_omp_3.0 */ #include diff --git a/parallel_execution/sources/nowait.1.f b/parallel_execution/sources/nowait.1.f index f5beab0..63876a1 100644 --- a/parallel_execution/sources/nowait.1.f +++ b/parallel_execution/sources/nowait.1.f @@ -1,8 +1,8 @@ ! @@name: nowait.1 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success +! @@version: pre_omp_3.0 SUBROUTINE NOWAIT_EXAMPLE(N, M, A, B, Y, Z) INTEGER N, M diff --git a/parallel_execution/sources/nowait.2.c b/parallel_execution/sources/nowait.2.c index 3e9ab8c..57d732a 100644 --- a/parallel_execution/sources/nowait.2.c +++ b/parallel_execution/sources/nowait.2.c @@ -1,11 +1,10 @@ /* * @@name: nowait.2 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success +* @@version: pre_omp_3.0 */ - #include void nowait_example2(int n, float *a, float *b, float *c, float *y, float *z) diff --git a/parallel_execution/sources/nowait.2.f90 b/parallel_execution/sources/nowait.2.f90 index 7119c37..98da9c0 100644 --- a/parallel_execution/sources/nowait.2.f90 +++ b/parallel_execution/sources/nowait.2.f90 @@ -1,8 +1,8 @@ ! @@name: nowait.2 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success +! @@version: pre_omp_3.0 SUBROUTINE NOWAIT_EXAMPLE2(N, A, B, C, Y, Z) INTEGER N REAL A(*), B(*), C(*), Y(*), Z(*) diff --git a/parallel_execution/sources/nthrs_dynamic.1.c b/parallel_execution/sources/nthrs_dynamic.1.c index bbf0314..ce7a3f7 100644 --- a/parallel_execution/sources/nthrs_dynamic.1.c +++ b/parallel_execution/sources/nthrs_dynamic.1.c @@ -1,9 +1,9 @@ /* * @@name: nthrs_dynamic.1 * @@type: C -* @@compilable: yes -* @@linkable: yes +* @@operation: link * @@expect: success +* @@version: pre_omp_3.0 */ #include int main() diff --git a/parallel_execution/sources/nthrs_dynamic.1.f b/parallel_execution/sources/nthrs_dynamic.1.f index b01bf04..f3a0ef4 100644 --- a/parallel_execution/sources/nthrs_dynamic.1.f +++ b/parallel_execution/sources/nthrs_dynamic.1.f @@ -1,8 +1,8 @@ ! @@name: nthrs_dynamic.1 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: yes +! @@operation: link ! @@expect: success +! @@version: pre_omp_3.0 PROGRAM EXAMPLE INCLUDE "omp_lib.h" ! or USE OMP_LIB CALL OMP_SET_DYNAMIC(.FALSE.) diff --git a/parallel_execution/sources/nthrs_dynamic.2.c b/parallel_execution/sources/nthrs_dynamic.2.c index 18247ba..7afbb06 100644 --- a/parallel_execution/sources/nthrs_dynamic.2.c +++ b/parallel_execution/sources/nthrs_dynamic.2.c @@ -1,9 +1,9 @@ /* * @@name: nthrs_dynamic.2 * @@type: C -* @@compilable: yes -* @@linkable: yes +* @@operation: link * @@expect: success +* @@version: pre_omp_3.0 */ #include int main() diff --git a/parallel_execution/sources/nthrs_dynamic.2.f b/parallel_execution/sources/nthrs_dynamic.2.f index d03cd82..0684287 100644 --- a/parallel_execution/sources/nthrs_dynamic.2.f +++ b/parallel_execution/sources/nthrs_dynamic.2.f @@ -1,8 +1,8 @@ ! @@name: nthrs_dynamic.2 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: yes +! @@operation: link ! @@expect: success +! @@version: pre_omp_3.0 PROGRAM EXAMPLE INCLUDE "omp_lib.h" ! or USE OMP_LIB CALL OMP_SET_DYNAMIC(.TRUE.) diff --git a/parallel_execution/sources/nthrs_nesting.1.c b/parallel_execution/sources/nthrs_nesting.1.c index a1fd908..aca2bfb 100644 --- a/parallel_execution/sources/nthrs_nesting.1.c +++ b/parallel_execution/sources/nthrs_nesting.1.c @@ -1,9 +1,10 @@ /* * @@name: nthrs_nesting.1 * @@type: C -* @@compilable: yes -* @@linkable: yes +* @@operation: run * @@expect: success +* @@env: OMP_NUM_THREADS=2,3 +* @@version: pre_omp_3.0 */ #include #include diff --git a/parallel_execution/sources/nthrs_nesting.1.f b/parallel_execution/sources/nthrs_nesting.1.f index 5242675..dc50af4 100644 --- a/parallel_execution/sources/nthrs_nesting.1.f +++ b/parallel_execution/sources/nthrs_nesting.1.f @@ -1,8 +1,9 @@ ! @@name: nthrs_nesting.1 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: yes +! @@operation: run ! @@expect: success +! @@env: OMP_NUM_THREADS=2,3 +! @@version: pre_omp_3.0 program icv use omp_lib call omp_set_nested(.true.) diff --git a/parallel_execution/sources/parallel.1.c b/parallel_execution/sources/parallel.1.c index b459723..a40b00f 100644 --- a/parallel_execution/sources/parallel.1.c +++ b/parallel_execution/sources/parallel.1.c @@ -1,9 +1,9 @@ /* * @@name: parallel.1 * @@type: C -* @@compilable: yes -* @@linkable: yes +* @@operation: link * @@expect: success +* @@version: pre_omp_3.0 */ #include diff --git a/parallel_execution/sources/parallel.1.f b/parallel_execution/sources/parallel.1.f index c9ae814..ae6b0fd 100644 --- a/parallel_execution/sources/parallel.1.f +++ b/parallel_execution/sources/parallel.1.f @@ -1,8 +1,8 @@ ! @@name: parallel.1 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: yes +! @@operation: link ! @@expect: success +! @@version: pre_omp_3.0 SUBROUTINE SUBDOMAIN(X, ISTART, IPOINTS) INTEGER ISTART, IPOINTS REAL X(*) diff --git a/parallel_execution/sources/ploop.1.c b/parallel_execution/sources/ploop.1.c index cca0999..4c863ae 100644 --- a/parallel_execution/sources/ploop.1.c +++ b/parallel_execution/sources/ploop.1.c @@ -1,9 +1,9 @@ /* * @@name: ploop.1 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success +* @@version: pre_omp_3.0 */ void simple(int n, float *a, float *b) { diff --git a/parallel_execution/sources/ploop.1.f b/parallel_execution/sources/ploop.1.f index 7a535c6..959b4b0 100644 --- a/parallel_execution/sources/ploop.1.f +++ b/parallel_execution/sources/ploop.1.f @@ -1,8 +1,8 @@ ! @@name: ploop.1 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success +! @@version: pre_omp_3.0 SUBROUTINE SIMPLE(N, A, B) INTEGER I, N diff --git a/parallel_execution/sources/pra_iterator.1.cpp b/parallel_execution/sources/pra_iterator.1.cpp index 1b52049..c458e5a 100644 --- a/parallel_execution/sources/pra_iterator.1.cpp +++ b/parallel_execution/sources/pra_iterator.1.cpp @@ -1,8 +1,7 @@ /* * @@name: pra_iterator.1 * @@type: C++ -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_3.0 */ diff --git a/parallel_execution/sources/psections.1.c b/parallel_execution/sources/psections.1.c index add6dc4..9977285 100644 --- a/parallel_execution/sources/psections.1.c +++ b/parallel_execution/sources/psections.1.c @@ -1,9 +1,9 @@ /* * @@name: psections.1 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success +* @@version: pre_omp_3.0 */ void XAXIS(); void YAXIS(); diff --git a/parallel_execution/sources/psections.1.f b/parallel_execution/sources/psections.1.f index ae063dd..98e213b 100644 --- a/parallel_execution/sources/psections.1.f +++ b/parallel_execution/sources/psections.1.f @@ -1,8 +1,8 @@ ! @@name: psections.1 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success +! @@version: pre_omp_3.0 SUBROUTINE SECT_EXAMPLE() !$OMP PARALLEL SECTIONS !$OMP SECTION diff --git a/parallel_execution/sources/set_dynamic_nthrs.1.c b/parallel_execution/sources/set_dynamic_nthrs.1.c index ecec374..eb47af4 100644 --- a/parallel_execution/sources/set_dynamic_nthrs.1.c +++ b/parallel_execution/sources/set_dynamic_nthrs.1.c @@ -1,9 +1,9 @@ /* * @@name: set_dynamic_nthrs.1 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success +* @@version: pre_omp_3.0 */ #include #include diff --git a/parallel_execution/sources/set_dynamic_nthrs.1.f b/parallel_execution/sources/set_dynamic_nthrs.1.f index ebef98e..9c5356c 100644 --- a/parallel_execution/sources/set_dynamic_nthrs.1.f +++ b/parallel_execution/sources/set_dynamic_nthrs.1.f @@ -1,8 +1,8 @@ ! @@name: set_dynamic_nthrs.1 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success +! @@version: pre_omp_3.0 SUBROUTINE DO_BY_16(X, IAM, IPOINTS) REAL X(*) INTEGER IAM, IPOINTS diff --git a/parallel_execution/sources/single.1.c b/parallel_execution/sources/single.1.c index 584e743..6871dc0 100644 --- a/parallel_execution/sources/single.1.c +++ b/parallel_execution/sources/single.1.c @@ -1,16 +1,16 @@ /* * @@name: single.1 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: link * @@expect: success +* @@version: pre_omp_3.0 */ #include void work1() {} void work2() {} -void single_example() +int main() { #pragma omp parallel { diff --git a/parallel_execution/sources/single.1.f b/parallel_execution/sources/single.1.f index 45d8944..06f5eb4 100644 --- a/parallel_execution/sources/single.1.f +++ b/parallel_execution/sources/single.1.f @@ -1,8 +1,8 @@ ! @@name: single.1 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: yes +! @@operation: link ! @@expect: success +! @@version: pre_omp_3.0 SUBROUTINE WORK1() END SUBROUTINE WORK1 diff --git a/parallel_execution/sources/workshare.1.f b/parallel_execution/sources/workshare.1.f index 2624352..ad5896c 100644 --- a/parallel_execution/sources/workshare.1.f +++ b/parallel_execution/sources/workshare.1.f @@ -1,8 +1,8 @@ ! @@name: workshare.1 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success +! @@version: pre_omp_3.0 SUBROUTINE WSHARE1(AA, BB, CC, DD, EE, FF, N) INTEGER N REAL AA(N,N), BB(N,N), CC(N,N), DD(N,N), EE(N,N), FF(N,N) diff --git a/parallel_execution/sources/workshare.2.f b/parallel_execution/sources/workshare.2.f index f9dcb62..25f812f 100644 --- a/parallel_execution/sources/workshare.2.f +++ b/parallel_execution/sources/workshare.2.f @@ -1,8 +1,8 @@ ! @@name: workshare.2 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success +! @@version: pre_omp_3.0 SUBROUTINE WSHARE2(AA, BB, CC, DD, EE, FF, N) INTEGER N REAL AA(N,N), BB(N,N), CC(N,N) diff --git a/parallel_execution/sources/workshare.3.f b/parallel_execution/sources/workshare.3.f index 2a4b0ae..69d414e 100644 --- a/parallel_execution/sources/workshare.3.f +++ b/parallel_execution/sources/workshare.3.f @@ -1,8 +1,8 @@ ! @@name: workshare.3 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success +! @@version: pre_omp_3.0 SUBROUTINE WSHARE3(AA, BB, CC, DD, N) INTEGER N REAL AA(N,N), BB(N,N), CC(N,N), DD(N,N) diff --git a/parallel_execution/sources/workshare.4.f b/parallel_execution/sources/workshare.4.f index 2c86d44..aaf767e 100644 --- a/parallel_execution/sources/workshare.4.f +++ b/parallel_execution/sources/workshare.4.f @@ -1,8 +1,8 @@ ! @@name: workshare.4 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success +! @@version: pre_omp_3.0 SUBROUTINE WSHARE4(AA, BB, CC, DD, EE, FF, GG, HH, N) INTEGER N REAL AA(N,N), BB(N,N), CC(N,N) diff --git a/parallel_execution/sources/workshare.5.f b/parallel_execution/sources/workshare.5.f index 6569ee1..add654c 100644 --- a/parallel_execution/sources/workshare.5.f +++ b/parallel_execution/sources/workshare.5.f @@ -1,8 +1,8 @@ ! @@name: workshare.5 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success +! @@version: pre_omp_3.0 SUBROUTINE WSHARE5(AA, BB, CC, DD, N) INTEGER N REAL AA(N,N), BB(N,N), CC(N,N), DD(N,N) diff --git a/parallel_execution/sources/workshare.6.f b/parallel_execution/sources/workshare.6.f index 4a1be20..55473ea 100644 --- a/parallel_execution/sources/workshare.6.f +++ b/parallel_execution/sources/workshare.6.f @@ -1,8 +1,8 @@ ! @@name: workshare.6 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no -! @@expect: success +! @@operation: compile +! @@expect: unspecified +! @@version: pre_omp_3.0 SUBROUTINE WSHARE6_WRONG(AA, BB, CC, DD, N) INTEGER N REAL AA(N,N), BB(N,N), CC(N,N), DD(N,N) diff --git a/parallel_execution/sources/workshare.7.f b/parallel_execution/sources/workshare.7.f index 6f94fb8..7c4d1ad 100644 --- a/parallel_execution/sources/workshare.7.f +++ b/parallel_execution/sources/workshare.7.f @@ -1,8 +1,8 @@ ! @@name: workshare.7 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success +! @@version: pre_omp_3.0 SUBROUTINE WSHARE7(AA, BB, CC, N) INTEGER N REAL AA(N), BB(N), CC(N) diff --git a/program_control/metadirective.tex b/program_control/metadirective.tex index 8bbef39..28d6ca5 100644 --- a/program_control/metadirective.tex +++ b/program_control/metadirective.tex @@ -19,7 +19,7 @@ The directive in an \code{otherwise} clause is used when a directive of the \index{context selector!construct@\plc{construct}} In the \code{when} clause the \plc{context selector} (or just \plc{selector}) defines traits that are evaluated for selection of the directive that follows the selector. -This "selectable" directive is called a \plc{directive variant}. +This ``selectables'' directive is called a \plc{directive variant}. Traits are grouped by \plc{construct}, \plc{implementation} and \plc{device} \plc{sets} to be used by a selector of the same name. diff --git a/program_control/pause_resource.tex b/program_control/pause_resource.tex new file mode 100644 index 0000000..ffacd73 --- /dev/null +++ b/program_control/pause_resource.tex @@ -0,0 +1,44 @@ +\pagebreak +\section{\scode{omp_pause_resource} and \\ + \scode{omp_pause_resource_all} Routines} +\label{sec:pause_resource} +\index{routines!omp_pause_resource@\scode{omp_pause_resource}} +\index{omp_pause_resource routine@\scode{omp_pause_resource} routine} +\index{routines!omp_get_max_threads@\scode{omp_get_max_threads}} +\index{omp_get_max_threads routine@\scode{omp_get_max_threadsi} routine} +\index{routines!omp_get_initial_device@\scode{omp_get_initial_device}} +\index{omp_get_initial_device routine@\scode{omp_get_initial_device} routine} + +Sometimes, it is necessary to relinquish resources created or allocated +for the OpenMP runtime environment to avoid interference with subsequent +actions as illustrated by the following example. In the beginning +either a call to the \scode{omp_get_max_threads} routine +or the subsequent \code{parallel} construct may trigger resource allocation +by the OpenMP runtime, which may cause unexpected side effects +for the subsequent \plc{fork} call. +It is desirable to relinquish OpenMP resources allocated before +the fork by using the \scode{omp_pause_resource} routine for a given +device, in this case the host device. The host device number is returned by +the \scode{omp_get_initial_device} routine. +The \scode{omp_pause_hard} value is used here to free as many +OpenMP resources as possible. +After the fork, the child process will initialize its OpenMP runtime +environment when encountering the \code{parallel} construct. + +\cexample[5.0]{pause_resource}{1} + +\index{routines!omp_pause_resource_all@\scode{omp_pause_resource_all}} +\index{omp_pause_resource_all routine@\scode{omp_pause_resource_all} routine} +The following example illustrates a different use case. +After executing the first parallel code (parallel region 1), +the \plc{relinquish} program switches to executing an external parallel program +(called \plc{subprogram}, which is compiled from \splc{pause_resource.2b}). +In order to make resources available for the external +subprogram, \plc{relinquish} calls \scode{omp_pause_resource_all} +to relinquish OpenMP resources used by the current program before +calling \scode{execute_command_line} to execute \plc{subprogram}. +The \scode{omp_pause_soft} value is used here to allow subsequent +OpenMP regions (parallel region 2) to restart more quickly. + +\ffreeexample[5.0]{pause_resource}{2a} +\ffreeexample{pause_resource}{2b} diff --git a/program_control/sources/cancellation.1.cpp b/program_control/sources/cancellation.1.cpp index 47b5732..23db01c 100644 --- a/program_control/sources/cancellation.1.cpp +++ b/program_control/sources/cancellation.1.cpp @@ -1,8 +1,7 @@ /* * @@name: cancellation.1 * @@type: C++ -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ diff --git a/program_control/sources/cancellation.1.f90 b/program_control/sources/cancellation.1.f90 index c2a977f..4fb386a 100644 --- a/program_control/sources/cancellation.1.f90 +++ b/program_control/sources/cancellation.1.f90 @@ -1,7 +1,6 @@ ! @@name: cancellation.1 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_4.0 subroutine example(n, dim) diff --git a/program_control/sources/cancellation.2.c b/program_control/sources/cancellation.2.c index 575a0fa..86a2589 100644 --- a/program_control/sources/cancellation.2.c +++ b/program_control/sources/cancellation.2.c @@ -1,8 +1,7 @@ /* * @@name: cancellation.2 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_5.1 */ diff --git a/program_control/sources/cancellation.2.f90 b/program_control/sources/cancellation.2.f90 index 4b37723..be65d1a 100644 --- a/program_control/sources/cancellation.2.f90 +++ b/program_control/sources/cancellation.2.f90 @@ -1,7 +1,6 @@ ! @@name: cancellation.2 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_5.1 module parallel_search diff --git a/program_control/sources/cond_comp.1.c b/program_control/sources/cond_comp.1.c index 717ef7d..1727794 100644 --- a/program_control/sources/cond_comp.1.c +++ b/program_control/sources/cond_comp.1.c @@ -1,9 +1,9 @@ /* * @@name: cond_comp.1 * @@type: C -* @@compilable: yes -* @@linkable: yes +* @@operation: run * @@expect: success +* @@version: pre_omp_3.0 */ #include diff --git a/program_control/sources/cond_comp.1.f b/program_control/sources/cond_comp.1.f index 7c76a18..a17c054 100644 --- a/program_control/sources/cond_comp.1.f +++ b/program_control/sources/cond_comp.1.f @@ -1,8 +1,8 @@ ! @@name: cond_comp.1 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: yes +! @@operation: run ! @@expect: success +! @@version: pre_omp_3.0 PROGRAM EXAMPLE C234567890 diff --git a/program_control/sources/declare_variant.1.c b/program_control/sources/declare_variant.1.c index 312f148..5bdd8e5 100644 --- a/program_control/sources/declare_variant.1.c +++ b/program_control/sources/declare_variant.1.c @@ -1,12 +1,10 @@ /* -* @@name: declare_variant.1 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.1 +* @@name: declare_variant.1 +* @@type: C +* @@operation: run +* @@expect: success +* @@version: omp_5.1 */ - #define N 100 #include #include diff --git a/program_control/sources/declare_variant.1.f90 b/program_control/sources/declare_variant.1.f90 index 11f26db..cb806d0 100644 --- a/program_control/sources/declare_variant.1.f90 +++ b/program_control/sources/declare_variant.1.f90 @@ -1,10 +1,8 @@ -! @@name: declare_variant.1 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_5.0 - +! @@name: declare_variant.1 +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: omp_5.0 module subs use omp_lib contains diff --git a/program_control/sources/declare_variant.2.c b/program_control/sources/declare_variant.2.c index 85764ee..e0de02c 100644 --- a/program_control/sources/declare_variant.2.c +++ b/program_control/sources/declare_variant.2.c @@ -1,10 +1,9 @@ /* -* @@name: declare_variant.2 -* @@type: C -* @@compilable: yes -* @@linkable: no -* @@expect: success -* @@version: omp_5.0 +* @@name: declare_variant.2 +* @@type: C +* @@operation: run +* @@expect: success +* @@version: omp_5.0 */ #include diff --git a/program_control/sources/declare_variant.2.f90 b/program_control/sources/declare_variant.2.f90 index 012cc10..a6dc20d 100644 --- a/program_control/sources/declare_variant.2.f90 +++ b/program_control/sources/declare_variant.2.f90 @@ -1,10 +1,8 @@ -! @@name: declare_variant.2 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_5.0 - +! @@name: declare_variant.2 +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: omp_5.0 module subs use omp_lib contains diff --git a/program_control/sources/display_env.1.c b/program_control/sources/display_env.1.c index 1bf5c53..e6281f6 100644 --- a/program_control/sources/display_env.1.c +++ b/program_control/sources/display_env.1.c @@ -1,8 +1,7 @@ /* * @@name: display_env.1 * @@type: C -* @@compilable: yes -* @@linkable: yes +* @@operation: link * @@expect: success * @@version: omp_5.1 */ diff --git a/program_control/sources/display_env.1.f90 b/program_control/sources/display_env.1.f90 index 89998ef..b72aa85 100644 --- a/program_control/sources/display_env.1.f90 +++ b/program_control/sources/display_env.1.f90 @@ -1,7 +1,6 @@ ! @@name: display_env.1 ! @@type: F-free -! @@compilable: yes -! @@linkable: yes +! @@operation: link ! @@expect: success ! @@version: omp_5.1 !implementers: customize debug routines for app debugging @@ -22,4 +21,3 @@ program display_omp_environment if( debug() ) call omp_display_env( debug_omp_verbose() ) !! ... end program - diff --git a/program_control/sources/error.1.c b/program_control/sources/error.1.c index 459561d..4864d74 100644 --- a/program_control/sources/error.1.c +++ b/program_control/sources/error.1.c @@ -1,10 +1,9 @@ /* -* @@name: error.1 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.2 +* @@name: error.1 +* @@type: C +* @@operation: link +* @@expect: success +* @@version: omp_5.2 */ #include #include @@ -17,7 +16,7 @@ int main(){ message("GNU compiler required.")) if( omp_get_num_procs() < 3 ){ - #pragma omp error at(runtime) severity(fatal) \ + #pragma omp error at(execution) severity(fatal) \ message("3 or more procs required.") } @@ -26,7 +25,7 @@ int main(){ // Give notice about master deprecation at compile time and run time. #pragma omp error at(compilation) severity(warning) \ message("Notice: master is deprecated.") - #pragma omp error at(runtime) severity(warning) \ + #pragma omp error at(execution) severity(warning) \ message("Notice: masked used next release.") printf(" Hello from thread number 0.\n"); diff --git a/program_control/sources/error.1.f90 b/program_control/sources/error.1.f90 index 0493050..3d974f0 100644 --- a/program_control/sources/error.1.f90 +++ b/program_control/sources/error.1.f90 @@ -1,9 +1,8 @@ -! @@name: error.1 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_5.2 +! @@name: error.1 +! @@type: F-free +! @@operation: link +! @@expect: success +! @@version: omp_5.2 program main use omp_lib @@ -14,7 +13,7 @@ use omp_lib if( omp_get_num_procs() < 3 ) then - !$omp error at(runtime) severity(fatal) & + !$omp error at(execution) severity(fatal) & !$omp& message("3 or more procs required.") endif @@ -23,7 +22,7 @@ endif !! Give notice about master deprecation at compile time and run time. !$omp error at(compilation) severity(warning) & !$omp& message("Notice: master is deprecated.") - !$omp error at(runtime) severity(warning) & + !$omp error at(execution) severity(warning) & !$omp& message("Notice: masked to be used in next release.") print*," Hello from thread number 0." diff --git a/program_control/sources/get_wtime.1.c b/program_control/sources/get_wtime.1.c index 31fede0..a634dac 100644 --- a/program_control/sources/get_wtime.1.c +++ b/program_control/sources/get_wtime.1.c @@ -1,9 +1,9 @@ /* * @@name: get_wtime.1 * @@type: C -* @@compilable: yes -* @@linkable: yes +* @@operation: link * @@expect: success +* @@version: pre_omp_3.0 */ #include #include diff --git a/program_control/sources/get_wtime.1.f90 b/program_control/sources/get_wtime.1.f90 index 40f1d00..1469fe4 100644 --- a/program_control/sources/get_wtime.1.f90 +++ b/program_control/sources/get_wtime.1.f90 @@ -1,8 +1,8 @@ ! @@name: get_wtime.1 ! @@type: F-free -! @@compilable: yes -! @@linkable: yes +! @@operation: link ! @@expect: success +! @@version: pre_omp_3.0 subroutine work_to_be_timed use, intrinsic :: iso_c_binding, only: c_int interface diff --git a/program_control/sources/icv.1.c b/program_control/sources/icv.1.c index 34aa133..dc61338 100644 --- a/program_control/sources/icv.1.c +++ b/program_control/sources/icv.1.c @@ -1,9 +1,9 @@ /* * @@name: icv.1 * @@type: C -* @@compilable: yes -* @@linkable: yes +* @@operation: run * @@expect: success +* @@version: pre_omp_3.0 */ #include #include diff --git a/program_control/sources/icv.1.f b/program_control/sources/icv.1.f index 0d4fe79..5065314 100644 --- a/program_control/sources/icv.1.f +++ b/program_control/sources/icv.1.f @@ -1,8 +1,8 @@ ! @@name: icv.1 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: yes +! @@operation: run ! @@expect: success +! @@version: pre_omp_3.0 program icv use omp_lib diff --git a/program_control/sources/interop.1.c b/program_control/sources/interop.1.c index 3d7bff5..74dae9f 100644 --- a/program_control/sources/interop.1.c +++ b/program_control/sources/interop.1.c @@ -1,10 +1,9 @@ /* -* @@name: interop.1 -* @@type: C -* @@compilable: no -* @@linkable: no -* @@expect: success -* @@version: omp_5.1 +* @@name: interop.1 +* @@type: C +* @@operation: link +* @@expect: success +* @@version: omp_5.1 */ #include #include diff --git a/program_control/sources/metadirective.1.c b/program_control/sources/metadirective.1.c index 9aff391..b770b0e 100644 --- a/program_control/sources/metadirective.1.c +++ b/program_control/sources/metadirective.1.c @@ -1,12 +1,10 @@ /* -* @@name: metadirective.1 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.2 +* @@name: metadirective.1 +* @@type: C +* @@operation: run +* @@expect: success +* @@version: omp_5.2 */ - #define N 100 #include diff --git a/program_control/sources/metadirective.1.f90 b/program_control/sources/metadirective.1.f90 index 6bff3c4..3eab66d 100644 --- a/program_control/sources/metadirective.1.f90 +++ b/program_control/sources/metadirective.1.f90 @@ -1,9 +1,8 @@ -! @@name: metadirective.1 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_5.2 +! @@name: metadirective.1 +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: omp_5.2 program main integer, parameter :: N= 100 integer :: v1(N), v2(N), v3(N); diff --git a/program_control/sources/metadirective.2.c b/program_control/sources/metadirective.2.c index f9b9acf..09a3434 100644 --- a/program_control/sources/metadirective.2.c +++ b/program_control/sources/metadirective.2.c @@ -1,10 +1,9 @@ /* -* @@name: metadirective.2 -* @@type: C -* @@compilable: yes -* @@linkable: no -* @@expect: success -* @@version: omp_5.2 +* @@name: metadirective.2 +* @@type: C +* @@operation: compile +* @@expect: success +* @@version: omp_5.2 */ #define N 100 #include @@ -33,4 +32,3 @@ int main() //Driver } return 0; } - diff --git a/program_control/sources/metadirective.2.f90 b/program_control/sources/metadirective.2.f90 index 31538a9..b1c2cb7 100644 --- a/program_control/sources/metadirective.2.f90 +++ b/program_control/sources/metadirective.2.f90 @@ -1,9 +1,8 @@ -! @@name: metadirective.2 -! @@type: F-free -! @@compilable: yes -! @@linkable: no -! @@expect: success -! @@version: omp_5.2 +! @@name: metadirective.2 +! @@type: F-free +! @@operation: compile +! @@expect: success +! @@version: omp_5.2 program main !!Driver use omp_lib implicit none diff --git a/program_control/sources/metadirective.3.c b/program_control/sources/metadirective.3.c index 8d0d18a..18f3624 100644 --- a/program_control/sources/metadirective.3.c +++ b/program_control/sources/metadirective.3.c @@ -1,10 +1,9 @@ /* -* @@name: metadirective.3 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.2 +* @@name: metadirective.3 +* @@type: C +* @@operation: run +* @@expect: success +* @@version: omp_5.2 */ #include #include diff --git a/program_control/sources/metadirective.3.f90 b/program_control/sources/metadirective.3.f90 index 9f06da7..df91d8f 100644 --- a/program_control/sources/metadirective.3.f90 +++ b/program_control/sources/metadirective.3.f90 @@ -1,9 +1,8 @@ -! @@name: metadirective.3 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_5.2 +! @@name: metadirective.3 +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: omp_5.2 module params integer, parameter :: N=1000 DOUBLE PRECISION, PARAMETER::M_PI=4.0d0*DATAN(1.0d0) diff --git a/program_control/sources/metadirective.4.c b/program_control/sources/metadirective.4.c index 5ae949c..e8ed302 100644 --- a/program_control/sources/metadirective.4.c +++ b/program_control/sources/metadirective.4.c @@ -1,13 +1,13 @@ /* -* @@name: metadirective.4 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.2 +* @@name: metadirective.4 +* @@type: C +* @@operation: run +* @@expect: success +* @@version: omp_5.2 */ #define N 100 #include +#include #include #include @@ -32,8 +32,8 @@ void bar (int *a, int n, bool run_parallel, bool unbalanced) #pragma omp metadirective \ when(user={condition(run_parallel)}: parallel) { - if(omp_in_parallel() == 1 && omp_get_thread_num() == 0) - {printf("PASSED 2 of 3\n");} + if(omp_in_parallel() && omp_get_thread_num() == 0) + printf("PASSED 2 of 3\n"); #pragma omp metadirective \ when( construct={parallel}, \ @@ -63,4 +63,5 @@ int main(){ foo(p, N, use_gpu); bar(p, N, run_parallel,unbalanced); + return 0; } diff --git a/program_control/sources/metadirective.4.f90 b/program_control/sources/metadirective.4.f90 index 7019383..1ee6a3b 100644 --- a/program_control/sources/metadirective.4.f90 +++ b/program_control/sources/metadirective.4.f90 @@ -1,9 +1,8 @@ -! @@name: metadirective.4 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_5.2 +! @@name: metadirective.4 +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: omp_5.2 subroutine foo(a, n, use_gpu) integer :: n, a(n) logical :: use_gpu @@ -22,14 +21,14 @@ subroutine foo(a, n, use_gpu) end subroutine subroutine bar (a, n, run_parallel, unbalanced) - use omp_lib, only : omp_get_thread_num + use omp_lib, only : omp_get_thread_num, omp_in_parallel integer :: n, a(n) logical :: run_parallel, unbalanced integer :: b=0 !$omp begin metadirective when(user={condition(run_parallel)}: parallel) - if(omp_in_parallel() == 1 .and. omp_get_thread_num() == 0) & + if(omp_in_parallel() .and. omp_get_thread_num() == 0) & print *,"PASSED 2 of 3" !$omp metadirective & diff --git a/program_control/sources/metadirective.5.cpp b/program_control/sources/metadirective.5.cpp index 43afdb7..ec15d30 100644 --- a/program_control/sources/metadirective.5.cpp +++ b/program_control/sources/metadirective.5.cpp @@ -1,10 +1,9 @@ /* -* @@name: metadirective.5 -* @@type: C++ -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.0 +* @@name: metadirective.5 +* @@type: C++ +* @@operation: run +* @@expect: success +* @@version: omp_5.0 */ #include diff --git a/program_control/sources/nested_loop.1.c b/program_control/sources/nested_loop.1.c index 7d99e06..42576c0 100644 --- a/program_control/sources/nested_loop.1.c +++ b/program_control/sources/nested_loop.1.c @@ -1,9 +1,9 @@ /* * @@name: nested_loop.1 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success +* @@version: pre_omp_3.0 */ void work(int i, int j) {} diff --git a/program_control/sources/nested_loop.1.f b/program_control/sources/nested_loop.1.f index 8e63641..ee86ff3 100644 --- a/program_control/sources/nested_loop.1.f +++ b/program_control/sources/nested_loop.1.f @@ -1,8 +1,8 @@ ! @@name: nested_loop.1 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success +! @@version: pre_omp_3.0 SUBROUTINE WORK(I, J) INTEGER I, J END SUBROUTINE WORK diff --git a/program_control/sources/nested_loop.2.c b/program_control/sources/nested_loop.2.c index 6f1aaf5..9966ebf 100644 --- a/program_control/sources/nested_loop.2.c +++ b/program_control/sources/nested_loop.2.c @@ -1,9 +1,9 @@ /* * @@name: nested_loop.2 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success +* @@version: pre_omp_3.0 */ void work(int i, int j) {} diff --git a/program_control/sources/nested_loop.2.f b/program_control/sources/nested_loop.2.f index 3b7780e..4a181b5 100644 --- a/program_control/sources/nested_loop.2.f +++ b/program_control/sources/nested_loop.2.f @@ -1,8 +1,8 @@ ! @@name: nested_loop.2 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success +! @@version: pre_omp_3.0 SUBROUTINE WORK(I, J) INTEGER I, J END SUBROUTINE WORK diff --git a/program_control/sources/nesting_restrict.1.c b/program_control/sources/nesting_restrict.1.c index 7e84326..c8986ef 100644 --- a/program_control/sources/nesting_restrict.1.c +++ b/program_control/sources/nesting_restrict.1.c @@ -1,11 +1,10 @@ /* * @@name: nesting_restrict.1 * @@type: C -* @@compilable: no -* @@linkable: no -* @@expect: failure +* @@operation: compile +* @@expect: ct-error +* @@version: pre_omp_3.0 */ - void work(int i, int j) {} void wrong1(int n) diff --git a/program_control/sources/nesting_restrict.1.f b/program_control/sources/nesting_restrict.1.f index 0280b6a..470e999 100644 --- a/program_control/sources/nesting_restrict.1.f +++ b/program_control/sources/nesting_restrict.1.f @@ -1,9 +1,8 @@ ! @@name: nesting_restrict.1 ! @@type: F-fixed -! @@compilable: no -! @@linkable: no -! @@expect: failure - +! @@operation: compile +! @@expect: ct-error +! @@version: pre_omp_3.0 SUBROUTINE WORK(I, J) INTEGER I, J diff --git a/program_control/sources/nesting_restrict.2.c b/program_control/sources/nesting_restrict.2.c index a3fe551..ef0d5e4 100644 --- a/program_control/sources/nesting_restrict.2.c +++ b/program_control/sources/nesting_restrict.2.c @@ -1,9 +1,9 @@ /* * @@name: nesting_restrict.2 * @@type: C -* @@compilable: maybe -* @@linkable: no -* @@expect: failure +* @@operation: compile +* @@expect: unspecified +* @@version: pre_omp_3.0 */ void work(int i, int j) {} void work1(int i, int n) diff --git a/program_control/sources/nesting_restrict.2.f b/program_control/sources/nesting_restrict.2.f index 1396151..df51cc6 100644 --- a/program_control/sources/nesting_restrict.2.f +++ b/program_control/sources/nesting_restrict.2.f @@ -1,8 +1,8 @@ ! @@name: nesting_restrict.2 ! @@type: F-fixed -! @@compilable: maybe -! @@linkable: no -! @@expect: failure +! @@operation: compile +! @@expect: unspecified +! @@version: pre_omp_3.0 SUBROUTINE WORK1(I,N) INTEGER I, N INTEGER J diff --git a/program_control/sources/nesting_restrict.3.c b/program_control/sources/nesting_restrict.3.c index 1f69e6e..c9ec891 100644 --- a/program_control/sources/nesting_restrict.3.c +++ b/program_control/sources/nesting_restrict.3.c @@ -1,9 +1,9 @@ /* * @@name: nesting_restrict.3 * @@type: C -* @@compilable: no -* @@linkable: no -* @@expect: failure +* @@operation: compile +* @@expect: ct-error +* @@version: pre_omp_3.0 */ void work(int i, int j) {} void wrong3(int n) diff --git a/program_control/sources/nesting_restrict.3.f b/program_control/sources/nesting_restrict.3.f index 8ff3ee4..8dd02d7 100644 --- a/program_control/sources/nesting_restrict.3.f +++ b/program_control/sources/nesting_restrict.3.f @@ -1,8 +1,8 @@ ! @@name: nesting_restrict.3 ! @@type: F-fixed -! @@compilable: no -! @@linkable: no -! @@expect: failure +! @@operation: compile +! @@expect: ct-error +! @@version: pre_omp_3.0 SUBROUTINE WRONG3(N) INTEGER N diff --git a/program_control/sources/nesting_restrict.4.c b/program_control/sources/nesting_restrict.4.c index 1f08d01..5d591c1 100644 --- a/program_control/sources/nesting_restrict.4.c +++ b/program_control/sources/nesting_restrict.4.c @@ -1,9 +1,9 @@ /* * @@name: nesting_restrict.4 * @@type: C -* @@compilable: no -* @@linkable: no -* @@expect: failure +* @@operation: compile +* @@expect: ct-error +* @@version: pre_omp_3.0 */ void work(int i, int j) {} void wrong4(int n) diff --git a/program_control/sources/nesting_restrict.4.f b/program_control/sources/nesting_restrict.4.f index 2720f09..1a3b2bc 100644 --- a/program_control/sources/nesting_restrict.4.f +++ b/program_control/sources/nesting_restrict.4.f @@ -1,8 +1,8 @@ ! @@name: nesting_restrict.4 ! @@type: F-fixed -! @@compilable: no -! @@linkable: no -! @@expect: failure +! @@operation: compile +! @@expect: ct-error +! @@version: pre_omp_3.0 SUBROUTINE WRONG4(N) INTEGER N diff --git a/program_control/sources/nesting_restrict.5.c b/program_control/sources/nesting_restrict.5.c index 4fc6c36..ef8fa77 100644 --- a/program_control/sources/nesting_restrict.5.c +++ b/program_control/sources/nesting_restrict.5.c @@ -1,9 +1,9 @@ /* * @@name: nesting_restrict.5 * @@type: C -* @@compilable: no -* @@linkable: no -* @@expect: failure +* @@operation: compile +* @@expect: ct-error +* @@version: pre_omp_3.0 */ void work(int i, int j) {} void wrong5(int n) diff --git a/program_control/sources/nesting_restrict.5.f b/program_control/sources/nesting_restrict.5.f index 1fc97dd..e0f3bf4 100644 --- a/program_control/sources/nesting_restrict.5.f +++ b/program_control/sources/nesting_restrict.5.f @@ -1,8 +1,8 @@ ! @@name: nesting_restrict.5 ! @@type: F-fixed -! @@compilable: no -! @@linkable: no -! @@expect: failure +! @@operation: compile +! @@expect: ct-error +! @@version: pre_omp_3.0 SUBROUTINE WRONG5(N) INTEGER N diff --git a/program_control/sources/nesting_restrict.6.c b/program_control/sources/nesting_restrict.6.c index ca71c93..c258185 100644 --- a/program_control/sources/nesting_restrict.6.c +++ b/program_control/sources/nesting_restrict.6.c @@ -1,9 +1,9 @@ /* * @@name: nesting_restrict.6 * @@type: C -* @@compilable: no -* @@linkable: no -* @@expect: failure +* @@operation: compile +* @@expect: ct-error +* @@version: pre_omp_3.0 */ void work(int i, int j) {} void wrong6(int n) diff --git a/program_control/sources/nesting_restrict.6.f b/program_control/sources/nesting_restrict.6.f index 3eb1cb3..b6ac881 100644 --- a/program_control/sources/nesting_restrict.6.f +++ b/program_control/sources/nesting_restrict.6.f @@ -1,8 +1,8 @@ ! @@name: nesting_restrict.6 ! @@type: F-fixed -! @@compilable: no -! @@linkable: no -! @@expect: failure +! @@operation: compile +! @@expect: ct-error +! @@version: pre_omp_3.0 SUBROUTINE WRONG6(N) INTEGER N diff --git a/program_control/sources/pause_resource.1.c b/program_control/sources/pause_resource.1.c new file mode 100644 index 0000000..4579e57 --- /dev/null +++ b/program_control/sources/pause_resource.1.c @@ -0,0 +1,50 @@ +/* +* @@name: pause_resource.1 +* @@type: C +* @@operation: link +* @@expect: success +* @@version: omp_5.0 +*/ +#include +#include +#include +#include +#include + +int main() +{ + pid_t pid; + int nt = omp_get_max_threads(); + + #pragma omp parallel + { + #pragma omp single + printf("number of threads = %d (max = %d)\n", + omp_get_num_threads(), nt); + } + + /* clean up thread environment before fork */ + omp_pause_resource(omp_pause_hard, omp_get_initial_device()); + + pid = fork(); + if (pid < 0) { + printf("fork failed\n"); + exit(1); + } + else if (pid == 0) { + /* child process */ + #pragma omp parallel num_threads(nt) + { + int myid = omp_get_thread_num(); + printf("child: myid %d of %d\n", myid, nt); + } + exit(0); + } + else { + /* parent process */ + int s; + printf("parent process - waiting pid %d\n", pid); + waitpid(pid, &s, 0); + } + return 0; +} diff --git a/program_control/sources/pause_resource.2a.f90 b/program_control/sources/pause_resource.2a.f90 new file mode 100644 index 0000000..58bbbc4 --- /dev/null +++ b/program_control/sources/pause_resource.2a.f90 @@ -0,0 +1,27 @@ +! @@name: pause_resource.2a +! @@type: F-free +! @@operation: link +! @@expect: success +! @@version: omp_5.0 +program relinquish + use omp_lib + implicit none + integer :: err + + write (*,*) 'In relinquish' + +!$omp parallel + write (*,*) 'In parallel region 1' +!$omp end parallel + + err = omp_pause_resource_all(omp_pause_soft) + + ! execute the external subprogram produced from pause_resource.2b + call execute_command_line(command='./subprogram', wait=.true., & + cmdstat=err) + if (err /= 0) write (*,*) 'Warning: subprogram failed to execute' + +!$omp parallel + write (*,*) 'In parallel region 2' +!$omp end parallel +end program relinquish diff --git a/program_control/sources/pause_resource.2b.f90 b/program_control/sources/pause_resource.2b.f90 new file mode 100644 index 0000000..94e3a62 --- /dev/null +++ b/program_control/sources/pause_resource.2b.f90 @@ -0,0 +1,34 @@ +! @@name: pause_resource.2b +! @@type: F-free +! @@operation: link +! @@expect: success +! @@version: pre_omp_3.0 +! This program compiles to an executable "subprogram" +subroutine compute(i, j, k, r) + implicit none + integer :: i, j, k + real(8) :: r + r = i + j + k +end subroutine compute + +program subprogram + implicit none + integer :: i, j, k + real(8) :: s, r + integer, parameter :: n = 500 + + write (*,*) 'In subprogram' + s = 0.d0 +!$omp parallel do private(r) reduction(+:s) + do i = 1, n + do j = 1, n + do k = 1, n + call compute(i, j, k, r) + s = s + r + end do + end do + end do +!$omp end parallel do + + write (*,*) 'Sum = ',s +end program subprogram diff --git a/program_control/sources/reproducible.1.c b/program_control/sources/reproducible.1.c index 95e7b13..7df1768 100644 --- a/program_control/sources/reproducible.1.c +++ b/program_control/sources/reproducible.1.c @@ -1,8 +1,7 @@ /* * @@name: reproducible.1 * @@type: C -* @@compilable: yes -* @@linkable: yes +* @@operation: link * @@expect: success * @@version: omp_5.0 */ diff --git a/program_control/sources/reproducible.1.f90 b/program_control/sources/reproducible.1.f90 index ecbbe4f..987a730 100644 --- a/program_control/sources/reproducible.1.f90 +++ b/program_control/sources/reproducible.1.f90 @@ -1,9 +1,8 @@ ! @@name: reproducible.1 ! @@type: F-free -! @@compilable: yes -! @@linkable: yes +! @@operation: link ! @@expect: success -! @@version: omp_5.0 +! @@version: omp_5.0 program main use omp_lib implicit none diff --git a/program_control/sources/reproducible.2.c b/program_control/sources/reproducible.2.c index 4fd84f8..ca8e2b7 100644 --- a/program_control/sources/reproducible.2.c +++ b/program_control/sources/reproducible.2.c @@ -1,8 +1,7 @@ /* * @@name: reproducible.2 * @@type: C -* @@compilable: yes -* @@linkable: yes +* @@operation: link * @@expect: success * @@version: omp_5.1 */ diff --git a/program_control/sources/reproducible.2.f90 b/program_control/sources/reproducible.2.f90 index bb9100f..64cb3aa 100644 --- a/program_control/sources/reproducible.2.f90 +++ b/program_control/sources/reproducible.2.f90 @@ -1,9 +1,8 @@ ! @@name: reproducible.2 ! @@type: F-free -! @@compilable: yes -! @@linkable: yes +! @@operation: link ! @@expect: success -! @@version: omp_5.1 +! @@version: omp_5.1 program main implicit none integer, parameter :: n = 1000 @@ -12,11 +11,12 @@ program main !$omp parallel !! reproducible schedules are used the following two constructs - !$omp do order(reproducible: concurrent) nowait + !$omp do order(reproducible: concurrent) do i = 1, n u(i) = i v(i) = i end do + !$omp end do nowait !$omp do order(reproducible: concurrent) do i = 1, n v(i) = v(i) + u(i) * u(i) @@ -25,11 +25,12 @@ program main !$omp parallel !! static schedules preserve data dependences between the loops - !$omp do schedule(static) order(concurrent) nowait + !$omp do schedule(static) order(concurrent) do i = 1, n u(i) = i v(i) = i - end do + end do + !$omp end do nowait !$omp do schedule(static) order(concurrent) do i = 1, n v(i) = v(i) + u(i) * u(i) diff --git a/program_control/sources/requires.1.cpp b/program_control/sources/requires.1.cpp index 4db42fe..1f33378 100644 --- a/program_control/sources/requires.1.cpp +++ b/program_control/sources/requires.1.cpp @@ -1,12 +1,10 @@ /* -* @@name: requires.1 -* @@type: C++ -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.0 +* @@name: requires.1 +* @@type: C++ +* @@operation: run +* @@expect: success +* @@version: omp_5.0 */ - #include using namespace std; diff --git a/program_control/sources/requires.1.f90 b/program_control/sources/requires.1.f90 index 5955693..a94fb23 100644 --- a/program_control/sources/requires.1.f90 +++ b/program_control/sources/requires.1.f90 @@ -1,10 +1,8 @@ -! @@name: requires.1 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_5.0 - +! @@name: requires.1 +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: omp_5.0 module data !$omp requires unified_shared_memory type,public :: mypoints diff --git a/program_control/sources/standalone.1.c b/program_control/sources/standalone.1.c index 3216c78..9b24887 100644 --- a/program_control/sources/standalone.1.c +++ b/program_control/sources/standalone.1.c @@ -1,12 +1,10 @@ /* * @@name: standalone.1 * @@type: C -* @@compilable: no -* @@linkable: no -* @@expect: failure +* @@operation: compile +* @@expect: ct-error * @@version: omp_3.1 */ - void standalone_wrong() { int a = 1; diff --git a/program_control/sources/standalone.1.f90 b/program_control/sources/standalone.1.f90 index fbf7b0c..e938f7e 100644 --- a/program_control/sources/standalone.1.f90 +++ b/program_control/sources/standalone.1.f90 @@ -1,11 +1,8 @@ ! @@name: standalone.1 ! @@type: F-free -! @@compilable: no -! @@linkable: no -! @@expect: failure -! @@version: omp_3.1 - - +! @@operation: compile +! @@expect: ct-error +! @@version: omp_3.1 SUBROUTINE STANDALONE_WRONG() INTEGER A diff --git a/program_control/sources/standalone.2.c b/program_control/sources/standalone.2.c index 837a6a6..0951bde 100644 --- a/program_control/sources/standalone.2.c +++ b/program_control/sources/standalone.2.c @@ -1,8 +1,7 @@ /* * @@name: standalone.2 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_3.1 */ diff --git a/program_control/sources/standalone.2.f90 b/program_control/sources/standalone.2.f90 index cfac4e0..966b9d3 100644 --- a/program_control/sources/standalone.2.f90 +++ b/program_control/sources/standalone.2.f90 @@ -1,9 +1,8 @@ ! @@name: standalone.2 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success -! @@version: omp_3.1 +! @@version: omp_3.1 SUBROUTINE STANDALONE_OK() INTEGER A A = 1 diff --git a/program_control/sources/target_offload_control.1.c b/program_control/sources/target_offload_control.1.c index bed104a..c581827 100644 --- a/program_control/sources/target_offload_control.1.c +++ b/program_control/sources/target_offload_control.1.c @@ -1,10 +1,10 @@ /* -* @@name: target_offload_control.1 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.0 +* @@name: target_offload_control.1 +* @@type: C +* @@operation: run +* @@expect: success +* @@version: omp_5.0 +* @@env: OMP_TARGET_OFFLOAD=default */ #include #include @@ -39,7 +39,6 @@ offload_policy_t get_offload_policy() int main() { - int i; int device_num, on_init_dev; // get policy from OMP_TARGET_OFFLOAD variable diff --git a/program_control/sources/target_offload_control.1.f90 b/program_control/sources/target_offload_control.1.f90 index 6dbc3e6..ee84d98 100644 --- a/program_control/sources/target_offload_control.1.f90 +++ b/program_control/sources/target_offload_control.1.f90 @@ -1,9 +1,9 @@ -! @@name: target_offload_control.1 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_5.0 +! @@name: target_offload_control.1 +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: omp_5.0 +! @@env: OMP_TARGET_OFFLOAD=default module offload_policy implicit none integer, parameter :: LEN_POLICY=10 diff --git a/program_control/target_offload.tex b/program_control/target_offload.tex index b589f7e..39a4817 100644 --- a/program_control/target_offload.tex +++ b/program_control/target_offload.tex @@ -36,10 +36,10 @@ when the \code{OMP\_DISPLAY\_ENV} environment variable is set to \code{TRUE} or \code{VERBOSE}. %\pagebreak -\cexample[5.0]{target_offload_control}{1} +\cexample[5.0]{target_offload_control}{1}[1] %\pagebreak -\ffreeexample[5.0]{target_offload_control}{1} +\ffreeexample[5.0]{target_offload_control}{1}[1] % OMP 4.5 target offload 15:9-11 diff --git a/sources/README b/sources/README index 5310289..9208c7a 100644 --- a/sources/README +++ b/sources/README @@ -14,17 +14,22 @@ under the corresponding chapter directory: ../synchronization/sources ../tasking/sources -This directory contains the test_codes script that performs +This directory contains the eval_codes script that performs a quick compilation test of all example codes (default). The -test results are stored in the test_codes.log file. The script +test results are stored in the eval_codes.log file. The script tries to automatically detect a compiler. Set the comp_c, comp_cc and comp_f variables if that doesn't work. - The test script (test_codes) is - ***** for reference purpose only and is NOT intended to validate ***** +*********************************************************************** +*** The test script (eval_codes) is for reference purpose only +*** and is NOT intended to validate OpenMP compliance of a compiler. +*********************************************************************** + + +The "check_tags" script can be used to check the validity of source +tags in source codes. The results are recorded in chk_tags.log. - OpenMP compliance of a compiler. July 31 2021 Changes * Automatic compiler determination (no need to specify comp_c, etc.) @@ -32,6 +37,12 @@ July 31 2021 Changes * Automatic Backdown (replacement) for deprecation if compiler is not 5.1/5.0 (replacements: masked->master,primary->master, *lock_hint*->*lock_sync*) * Automatic -c compiler flag for "linkable=no" metadata -* Utilities file, test_utils, created for clean coding +* Utilities file, eval_utils, created for clean coding * Command line now takes file name argument (just file name, not path) -* sourceme file: puts test_codes in PATH, creates tc alias, defines OMP_BASE_DI +* sourceme file: puts eval_codes in PATH, creates tc alias, defines OMP_BASE_DI + + +May 31 2022 Changes +* Reworked to use info from the tags "@@operation" and "@@version" +* Removed codes related to preprocessing + diff --git a/sources/check_tags b/sources/check_tags index 3bc6ee3..ff9e135 100755 --- a/sources/check_tags +++ b/sources/check_tags @@ -1,14 +1,59 @@ #!/bin/bash -# call ../util/chk_tags.x to check tags in source codes +# call util/chk_tags.x to check tags in source codes -BASE_DIR=$(dirname $0) -UTIL_DIR=${BASE_DIR}/../util -chk_tags=$UTIL_DIR/chk_tags.x +BASE_DIR=$(dirname $0)/.. CURR_DIR=$(pwd) +UTIL_DIR=$BASE_DIR/util +chk_tags=$UTIL_DIR/chk_tags.x +log_file=chk_tags.log cd $UTIL_DIR; make chk_tags.x; cd $CURR_DIR echo "Running $chk_tags ..." -$chk_tags ${BASE_DIR}/../*/sources/* 2>&1 | tee -a chk_tags.log + +# check specific files +cnt=0 +while (($#)); do + (( cnt = cnt + 1 )) + ff=$1 + echo $ff | grep '/' &> /dev/null + if [[ $? == 0 ]]; then + flist=$(ls $ff) + elif [[ $ff =~ .tex$ ]]; then + flist=$(ls $BASE_DIR/*/$ff) + else + flist=$(ls $BASE_DIR/*/sources/$ff) + fi + for f in $flist; do + if [[ $f =~ .tex$ ]]; then + echo " +>>> version tags in $f" | tee -a $log_file + $chk_tags -vtag $f 2>&1 | tee -a $log_file + else + echo " +>>> source tags and line length of $f" | tee -a $log_file + $chk_tags -sc $f 2>&1 | tee -a $log_file + $chk_tags -clen $f 2>&1 | tee -a $log_file + fi + done + shift +done +[[ $cnt -gt 0 ]] && exit + +# check all files +echo " +>>> Checking version tags in tex files" | tee -a $log_file +$chk_tags -vtag $BASE_DIR/*/*.tex 2>&1 | tee -a $log_file +echo " +>>> Checking tags and line length of source files" | tee -a $log_file +$chk_tags -sc $BASE_DIR/*/sources/* 2>&1 | tee -a $log_file +$chk_tags -clen $BASE_DIR/*/sources/* 2>&1 | tee -a $log_file + +echo " +>>> Checking if all source files are referenced in tex files" | tee -a $log_file +$chk_tags -v -list -vtag $BASE_DIR/*/*.tex | sort > msrc_in_tex.list +ls $BASE_DIR/*/sources/* | sort > msrc_files.list +diff -p msrc_in_tex.list msrc_files.list 2>&1 | tee -a $log_file +\rm -f msrc_in_tex.list msrc_files.list diff --git a/sources/eval_codes b/sources/eval_codes new file mode 100755 index 0000000..25d24e9 --- /dev/null +++ b/sources/eval_codes @@ -0,0 +1,363 @@ +#!/bin/bash + +#****************************************************************************** +# Author Henry Jin +# test example source-codes with C, C++ and Fortran compilers +# set in comp_* variables. +# Additions 2021-07-30 Kent Milfeld +# Command line entry of files to be tested. +# Automatic compiler determination +# Automatic version (DATE/NUMBER) determination +# Utilities file, eval_utils, created for clean coding +# 2022-05-31 Changes +# Use tag (@@operation + @@version) info from source files +# to set up test conditions +# Removed codes related to preprocessing +# 2022-05-31 Changes KM +# Now uses variable names with VER, NUM, REL +# for compiler VERsion, compiler version NUMber & RELease +# e.g. 5.0, 50 202111 +# Allows any combination types c/C++/f code evaluation +# Allows setting Compliance Version for Compiler (comp-ver/COMP_VER) +# (e.g. allows testing 5.0 code for Intel 4.5+ Compliant.) +# Removed aopt = 1/2/3. Changed to using variables/values that are relatable. +# Just uses no-omp for turning openmp off, no need for with-omp option +# Cleaned up eval_one_code selection for skipping due to COMP_VER/CODE_VER +# Cleaned up get_compiler_version_date_number +# +more error checking, prints more information about decisions +# Changed TEST_DEBUG to EVAL_DEBUG, print lines now have DEBUG: prefix +# +#****************************************************************************** + +BASE_DIR=$(dirname $0)/.. #Top level directory + +source $BASE_DIR/sources/eval_utils + +# Hard code Compiler names and flags here: comp_c, comp_cpp, comp_f, omp_flag +# Keep comp_c="" to automatically determine compiler parameters +# Specifying compiler system (amd,cray,gnu,ibm,intel,nvhpc) on command line, or +# setting env. var. COMP_SYS (to AMD,CRAY,GNU,IBM,INTEL,NVHPC), +# will override specifying compiler here, and auto detection.. + +comp_c="" +comp_cpp="" +comp_f="" +omp_flag="" + +#COMP_SYS=GNU #(or AMD,CRAY,IBM,INTEL) forces one of these compiler systems +(list in eval_utils) + +#========================= No need to change code below ======================= + +# command line option +do_with_omp=yes + +dryrun=0 #0:normal, 1:print commands without executing + +COMP_SYS="" +CODE_VER="" +COMP_VER="" +[[ -z $EVAL_DEBUG ]] && EVAL_DEBUG=0 +code_types="" + +while (($#)); do + case "$1" in + no-omp | -no-omp ) do_with_omp=no ;; + code-ver | -code-ver) shift; CODE_VER=$1 ;; + comp-ver | -comp-ver) shift; COMP_VER=$1 ;; + c-only | -c-only ) code_types+="c-only" ;; + cpp-only | -cpp-only) code_types+="C-only" ;; + f-only | -f-only ) code_types+="f-only" ;; + c-cpp-only | -c-cpp-only ) code_types+="c-C-only" ;; + dryrun | -dryrun ) dryrun=1 ;; + debug | -debug ) EVAL_DEBUG=1 ;; + cleanup | -cleanup ) + \rm -f *.o *.mod a.x exmpl_* + exit ;; + help | -h |-help) + echo "USAGE: eval_codes [options] + +options: meaning + -no-omp ; no OpenMP compilation flag + -code-ver ; code limit: eval codes of this version tag & lower (3.0,...) + -comp-ver ; assume Compiler is compliant with this version (3.0,...) + -c-cpp-only ; test C & C++ codes only + -c-only ; test C codes only + -cpp-only ; test C++ codes only + -f-only ; test Fortran codes only + -dryrun ; print commands without execution + -debug ; print debug information + -cleanup ; clean up temp files + amd | cray | gnu | ibm | intel | nvhpc + ; choose a compilation system (default is auto-detection) + ; one or more example codes to test" + exit ;; + + amd | AMD | aocc | AOCC ) COMP_SYS=AMD ;; + cray | CRAY | cce | CCE ) COMP_SYS=CRAY ;; + gnu | GNU ) COMP_SYS=GNU ;; + ibm | IBM | pwr | PWR ) COMP_SYS=IBM ;; + intel | INTEL ) COMP_SYS=INTEL;; + nvhpc | NVHPC| pgi | PGI ) COMP_SYS=NVHPC;; + #These will override auto detection, and comp_x setting below. + + *.f* ) FILES+=($1) ;; + *.c* ) FILES+=($1) ;; + * ) echo "*** unknown option - $1"; exit 1 ;; + esac + shift +done + +echo " +*** DISCLAIMER *** +*** eval_codes DOES NOT VALIDATE OpenMP COMPLIANCE OF A COMPILER. *** +*** eval_codes evaluates compile/link/run FOR EXAMPLES DEVELOPER TEAM. *** +" + +[[ -z "$code_types" ]] && code_types="c C f" # if code_types not set, default is all (c, C, f) + +[[ ! -z $COMP_SYS ]] && unset comp_c # If Compiler System Set (COMP_SYS or cmd line) unset comp_c. + # This will allow get_compiler_commands_and_omp_flag call. + +[[ ! -z $CODE_VER ]] && CODE_NUM=`echo $CODE_VER | sed -e 's/\.//'` + +# Set Compiler comp_c, comp_cpp, comp_f, omp_flag + +# *** If comp_c is hard coded above don't get compiler commands and omp_flag, use comp_x & omp_flag +[[ -z $comp_c ]] && get_compiler_commands_and_omp_flag + +# *** Always get Compiler _OPENMP Release Date and Compiler Version +get_compiler_version_date_number + +[[ $EVAL_DEBUG -gt 0 ]] && echo " DEBUG: Using CC=$comp_c FC=$comp_f omp_flag=$omp_flag Compile type(s) = $code_types ." +[[ $EVAL_DEBUG -gt 0 ]] && echo " DEBUG: Expected/Assuming Compiler Compliance: $COMP_VER" +[[ $EVAL_DEBUG -gt 0 ]] && echo " DEBUG: Evaluations limited to codes of this version or earlier: ${CODE_VER:-$COMP_VER}" + +# function to test one code ($f) +eval_one_code() { + local s opr copts="" verno="" tested="compile & link" TEST=CL + + if [[ -z $comp ]]; then + return + fi + + f_base=`basename $f` + ef=exmpl_${f_base} + ext=$1 + + if [[ $do_with_omp == no ]]; then + s=omp.h + if [[ "$ext" =~ ^f ]]; then + s="use omp_lib|omp_lib.h" + fi + egrep "$s" $f > /dev/null 2>&1 + if [ $? -eq 0 ]; then + printf " [ %-3s ] [ SKIP ][ %30s ] Requested NO OMP: but code uses header\n" "OMP" "$f_base" + (( cntskip = cntskip + 1 )) + return + fi + else + copts="$omp_flag" + fi + + opr=`grep -i '@@operation' $f | cut -d: -f2` + if [[ "$opr" =~ "view" ]]; then + printf " [ %-3s ] [ SKIP ][ %30s ] View Only\n" "V" "$f_base" + TEST=V + (( cntskip = cntskip + 1 )) + return + fi + if [[ "$opr" =~ "compile" ]]; then + copts+=" -c" + tested="compile only" + TEST=C + else + copts+=" -o a.x" + fi + + [[ "$opr" =~ "run" ]] && TEST=CLR + + # Consider Skipping Code + code_ver="" + if [ $do_with_omp == yes ]; then #only if compiling with OpenMP + + code_ver=`grep -i '@@version' $f | cut -d_ -f2` + [[ $code_ver == "omp" ]] && code_ver="" + verno=`echo $code_ver | sed -e 's/\.//'` + if [[ ! -z $verno ]]; then #Only consider skipping if verno != null + skip=" " + + #Check compiler compliance + [[ $verno -gt $COMP_NUM ]] && skip=" comp_yes" + + #check code limit + [[ ! -z $CODE_NUM ]] && [[ $verno -gt $CODE_NUM ]] && skip+=" code_yes" + + if [[ $skip =~ yes ]]; then + + printf " [ %-3s ] [ SKIP ][ %30s ] code is omp_$code_ver, " "$TEST" "$f_base" + printf "compiler limit is $COMP_VER " + if [[ $skip =~ code_yes ]]; then + printf " or code limit is $CODE_VER : $f_base \n" + else + printf " : $f_base\n" + fi + + (( cntskip = cntskip + 1 )) + return + + fi + + fi # if verno exists + fi #if using omp + + + s=`grep -i '@@depend' $f | cut -d: -f2 | cut -f2` + [[ ! -z $s ]] && copts+=" -I$(dirname $f)" + s=`grep -i '@@expect' $f | cut -d: -f2 | cut -f2` + [[ ! -z $s ]] && s="expect=$s" + [[ ! -z $code_ver ]] && s+=" omp_$code_ver" + + if [ $dryrun -gt 0 ]; then + printf " [$s]\n" >> $logf + return + fi + # compile and link if requested + CorCL=$TEST + [[ $TEST == CLR ]] && CorCL="CL" + \cp -f $f $ef + $comp $copts $ef >> $logf 2>&1 + + if [ $? -ne 0 ]; then + printf "***" >> $logf + printf " [ %-3s ] [ FAILED %-2s ][ %30s ] %s" "$TEST" "$CorCL" "$f_base" "$s" | tee -a $logf + (( cntfail = cntfail + 1 )) + else + printf " [ %-3s ] [ PASSED %-2s ][ %30s ]" "$TEST" "$CorCL" "$f_base" | tee -a $logf + if [[ "$opr" =~ "run" && -e a.x ]]; then + TEST=R + fi + fi + echo " >>> $comp $copts $f" | tee -a $logf + + # run the compiled code + if [[ $TEST == R ]]; then + $BASE_DIR/sources/run_code ./a.x $ef >> $logf 2>&1 + if [ $? -ne 0 ]; then + printf " [ ] [ FAILED R ][ %30s ] %s" "$f_base" "$s" | tee -a $logf + (( cntfail = cntfail + 1 )) + else + printf " [ ] [ SUCCESS R ][ %30s ]" "$f_base" | tee -a $logf + fi + echo " ... ran compiled code" | tee -a $logf + fi + + # clean up + \rm -f *.o *.mod *.x + \rm -f $ef +} + +# start testing +cntc=0 +cntcpp=0 +cntf=0 +cntffree=0 +cntskip=0 +cntfail=0 +logf=eval_codes.log + +printf "\nLegend: [ ] C=Compile L=Link R=Run V=View\n" + +# SELECTED FILE PROCESSING +if [[ ! -z $FILES ]]; then + + echo -e " >>> TESTING: ${#FILES[*]} files\n" + + for ff in ${FILES[@]}; do + + echo $ff | grep '/' &> /dev/null + if [[ $? == 0 ]]; then + flist=$(ls $ff) + else + flist=$(ls $BASE_DIR/*/sources/$ff) + fi + for f in $flist; do + + if [[ $f =~ .c$ ]]; then + comp=$comp_c + (( cntc = cntc + 1 )) + eval_one_code c + elif [[ $f =~ .cpp$ ]]; then + comp=$comp_cpp + (( cntcpp = cntcpp + 1 )) + eval_one_code cpp + elif [[ $f =~ .f$ ]]; then + comp=$comp_f + (( cntf = cntf + 1 )) + eval_one_code f + elif [[ $f =~ .f90$ ]]; then + comp=$comp_f + (( cntffree = cntffree + 1 )) + eval_one_code f90 + fi + + done + done + +else + +# BULK PROCESSING + if [[ $code_types =~ c ]]; then + comp=$comp_c + for f in $BASE_DIR/*/sources/*.c; do + (( cntc = cntc + 1 )) + eval_one_code c + done + fi + + if [[ $code_types =~ C ]]; then + comp=$comp_cpp + for f in $BASE_DIR/*/sources/*.cpp; do + (( cntcpp = cntcpp + 1 )) + eval_one_code cpp + done + fi + + if [[ $code_types =~ f ]]; then + comp=$comp_f + for f in $BASE_DIR/*/sources/*.f; do + (( cntf = cntf + 1 )) + eval_one_code f + done + + for f in $BASE_DIR/*/sources/*.f90; do + (( cntffree = cntffree + 1 )) + eval_one_code f90 + done + fi + +fi + +# print summary stats +(( cntotal = cntc + cntcpp + cntf + cntffree )) +echo " +C compiler = $comp_c +C++ compiler = $comp_cpp +Fortran compiler = $comp_f +OpenMP flag = $omp_flag" | tee -a $logf + +if [[ ! -z $DATE_OPENMP ]]; then + echo "Compiler Version = $COMP_VER_FROM_OPENMP_DATE ($COMP_REL) " | tee -a $logf + #echo " Comp_openmp=$COMP_VER_FROM_OPENMP_DATE CoMPVER=$COMP_VER" + [[ $COMP_VER_FROM_OPENMP_DATE != $COMP_VER ]] && echo "User set support = $COMP_VER " | tee -a $logf +fi + +echo " +Total number of C examples : $cntc +Total number of C++ examples : $cntcpp +Total number of F-fixed examples: $cntf +Total number of F-free examples : $cntffree + +Total number of files : $cntotal +Total number of files skipped : $cntskip +Total number of failed examples : $cntfail" | tee -a $logf diff --git a/sources/eval_utils b/sources/eval_utils new file mode 100644 index 0000000..4ab0e6b --- /dev/null +++ b/sources/eval_utils @@ -0,0 +1,216 @@ +COMP_RELS=( 202111 202011 201811 201511 201307 201107 200805 ) +COMP_REL_2_NUM=( [202111]=52 [202011]=51 [201811]=50 [201511]=45 [201307]=40 [201107]=31 [200805]=30 ) + +add_decimal(){ sed 's/\([0-9]\)/\1./' <<< $1; } # replace 1st # with #. +rm_decimal(){ sed 's/\(\.\)//' <<< $1; } # replace . with blank + +for i in ${COMP_RELS[@]}; do #loop over Release Dates (e.g. 202011) + num=${COMP_REL_2_NUM[$i]} #Release Date hash has Compiler Numbers (e.g. 51) + ver=${num:0:1}\.${num:1} #Change Release Number to Compiler Version (e.g. 5.1) + COMP_VERS+=($ver) #Make an array of Compiler Versions +done + +get_compiler_version_date_number(){ + [[ $EVAL_DEBUG -gt 0 ]] && echo " DEBUG: BEGIN get_compiler_version_date_number" + + cat <<' EOF' >version.c + #include + #include + int main(){ printf("%d\n", _OPENMP);} + EOF + DATE_OPENMP=$( $comp_c -o a.x $omp_flag version.c; ./a.x; rm -f version.c a.x ) + + FORCE_COMP_VER="no" + if [[ ! -z $COMP_VER ]]; then + FORCE_COMP_VER=yes + fi + comp_num="" + if [[ ! -z $DATE_OPENMP ]]; then + for rd in ${COMP_RELS[@]}; do + if [[ $DATE_OPENMP -ge $rd ]]; then + + if [[ $rd -ne $DATE_OPENMP ]]; then + + comp_num=${COMP_REL_2_NUM[$rd]} + comp_ver=$(add_decimal $comp_num) + COMP_VER_FROM_OPENMP_DATE=$comp_ver + COMP_REL=$rd + + printf " -> Compiler $comp_c reported _OPENMP = $DATE_OPENMP. Valid Releases are: $prev_rd and $rd.\n" + printf " -> This could be a Technical Report Date.\n\n" + + # If not Forced compiler version (e.g. cmd ln comp-ver), set COMP_NUM/VER here from _OPENMP + if [[ $FORCE_COMP_VER == no ]]; then + COMP_VER=$comp_ver + COMP_NUM=$comp_num + + printf " -> ** ASSUMING COMPLIANCE at Version $COMP_VER (Release Date $COMP_REL) from _OPENMP in $comp_c.\n\n" + printf " -> To force Compiler Version use cmd line comp-ver option or set COMP_VER env. var to one of:\n" + printf " -> ${COMP_VERS[*]}\n" + fi + fi + + if [[ $DATE_OPENMP -eq $rd ]]; then + + comp_num=${COMP_REL_2_NUM[$rd]} + comp_ver=$(add_decimal $comp_num) + COMP_VER_FROM_OPENMP_DATE=$comp_ver + COMP_REL=$rd + if [[ $FORCE_COMP_VER == no ]]; then + COMP_VER=$comp_ver + COMP_NUM=$comp_num + printf " -> ** Using Compliant Version $COMP_VER (Release Date $COMP_REL) from _OPENMP in compiler $comp_c.\n" + fi + + fi + + if [[ $DATE_OPENMP -eq $rd ]] && [[ $FORCE_COMP_VER == yes ]] ; then + printf " -> ** Informational: $comp_c is Version $comp_ver (Release Date $rd) from _OPENMP.\n" + fi + + break + + fi + prev_rd=$rd + done + fi + + if [[ $FORCE_COMP_VER == yes ]]; then #if Forced compiler VER. check and set COMP_NUM + + if [[ ! "$COMP_VER" =~ ^[0-9]\.{0,1}[0-9]$ ]] ; then + echo " -> ERROR: Wrong Syntax for COMP_VER environment variable." + echo " -> Format Version: #.# (or use number ##)." + echo " -> Read Value: COMP_VER=$COMP_VER" + echo " -> Must be one of {${COMP_VERS[@]}}" + echo " -> or corresponding number {${COMP_REL_2_NUM[@]}}" + exit 1 + fi + # COMP_VER can have decimal or not (for convenience) + if [[ $COMP_VER =~ \. ]]; then + comp_ver=$COMP_VER + comp_num=$(rm_decimal $COMP_VER) + else + comp_ver=$(add_decimal $COMP_VER) + comp_num=$COMP_VER + fi + + found_force_compliance=no #Make sure $COMP_VER exits: look through COMP_NUMS + for i in ${!COMP_REL_2_NUM[@]}; do #Loop over releases + if [[ ${COMP_REL_2_NUM[$i]} -eq $comp_num ]]; then #get COMP_NUM from hash and compare + comp_rel=$i + found_force_compliance=yes + break + fi + done + + if [[ $found_force_compliance == no ]]; then + echo " -> ERROR: Not a valid Compiler Version used in COMP_VER." + echo " -> Read Value: COMP_VER=$COMP_VER" + echo " -> Must be one of {${COMP_VERS[@]}}" + echo " -> or corresponding number {${COMP_REL_2_NUM[@]}}" + exit 1 + fi + + COMP_NUM=$comp_num + COMP_VER=$comp_ver + COMP_REL=$comp_rel + + echo " -> Compiler Version from cmd line: comp-ver=$COMP_VER" + echo " -> ASSUMING COMPLIANCE at Version: $COMP_VER" + echo " -> corresponding to Release Date: $COMP_REL" + + fi + + + if [ -z $COMP_NUM ]; then + echo "Can't determine an OpenMP version number from $comp_c" + exit 1 + fi + + [[ $EVAL_DEBUG -gt 0 ]] && echo " DEBUG: Determined: COMP_REL=$COMP_REL COMP_VER=$COMP_VER" + [[ $EVAL_DEBUG -gt 0 ]] && echo " DEBUG: END get_compiler_version_date_number" && echo "" +} + +get_compiler_commands_and_omp_flag(){ + # Determine compiler and return compiler commands + + local found="" + + [[ $EVAL_DEBUG -gt 0 ]] && echo -e "\n DEBUG: BEGIN get_compiler_commands_and_omp_flag:" + + if [[ -z $COMP_SYS ]]; then + + command -v nvc &> /dev/null + [[ $? == 0 ]] && COMP_SYS="NVHPC" found+=" $COMP_SYS" + + command -v icc &> /dev/null + [[ $? == 0 ]] && COMP_SYS="INTEL" found+=" $COMP_SYS" + + command -v xlc &> /dev/null + [[ $? == 0 ]] && COMP_SYS="IBM" found+=" $COMP_SYS" + + command -v ftn &> /dev/null + [[ $? == 0 ]] && COMP_SYS="CRAY" found+=" $COMP_SYS" + + command -v clang &> /dev/null + [[ $? == 0 ]] && COMP_SYS="AMD" found+=" $COMP_SYS" + + command -v gcc &> /dev/null + [[ $? == 0 ]] && COMP_SYS="GNU" found+=" $COMP_SYS" + + [[ ! -z $COMP_SYS ]] && printf " -> Detected compilers:$found. If multiple compilers, will use last found.\n" + + fi + + if [[ "$COMP_SYS" == 'GNU' ]]; then + comp_c=gcc comp_cpp=g++ omp_flag="-fopenmp" + command -v gfortran &> /dev/null + [[ $? == 0 ]] && comp_f=gfortran + elif [[ "$COMP_SYS" == 'IBM' ]]; then + comp_c=xlc_r comp_cpp=xlC_r omp_flag="-qsmp" + command -v flang &> /dev/null + [[ $? == 0 ]] && comp_f=xlf90_r + elif [[ "$COMP_SYS" == 'INTEL' ]]; then + comp_c=icc comp_cpp=icpc omp_flag="-qopenmp" + command -v ifort &> /dev/null + [[ $? == 0 ]] && comp_f=ifort + elif [[ "$COMP_SYS" == 'AMD' ]]; then + comp_c=clang comp_cpp=clang++ omp_flag="-fopenmp" + command -v flang &> /dev/null + [[ $? == 0 ]] && comp_f=flang + elif [[ "$COMP_SYS" == 'CRAY' ]]; then + comp_c=cc comp_cpp=CC omp_flag="-homp" + comp_f=ftn + elif [[ "$COMP_SYS" == 'NVHPC' ]]; then + comp_c=nvc comp_cpp=nvc++ omp_flag="-mp" + command -v nvfortran &> /dev/null + [[ $? == 0 ]] && comp_f=nvfortran + fi + + [[ ! -z $comp_c ]] && echo " -> Using compiler system: $COMP_SYS" + + if [[ -z $comp_c ]]; then + echo " >>> Auto detection of GNU, AMD, CRAY, INTEL, IBM, and NVHPC compilers failed". + echo " (SYSTEM must have a Fortran compiler.)" + echo " >>> REQUIREMENT: Must set compiler info (comp_xxx variables,...) in eval_codes:" + echo " ** comp_c, comp_cpp, comp_f, and omp_flag" + echo " or set COMP_SYS env. var. to one of: GNU, AMD, CRAY, INTEL, IBM, or NVHPC." + echo " See COMP_SYS array in eval_utils comp_xxx values." + exit 1 + fi + + # AMD INTEL IBM + # ARCH x86_64 x86_64 ppc64le + # VENID AuthenticAMD GenuineIntel N/A + command -v lscpu &> /dev/null + if [[ $? == 0 ]]; then + ARCH=$(lscpu | grep Architecture) + [[ $EVAL_DEBUG -gt 0 ]] && echo " DEBUG: lscpu FOUND Architecture: $ARCH" + + VENID=$(lscpu | grep -i "Vendor ID:") + [[ $EVAL_DEBUG -gt 0 ]] && echo " DEBUG: lscpu FOUND Vendor ID: $VENID" + fi + + [[ $EVAL_DEBUG -gt 0 ]] && echo " DEBUG: FOUND CC: $comp_c CXX: $comp_cpp FC: $comp_f omp_flag: $omp_flag" + [[ $EVAL_DEBUG -gt 0 ]] && echo " DEBUG: END get_compiler_commands_and_omp_flag" && echo "" +} diff --git a/sources/run_code b/sources/run_code new file mode 100755 index 0000000..a162579 --- /dev/null +++ b/sources/run_code @@ -0,0 +1,20 @@ +#!/bin/bash + +basedir=$(dirname $0) +cmd=$1 +ef=$2 +envfile=exmpl_test_envs +if [ ! -z $ef ]; then + $basedir/../util/list_tags -env $ef | tee $envfile + source $envfile +fi + +s=0 +if [ -e $cmd ]; then + $cmd + s=$? +fi +if [ -e $envfile ]; then + \rm -f $envfile +fi +exit $s diff --git a/sources/sourceme b/sources/sourceme index aef5535..03e664f 100644 --- a/sources/sourceme +++ b/sources/sourceme @@ -1,3 +1,3 @@ -export PATH=`pwd`:$PATH #put test_cases in path +export PATH=`pwd`:$PATH #put eval_cases in path export OMP_BASE_DIR=$( dirname `pwd` ) #directory above pwd is base -alias tc=test_codes +alias ec=eval_codes diff --git a/sources/test_codes b/sources/test_codes deleted file mode 100755 index e24ad8a..0000000 --- a/sources/test_codes +++ /dev/null @@ -1,241 +0,0 @@ -#!/bin/bash - -#******************************************************************************************* -# Author Henry Jin -# test example source-codes with C, C++ and Fortran compilers -# set in comp_* variables. - - -# Additions 2021-07-30 Kent Milfeld -# Command line entry of files to be tested. -# Automatic compiler determination -# Automatic version (DATE/NUMBER) determination -# Automatic Backdown for deprecation if compiler is not 5.1 -# (masked->master,primary->master, *lock_hint*->*sync_hint*) -# Automatic -c compiler flag for "linkable=no" metadata -# save command line option to save preprocessed files (have exmpl_ prefix) -# Utilities file, test_utils, created for clean coding -#******************************************************************************************* - -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null && pwd )" #location of test_cases -BASE_DIR=$(dirname $DIR) #Top level directory - -source test_utils - -# Hard code Compiler names and flags here: comp_c, comp_cpp, comp_f, omp_flag, fpp_flag -# Keep comp_c="" to automatically determine compiler parameters -# Specifying compiler system (amd,cray,gnu,ibm,intel) on command line, or -# setting env. var. COMP (to AMD,CRAY,GNU,IBM,INTEL), -# will override specifying compiler here, and auto detection.. - -comp_c="" -comp_cpp="" -comp_f="" -omp_flag="" -fpp_flag="" - -#COMP=GNU #(or AMD,CRAY,IBM,INTEL) forces one of these compiler systems (list in test_utils) - -#Compiler version DATE (e.g. 202011) and version NUMBER (e.g. 5.1) -#Function below will set these for you. -#If you set them here, auto detection function will not be called. - -VER_DATE="" -VER_NUM="" -NA_VER_NUMS=() - -#export OMP_DEBUG=1 #you can set this outside of test_cases - -printf "\n **** text_code ONLY tests compilation, and linking (when linkable=yes). ****" -printf "\n **** text_code does NOT validate examples. It just compiles them. ****\n\n" - -#=========================== No need to change code below =================================== - -# command line option -aopt=2 #default(auto), 0:no-omp, 1:with-omp - -while (($#)); do - case "$1" in - no-omp | -no-omp ) aopt=0 ;; - with-omp | -with-omp) aopt=1 ;; - auto | -auto ) aopt=2 ;; - save | -save ) save_pp_files=on ;; - help | -h |-help) - echo "USAGE: test_codes [options] - - options: meaning - -no-omp : no OpenMP compilation flag - -with-omp : with OpenMP compilation flag - -auto : (default) auto-detection - based on include files - -save : save preprocessed files - : one or more example codes to test " - exit ;; - - amd | AMD | oacc | OACC ) COMP=AMD comp_c="" ;; #comp_c="" => call get_compiler_commands_and_omp_flag - cray | CRAY | cce | CCE ) COMP=CRAY comp_c="" ;; - gnu | GNU ) COMP=GNU comp_c="" ;; - ibm | IBM | pwr | PWR ) COMP=IBM comp_c="" ;; - intel | INTEL ) COMP=INTEL comp_c="" ;; - #These will override auto detection, and comp_x setting below. - - *.f* ) FILES+=($1) ;; - *.c* ) FILES+=($1) ;; - esac - shift -done -# Set Compiler comp_c, comp_cpp, comp_f, omp_flag, fpp_flag -# *** If comp_c is set, it is assumed all above comp_x/x_flag are set -[[ -z $comp_c ]] && get_compiler_commands_and_omp_flag -[[ -z $VER_DATE ]] && get_compiler_version_date # can set as env. var. for testing -[[ -z $NA_VER_NUMS ]] && get_compiler_version_number # get VER_NUMs which compiler doesn't support (NA) - -[[ ! -z $NA_VER_NUMS ]] && REPLACE=ON - -echo -e " >>> TESTING: ${FILES[@]}\n" - -# function to test one code ($f) -test_one_code() { - local link_opt inc_suffix inc_opt comment fort_opts tested="compile & link" - - f_base=`basename $f` - ef=exmpl_${f_base} - ext=$1 - \cp -f $f $ef - opts="" - - if [ $aopt -eq 1 ]; then - opts=" $copt" - elif [ $aopt -ne 0 ]; then - sstr=omp.h - if [ "$ext" == "f" -o "$ext" == "f90" ]; then - sstr="use omp_lib|omp_lib.h" #Can non-header files require copt? - fi #Why not always have copt? KM - egrep "$sstr" $ef > /dev/null 2>&1 && opts=" $copt" - fi - - grep -ie '@@linkable\s*:\s*.*no' $ef &>/dev/null - [[ $? == 0 ]] && link_opt="-c" && tested="compile only" - - grep -ie '@@\s*requires\s*:\s*.*preprocessing' $ef &>/dev/null - [[ $? == 0 ]] && fort_opts="$fpp_flag" #JIC fpp needed for any reason - - if [[ $REPLACE == ON ]]; then - for no in ${NA_VER_NUMS[@]}; do - ver_date=${VNUM2DATE[$no]} - grep -e '\s*#if\s*_OPENMP\s*<\s*'${ver_date}'\s*' $ef &>/dev/null - if [[ $? == 0 ]]; then - [ "$ext" == "f" -o "$ext" == "f90" ] && fort_opts="$fpp_flag" - echo " -> Backing down from $no on $f_base code" - #uncomment lines if they are commented out-- What about unwanted version - #sed 's@\s*'$comment'\s*\(#\(if\|define\|endif\)\($\|\s\).*\)@\1@' $ef - fi - done - fi - - spaces=" " - eval EVAL=$f - short_f=$(echo $EVAL | sed s@$BASE_DIR@\$OMP_BASE_DIR@) - printf " >>> %-36s %-50s " \ - "$comp $omp_flag $inc_opt $fort_opts $link_opt" "$short_f${spaces:40}" | tee -a $logf - $comp $omp_flag $inc_opt $fort_opts $link_opt $ef >> $logf 2>&1 - - if [ $? -ne 0 ]; then - printf "***" >> $logf - printf " [FAILED]\n" | tee -a $logf - (( cntfail = cntfail + 1 )) - else - printf " %-25s\n" "[PASSED: $tested]" - fi - \rm -f *.o *.mod - [[ ! ( $REPLACE == ON && $save_pp_files == on) ]] && \rm -f $ef - printf " ------------------------------------------------------\n\n" -} - -# start testing -copt=$omp_flag - -cntc=0 -cntcpp=0 -cntf=0 -cntffree=0 -cntfail=0 -logf=test_codes.log - -# SELECTED FILE PROCESSING -if [[ ! -z $FILES ]]; then - - for ff in ${FILES[@]}; do - - f=$BASE_DIR/*/sources/$ff - - if [[ $f =~ .c$ ]]; then - comp=$comp_c - (( cntc = cntc + 1 )) - test_one_code c - fi - - if [[ $f =~ .cpp$ ]]; then - comp=$comp_cpp - (( cntcpp = cntcpp + 1 )) - test_one_code cpp - fi - - if [[ $f =~ .f$ ]]; then - comp=$comp_f - (( cntf = cntf + 1 )) - test_one_code f - fi - - if [[ $f =~ .f90$ ]]; then - comp=$comp_f - f=$BASE_DIR/*/sources/$ff - (( cntffree = cntffree + 1 )) - test_one_code f90 - fi - done - exit #No need for bulk processing information - -fi - -# BULK PROCESSING -if [[ -z $FILES ]]; then - - comp=$comp_c - for f in ../*/sources/*.c; do - (( cntc = cntc + 1 )) - test_one_code c - done - - comp=$comp_cpp - for f in ../*/sources/*.cpp; do - (( cntcpp = cntcpp + 1 )) - test_one_code cpp - done - - comp=$comp_f - for f in ../*/sources/*.f; do - (( cntf = cntf + 1 )) - test_one_code f - done - - for f in ../*/sources/*.f90; do - (( cntffree = cntffree + 1 )) - test_one_code f90 - done - -fi - -# print summary stats -echo " -C compiler = $comp_c -C++ compiler = $comp_cpp -Fortran compiler = $comp_f -OpenMP flag = $omp_flag - - -Total number of C examples : $cntc -Total number of C++ examples : $cntcpp -Total number of F-fixed examples: $cntf -Total number of F-free examples : $cntffree -Total number of failed examples : $cntfail" | tee -a $logf diff --git a/sources/test_utils b/sources/test_utils deleted file mode 100644 index 4087767..0000000 --- a/sources/test_utils +++ /dev/null @@ -1,102 +0,0 @@ - -VDATES=( 202011 201811 201511 201307 201107 200805 ) -VNUM2DATE=( [51]=202011 [50]=201811 [45]=201511 [40]=201307 [31]=201107 [30]=200805 ) -VDATE2NUM=( [202011]=51 [201811]=50 [201511]=45 [201307]=40 [201107]=31 [200805]=30 ) - -get_compiler_version_date(){ - # Uses CC and omp_flag (compiler options) to get the VER_DATE (e.g. 200805) from compiler - [[ ! -z $TEST_DEBUG ]] && echo -e "\n -> INSIDE get_compiler_version_date:" - - cat <<' EOF' >version.c - #include - #include - int main(){ printf("%d\n", _OPENMP);} - EOF - VER_DATE=$( $comp_c $omp_flag version.c; ./a.out; rm -f version.c a.out ) - VER_NUM=${VDATE2NUM[$VER_DATE]} - [[ ! -z $TEST_DEBUG ]] && echo " Finished, FOUND VER_DATE=$VER_DATE ($VER_NUM)" -} - -get_compiler_version_number(){ - # Uses VER_DATE (e.g. 200805) to determine not_available VER_NUMs, NA_VER_NUMS (4.g. 30) - [[ ! -z $TEST_DEBUG ]] && echo -e "\n -> INSIDE get_compiler_version_number:" - - for i in $(seq 0 $(( ${#VDATES[@]} - 1 )) ) ; do - if [[ "${VDATES[$i]}" -gt "$VER_DATE" ]]; then - #echo "HERE $i $VER_DATE ${VDATES[$i]}" - NA_VER_NUMS+=( ${VDATE2NUM[ ${VDATES[$i]} ]} ) - [[ ! -z $TEST_DEBUG ]] && echo " FOUND: ${VDATES[$i]} <= $VER_DATE, Compiler earlier than $NA_VER_NUMS." - fi - done - - [[ ! -z $TEST_DEBUG ]] && echo -e " Finished, using Compiler $VER_DATE (${VDATE2NUM[$VER_DATE]}).\n" -} - - -get_compiler_commands_and_omp_flag(){ - # Determine compiler and return compiler commands - - local found="" - - [[ ! -z $TEST_DEBUG ]] && echo -e "\n -> INSIDE get_compiler_commands_and_omp_flag:" - - comp_c="" comp_cpp="" comp_f="" fixed_flags="" fpp_flag="" omp_flag="" - - #Force - [[ "$COMP" == 'GNU' ]] && comp_c=gcc comp_cpp=g++ comp_f=gfortran fixed_flag="-ffixed-form" fpp_flag="-cpp" omp_flag="-fopenmp" - [[ "$COMP" == 'IBM' ]] && comp_c=xlc_r comp_cpp="xlC_r" comp_f=xlf90_r fixed_flag="-qfixed" fpp_flag="-qpreprocess" omp_flag="-qsmp" - [[ "$COMP" == 'INTEL' ]] && comp_c=icc comp_cpp=icpc comp_f=ifort fixed_flag="-fixed" fpp_flag="-fpp" omp_flag="-qopenmp" - [[ "$COMP" == 'AMD' ]] && comp_c=clang comp_cpp=clang++ comp_f=flang fixed_flag="-Mfixed" fpp_flag="-cpp" omp_flag="-fopenmp" - [[ "$COMP" == 'CRAY' ]] && comp_c=cc comp_cpp=CC comp_f=ftn fixed_flag="-f fixed" fpp_flag="-e F" omp_flag="-homp" - #use reasonable names instead of AOCC(AMD), CCE(CRAY),... - - [[ ! -z $comp_c ]] && echo " Using $COMP compiler system as provided in the COMP environment variable" - - if [[ -z $comp_c ]]; then - - command -v gcc -v &> /dev/null - [[ $? == 0 ]] && comp_c=gcc comp_cpp=g++ comp_f=gfortran fixed_flag="-ffixed-form" fpp_flag="-cpp" omp_flag="-fopenmp" found+=" GNU" - - command -v flang -v &> /dev/null - [[ $? == 0 ]] && comp_c=clang comp_cpp=clang++ comp_f=flang fixed_flag="-Mfixed" fpp_flag="-cpp" omp_flag="-fopenmp" found+=" CLANG" - - command -v ftn -v &> /dev/null - [[ $? == 0 ]] && comp_c=cc comp_cpp=CC comp_f=ftn fixed_flag="-f fixed" fpp_flag="-e F" omp_flag="-homp" found+=" CRAY" - - command -v icc -v &> /dev/null - [[ $? == 0 ]] && comp_c=icc comp_cpp=icpc comp_f=ifort fixed_flag="-fixed" fpp_flag="-fpp" omp_flag="-qopenmp" found+=" INTEL" - - command -v xlc -v &> /dev/null - [[ $? == 0 ]] && comp_c=xlc_r comp_cpp="xlC_r" comp_f=xlf90_r fixed_flag="-qfixed" fpp_flag="-qpreprocess" omp_flag="-qsmp" found+=" IBM" - - [[ ! -z $comp_c ]] && printf " Detected compilers: $found If multiple compilers, will use last found.\n" - - fi - - if [[ -z $comp_c ]]; then - echo " >>> Auto detection of GNU, CLANG, CRAY, INTEL, and IBM SYSTEM compilers failed". - echo " (flang is used to detect CLANG compiler, SYSTEM must have Fortran compiler.)" - echo " >>> REQUIREMENT: Must set compiler info (comp_xxx variables,...) in test_codes:" - echo " ** comp_c, comp_cpp, comp_f, fixed_flag, fpp_flag and omp_flag" - echo " or set COMP env. var. to one of: GNU, CLANG, CRAY, INTEL, or IBM." - echo " See COMP array in test_utils comp_xxx values." - exit 1 - fi - - - command -v lspu &> /dev/null - if [[ $? == 0 ]]; then - # # AMD HPE INTEL IBM - ARCH=$(lscpu | grep Architecture) # x86_64 x86_64 ppc64le - [[ ! -z $TEST_DEBUG ]] && echo " lscpu FOUND Architecture: $ARCH" - - # # AMD HPE INTEL IBM - VENID=$(lscpu | grep -i "Vendor ID:") # AuthenticAMD GenuineIntel NA - [[ ! -z $TEST_DEBUG ]] && echo " lscpu FOUND Vendor ID: $VENID" - fi - - - [[ ! -z $TEST_DEBUG ]] && echo " Finished, FOUND CC: $comp_c CXX: $comp_cpp F90: $comp_f" - [[ ! -z $TEST_DEBUG ]] && echo " Finished, FOUND omp_flag: $omp_flag Fortran flags: Fixedform=$fixed_flag Preprocess=$fpp_flag" -} - diff --git a/synchronization/acquire_release.tex b/synchronization/acquire_release.tex index 0adab37..6817bdd 100644 --- a/synchronization/acquire_release.tex +++ b/synchronization/acquire_release.tex @@ -132,7 +132,7 @@ construct used in Example 2 for thread 1. %The code performs the same thread synchronization of the previous example, with only a slight %coding change. %The explicit \code{release} and \code{acquire} clauses of the atomic construct has been -%replaced with implicit release and aquire flushes of explicit \code{flush} constructs. +%replaced with implicit release and acquire flushes of explicit \code{flush} constructs. %(Here, the \code{atomic} constructs have \plc{relaxed} operations.) %} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%3 diff --git a/synchronization/atomic_cas.tex b/synchronization/atomic_cas.tex new file mode 100644 index 0000000..1a4350e --- /dev/null +++ b/synchronization/atomic_cas.tex @@ -0,0 +1,42 @@ +\pagebreak +\section{Atomic Compare} +\label{sec:cas} + +\index{constructs!atomic@\code{atomic}} +\index{atomic construct@\code{atomic} construct} +\index{clauses!capture@\code{capture}} +\index{clauses!compare@\code{compare}} +\index{capture clause@\code{capture} clause} +\index{compare clause@\code{compare} clause} + +In OpenMP 5.1 the \scode{compare} clause was added to the extended-atomic clauses. +The \scode{compare} clause extends the semantics to perform the \scode{atomic} +update conditionally. + +In the following C/C++ example, two formats of structured blocks +are shown for associated \scode{atomic} constructs with the \scode{compare} clause. +In the first \scode{atomic} construct, the format forms a conditional update statement. +In the second \scode{atomic} construct the format forms a conditional expression statement. +The ``greater than'' and ``less than'' forms are not available with the Fortran \scode{compare} +clause. One can use the \splc{max} and \splc{min} functions with the \scode{atomic}~\scode{update} +construct to perform the C/C++ example operations. + +\cexample[5.1]{cas}{1} +%\ffreeexample[5.1]{cas}{1} + +In OpenMP 5.1 the \scode{compare} clause was also added to support Compare And +Swap (CAS) semantics. In the following example the \splc{enqueue} routine +(a naive implementation of a Michael and Scott enqueue function), uses the +\scode{compare} clause, with the \scode{capture} clause, to perform and compare +(\splc{q->head == node->next}) and swap (\splc{if-else} assignments) of the +form: +\begin{description}[noitemsep,labelindent=5mm,widest=f90] +\item \splc{{ r = x == e; if(r) { x = d; } else { v = x; } }}. +\end{description} +The example program concurrently enqueues nodes from an array of nodes (\splc{nodes[N]}). +Since the equivalence of Fortran pointers can be determined only with a function (such as associated), +no Fortran version is provided here. The use of the associated function in an atomic compare syntax is +being considered in a future release. + +\cexample[5.1]{cas}{2} +%\ffreeexample[5.1]{cas}{2} diff --git a/synchronization/sources/acquire_release.1.c b/synchronization/sources/acquire_release.1.c index b6ca12d..4da2711 100644 --- a/synchronization/sources/acquire_release.1.c +++ b/synchronization/sources/acquire_release.1.c @@ -1,12 +1,10 @@ /* -* @@name: acquire_release.1 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.0 +* @@name: acquire_release.1 +* @@type: C +* @@operation: run +* @@expect: success +* @@version: omp_5.0 */ - #include #include diff --git a/synchronization/sources/acquire_release.1.f90 b/synchronization/sources/acquire_release.1.f90 index 8ac677f..3023e1d 100644 --- a/synchronization/sources/acquire_release.1.f90 +++ b/synchronization/sources/acquire_release.1.f90 @@ -1,10 +1,8 @@ -! @@name: acquire_release.1 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_5.0 - +! @@name: acquire_release.1 +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: omp_5.0 program rel_acq_ex1 use omp_lib integer :: x, y, thrd, tmp diff --git a/synchronization/sources/acquire_release.2.c b/synchronization/sources/acquire_release.2.c index 60e4d4d..276d204 100644 --- a/synchronization/sources/acquire_release.2.c +++ b/synchronization/sources/acquire_release.2.c @@ -1,12 +1,10 @@ /* -* @@name: acquire_release.2 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.0 +* @@name: acquire_release.2 +* @@type: C +* @@operation: run +* @@expect: success +* @@version: omp_5.0 */ - #include #include diff --git a/synchronization/sources/acquire_release.2.f90 b/synchronization/sources/acquire_release.2.f90 index 2507aa5..4b4c16a 100644 --- a/synchronization/sources/acquire_release.2.f90 +++ b/synchronization/sources/acquire_release.2.f90 @@ -1,10 +1,8 @@ -! @@name: acquire_release.2 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_5.0 - +! @@name: acquire_release.2 +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: omp_5.0 program rel_acq_ex2 use omp_lib integer :: x, y, thrd, tmp diff --git a/synchronization/sources/acquire_release.3.c b/synchronization/sources/acquire_release.3.c index 26aedfa..13a8a18 100644 --- a/synchronization/sources/acquire_release.3.c +++ b/synchronization/sources/acquire_release.3.c @@ -1,12 +1,10 @@ /* -* @@name: acquire_release.3 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.0 +* @@name: acquire_release.3 +* @@type: C +* @@operation: run +* @@expect: success +* @@version: omp_5.0 */ - #include #include diff --git a/synchronization/sources/acquire_release.3.f90 b/synchronization/sources/acquire_release.3.f90 index 73dd7bf..f53bf3d 100644 --- a/synchronization/sources/acquire_release.3.f90 +++ b/synchronization/sources/acquire_release.3.f90 @@ -1,10 +1,8 @@ -! @@name: acquire_release.3 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_5.0 - +! @@name: acquire_release.3 +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: omp_5.0 program rel_acq_ex3 use omp_lib integer :: x, y, thrd, tmp diff --git a/synchronization/sources/acquire_release_broke.4.c b/synchronization/sources/acquire_release_broke.4.c index 4e575e3..79e3621 100644 --- a/synchronization/sources/acquire_release_broke.4.c +++ b/synchronization/sources/acquire_release_broke.4.c @@ -1,12 +1,10 @@ /* -* @@name: acquire_release_broke.4 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.0 +* @@name: acquire_release_broke.4 +* @@type: C +* @@operation: run +* @@expect: unspecified +* @@version: omp_5.0 */ - #include #include diff --git a/synchronization/sources/acquire_release_broke.4.f90 b/synchronization/sources/acquire_release_broke.4.f90 index 7c8a1f0..187e13d 100644 --- a/synchronization/sources/acquire_release_broke.4.f90 +++ b/synchronization/sources/acquire_release_broke.4.f90 @@ -1,10 +1,8 @@ -! @@name: acquire_release_broke.4 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_5.0 - +! @@name: acquire_release_broke.4 +! @@type: F-free +! @@operation: run +! @@expect: unspecified +! @@version: omp_5.0 program rel_acq_ex4 use omp_lib integer :: x, y, thrd diff --git a/synchronization/sources/atomic.1.c b/synchronization/sources/atomic.1.c index 0108f1d..cd6e0cf 100644 --- a/synchronization/sources/atomic.1.c +++ b/synchronization/sources/atomic.1.c @@ -1,8 +1,7 @@ /* * @@name: atomic.1 * @@type: C -* @@compilable: yes -* @@linkable: yes +* @@operation: link * @@expect: success * @@version: omp_3.1 */ diff --git a/synchronization/sources/atomic.1.f b/synchronization/sources/atomic.1.f index d281387..7c60c24 100644 --- a/synchronization/sources/atomic.1.f +++ b/synchronization/sources/atomic.1.f @@ -1,7 +1,6 @@ ! @@name: atomic.1 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: yes +! @@operation: link ! @@expect: success ! @@version: omp_3.1 REAL FUNCTION WORK1(I) diff --git a/synchronization/sources/atomic.2.c b/synchronization/sources/atomic.2.c index a85f25e..06b14ed 100644 --- a/synchronization/sources/atomic.2.c +++ b/synchronization/sources/atomic.2.c @@ -1,8 +1,7 @@ /* * @@name: atomic.2 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_3.1 */ diff --git a/synchronization/sources/atomic.2.f b/synchronization/sources/atomic.2.f index 03e956f..77d7400 100644 --- a/synchronization/sources/atomic.2.f +++ b/synchronization/sources/atomic.2.f @@ -1,7 +1,6 @@ ! @@name: atomic.2 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_3.1 function atomic_read(p) diff --git a/synchronization/sources/atomic.3.c b/synchronization/sources/atomic.3.c index c557835..9f8b1af 100644 --- a/synchronization/sources/atomic.3.c +++ b/synchronization/sources/atomic.3.c @@ -1,8 +1,7 @@ /* * @@name: atomic.3 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_3.1 */ diff --git a/synchronization/sources/atomic.3.f b/synchronization/sources/atomic.3.f index f2a8d6f..9801b27 100644 --- a/synchronization/sources/atomic.3.f +++ b/synchronization/sources/atomic.3.f @@ -1,7 +1,6 @@ ! @@name: atomic.3 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_3.1 function fetch_and_add(p) diff --git a/synchronization/sources/atomic_restrict.1.c b/synchronization/sources/atomic_restrict.1.c index 9c86168..083284e 100644 --- a/synchronization/sources/atomic_restrict.1.c +++ b/synchronization/sources/atomic_restrict.1.c @@ -1,9 +1,8 @@ /* * @@name: atomic_restrict.1 * @@type: C -* @@compilable: maybe -* @@linkable: no -* @@expect: failure +* @@operation: compile +* @@expect: unspecified * @@version: omp_3.1 */ void atomic_wrong () diff --git a/synchronization/sources/atomic_restrict.1.f b/synchronization/sources/atomic_restrict.1.f index 27cf690..838edd8 100644 --- a/synchronization/sources/atomic_restrict.1.f +++ b/synchronization/sources/atomic_restrict.1.f @@ -1,8 +1,7 @@ ! @@name: atomic_restrict.1 ! @@type: F-fixed -! @@compilable: maybe -! @@linkable: no -! @@expect: failure +! @@operation: compile +! @@expect: unspecified ! @@version: omp_3.1 SUBROUTINE ATOMIC_WRONG() INTEGER:: I diff --git a/synchronization/sources/atomic_restrict.2.c b/synchronization/sources/atomic_restrict.2.c index fa92390..b81ea25 100644 --- a/synchronization/sources/atomic_restrict.2.c +++ b/synchronization/sources/atomic_restrict.2.c @@ -1,9 +1,8 @@ /* * @@name: atomic_restrict.2 * @@type: C -* @@compilable: maybe -* @@linkable: no -* @@expect: failure +* @@operation: compile +* @@expect: unspecified * @@version: omp_3.1 */ void atomic_wrong2 () diff --git a/synchronization/sources/atomic_restrict.2.f b/synchronization/sources/atomic_restrict.2.f index cdf2b91..fde10fe 100644 --- a/synchronization/sources/atomic_restrict.2.f +++ b/synchronization/sources/atomic_restrict.2.f @@ -1,8 +1,7 @@ ! @@name: atomic_restrict.2 ! @@type: F-fixed -! @@compilable: maybe -! @@linkable: no -! @@expect: failure +! @@operation: compile +! @@expect: unspecified ! @@version: omp_3.1 SUBROUTINE SUB() COMMON /BLK/ R diff --git a/synchronization/sources/atomic_restrict.3.f b/synchronization/sources/atomic_restrict.3.f index 4cf08c7..25c1c72 100644 --- a/synchronization/sources/atomic_restrict.3.f +++ b/synchronization/sources/atomic_restrict.3.f @@ -1,8 +1,7 @@ ! @@name: atomic_restrict.3 ! @@type: F-fixed -! @@compilable: maybe -! @@linkable: no -! @@expect: failure +! @@operation: compile +! @@expect: unspecified ! @@version: omp_3.1 SUBROUTINE ATOMIC_WRONG3 INTEGER:: I diff --git a/synchronization/sources/barrier_regions.1.c b/synchronization/sources/barrier_regions.1.c index b0cf635..c8e137c 100644 --- a/synchronization/sources/barrier_regions.1.c +++ b/synchronization/sources/barrier_regions.1.c @@ -1,9 +1,9 @@ /* * @@name: barrier_regions.1 * @@type: C -* @@compilable: yes -* @@linkable: yes +* @@operation: link * @@expect: success +* @@version: pre_omp_3.0 */ void work(int n) {} diff --git a/synchronization/sources/barrier_regions.1.f b/synchronization/sources/barrier_regions.1.f index c19d093..bbe31ce 100644 --- a/synchronization/sources/barrier_regions.1.f +++ b/synchronization/sources/barrier_regions.1.f @@ -1,8 +1,8 @@ ! @@name: barrier_regions.1 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: yes +! @@operation: link ! @@expect: success +! @@version: pre_omp_3.0 SUBROUTINE WORK(N) INTEGER N END SUBROUTINE WORK diff --git a/synchronization/sources/cas.1.c b/synchronization/sources/cas.1.c new file mode 100644 index 0000000..0453db8 --- /dev/null +++ b/synchronization/sources/cas.1.c @@ -0,0 +1,40 @@ +/* +* @@name: cas.1 +* @@type: C +* @@operation: run +* @@expect: success +* @@version: omp_5.1 +*/ +#include +#define N 10 + +void init(int *); + +int main(){ + int val_min=2*N, val_max=-2*N; + int val[N]; + + init(val); + + #pragma omp parallel for num_threads(2) + for (int i=1; i val_max ? val[i] : val_max; + } + + if(val_max != 2*N || val_min != -2*N){ printf("FAILED\n");} + else { printf("PASSED\n");} + // OUT: PASSED +} + +void init(int *val){ + for (int i=0; i +#include +#include +#include + +#define N 10 + +typedef struct Node{ struct Node *next; int id; } Node; +typedef struct Queue{ Node *head; Node *tail; } Queue; + +void enqueue( Queue *, Node * ); + +int main(){ + Queue q; + Node nodes[N]; + int id_check[N]; + +// Initializing + for(int i=0; iid]=node->id; //Store found id at position id + node =node->next; + }while(node->next != NULL); + id_check[node->id]=node->id; //checking also the 1st node here + + for(int id=0; idnext = queue->tail; + do{ + #pragma omp atomic compare capture + { + result = queue->tail == node->next; + if(result) { + queue->tail = node; + }else{ + node->next = queue->tail; + } + } + }while(!result); +} diff --git a/synchronization/sources/critical.1.c b/synchronization/sources/critical.1.c index b9d8271..6e1b6ec 100644 --- a/synchronization/sources/critical.1.c +++ b/synchronization/sources/critical.1.c @@ -1,9 +1,9 @@ /* * @@name: critical.1 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success +* @@version: pre_omp_3.0 */ int dequeue(float *a); void work(int i, float *a); diff --git a/synchronization/sources/critical.1.f b/synchronization/sources/critical.1.f index 3db5e60..194b6bb 100644 --- a/synchronization/sources/critical.1.f +++ b/synchronization/sources/critical.1.f @@ -1,8 +1,8 @@ ! @@name: critical.1 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success +! @@version: pre_omp_3.0 SUBROUTINE CRITICAL_EXAMPLE(X, Y) REAL X(*), Y(*) diff --git a/synchronization/sources/critical.2.c b/synchronization/sources/critical.2.c index 5abc7db..b594a6d 100644 --- a/synchronization/sources/critical.2.c +++ b/synchronization/sources/critical.2.c @@ -1,8 +1,7 @@ /* * @@name: critical.2 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_5.0 */ diff --git a/synchronization/sources/critical.2.f b/synchronization/sources/critical.2.f index cff6aa6..30bad47 100644 --- a/synchronization/sources/critical.2.f +++ b/synchronization/sources/critical.2.f @@ -1,7 +1,6 @@ ! @@name: critical.2 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_5.0 SUBROUTINE CRITICAL_EXAMPLE(X, Y) diff --git a/synchronization/sources/depobj.1.c b/synchronization/sources/depobj.1.c index fa339ef..d1cde20 100644 --- a/synchronization/sources/depobj.1.c +++ b/synchronization/sources/depobj.1.c @@ -1,12 +1,10 @@ /* -* @@name: depobj.1 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.2 +* @@name: depobj.1 +* @@type: C +* @@operation: link +* @@expect: success +* @@version: omp_5.2 */ - #include #include @@ -73,4 +71,3 @@ void init(float a[], int n) { for(int i=0;i diff --git a/synchronization/sources/init_lock.1.f b/synchronization/sources/init_lock.1.f index 228977d..7227d2d 100644 --- a/synchronization/sources/init_lock.1.f +++ b/synchronization/sources/init_lock.1.f @@ -1,8 +1,8 @@ ! @@name: init_lock.1 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success +! @@version: pre_omp_3.0 FUNCTION NEW_LOCKS() USE OMP_LIB ! or INCLUDE "omp_lib.h" INTEGER(OMP_LOCK_KIND), DIMENSION(1000) :: NEW_LOCKS diff --git a/synchronization/sources/init_lock_with_hint.1.cpp b/synchronization/sources/init_lock_with_hint.1.cpp index 76ada0b..7b65bb6 100644 --- a/synchronization/sources/init_lock_with_hint.1.cpp +++ b/synchronization/sources/init_lock_with_hint.1.cpp @@ -1,8 +1,7 @@ /* * @@name: init_lock_with_hint.1 * @@type: C++ -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_5.0 */ diff --git a/synchronization/sources/init_lock_with_hint.1.f b/synchronization/sources/init_lock_with_hint.1.f index 8d4ba4f..015786e 100644 --- a/synchronization/sources/init_lock_with_hint.1.f +++ b/synchronization/sources/init_lock_with_hint.1.f @@ -1,7 +1,6 @@ ! @@name: init_lock_with_hint.1 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_5.0 FUNCTION NEW_LOCKS() diff --git a/synchronization/sources/lock_owner.1.c b/synchronization/sources/lock_owner.1.c index c3fefea..ebd76c9 100644 --- a/synchronization/sources/lock_owner.1.c +++ b/synchronization/sources/lock_owner.1.c @@ -1,10 +1,9 @@ /* * @@name: lock_owner.1 * @@type: C -* @@compilable: yes -* @@linkable: yes +* @@operation: link * @@expect: success -* @@version: omp_5.1 +* @@version: omp_5.1 */ #include #include diff --git a/synchronization/sources/lock_owner.1.f b/synchronization/sources/lock_owner.1.f index 185e8d1..1683009 100644 --- a/synchronization/sources/lock_owner.1.f +++ b/synchronization/sources/lock_owner.1.f @@ -1,9 +1,8 @@ ! @@name: lock_owner.1 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: yes +! @@operation: link ! @@expect: success -! @@version: omp_5.1 +! @@version: omp_5.1 program lock use omp_lib integer :: x diff --git a/synchronization/sources/nestable_lock.1.c b/synchronization/sources/nestable_lock.1.c index 71ec595..a232524 100644 --- a/synchronization/sources/nestable_lock.1.c +++ b/synchronization/sources/nestable_lock.1.c @@ -1,11 +1,10 @@ /* * @@name: nestable_lock.1 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success +* @@version: pre_omp_3.0 */ - #include typedef struct { diff --git a/synchronization/sources/nestable_lock.1.f b/synchronization/sources/nestable_lock.1.f index 6b468ff..c4bcac0 100644 --- a/synchronization/sources/nestable_lock.1.f +++ b/synchronization/sources/nestable_lock.1.f @@ -1,8 +1,8 @@ ! @@name: nestable_lock.1 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success +! @@version: pre_omp_3.0 MODULE DATA USE OMP_LIB, ONLY: OMP_NEST_LOCK_KIND TYPE LOCKED_PAIR diff --git a/synchronization/sources/ordered.1.c b/synchronization/sources/ordered.1.c index b766382..f8c9e69 100644 --- a/synchronization/sources/ordered.1.c +++ b/synchronization/sources/ordered.1.c @@ -1,9 +1,9 @@ /* * @@name: ordered.1 * @@type: C -* @@compilable: yes -* @@linkable: yes +* @@operation: run * @@expect: success +* @@version: pre_omp_3.0 */ #include diff --git a/synchronization/sources/ordered.1.f b/synchronization/sources/ordered.1.f index 0e3c3ff..60cb3f1 100644 --- a/synchronization/sources/ordered.1.f +++ b/synchronization/sources/ordered.1.f @@ -1,8 +1,8 @@ ! @@name: ordered.1 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: yes +! @@operation: run ! @@expect: success +! @@version: pre_omp_3.0 SUBROUTINE WORK(K) INTEGER k diff --git a/synchronization/sources/ordered.2.c b/synchronization/sources/ordered.2.c index d07af89..2b1a0f5 100644 --- a/synchronization/sources/ordered.2.c +++ b/synchronization/sources/ordered.2.c @@ -1,9 +1,9 @@ /* * @@name: ordered.2 * @@type: C -* @@compilable: no -* @@linkable: no -* @@expect: failure +* @@operation: compile +* @@expect: ct-error +* @@version: pre_omp_3.0 */ void work(int i) {} diff --git a/synchronization/sources/ordered.2.f b/synchronization/sources/ordered.2.f index e0bb30a..812830a 100644 --- a/synchronization/sources/ordered.2.f +++ b/synchronization/sources/ordered.2.f @@ -1,8 +1,8 @@ ! @@name: ordered.2 ! @@type: F-fixed -! @@compilable: no -! @@linkable: no -! @@expect: failure +! @@operation: compile +! @@expect: ct-error +! @@version: pre_omp_3.0 SUBROUTINE WORK(I) INTEGER I END SUBROUTINE WORK diff --git a/synchronization/sources/ordered.3.c b/synchronization/sources/ordered.3.c index 18b0de5..ab752be 100644 --- a/synchronization/sources/ordered.3.c +++ b/synchronization/sources/ordered.3.c @@ -1,9 +1,9 @@ /* * @@name: ordered.3 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success +* @@version: pre_omp_3.0 */ void work(int i) {} void ordered_good(int n) diff --git a/synchronization/sources/ordered.3.f b/synchronization/sources/ordered.3.f index 4b75230..93138d5 100644 --- a/synchronization/sources/ordered.3.f +++ b/synchronization/sources/ordered.3.f @@ -1,8 +1,8 @@ ! @@name: ordered.3 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success +! @@version: pre_omp_3.0 SUBROUTINE ORDERED_GOOD(N) INTEGER N diff --git a/synchronization/sources/simple_lock.1.c b/synchronization/sources/simple_lock.1.c index 26294d6..a7cdf59 100644 --- a/synchronization/sources/simple_lock.1.c +++ b/synchronization/sources/simple_lock.1.c @@ -1,9 +1,9 @@ /* * @@name: simple_lock.1 * @@type: C -* @@compilable: yes -* @@linkable: yes +* @@operation: link * @@expect: success +* @@version: pre_omp_3.0 */ #include #include diff --git a/synchronization/sources/simple_lock.1.f b/synchronization/sources/simple_lock.1.f index 4dcd5bc..01be923 100644 --- a/synchronization/sources/simple_lock.1.f +++ b/synchronization/sources/simple_lock.1.f @@ -1,8 +1,8 @@ ! @@name: simple_lock.1 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: yes +! @@operation: link ! @@expect: success +! @@version: pre_omp_3.0 SUBROUTINE SKIP(ID) END SUBROUTINE SKIP diff --git a/synchronization/sources/worksharing_critical.1.c b/synchronization/sources/worksharing_critical.1.c index 2644060..38ccad3 100644 --- a/synchronization/sources/worksharing_critical.1.c +++ b/synchronization/sources/worksharing_critical.1.c @@ -1,9 +1,9 @@ /* * @@name: worksharing_critical.1 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success +* @@version: pre_omp_3.0 */ void critical_work() { diff --git a/synchronization/sources/worksharing_critical.1.f b/synchronization/sources/worksharing_critical.1.f index d2b7335..dcd471d 100644 --- a/synchronization/sources/worksharing_critical.1.f +++ b/synchronization/sources/worksharing_critical.1.f @@ -1,8 +1,8 @@ ! @@name: worksharing_critical.1 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success +! @@version: pre_omp_3.0 SUBROUTINE CRITICAL_WORK() INTEGER I diff --git a/tasking/sources/parallel_masked_taskloop.1.c b/tasking/sources/parallel_masked_taskloop.1.c index db91d8d..e9fd675 100644 --- a/tasking/sources/parallel_masked_taskloop.1.c +++ b/tasking/sources/parallel_masked_taskloop.1.c @@ -1,8 +1,7 @@ /* * @@name: parallel_masked_taskloop.1 * @@type: C -* @@compilable: yes -* @@linkable: yes +* @@operation: run * @@expect: success * @@version: omp_5.1 */ diff --git a/tasking/sources/parallel_masked_taskloop.1.f90 b/tasking/sources/parallel_masked_taskloop.1.f90 index 0c693b4..e90e5c2 100644 --- a/tasking/sources/parallel_masked_taskloop.1.f90 +++ b/tasking/sources/parallel_masked_taskloop.1.f90 @@ -1,9 +1,8 @@ -! @@name: parallel_masked_taskloop.1 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_5.1 +! @@name: parallel_masked_taskloop.1 +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: omp_5.1 program main integer, parameter :: N=100 diff --git a/tasking/sources/task_dep.1.c b/tasking/sources/task_dep.1.c index 5ac21ab..7e553eb 100644 --- a/tasking/sources/task_dep.1.c +++ b/tasking/sources/task_dep.1.c @@ -1,8 +1,7 @@ /* * @@name: task_dep.1 * @@type: C -* @@compilable: yes -* @@linkable: yes +* @@operation: run * @@expect: success * @@version: omp_4.0 */ diff --git a/tasking/sources/task_dep.1.f90 b/tasking/sources/task_dep.1.f90 index 39d1626..b30095a 100644 --- a/tasking/sources/task_dep.1.f90 +++ b/tasking/sources/task_dep.1.f90 @@ -1,9 +1,8 @@ ! @@name: task_dep.1 ! @@type: F-free -! @@compilable: yes -! @@linkable: yes +! @@operation: run ! @@expect: success -! @@version: omp_4.0 +! @@version: omp_4.0 program example integer :: x x = 1 diff --git a/tasking/sources/task_dep.10.c b/tasking/sources/task_dep.10.c index 2a15431..3115275 100644 --- a/tasking/sources/task_dep.10.c +++ b/tasking/sources/task_dep.10.c @@ -1,9 +1,8 @@ /* * @@name: task_dep.10 * @@type: C -* @@compilable: no -* @@linkable: no -* @@expect: failure +* @@operation: compile +* @@expect: success * @@version: omp_5.0 */ extern int longTaskA(), shortTaskB(); diff --git a/tasking/sources/task_dep.10.f90 b/tasking/sources/task_dep.10.f90 index b3e041d..769cb11 100644 --- a/tasking/sources/task_dep.10.f90 +++ b/tasking/sources/task_dep.10.f90 @@ -1,9 +1,8 @@ ! @@name: task_dep.10 ! @@type: F-free -! @@compilable: no -! @@linkable: no -! @@expect: failure -! @@version: omp_5.0 +! @@operation: compile +! @@expect: success +! @@version: omp_5.0 subroutine foo integer :: a,b,c c = 0 diff --git a/tasking/sources/task_dep.11.c b/tasking/sources/task_dep.11.c index 8125795..505d788 100644 --- a/tasking/sources/task_dep.11.c +++ b/tasking/sources/task_dep.11.c @@ -1,10 +1,9 @@ /* -* @@name: task_dep.11 -* @@type: C -* @@compilable: yes -* @@linkable: no -* @@expect: success -* @@version: omp_5.0 +* @@name: task_dep.11 +* @@type: C +* @@operation: compile +* @@expect: success +* @@version: omp_5.0 */ #include @@ -36,4 +35,3 @@ void parallel_computation(int n) { print_all_elements(v, n); } } - diff --git a/tasking/sources/task_dep.11.f90 b/tasking/sources/task_dep.11.f90 index eeeb7e1..3e4062d 100644 --- a/tasking/sources/task_dep.11.f90 +++ b/tasking/sources/task_dep.11.f90 @@ -1,9 +1,8 @@ ! @@name: task_dep.11 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success -! @@version: omp_5.0 +! @@version: omp_5.0 subroutine set_an_element(e, val) implicit none integer :: e, val diff --git a/tasking/sources/task_dep.12.c b/tasking/sources/task_dep.12.c index 0c93ee7..fc60e21 100644 --- a/tasking/sources/task_dep.12.c +++ b/tasking/sources/task_dep.12.c @@ -1,13 +1,12 @@ /* * @@name: task_dep.12 * @@type: C -* @@compilable: yes -* @@linkable: yes +* @@operation: run * @@expect: success * @@version: omp_4.0 */ #include -int main (int argc, char *argv[]) +int main () { int x = 0; #pragma omp parallel diff --git a/tasking/sources/task_dep.12.f90 b/tasking/sources/task_dep.12.f90 index 93e2291..5f22add 100644 --- a/tasking/sources/task_dep.12.f90 +++ b/tasking/sources/task_dep.12.f90 @@ -1,7 +1,6 @@ ! @@name: task_dep.12 ! @@type: F-free -! @@compilable: yes -! @@linkable: yes +! @@operation: run ! @@expect: success ! @@version: omp_4.0 program example diff --git a/tasking/sources/task_dep.13.c b/tasking/sources/task_dep.13.c index 926de74..6056736 100644 --- a/tasking/sources/task_dep.13.c +++ b/tasking/sources/task_dep.13.c @@ -1,10 +1,9 @@ /* -* @@name: task_dep.13 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.1 +* @@name: task_dep.13 +* @@type: C +* @@operation: run +* @@expect: success +* @@version: omp_5.1 */ #include diff --git a/tasking/sources/task_dep.13.f90 b/tasking/sources/task_dep.13.f90 index 6ae6fed..9c96fb1 100644 --- a/tasking/sources/task_dep.13.f90 +++ b/tasking/sources/task_dep.13.f90 @@ -1,7 +1,6 @@ ! @@name: task_dep.13 ! @@type: F-free -! @@compilable: yes -! @@linkable: yes +! @@operation: run ! @@expect: success ! @@version: omp_5.1 program main diff --git a/tasking/sources/task_dep.2.c b/tasking/sources/task_dep.2.c index 73d56a0..d33a443 100644 --- a/tasking/sources/task_dep.2.c +++ b/tasking/sources/task_dep.2.c @@ -1,8 +1,7 @@ /* * @@name: task_dep.2 * @@type: C -* @@compilable: yes -* @@linkable: yes +* @@operation: run * @@expect: success * @@version: omp_4.0 */ diff --git a/tasking/sources/task_dep.2.f90 b/tasking/sources/task_dep.2.f90 index 5efa05b..8a0ae98 100644 --- a/tasking/sources/task_dep.2.f90 +++ b/tasking/sources/task_dep.2.f90 @@ -1,9 +1,8 @@ ! @@name: task_dep.2 ! @@type: F-free -! @@compilable: yes -! @@linkable: yes +! @@operation: run ! @@expect: success -! @@version: omp_4.0 +! @@version: omp_4.0 program example integer :: x x = 1 diff --git a/tasking/sources/task_dep.3.c b/tasking/sources/task_dep.3.c index 8b26d41..bd8f59e 100644 --- a/tasking/sources/task_dep.3.c +++ b/tasking/sources/task_dep.3.c @@ -1,8 +1,7 @@ /* * @@name: task_dep.3 * @@type: C -* @@compilable: yes -* @@linkable: yes +* @@operation: run * @@expect: success * @@version: omp_4.0 */ diff --git a/tasking/sources/task_dep.3.f90 b/tasking/sources/task_dep.3.f90 index 1f3ca72..9c70527 100644 --- a/tasking/sources/task_dep.3.f90 +++ b/tasking/sources/task_dep.3.f90 @@ -1,9 +1,8 @@ ! @@name: task_dep.3 ! @@type: F-free -! @@compilable: yes -! @@linkable: yes +! @@operation: run ! @@expect: success -! @@version: omp_4.0 +! @@version: omp_4.0 program example integer :: x !$omp parallel diff --git a/tasking/sources/task_dep.4.c b/tasking/sources/task_dep.4.c index 388b20b..618aa46 100644 --- a/tasking/sources/task_dep.4.c +++ b/tasking/sources/task_dep.4.c @@ -1,8 +1,7 @@ /* * @@name: task_dep.4 * @@type: C -* @@compilable: yes -* @@linkable: yes +* @@operation: run * @@expect: success * @@version: omp_4.0 */ diff --git a/tasking/sources/task_dep.4.f90 b/tasking/sources/task_dep.4.f90 index 0a297f8..82ad34d 100644 --- a/tasking/sources/task_dep.4.f90 +++ b/tasking/sources/task_dep.4.f90 @@ -1,10 +1,8 @@ ! @@name: task_dep.4 ! @@type: F-free -! @@compilable: yes -! @@linkable: yes +! @@operation: run ! @@expect: success -! @@version: omp_4.0 - +! @@version: omp_4.0 program example integer :: x diff --git a/tasking/sources/task_dep.4b.c b/tasking/sources/task_dep.4b.c new file mode 100644 index 0000000..c0e2dc8 --- /dev/null +++ b/tasking/sources/task_dep.4b.c @@ -0,0 +1,49 @@ +/* +* @@name: task_dep.4b +* @@type: C +* @@operation: compile +* @@expect: success +* @@version: omp_5.1 +*/ +#include + +extern int f(int i); + +void task_dep(int N) +{ + int i, v, R; + + #pragma omp parallel private(i,v) shared(R) + #pragma omp single + { + // CASE 1: tasks with inout dependence type. + // tasks are serialized here. + R = 0; + for ( i = 0; i < N; i++ ) { + #pragma omp task depend(inout: R) // T1 + { + v = f(i); + R += v; + } + } + + #pragma omp task depend(in: R) // T2 + printf("result is %d\n", R); + #pragma omp taskwait // to avoid race with CASE 2 + + // CASE 2: tasks with inoutset dependence type. + // tasks are executed concurrently. + R = 0; + for ( i = 0; i < N; i++ ) { + #pragma omp task depend(inoutset: R) // T3 + { + v = f(i); + #pragma omp atomic + R += v; + } + } + + #pragma omp task depend(in: R) // T4 + printf("result is %d\n", R); + } +} diff --git a/tasking/sources/task_dep.4b.f90 b/tasking/sources/task_dep.4b.f90 new file mode 100644 index 0000000..931ecd8 --- /dev/null +++ b/tasking/sources/task_dep.4b.f90 @@ -0,0 +1,47 @@ +! @@name: task_dep.4b +! @@type: F-free +! @@operation: compile +! @@expect: success +! @@version: omp_5.1 +subroutine task_dep(N) + implicit none + integer :: N + + integer :: i, v, R + integer, external :: f + + !$omp parallel private(i,v) shared(R) + !$omp single + !! CASE 1: tasks with inout dependence type. + !! tasks are serialized here. + R = 0 + do i = 1, N + !$omp task depend(inout: R) !! T1 + v = f(i) + R = R + v + !$omp end task + end do + + !$omp task depend(in: R) !! T2 + print *, "result is ", R + !$omp end task + !$omp taskwait !! to avoid race with CASE 2 + + !! CASE 2: tasks with inoutset dependence type. + !! tasks are executed concurrently. + R = 0 + do i = 1, N + !$omp task depend(inoutset: R) !! T3 + v = f(i) + !$omp atomic + R = R + v + !$omp end task + end do + + !$omp task depend(in: R) !! T4 + print *, "result is ", R + !$omp end task + + !$omp end single + !$omp end parallel +end subroutine diff --git a/tasking/sources/task_dep.5.c b/tasking/sources/task_dep.5.c index 3a2319a..f98cf40 100644 --- a/tasking/sources/task_dep.5.c +++ b/tasking/sources/task_dep.5.c @@ -1,14 +1,14 @@ /* * @@name: task_dep.5 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ +#define N 100 // Assume BS divides N perfectly -void matmul_depend(int N, int BS, float A[N][N], float B[N][N], float -C[N][N] ) +void matmul_depend(int BS, float A[N][N], float B[N][N], + float C[N][N]) { int i, j, k, ii, jj, kk; for (i = 0; i < N; i+=BS) { diff --git a/tasking/sources/task_dep.5.f90 b/tasking/sources/task_dep.5.f90 index 21d8884..4a9d7be 100644 --- a/tasking/sources/task_dep.5.f90 +++ b/tasking/sources/task_dep.5.f90 @@ -1,9 +1,8 @@ ! @@name: task_dep.5 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success -! @@version: omp_4.0 +! @@version: omp_4.0 ! Assume BS divides N perfectly subroutine matmul_depend (N, BS, A, B, C) implicit none diff --git a/tasking/sources/task_dep.6.c b/tasking/sources/task_dep.6.c index 4e2ad32..6dbeeb5 100644 --- a/tasking/sources/task_dep.6.c +++ b/tasking/sources/task_dep.6.c @@ -1,10 +1,9 @@ /* -* @@name: task_dep.6 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.0 +* @@name: task_dep.6 +* @@type: C +* @@operation: run +* @@expect: success +* @@version: omp_5.0 */ #include diff --git a/tasking/sources/task_dep.6.f90 b/tasking/sources/task_dep.6.f90 index 369ace9..a297c61 100644 --- a/tasking/sources/task_dep.6.f90 +++ b/tasking/sources/task_dep.6.f90 @@ -1,9 +1,8 @@ -! @@name: task_dep.6 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_5.0 +! @@name: task_dep.6 +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: omp_5.0 subroutine foo() implicit none integer :: x, y diff --git a/tasking/sources/task_dep.7.c b/tasking/sources/task_dep.7.c index a18853c..489bc33 100644 --- a/tasking/sources/task_dep.7.c +++ b/tasking/sources/task_dep.7.c @@ -1,10 +1,9 @@ /* -* @@name: task_dep.7 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.0 +* @@name: task_dep.7 +* @@type: C +* @@operation: run +* @@expect: success +* @@version: omp_5.0 */ #include diff --git a/tasking/sources/task_dep.7.f90 b/tasking/sources/task_dep.7.f90 index 5a48f17..d57d5a8 100644 --- a/tasking/sources/task_dep.7.f90 +++ b/tasking/sources/task_dep.7.f90 @@ -1,9 +1,8 @@ -! @@name: task_dep.7 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_5.0 +! @@name: task_dep.7 +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: omp_5.0 subroutine foo() implicit none integer :: x, y diff --git a/tasking/sources/task_dep.8.c b/tasking/sources/task_dep.8.c index 25b2137..12f8410 100644 --- a/tasking/sources/task_dep.8.c +++ b/tasking/sources/task_dep.8.c @@ -1,10 +1,9 @@ /* -* @@name: task_dep.8 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.0 +* @@name: task_dep.8 +* @@type: C +* @@operation: run +* @@expect: success +* @@version: omp_5.0 */ #include diff --git a/tasking/sources/task_dep.8.f90 b/tasking/sources/task_dep.8.f90 index 41fdd69..8cf01ac 100644 --- a/tasking/sources/task_dep.8.f90 +++ b/tasking/sources/task_dep.8.f90 @@ -1,9 +1,8 @@ -! @@name: task_dep.8 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_5.0 +! @@name: task_dep.8 +! @@type: F-free +! @@operation: run +! @@expect: success +! @@version: omp_5.0 subroutine foo() implicit nonE integer :: x, y diff --git a/tasking/sources/task_dep.9.c b/tasking/sources/task_dep.9.c index 2caae08..5dfdcdd 100644 --- a/tasking/sources/task_dep.9.c +++ b/tasking/sources/task_dep.9.c @@ -1,8 +1,7 @@ /* * @@name: task_dep.9 * @@type: C -* @@compilable: yes -* @@linkable: yes +* @@operation: run * @@expect: success * @@version: omp_5.0 */ diff --git a/tasking/sources/task_dep.9.f90 b/tasking/sources/task_dep.9.f90 index 9578ec0..147fb14 100644 --- a/tasking/sources/task_dep.9.f90 +++ b/tasking/sources/task_dep.9.f90 @@ -1,9 +1,8 @@ ! @@name: task_dep.9 ! @@type: F-free -! @@compilable: yes -! @@linkable: yes +! @@operation: run ! @@expect: success -! @@version: omp_5.0 +! @@version: omp_5.0 program example integer :: a, b, c, d !$omp parallel diff --git a/tasking/sources/task_detach.1.c b/tasking/sources/task_detach.1.c index 5b13cac..b99fbc4 100644 --- a/tasking/sources/task_detach.1.c +++ b/tasking/sources/task_detach.1.c @@ -1,10 +1,9 @@ /* -* @@name: task_detach.1 -* @@type: C -* @@compilable: yes -* @@linkable: no -* @@expect: success -* @@version: omp_5.0 +* @@name: task_detach.1 +* @@type: C +* @@operation: compile +* @@expect: success +* @@version: omp_5.0 */ #include diff --git a/tasking/sources/task_detach.1.f90 b/tasking/sources/task_detach.1.f90 index 32ad63c..04da818 100644 --- a/tasking/sources/task_detach.1.f90 +++ b/tasking/sources/task_detach.1.f90 @@ -1,9 +1,8 @@ ! @@name: task_detach.1 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success -! @@version: omp_5.0 +! @@version: omp_5.0 program main use omp_lib implicit none diff --git a/tasking/sources/task_detach.2.c b/tasking/sources/task_detach.2.c index 5282243..b89b435 100644 --- a/tasking/sources/task_detach.2.c +++ b/tasking/sources/task_detach.2.c @@ -1,12 +1,10 @@ /* -* @@name: task_detach.2 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_5.0 +* @@name: task_detach.2 +* @@type: C +* @@operation: run +* @@expect: success +* @@version: omp_5.0 */ - // use -lrt on loader line #include #include @@ -14,6 +12,7 @@ #include #include #include +#include #include @@ -24,7 +23,8 @@ static void callback_aioSigHandler(int sig, siginfo_t *si, void *ucontext) { if (si->si_code == SI_ASYNCIO){ printf( "OUT: I/O completion signal received.\n"); - omp_fulfill_event( (omp_event_handle_t)(si->si_value.sival_ptr) ); + omp_fulfill_event( (omp_event_handle_t)(uintptr_t) + (si->si_value.sival_ptr) ); } } diff --git a/tasking/sources/task_priority.1.c b/tasking/sources/task_priority.1.c index 821c2e6..cb14ee8 100644 --- a/tasking/sources/task_priority.1.c +++ b/tasking/sources/task_priority.1.c @@ -1,10 +1,9 @@ /* -* @@name: task_priority.1 -* @@type: C -* @@compilable: yes -* @@linkable: no -* @@expect: success -* @@version: omp_4.5 +* @@name: task_priority.1 +* @@type: C +* @@operation: compile +* @@expect: success +* @@version: omp_4.5 */ void compute_array (float *node, int M); diff --git a/tasking/sources/task_priority.1.f90 b/tasking/sources/task_priority.1.f90 index 2edda1a..1c5e762 100644 --- a/tasking/sources/task_priority.1.f90 +++ b/tasking/sources/task_priority.1.f90 @@ -1,9 +1,8 @@ ! @@name: task_priority.1 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success -! @@version: omp_4.5 +! @@version: omp_4.5 subroutine compute_matrix(matrix, M, N) implicit none integer :: M, N diff --git a/tasking/sources/taskgroup.1.c b/tasking/sources/taskgroup.1.c index 98a373b..b73b711 100644 --- a/tasking/sources/taskgroup.1.c +++ b/tasking/sources/taskgroup.1.c @@ -1,8 +1,7 @@ /* * @@name: taskgroup.1 * @@type: C -* @@compilable: yes -* @@linkable: yes +* @@operation: compile * @@expect: success * @@version: omp_4.0 */ diff --git a/tasking/sources/taskgroup.1.f90 b/tasking/sources/taskgroup.1.f90 index 5af9177..f9ab3b4 100644 --- a/tasking/sources/taskgroup.1.f90 +++ b/tasking/sources/taskgroup.1.f90 @@ -1,9 +1,8 @@ ! @@name: taskgroup.1 ! @@type: F-free -! @@compilable: yes -! @@linkable: yes +! @@operation: compile ! @@expect: success -! @@version: omp_4.0 +! @@version: omp_4.0 module tree_type_mod integer, parameter :: max_steps=100 type tree_type diff --git a/tasking/sources/tasking.1.c b/tasking/sources/tasking.1.c index b29efba..cd26b43 100644 --- a/tasking/sources/tasking.1.c +++ b/tasking/sources/tasking.1.c @@ -1,12 +1,10 @@ /* * @@name: tasking.1 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_3.0 */ - struct node { struct node *left; struct node *right; diff --git a/tasking/sources/tasking.1.f90 b/tasking/sources/tasking.1.f90 index 9b7494c..5ba8e77 100644 --- a/tasking/sources/tasking.1.f90 +++ b/tasking/sources/tasking.1.f90 @@ -1,10 +1,8 @@ ! @@name: tasking.1 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success -! @@version: omp_3.0 - +! @@version: omp_3.0 RECURSIVE SUBROUTINE traverse ( P ) TYPE Node TYPE(Node), POINTER :: left, right diff --git a/tasking/sources/tasking.10.c b/tasking/sources/tasking.10.c index e32ed6d..162f03b 100644 --- a/tasking/sources/tasking.10.c +++ b/tasking/sources/tasking.10.c @@ -1,8 +1,7 @@ /* * @@name: tasking.10 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_3.0 */ diff --git a/tasking/sources/tasking.10.f90 b/tasking/sources/tasking.10.f90 index ecf548d..23e0702 100644 --- a/tasking/sources/tasking.10.f90 +++ b/tasking/sources/tasking.10.f90 @@ -1,9 +1,8 @@ ! @@name: tasking.10 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success -! @@version: omp_3.0 +! @@version: omp_3.0 module example include 'omp_lib.h' integer (kind=omp_lock_kind) lock diff --git a/tasking/sources/tasking.11.c b/tasking/sources/tasking.11.c index bf2b005..4cd1955 100644 --- a/tasking/sources/tasking.11.c +++ b/tasking/sources/tasking.11.c @@ -1,8 +1,7 @@ /* * @@name: tasking.11 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_3.1 */ diff --git a/tasking/sources/tasking.11.f90 b/tasking/sources/tasking.11.f90 index 92e9c12..8d7b5fa 100644 --- a/tasking/sources/tasking.11.f90 +++ b/tasking/sources/tasking.11.f90 @@ -1,9 +1,8 @@ ! @@name: tasking.11 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success -! @@version: omp_3.1 +! @@version: omp_3.1 subroutine foo() integer :: x x = 2 diff --git a/tasking/sources/tasking.12.c b/tasking/sources/tasking.12.c index 518d84c..ff5b6fc 100644 --- a/tasking/sources/tasking.12.c +++ b/tasking/sources/tasking.12.c @@ -1,8 +1,7 @@ /* * @@name: tasking.12 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: rt-error * @@version: omp_3.1 */ diff --git a/tasking/sources/tasking.12.f90 b/tasking/sources/tasking.12.f90 index d3a0d97..0f8a5d6 100644 --- a/tasking/sources/tasking.12.f90 +++ b/tasking/sources/tasking.12.f90 @@ -1,9 +1,8 @@ ! @@name: tasking.12 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: rt-error -! @@version: omp_3.1 +! @@version: omp_3.1 subroutine foo() integer :: x x = 2 diff --git a/tasking/sources/tasking.13.c b/tasking/sources/tasking.13.c index e5df11c..4f50e45 100644 --- a/tasking/sources/tasking.13.c +++ b/tasking/sources/tasking.13.c @@ -1,8 +1,7 @@ /* * @@name: tasking.13 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_3.1 */ diff --git a/tasking/sources/tasking.13.f90 b/tasking/sources/tasking.13.f90 index d46a9ec..5bcaad3 100644 --- a/tasking/sources/tasking.13.f90 +++ b/tasking/sources/tasking.13.f90 @@ -1,9 +1,8 @@ ! @@name: tasking.13 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success -! @@version: omp_3.1 +! @@version: omp_3.1 recursive subroutine bin_search(pos, n, state) use omp_lib integer :: pos, n diff --git a/tasking/sources/tasking.14.c b/tasking/sources/tasking.14.c index df60436..41919fa 100644 --- a/tasking/sources/tasking.14.c +++ b/tasking/sources/tasking.14.c @@ -1,8 +1,7 @@ /* * @@name: tasking.14 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_3.1 */ diff --git a/tasking/sources/tasking.14.f90 b/tasking/sources/tasking.14.f90 index cfeb913..ee99e22 100644 --- a/tasking/sources/tasking.14.f90 +++ b/tasking/sources/tasking.14.f90 @@ -1,9 +1,8 @@ ! @@name: tasking.14 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success -! @@version: omp_3.1 +! @@version: omp_3.1 subroutine foo() integer i !$omp task if(.FALSE.) ! This task is undeferred diff --git a/tasking/sources/tasking.15.c b/tasking/sources/tasking.15.c deleted file mode 100644 index 091af82..0000000 --- a/tasking/sources/tasking.15.c +++ /dev/null @@ -1,22 +0,0 @@ -/* -* @@name: tasking.15 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_4.0 -*/ -#include -int main() -{ - int x = 1; - #pragma omp parallel - #pragma omp single - { - #pragma omp task shared(x) depend(out: x) - x = 2; - #pragma omp task shared(x) depend(in: x) - printf("x = %d\n", x); - } - return 0; -} diff --git a/tasking/sources/tasking.15.f90 b/tasking/sources/tasking.15.f90 deleted file mode 100644 index 5116076..0000000 --- a/tasking/sources/tasking.15.f90 +++ /dev/null @@ -1,20 +0,0 @@ -! @@name: tasking.15 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_4.0 -program example - integer :: x - x = 1 - !$omp parallel - !$omp single - !$omp task shared(x) depend(out: x) - x = 2 - !$omp end task - !$omp task shared(x) depend(in: x) - print*, "x = ", x - !$omp end task - !$omp end single - !$omp end parallel -end program diff --git a/tasking/sources/tasking.16.c b/tasking/sources/tasking.16.c deleted file mode 100644 index 36b9a5f..0000000 --- a/tasking/sources/tasking.16.c +++ /dev/null @@ -1,22 +0,0 @@ -/* -* @@name: tasking.16 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_4.0 -*/ -#include -int main() -{ - int x = 1; - #pragma omp parallel - #pragma omp single - { - #pragma omp task shared(x) depend(in: x) - printf("x = %d\n", x); - #pragma omp task shared(x) depend(out: x) - x = 2; - } - return 0; -} diff --git a/tasking/sources/tasking.16.f90 b/tasking/sources/tasking.16.f90 deleted file mode 100644 index 449ccc0..0000000 --- a/tasking/sources/tasking.16.f90 +++ /dev/null @@ -1,20 +0,0 @@ -! @@name: tasking.16 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_4.0 -program example - integer :: x - x = 1 - !$omp parallel - !$omp single - !$omp task shared(x) depend(in: x) - print*, "x = ", x - !$omp end task - !$omp task shared(x) depend(out: x) - x = 2 - !$omp end task - !$omp end single - !$omp end parallel -end program diff --git a/tasking/sources/tasking.17.c b/tasking/sources/tasking.17.c deleted file mode 100644 index f89ae91..0000000 --- a/tasking/sources/tasking.17.c +++ /dev/null @@ -1,24 +0,0 @@ -/* -* @@name: tasking.17 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_4.0 -*/ -#include -int main() -{ - int x; - #pragma omp parallel - #pragma omp single - { - #pragma omp task shared(x) depend(out: x) - x = 1; - #pragma omp task shared(x) depend(out: x) - x = 2; - #pragma omp taskwait - printf("x = %d\n", x); - } - return 0; -} diff --git a/tasking/sources/tasking.17.f90 b/tasking/sources/tasking.17.f90 deleted file mode 100644 index fa5418f..0000000 --- a/tasking/sources/tasking.17.f90 +++ /dev/null @@ -1,21 +0,0 @@ -! @@name: tasking.17 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_4.0 -program example - integer :: x - !$omp parallel - !$omp single - !$omp task shared(x) depend(out: x) - x = 1 - !$omp end task - !$omp task shared(x) depend(out: x) - x = 2 - !$omp end task - !$omp taskwait - print*, "x = ", x - !$omp end single - !$omp end parallel -end program diff --git a/tasking/sources/tasking.18.c b/tasking/sources/tasking.18.c deleted file mode 100644 index 3336740..0000000 --- a/tasking/sources/tasking.18.c +++ /dev/null @@ -1,24 +0,0 @@ -/* -* @@name: tasking.18 -* @@type: C -* @@compilable: yes -* @@linkable: yes -* @@expect: success -* @@version: omp_4.0 -*/ -#include -int main() -{ - int x = 1; - #pragma omp parallel - #pragma omp single - { - #pragma omp task shared(x) depend(out: x) - x = 2; - #pragma omp task shared(x) depend(in: x) - printf("x + 1 = %d. ", x+1); - #pragma omp task shared(x) depend(in: x) - printf("x + 2 = %d\n", x+2); - } - return 0; -} diff --git a/tasking/sources/tasking.18.f90 b/tasking/sources/tasking.18.f90 deleted file mode 100644 index 66c9676..0000000 --- a/tasking/sources/tasking.18.f90 +++ /dev/null @@ -1,23 +0,0 @@ -! @@name: tasking.18 -! @@type: F-free -! @@compilable: yes -! @@linkable: yes -! @@expect: success -! @@version: omp_4.0 -program example - integer :: x - x = 1 - !$omp parallel - !$omp single - !$omp task shared(x) depend(out: x) - x = 2 - !$omp end task - !$omp task shared(x) depend(in: x) - print*, "x + 1 = ", x+1, "." - !$omp end task - !$omp task shared(x) depend(in: x) - print*, "x + 2 = ", x+2, "." - !$omp end task - !$omp end single - !$omp end parallel -end program diff --git a/tasking/sources/tasking.19.c b/tasking/sources/tasking.19.c deleted file mode 100644 index 04384c5..0000000 --- a/tasking/sources/tasking.19.c +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @@name: tasking.19 -* @@type: C -* @@compilable: yes -* @@linkable: no -* @@expect: success -* @@version: omp_4.0 -*/ -// Assume BS divides N perfectly -void matmul_depend(int N, int BS, float A[N][N], float B[N][N], float -C[N][N] ) -{ - int i, j, k, ii, jj, kk; - for (i = 0; i < N; i+=BS) { - for (j = 0; j < N; j+=BS) { - for (k = 0; k < N; k+=BS) { -#pragma omp task depend ( in: A[i:BS][k:BS], B[k:BS][j:BS] ) \ - depend ( inout: C[i:BS][j:BS] ) - for (ii = i; ii < i+BS; ii++ ) - for (jj = j; jj < j+BS; jj++ ) - for (kk = k; kk < k+BS; kk++ ) - C[ii][jj] = C[ii][jj] + A[ii][kk] * B[kk][jj]; - } - } - } -} diff --git a/tasking/sources/tasking.19.f90 b/tasking/sources/tasking.19.f90 deleted file mode 100644 index 3ee2edf..0000000 --- a/tasking/sources/tasking.19.f90 +++ /dev/null @@ -1,28 +0,0 @@ -! @@name: tasking.19 -! @@type: F-free -! @@compilable: yes -! @@linkable: no -! @@expect: success -! @@version: omp_4.0 -subroutine matmul_depend (N, BS, A, B, C) - integer :: N, BS, BM - real, dimension(N, N) :: A, B, C - integer :: i, j, k, ii, jj, kk - BM = BS -1 - do i = 1, N, BS - do j = 1, N, BS - do k = 1, N, BS -!$omp task depend ( in: A(i:i+BM, k:k+BM), B(k:k+BM, j:j+BM) ) & -!$omp depend ( inout: C(i:i+BM, j:j+BM) ) - do ii = i, i+BS - do jj = j, j+BS - do kk = k, k+BS - C(jj,ii) = C(jj,ii) + A(kk,ii) * B(jj,kk) - end do - end do - end do -!$omp end task - end do - end do - end do -end subroutine diff --git a/tasking/sources/tasking.2.c b/tasking/sources/tasking.2.c index 62f155c..6734d0f 100644 --- a/tasking/sources/tasking.2.c +++ b/tasking/sources/tasking.2.c @@ -1,8 +1,7 @@ /* * @@name: tasking.2 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_3.0 */ diff --git a/tasking/sources/tasking.2.f90 b/tasking/sources/tasking.2.f90 index 4be6a0d..fe568a2 100644 --- a/tasking/sources/tasking.2.f90 +++ b/tasking/sources/tasking.2.f90 @@ -1,9 +1,8 @@ ! @@name: tasking.2 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success -! @@version: omp_3.0 +! @@version: omp_3.0 RECURSIVE SUBROUTINE traverse ( P ) TYPE Node TYPE(Node), POINTER :: left, right diff --git a/tasking/sources/tasking.3.c b/tasking/sources/tasking.3.c index a3fcb75..83b9aa7 100644 --- a/tasking/sources/tasking.3.c +++ b/tasking/sources/tasking.3.c @@ -1,12 +1,10 @@ /* * @@name: tasking.3 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_3.0 */ - typedef struct node node; struct node { int data; diff --git a/tasking/sources/tasking.3.f90 b/tasking/sources/tasking.3.f90 index 1efbec5..9ae6233 100644 --- a/tasking/sources/tasking.3.f90 +++ b/tasking/sources/tasking.3.f90 @@ -1,10 +1,8 @@ ! @@name: tasking.3 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success -! @@version: omp_3.0 - +! @@version: omp_3.0 MODULE LIST TYPE NODE INTEGER :: PAYLOAD diff --git a/tasking/sources/tasking.4.c b/tasking/sources/tasking.4.c index 57fd6e4..0965161 100644 --- a/tasking/sources/tasking.4.c +++ b/tasking/sources/tasking.4.c @@ -1,8 +1,7 @@ /* * @@name: tasking.4 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_3.0 */ diff --git a/tasking/sources/tasking.4.f b/tasking/sources/tasking.4.f index 2054b5e..b6c57d9 100644 --- a/tasking/sources/tasking.4.f +++ b/tasking/sources/tasking.4.f @@ -1,7 +1,6 @@ ! @@name: tasking.4 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_3.0 RECURSIVE INTEGER FUNCTION fib(n) RESULT(res) diff --git a/tasking/sources/tasking.5.c b/tasking/sources/tasking.5.c index 9fc2a77..54d9186 100644 --- a/tasking/sources/tasking.5.c +++ b/tasking/sources/tasking.5.c @@ -1,8 +1,7 @@ /* * @@name: tasking.5 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_3.0 */ diff --git a/tasking/sources/tasking.5.f b/tasking/sources/tasking.5.f index 588fca1..02765ff 100644 --- a/tasking/sources/tasking.5.f +++ b/tasking/sources/tasking.5.f @@ -1,7 +1,6 @@ ! @@name: tasking.5 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_3.0 real*8 item(10000000) diff --git a/tasking/sources/tasking.6.c b/tasking/sources/tasking.6.c index a8769ed..e926747 100644 --- a/tasking/sources/tasking.6.c +++ b/tasking/sources/tasking.6.c @@ -1,8 +1,7 @@ /* * @@name: tasking.6 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_3.0 */ diff --git a/tasking/sources/tasking.6.f b/tasking/sources/tasking.6.f index dbb1c4e..fea03a4 100644 --- a/tasking/sources/tasking.6.f +++ b/tasking/sources/tasking.6.f @@ -1,7 +1,6 @@ ! @@name: tasking.6 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_3.0 real*8 item(10000000) diff --git a/tasking/sources/tasking.7.c b/tasking/sources/tasking.7.c index a13d723..b942bc0 100644 --- a/tasking/sources/tasking.7.c +++ b/tasking/sources/tasking.7.c @@ -1,12 +1,10 @@ /* * @@name: tasking.7 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_3.0 */ - int tp; #pragma omp threadprivate(tp) int var; diff --git a/tasking/sources/tasking.7.f b/tasking/sources/tasking.7.f index ba094d1..1835a9d 100644 --- a/tasking/sources/tasking.7.f +++ b/tasking/sources/tasking.7.f @@ -1,7 +1,6 @@ ! @@name: tasking.7 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_3.0 module example diff --git a/tasking/sources/tasking.8.c b/tasking/sources/tasking.8.c index 0101265..5e7bd92 100644 --- a/tasking/sources/tasking.8.c +++ b/tasking/sources/tasking.8.c @@ -1,12 +1,10 @@ /* * @@name: tasking.8 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_3.0 */ - int tp; #pragma omp threadprivate(tp) int var; diff --git a/tasking/sources/tasking.8.f b/tasking/sources/tasking.8.f index 38fc281..30b15d6 100644 --- a/tasking/sources/tasking.8.f +++ b/tasking/sources/tasking.8.f @@ -1,7 +1,6 @@ ! @@name: tasking.8 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success ! @@version: omp_3.0 module example diff --git a/tasking/sources/tasking.9.c b/tasking/sources/tasking.9.c index 7261dfd..92ade91 100644 --- a/tasking/sources/tasking.9.c +++ b/tasking/sources/tasking.9.c @@ -1,8 +1,7 @@ /* * @@name: tasking.9 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: rt-error * @@version: omp_3.0 */ diff --git a/tasking/sources/tasking.9.f b/tasking/sources/tasking.9.f index abfd4ee..d39f75c 100644 --- a/tasking/sources/tasking.9.f +++ b/tasking/sources/tasking.9.f @@ -1,7 +1,6 @@ ! @@name: tasking.9 ! @@type: F-fixed -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: rt-error ! @@version: omp_3.0 module example diff --git a/tasking/sources/taskloop.1.c b/tasking/sources/taskloop.1.c index afc63e4..d467ffe 100644 --- a/tasking/sources/taskloop.1.c +++ b/tasking/sources/taskloop.1.c @@ -1,8 +1,7 @@ /* * @@name: taskloop.1 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_4.5 */ diff --git a/tasking/sources/taskloop.1.f90 b/tasking/sources/taskloop.1.f90 index 50465f6..c5f7bed 100644 --- a/tasking/sources/taskloop.1.f90 +++ b/tasking/sources/taskloop.1.f90 @@ -1,9 +1,8 @@ ! @@name: taskloop.1 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success -! @@version: omp_4.5 +! @@version: omp_4.5 subroutine parallel_work integer i integer j diff --git a/tasking/sources/taskloop.2.c b/tasking/sources/taskloop.2.c index 027df2b..8b10d69 100644 --- a/tasking/sources/taskloop.2.c +++ b/tasking/sources/taskloop.2.c @@ -1,10 +1,9 @@ /* -* @@name: taskloop.2 -* @@type: C -* @@compilable: yes -* @@linkable: no -* @@expect: success -* @@version: omp_4.5 +* @@name: taskloop.2 +* @@type: C +* @@operation: compile +* @@expect: success +* @@version: omp_4.5 */ #include diff --git a/tasking/sources/taskloop.2.f90 b/tasking/sources/taskloop.2.f90 index 818314e..401d001 100644 --- a/tasking/sources/taskloop.2.f90 +++ b/tasking/sources/taskloop.2.f90 @@ -1,9 +1,8 @@ -! @@name: taskloop.2 -! @@type: F-free -! @@compilable: yes -! @@linkable: no -! @@expect: success -! @@version: omp_4.5 +! @@name: taskloop.2 +! @@type: F-free +! @@operation: compile +! @@expect: success +! @@version: omp_4.5 subroutine parallel_work implicit none integer :: x1, x2 diff --git a/tasking/sources/taskyield.1.c b/tasking/sources/taskyield.1.c index 1b2c1b4..1ec6031 100644 --- a/tasking/sources/taskyield.1.c +++ b/tasking/sources/taskyield.1.c @@ -1,8 +1,7 @@ /* * @@name: taskyield.1 * @@type: C -* @@compilable: yes -* @@linkable: no +* @@operation: compile * @@expect: success * @@version: omp_3.1 */ diff --git a/tasking/sources/taskyield.1.f90 b/tasking/sources/taskyield.1.f90 index 8c2b2bb..3b46bf3 100644 --- a/tasking/sources/taskyield.1.f90 +++ b/tasking/sources/taskyield.1.f90 @@ -1,9 +1,8 @@ ! @@name: taskyield.1 ! @@type: F-free -! @@compilable: yes -! @@linkable: no +! @@operation: compile ! @@expect: success -! @@version: omp_3.1 +! @@version: omp_3.1 subroutine foo ( lock, n ) use omp_lib integer (kind=omp_lock_kind) :: lock diff --git a/tasking/task_dep.tex b/tasking/task_dep.tex index b7103a6..d7507df 100644 --- a/tasking/task_dep.tex +++ b/tasking/task_dep.tex @@ -19,7 +19,7 @@ clause on the \code{task} construct. \ffreeexample[4.0]{task_dep}{1} -The program will always print \texttt{"}x = 2\texttt{"}, because the \code{depend} +The program will always print ``x = 2'', because the \code{depend} clauses enforce the ordering of the tasks. If the \code{depend} clauses had been omitted, then the tasks could execute in any order and the program and the program would have a race condition. @@ -35,7 +35,7 @@ clause on the \code{task} construct. \ffreeexample[4.0]{task_dep}{2} -The program will always print \texttt{"}x = 1\texttt{"}, because the \code{depend} +The program will always print ``x = 1'', because the \code{depend} clauses enforce the ordering of the tasks. If the \code{depend} clauses had been omitted, then the tasks could execute in any order and the program would have a race condition. @@ -51,7 +51,7 @@ clause on the \code{task} construct. \ffreeexample[4.0]{task_dep}{3} -The program will always print \texttt{"}x = 2\texttt{"}, because the \code{depend} +The program will always print ``x = 2'', because the \code{depend} clauses enforce the ordering of the tasks. If the \code{depend} clauses had been omitted, then the tasks could execute in any order and the program would have a race condition. @@ -65,16 +65,32 @@ In this example we show potentially concurrent execution of tasks using multiple flow dependences expressed using the \code{depend} clause on the \code{task} construct. +The last two tasks are dependent on the first task. However, there is no dependence +between the last two tasks, which may execute in any order (or concurrently if +more than one thread is available). Thus, the possible outputs are ``x ++ 1 = 3. x + 2 = 4.'' and ``x + 2 = 4. x + 1 = 3.''. +If the \code{depend} clauses had been omitted, then all of the tasks could execute +in any order and the program would have a race condition. + \cexample[4.0]{task_dep}{4} \ffreeexample[4.0]{task_dep}{4} -The last two tasks are dependent on the first task. However, there is no dependence -between the last two tasks, which may execute in any order (or concurrently if -more than one thread is available). Thus, the possible outputs are \texttt{"}x -+ 1 = 3. x + 2 = 4. \texttt{"} and \texttt{"}x + 2 = 4. x + 1 = 3. \texttt{"}. -If the \code{depend} clauses had been omitted, then all of the tasks could execute -in any order and the program would have a race condition. +The following example illustrates the semantic difference between \scode{inout} +and \scode{inoutset} dependence types. In CASE 1, tasks generated at T1 +inside the loop have dependences among themselves due to +the \scode{inout} dependence type and with task T2. +As a result, these tasks are executed sequentially before the print +statement from task T2. +In CASE 2, tasks generated at T3 inside the loop have no dependences +among themselves from the \scode{inoutset} dependence type, but have +dependences with task T4. +As a result, these tasks are executed concurrently before the print +statement from task T4. + +\cexample[5.1]{task_dep}{4b} + +\ffreeexample[5.1]{task_dep}{4b} \subsection{Matrix multiplication} \label{subsec:task_matrix_mult} @@ -143,6 +159,7 @@ in a data-flow model.) \cexample[5.0]{task_dep}{7} \ffreeexample[5.0]{task_dep}{7} +\clearpage This example is similar to the previous one, except the generating task is @@ -222,8 +239,8 @@ after all the tasks generated by the loop have completed. Note, one cannot simply use an array section in the \code{depend} clause of the second task construct because this would violate the \code{depend} clause restriction: -"List items used in \code{depend} clauses of the same task or sibling tasks -must indicate identical storage locations or disjoint storage locations". +``List items used in \code{depend} clauses of the same task or sibling tasks +must indicate identical storage locations or disjoint storage locations''. In this case each of the loop tasks use a single disjoint (different storage) element in their \code{depend} clause; however, @@ -254,7 +271,7 @@ is completed. But, because of the dependence, the first explicit task must complete first, then the second explicit task can execute and complete, and only then the generating task can resume to the print statement. -Thus, the program will always print "\texttt{x = 2}". +Thus, the program will always print ``\texttt{x = 2}''. \cexample[4.0]{task_dep}{12} \clearpage diff --git a/tasking/tasking.tex b/tasking/tasking.tex index 0f4f1ba..3cd87ed 100644 --- a/tasking/tasking.tex +++ b/tasking/tasking.tex @@ -97,7 +97,6 @@ value of \code{var} can be either 1 or 2. \cexample[3.0]{tasking}{7} - \fexample[3.0]{tasking}{7} In this example, scheduling constraints prohibit a thread in the team from executing @@ -107,7 +106,6 @@ task scheduling point. \cexample[3.0]{tasking}{8} - \fexample[3.0]{tasking}{8} The following two examples demonstrate how the scheduling rules illustrated in @@ -123,7 +121,6 @@ begin task 2 which will result in a deadlock when it tries to enter critical reg \cexample[3.0]{tasking}{9} - \fexample[3.0]{tasking}{9} In the following example, \code{lock} is held across a task scheduling point. diff --git a/util/README b/util/README new file mode 100644 index 0000000..9d8528b --- /dev/null +++ b/util/README @@ -0,0 +1,44 @@ +A Few Utilities for Checking and Listing Tags in Source Codes + +- chk_tags.x (created from 'make chk_tags.x') + + A utility to check validity of @@ in source codes. + The tool can also be used to fix issues when possible. + This tool is used by script '../sources/check_tags'. + + Usage: chk_tags.x [-options] filename ... + options - + -sc ; strictly check for "@@:" + -vtag ; check version tags in tex file + -clen ; check line length over a limit (def =75) + -fix ; apply tag fix if needed (to _fix) + -list ; list tags (with -vtag to list version tags) + +- get_tags + + Generate a source template with proper source tags. + + Usage: gen_tags [-tags] [- ...] [] + options - + -tags ; list supported tags and values + - ; specify a tag and its value + ; give filename in form of + + Any of the tag information may be entered at the prompt later. + If is not given, construct it from and . + For an existing file with tags, print tags in the file; + for an existing file without tags, add tags to the file; + otherwise, create a file with new tags. + +- list_tags + + List tag information in source codes. This tool is used by make + in the top-level directory to generate generated-include.tex. + + Usage: list_tags [options] [-h] + options - + -list ; list tags in csv format + -vtag ; create version tag info for use in latex file + -env|-fenv ; print env tag values + -clen= ; check line length, default =75 + Multiple files may be specified diff --git a/util/chk_tags.c b/util/chk_tags.c index 7feff74..ca56b3c 100644 --- a/util/chk_tags.c +++ b/util/chk_tags.c @@ -5,44 +5,86 @@ * Version 0.1 checks only @@name and @@type. * Version 0.2 added check for other tags. * Version 0.3 added check for line length. + * Version 0.4 added check for version tags in tex files. + * updated for new tag format + * Version 0.5 enabled translation of empty version tag to "pre_omp" */ #define _GNU_SOURCE #include #include #include -#define VERNO "0.3" +#define VERNO "0.5" -#define BUF_SIZE 256 +#define BKS '\\' +#define BUF_SIZE 1024 +#define FN_SIZE 256 +#define TAG_SIZE 256 #define F_VFILE 0x01 #define F_STRICT 0x02 #define F_FIXIT 0x04 #define F_CHKLLN 0x08 +#define F_CHKTAG 0x10 +#define F_LIST 0x20 +#define F_VLIST 0x31 +#define F_HLIST 0x40 #define T_PNAME 0x02 #define T_MTAGS 0x04 +#define skipspc(ic, cp) \ + for (cp += ic; *cp == ' ' || *cp == '\t'; cp++) + /* list of tags */ static int max_tags = 7; +static int vtag_idx = 4; +static int etag_idx = 5; static struct tags_s { char *name; /* tag name */ char *tvals; /* possible values */ int nc; /* size of name */ int r, c; /* line number, column number */ + char val[TAG_SIZE]; /* actual value */ } tags[] = { {"name", "", 4, 0, 0}, {"type", "", 4, 0, 0}, - {"compilable", "yes|no|maybe|unknown", 10, 0, 0}, - {"linkable", "yes|no|maybe|unknown", 8, 0, 0}, - {"expect", "success|failure|nothing|compile-time-error|ct-error" - "|runtime-error|rt-error|undefined-behavior", 6, 0, 0}, + {"operation", "view|compile|link|run", 9, 0, 0}, + {"expect", "success|error|ct-error|rt-error" + "|undefined|unspecified", 6, 0, 0}, {"version", "omp_*", 7, 0, 0}, - {"requires", "preprocessing", 8, 0, 0} + {"env", "", 3, 0, 0}, + {"depend", "", 6, 0, 0}, + {"unused", "", 6, 0, 0} }; /* supported file extensions and types */ static int max_exts = 4; -static char *fexts[] = {"c", "cpp", "f", "f90"}; -static char *types[] = {"C", "C++", "F-fixed", "F-free"}; +static struct ftype_s { + char *ext; + char *type; +} ftypes[] = { + {"c", "C"}, + {"cpp", "C++"}, + {"f", "F-fixed"}, + {"f90", "F-free"} +}; + +/* latex macro keys */ +static int max_mkeys = 9; +static struct keys_s { + char *kname; + int nc; + int iext; +} type_mkeys[] = { + {"cnexample", 9, 0}, + {"cppnexample", 11, 1}, + {"fnexample", 9, 2}, + {"ffreenexample",13, 3}, + {"srcnexample", 11,-1}, + {"cexample", 8, 0}, + {"cppexample", 10, 1}, + {"fexample", 8, 2}, + {"ffreeexample", 12, 3} +}; /* match filename (mname) with tname value (tvalue) up to file extension (fext). @@ -84,8 +126,8 @@ int check_type(char *ttype, char *fext, int *iext) int mext, s = 1; /* get ext index from ttype value */ for (mext = max_exts-1; mext >= 0; mext--) { - if (strcasecmp(ttype, fexts[mext]) == 0 || - strcasecmp(ttype, types[mext]) == 0) break; + if (strcasecmp(ttype, ftypes[mext].ext) == 0 || + strcasecmp(ttype, ftypes[mext].type) == 0) break; } if (mext < 0) { if (strcasecmp(ttype, "ffree") == 0) @@ -94,21 +136,35 @@ int check_type(char *ttype, char *fext, int *iext) mext = 2; } *iext = mext; - if (mext >= 0 && fext && strcasecmp(fexts[mext], fext+1) == 0) + if (mext >= 0 && fext && strcasecmp(ftypes[mext].ext, fext+1) == 0) s = 0; return s; } /* check validity of a tag value. - return 0 - OK, 1 - unexpected */ + return 0 - unexpected, >= 1 - OK */ int check_tvalue(char *tvalue, int itag) { - int s = 0; - if (itag == 5) { - s = strncasecmp(tvalue, tags[itag].tvals, 4); + int s = 1; + if (*tvalue == '\0') + s = 0; + else if (itag == vtag_idx) { + if (strncasecmp(tvalue, "pre_omp", 7) == 0) + s = 1; + else + s = (strncasecmp(tvalue, tags[itag].tvals, 4) == 0)? 1 : 0; } - else if (itag >= 2 && itag <= 6) { - if (!strcasestr(tags[itag].tvals, tvalue)) s = 1; + else if (itag > 1 && itag < etag_idx) { + char *cp = strcasestr(tags[itag].tvals, tvalue); + if (!cp) + s = 0; + else { + char *vp = tags[itag].tvals; + while (vp != cp) { + if (*vp == '|') s++; + vp++; + } + } } return s; } @@ -148,7 +204,13 @@ int fix_tags(char *fname, char *mname, char *fext, int iext) } cp = strstr(buff, "@@"); if (!cp) { - if (tcnt == 1) tcnt = 2; + if (tcnt == 1) { + if (!tags[vtag_idx].c) { + fprintf(fou, "%c", (iext>1)? '!':'*'); + fprintf(fou, " @@version:\tpre_omp_3.0\n"); + } + tcnt = 2; + } fputs(buff, fou); continue; } @@ -159,7 +221,7 @@ int fix_tags(char *fname, char *mname, char *fext, int iext) fputs(buff, fou); continue; } - for (cp += 2; *cp == ' ' || *cp == '\t'; cp++); + skipspc(2, cp); ic = tags[i].c; cp += ic; fprintf(fou, "%.*s", (int)(cp-buff), buff); @@ -182,9 +244,9 @@ int fix_tags(char *fname, char *mname, char *fext, int iext) /* use supported type value */ if (iext < 0) { for (iext = max_exts-1; iext > 0; iext--) - if (strcasecmp(fexts[iext], fext+1) == 0) break; + if (strcasecmp(ftypes[iext].ext, fext+1) == 0) break; } - fprintf(fou, "%s\n", types[iext]); + fprintf(fou, "%s\n", ftypes[iext].type); } else { fputs(cp, fou); @@ -226,6 +288,7 @@ int chk_file(char *fname, int vflg, int lln) ntags++; if (ntags == 1 && *buff != '!') ntags += 2; if (ctag == 0) ctag = 1; + continue; } else if (ctag == 1) ctag = 2; @@ -236,7 +299,9 @@ int chk_file(char *fname, int vflg, int lln) tcnt++; if (tcnt == 1 && !(vflg&F_VFILE)) printf(">> File = %s\n", fname); - printf(" line %d (S-%d): nchars = %d\n", lineno, lineno-ntags, nc); + printf(" line %d ", lineno); + if (ntags > 0) printf("(S-%d)", lineno-ntags); + printf(": nchars = %d\n", nc); } } fclose(fp); @@ -247,13 +312,14 @@ int chk_file(char *fname, int vflg, int lln) int proc_file(char *fname, int vflg) { FILE *fp; - char buff[BUF_SIZE], *cp; + char buff[BUF_SIZE], *cp, *ip; char *mname, *fext; - int lineno, tcnt, ic, iext, i, s; + int lineno, tcnt, cnt, ic, iext, i, s, ctag; + ctag = (vflg & F_CHKTAG); fp = fopen(fname, "r"); if (!fp) { - perror(fname); + if (!ctag) perror(fname); return -1; } @@ -261,13 +327,15 @@ int proc_file(char *fname, int vflg) mname = strrchr(fname, '/'); mname = mname? (mname+1) : fname; fext = strrchr(mname, '.'); - for (i = 0; i < max_tags; i++) + for (i = 0; i < max_tags; i++) { tags[i].r = tags[i].c = 0; + tags[i].val[0] = '\0'; + } /* search for @@ */ if (vflg&F_VFILE) fprintf(stderr, "file = %s\n", fname); - tcnt = lineno = 0; + tcnt = cnt = lineno = 0; iext = -1; while (fgets(buff, BUF_SIZE, fp)) { lineno++; @@ -276,39 +344,44 @@ int proc_file(char *fname, int vflg) if (tcnt) break; continue; } - if (tcnt == 0) tcnt = 1; - for (cp += 2; *cp == ' ' || *cp == '\t'; cp++); + cnt++; + if (tcnt == 0) { + ip = buff; + skipspc(0, ip); + if (*ip != '/' && *ip != '!') cnt += 2; + tcnt = 1; + } + skipspc(2, cp); for (ic = 0; !strchr(": \t\n", cp[ic]); ic++); i = max_tags; - if (ic >= 4) { + if (ic >= 3) { for (i = 0; i < max_tags; i++) { if (tags[i].nc != ic) continue; if (strncasecmp(cp, tags[i].name, ic) == 0) break; } } - if (i >= max_tags || tags[i].c != 0) { - prn_fname(&tcnt, fname, vflg); - if (tags[i].c != 0) - fprintf(stderr, "\t*** duplicated tag - @@%.*s (lines %d, %d)\n", - ic, cp, tags[i].r, lineno); - else - fprintf(stderr, "\t*** unrecognized tag - @@%.*s\n", ic, cp); - } - else { + if (i < max_tags && tags[i].c == 0) { tags[i].r = lineno; - if (cp[ic] != ':') { + if (cp[ic] == ':') + ic++; + else if (!ctag) { prn_fname(&tcnt, fname, vflg); fprintf(stderr, "\tmissing (:) after @@%s\n", tags[i].name); tags[i].c = ic; tcnt |= T_MTAGS; } - else - ic++; - while (cp[ic] == ' ' || cp[ic] == '\t') ic++; - cp += ic; - s = strlen(cp) - 1; - while (s >= 0 && strchr("\t \n", cp[s])) cp[s--] = '\0'; - if (i == 0 || i == 1) { + ip = &cp[ic]; + skipspc(ic, cp); + ic += (int)(cp - ip); + s = strlen(cp); + while (s > 0 && strchr("\t \n", cp[s-1])) s--; + if (s >= TAG_SIZE) s = TAG_SIZE - 1; + cp[s] = '\0'; + if (ctag) { + tags[i].c++; + strcpy(tags[i].val, cp); + } + else if (i == 0 || i == 1) { if (i == 0) s = check_name(cp, mname, fext, vflg); else @@ -322,7 +395,7 @@ int proc_file(char *fname, int vflg) } else { s = check_tvalue(cp, i); - if (s) { + if (!s) { prn_fname(&tcnt, fname, vflg); fprintf(stderr, "\t*** unknown value for @@%s: %s\n", tags[i].name, cp); @@ -330,9 +403,20 @@ int proc_file(char *fname, int vflg) } if (tags[i].c == 0) tags[i].c = -1; } + else if (ctag) + tags[i].c++; + else if (i < etag_idx || i >= max_tags) { + prn_fname(&tcnt, fname, vflg); + if (tags[i].c != 0) + fprintf(stderr, "\t*** duplicated tag - @@%.*s (lines %d, %d)\n", + ic, cp, tags[i].r, lineno); + else + fprintf(stderr, "\t*** unrecognized tag - @@%.*s\n", ic, cp); + } } fclose(fp); + if (ctag) return cnt; if (!tags[0].c || !tags[1].c) { prn_fname(&tcnt, fname, vflg); fprintf(stderr, "\t*** no"); @@ -341,6 +425,11 @@ int proc_file(char *fname, int vflg) if (!tags[1].c) fprintf(stderr, " @@%s", tags[1].name); fprintf(stderr, " tag found\n"); } + if ((vflg&F_STRICT) && !tags[vtag_idx].c) { + tcnt |= T_MTAGS; + prn_fname(&tcnt, fname, vflg); + fprintf(stderr, "\t*** no @@%s tag found\n", tags[vtag_idx].name); + } /* fix tag values when required */ if ((tcnt&T_MTAGS) && (vflg&F_FIXIT)) { @@ -349,22 +438,196 @@ int proc_file(char *fname, int vflg) return tcnt; } +/* return source file name and tag from macro in kbuf */ +int get_mkeys(char *kbuf, char *sname, char *tag) +{ + int i, n, iext; + char *cp = kbuf; + while (*cp && *cp != BKS && *cp != '%') cp++; + if (*cp != BKS) return 0; + cp++; + for (i = 0; i < max_mkeys; i++) { + n = type_mkeys[i].nc; + if (strncmp(cp, type_mkeys[i].kname, n) == 0) { + cp += n; + break; + } + } + if (i >= max_mkeys) return 0; + skipspc(0, cp); + if (*cp == '[') { + cp++; + n = 4; + while (*cp && *cp != ']' && *cp != '{') + tag[n++] = *cp++; + if (n > 4) + memcpy(tag, "omp_", 4); + else + n = 0; + tag[n] = '\0'; + if (*cp == ']') cp++; + while (*cp == ' ' || *cp == '\t') cp++; + } + else + tag[0] = '\0'; + if (*cp != '{') return 0; + cp++; + n = 0; + while (*cp && *cp != '}') { + sname[n++] = *cp++; + } + if (!*cp) return 0; + skipspc(1, cp); + if (*cp != '{') return 0; + cp++; + sname[n++] = '.'; + while (*cp && *cp != '}') { + sname[n++] = *cp++; + } + if (!*cp) return 0; + iext = type_mkeys[i].iext; + if (iext < 0) { + skipspc(1, cp); + if (*cp != '{') return 0; + cp++; + sname[n++] = '.'; + while (*cp && *cp != '}') { + sname[n++] = *cp++; + } + if (!*cp) return 0; + sname[n] = '\0'; + } + else { + sprintf(sname+n, ".%s", ftypes[iext].ext); + } + return (i+1); +} + +/* check version tags in tex file */ +int chk_vtags_file(char *fname, int vflg, int *tc) +{ + char buff[BUF_SIZE], sfname[FN_SIZE], sname[TAG_SIZE], tag[TAG_SIZE]; + char *dp, *stag; + FILE *fp; + int k, n, cnt, s; + fp = fopen(fname, "r"); + if (!fp) { + perror(fname); + return -1; + } + dp = strrchr(fname, '/'); + if (!dp) dp = fname + strlen(fname); + cnt = *tc = 0; + while (fgets(buff, BUF_SIZE, fp)) { + k = get_mkeys(buff, sname, tag); + if (k > 0) { + n = 0; + if (dp) + n += sprintf(sfname+n, "%.*s", (int)(dp-fname)+1, fname); + n += sprintf(sfname+n, "sources/%s", sname); + if ((vflg & F_VFILE) && (vflg & F_LIST)) { + printf("%s\n", sfname); + continue; + } + stag = tags[vtag_idx].val; + s = proc_file(sfname, vflg); + if (s < 0) + /*EMPTY*/; + else if (vflg & F_LIST) { + char *cp = (*stag)? strstr(stag, "omp_") : NULL; + if (*stag && strncmp(stag, "omp_", 4) == 0) stag += 4; + printf("\\newlabel{ex_vtag:%s}{{", sname); + if (cp) { + if (cp > stag) printf("%.*s", (int)(cp-stag), stag); + stag += (int)(cp-stag) + 4; + } + printf("%s}{%d}{}{}{}}\n", stag, s); + continue; + } + else { + if (*tag) (*tc)++; + if (*stag && strncmp(stag, "pre_", 4) == 0) stag += strlen(stag); + if (*tag && *stag) + s = (strcmp(tag, stag) == 0)? 0 : 1; + else + s = (*tag != *stag); + } + if (!s) + continue; + if (cnt++ == 0) + fprintf(stderr, "file - %s\n", fname); + fprintf(stderr, " %s", sfname); + if (s < 0) + fprintf(stderr, " *** not exist"); + else + fprintf(stderr, " [%s]", (*stag)? stag : "none"); + fprintf(stderr, " -- [doc:%s]\n", (*tag)? tag : "none"); + } + } + fclose(fp); + return cnt; +} + +/* list tags in one file at a time */ +int list_tags_file(char *fname, int vflg) +{ + int i, s; + char *cp; + + if (proc_file(fname, vflg|F_CHKTAG) < 0) return -1; + + if (vflg & F_HLIST) { + printf("filename"); + for (i = 0; i < max_tags; i++) { + printf(",%s", tags[i].name); + } + printf("\n"); + } + + printf("%s", fname); + for (i = 0; i < max_tags; i++) { + s = 0; + if (i >= etag_idx) { + for (cp = tags[i].val; *cp && !strchr(",'\"", *cp); cp++); + if (*cp) s = 1; + } + cp = tags[i].val; + if (s == 1) { + printf(",\""); + for (; *cp; cp++) { + if (*cp == '"') putchar(*cp); + putchar(*cp); + } + putchar('"'); + if (tags[i].c > 1) + printf(",%d more %s tags", tags[i].c-1, tags[i].name); + } + else + printf(",%s", cp); + } + printf("\n"); + + return 0; +} + /* print usage and exit */ void usage(char *pgnam) { printf("chk_tags - v%s\n%s [-options] filename ...\n", VERNO, pgnam); printf("options:\n\ - -v ; view filenames\n\ - -sc ; strictly check for \"@@:\"\n\ - -fix ; apply tag fix if needed (to _fix)\n\ - -c ; check line length over a limit (def =75)\n"); + -sc ; strictly check for \"@@:\"\n\ + -vtag ; check version tags in tex file\n\ + -clen ; check line length over a limit (def =75)\n\ + -fix ; apply tag fix if needed (to _fix)\n\ + -list ; list tags (with -vtag to list version tags)\n\ + -v ; view filenames\n"); exit(0); } /* the driver */ int main(int argc, char *argv[]) { - int cnt, fcnt = -1, bcnt = 0, vflg = 0, lln = 75; + int cnt, fcnt = -1, bcnt = -1, scnt = 0, tcnt = 0, vflg = 0, lln = 75; char *pgnam = strrchr(argv[0], '/'); pgnam = pgnam? (pgnam+1) : argv[0]; while (--argc > 0) { @@ -375,11 +638,17 @@ int main(int argc, char *argv[]) vflg |= F_STRICT; else if (strcmp(cp, "-fix") == 0) vflg |= (F_STRICT|F_FIXIT); - else if (strncmp(cp, "-c", 2) == 0) { + else if (strcmp(cp, "-vtag") == 0) + vflg |= F_CHKTAG; + else if (strcmp(cp, "-list") == 0) + vflg |= F_LIST; + else if (strncmp(cp, "-clen", 5) == 0) { vflg |= F_CHKLLN; - if (cp[2]) { - lln = atoi(cp+2); - if (lln < 1) lln = 75; + cp += 5; + if (*cp == '=') cp++; + if (*cp) { + lln = atoi(cp); + if (lln < 2) lln = 75; } } else if (strcmp(cp, "-h") == 0) @@ -387,11 +656,27 @@ int main(int argc, char *argv[]) else { if (vflg & F_CHKLLN) cnt = chk_file(cp, vflg, lln); + else if (vflg & F_CHKTAG) { + int tc = 0; + cnt = chk_vtags_file(cp, vflg, &tc); + if (cnt > 0) { + scnt += cnt; + cnt++; + } + tcnt += tc; + } + else if (vflg & F_LIST) { + int vf = vflg; + if (fcnt < 0) vf |= F_HLIST; + cnt = list_tags_file(cp, vf); + } else cnt = proc_file(cp, vflg); if (fcnt < 0) fcnt = 0; if (cnt < 0) break; fcnt++; + if (bcnt < 0 && (cnt > 1 || (vflg & F_VLIST) != F_VLIST)) + bcnt = 0; if (cnt > 1) bcnt++; } } @@ -400,6 +685,13 @@ int main(int argc, char *argv[]) fprintf(stderr, "Number of files scanned = %d\n", fcnt); if ((vflg & F_CHKLLN) && fcnt > 0) fprintf(stderr, "Line length limit = %d\n", lln); - fprintf(stderr, "Number of bad files = %d\n", bcnt); + if (vflg & F_CHKTAG) { + if (tcnt > 0) + fprintf(stderr, "Number of version tags = %d\n", tcnt); + if (scnt > 0) + fprintf(stderr, "Number of bad src files = %d\n", scnt); + } + if (bcnt >= 0) + fprintf(stderr, "Number of bad files = %d\n", bcnt); return 0; } diff --git a/util/cvt_fixed b/util/cvt_fixed new file mode 100755 index 0000000..7cab102 --- /dev/null +++ b/util/cvt_fixed @@ -0,0 +1,22 @@ +#!/bin/bash + +dryrun=0 +if [ "$1" = "revert" ]; then + for i in `ls */sources/*_orig`; do + nf=`echo $i | sed -e 's/_orig$//'` + echo "file -- $i --> $nf" + if [ $dryrun -eq 0 ]; then + mv $nf ${nf}_fix + mv $i $nf + fi + done +else + for i in `ls */sources/*_fix`; do + nf=`echo $i | sed -e 's/_fix$//'` + echo "file -- $i --> $nf" + if [ $dryrun -eq 0 ]; then + mv $nf ${nf}_orig + mv $i $nf + fi + done +fi diff --git a/util/gen_tags b/util/gen_tags new file mode 100755 index 0000000..99b9bb9 --- /dev/null +++ b/util/gen_tags @@ -0,0 +1,227 @@ +#!/usr/bin/env python3 + +import sys +import os +import re + +tag_metadata = { + 'name' : ['R', '', '.'], + 'type' : ['R', '', ['c','cpp','f','f90']], + 'operation': ['R', '', ['compile','link','run','view']], + 'expect' : ['R', '', ['success','ct-error','rt-error','unspecified']], + 'version' : ['V', '', ['5.2','5.1','5.0','4.5','4.0','3.1','3.0']], + 'env' : ['O', '', '='], + 'depend' : ['O', '', ''] +} +tv_kind = 0 +tv_val = 1 +tv_sval = 2 + +tag_present = { + 'R' : 'required', + 'V' : 'optional', + 'O' : 'optional, repeatable' +} + +tag_type_conv = { + 'c' : 'C', + 'cpp' : 'C++', + 'f' : 'F-fixed', + 'f90' : 'F-free' +} + +def write_tags(dflag): + ft = tag_metadata['type'][tv_val] + tv = tv_sval + ps = '' + + if dflag <= 0: + tv = tv_val + if ft[0] == 'c': + ps = '*' + else: + ps = '!' + fname = tag_metadata['name'][tv_val] + '.' + ft + if dflag == 0: + fname_save = fname + '_save' + os.rename(fname, fname_save) + print(f">>> adding tags to file: {fname}") + print(f"... original saved to : {fname_save}") + else: + print(f">>> creating file: {fname}") + f = open(fname, 'w') + if ft[0] == 'c': + f.write("/*\n") + + cnt = 0 + for tag in list(tag_metadata): + val = tag_metadata[tag][tv] + kind = tag_metadata[tag][tv_kind] + if val == '' and kind == 'V': + val = "pre_omp_3.0" + elif val == '' and kind != 'R': + continue + if dflag > 0: + print(' {:9s} ({}): {}'.format(tag, tag_present[kind], val)) + elif kind != 'O': + if tag == 'type': + val = tag_type_conv[val] + elif tag == 'version' and val.find("pre", 0) < 0: + val = "omp_" + val + cnt += 1 + f.write('{} @@{}:\t{}\n'.format(ps, tag, val)) + else: + for val in tag_metadata[tag][tv_val]: + cnt += 1 + f.write('{} @@{}:\t{}\n'.format(ps, tag, val)) + + if dflag <= 0: + if ft[0] == 'c': + f.write("*/\n") + if dflag == 0: + fs = open(fname_save, 'r') + f.write(fs.read()) + fs.close() + f.close() + print(f'... {cnt} tags added') + +def list_tags(fname): + cnt = 0 + try: + f = open(fname, 'r') + except OSError: + cnt = -1 + else: + for line in f: + idx = line.find("@@") + if idx >= 0: + cnt += 1 + print(line, end='') + elif cnt > 0: + break + f.close() + if cnt > 0: + print(f">>> {fname} contains {cnt} tags") + return cnt + +def get_tag_values(): + cnt = -1 + for tag in list(tag_metadata): + if tag == 'operation': + fname = tag_metadata['name'][tv_val] + fname += '.' + tag_metadata['type'][tv_val] + cnt = list_tags(fname) + if cnt > 0: + return cnt + prompt = tag + '? ' + kind = tag_metadata[tag][tv_kind] + pval = tag_metadata[tag][tv_val] + if pval == '': + val = tag_metadata[tag][tv_sval] + print('{}: {}'.format(tag, val)) + if kind == 'R' and tag != 'name': + print('.. enter a first few letters (def={})'.format(val[0])) + else: + print('>> {} = {}'.format(tag, pval)) + if kind == 'R' or kind == 'V': + val = '' + while val == '': + if pval == '': + val = input(prompt) + else: + val = pval + pval = '' + if val == '': + if kind == 'V': + break + if tag != 'name': + val = tag_metadata[tag][tv_sval][0] + elif tag == 'name': + if not '.' in val: + print("*** '.' missing, try again") + val = '' + else: + for rval in tag_metadata[tag][tv_sval]: + if rval.find(val, 0) >= 0: + val = rval + break + else: + sval = '' + if tag == 'type': + for rval in list(tag_type_conv): + if tag_type_conv[rval].find(val, 0) >= 0: + sval = rval + break + if sval == '': + print(f"*** [{val}] not in the supported list:") + print(tag_metadata[tag][tv_sval]) + val = sval + tag_metadata[tag][tv_val] = val + else: + if pval == '': + val = input(prompt) + else: + val = pval + mval = [] + while val != '': + if tag != 'env' or '=' in val: + mval.append(val) + else: + print("*** '=' missing, not added") + val = input(prompt) + tag_metadata[tag][tv_val] = mval + return cnt + +def main(): + tcnt = 0 + i = 1 + while i < len(sys.argv): + arg, i = sys.argv[i], i+1 + if arg == '-t' or arg == '-tags': + write_tags(1) + return 0 + tag = re.sub('^-', '', arg) + if tag in list(tag_metadata): + if i < len(sys.argv): + tag_metadata[tag][tv_val], i = sys.argv[i], i+1 + elif arg == '-h' or arg == '-help': + print( +"""usage: gen_tags [-tags] [- ...] [] + -tags ; list supported tags and values + - ; specify a tag and its value + ; give filename in form of + +Any of the tag information may be entered at the prompt later. +If is not given, construct it from and . +For an existing file with tags, print tags in the file; +for an existing file without tags, add tags to the file; +otherwise, create a file with new tags.""") + sys.exit(0); + elif arg[0] == '-': + print(f"*** unknown option: {arg}") + return 1 + elif tcnt < 0: + print(f"*** too many filenames - {arg}") + return 1 + else: + cnt = list_tags(arg) + if cnt > 0 or tcnt > 0: + tcnt += 1 + continue + tcnt = -1 + items = arg.split('.') + tag_metadata['name'][tv_val] = items[0] + if len(items) > 1 and items[1] != '': + tag_metadata['name'][tv_val] += '.' + items[1] + if len(items) > 2: + tag_metadata['type'][tv_val] = items[2] + + if tcnt < 1: + cnt = get_tag_values() + if cnt <= 0: + write_tags(cnt) + + return 0 + +if __name__ == "__main__": + sys.exit(main()) diff --git a/util/list_tags b/util/list_tags new file mode 100755 index 0000000..73a4b63 --- /dev/null +++ b/util/list_tags @@ -0,0 +1,134 @@ +#!/usr/bin/env python3 + +import sys +import re +from enum import Enum + +class Pflag(Enum): + list = 0 + vtag = 1 + clen = 2 + env = 3 + fenv = 4 +tag_names = ['name', 'type', 'operation', 'expect', 'version', 'env', 'depend'] +total_cnt = 0 + +def print_hline(): + a = 'filename' + for tag in tag_names: + a += ',' + tag + print(a) + +def esc_vstr(tag, val): + if tag != 'env' and tag != 'depend': + return val + if not ('"' in val or ',' in val): + return val + a = '"' + for v in val: + if v == '"': + a += '"' + a += v + a += '"' + return a + +def list_tags(fname, pflag): + global total_cnt + with open(fname, 'r') as f: + tags = {} + cnt = 0 + for line in f: + idx = line.find("@@") + if idx >= 0: + m = re.split('[:\t ]+', line[idx+2:], 1) + if pflag == Pflag.env or pflag == Pflag.fenv: + if m[0] == 'env': + cnt += 1 + if pflag == Pflag.fenv and cnt == 1: + print(">> file =", fname) + print("export {}".format(m[1]),end='') + else: + cnt += 1 + tags[m[0]] = re.sub('\n', '', m[1]) + elif cnt > 0: + break + if cnt > 0 and pflag == Pflag.vtag: + idx = fname.rfind('/') + 1 + if idx < 1: + idx = 0 + a = '\\newlabel{ex_vtag:'+fname[idx:]+'}{{' + tag = 'version' + if tag in tags: + a += re.sub("omp_","",tags[tag]) + a += '}{'+'{0:d}'.format(cnt)+'}{}{}{}}' + print(a) + elif pflag == Pflag.list: + total_cnt += 1 + if total_cnt == 1: + print_hline() + a = fname + for tag in tag_names: + a += ',' + if tag in tags: + a += esc_vstr(tag, tags[tag]) + print(a) + return cnt + +def check_lln(fname, lsize): + with open(fname, 'r') as f: + cnt, s, lineno = 0, 0, 0 + for line in f: + lineno += 1 + idx = line.find("@@") + if idx >= 0: + s += 1 + if s == 1 and line.find("!", 0, idx) < 0: + s += 2 + else: + m = len(line) - 1 + if m > lsize: + cnt += 1 + if cnt == 1: + print(">>> file =", fname) + print(' line {0:d}'.format(lineno), end='') + if s > 0: + print(" (S-{0:d})".format(lineno-s), end='') + print(': nchars = {0:d}'.format(m)) + return cnt + +def main(): + pflag = Pflag.list + lsize = 75 + for arg in sys.argv[1:]: + if arg == '-list': + pflag = Pflag.list + elif arg == '-vtag': + pflag = Pflag.vtag + elif arg[:5] == '-clen': + pflag = Pflag.clen + if len(arg) > 6 and arg[5] == '=': + lsize = int(arg[6:]) + if lsize < 2: + lsize = 75 + elif arg == '-env': + pflag = Pflag.env + elif arg == '-fenv': + pflag = Pflag.fenv + elif arg == '-h' or arg == '-help': + print("""usage: list_tags [options] [-h] +available options - + -list ; list tags in csv format + -vtag ; create version tag info for use in latex file + -env|-fenv ; print env tag values + -clen= ; check line length, default =75 +multiple files may be specified""") + break + elif pflag == Pflag.clen: + check_lln(arg, lsize) + else: + list_tags(arg, pflag) + return 0 + +if __name__ == "__main__": + sys.exit(main()) +