OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [libgomp/] [libgomp.texi] - Diff between revs 154 and 816

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 154 Rev 816
\input texinfo @c -*-texinfo-*-
\input texinfo @c -*-texinfo-*-
 
 
@c %**start of header
@c %**start of header
@setfilename libgomp.info
@setfilename libgomp.info
@settitle GNU libgomp
@settitle GNU libgomp
@c %**end of header
@c %**end of header
 
 
 
 
@copying
@copying
Copyright @copyright{} 2006 Free Software Foundation, Inc.
Copyright @copyright{} 2006 Free Software Foundation, Inc.
 
 
Permission is granted to copy, distribute and/or modify this document
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1 or
under the terms of the GNU Free Documentation License, Version 1.1 or
any later version published by the Free Software Foundation; with the
any later version published by the Free Software Foundation; with the
Invariant Sections being ``GNU General Public License'' and ``Funding
Invariant Sections being ``GNU General Public License'' and ``Funding
Free Software'', the Front-Cover
Free Software'', the Front-Cover
texts being (a) (see below), and with the Back-Cover Texts being (b)
texts being (a) (see below), and with the Back-Cover Texts being (b)
(see below).  A copy of the license is included in the section entitled
(see below).  A copy of the license is included in the section entitled
``GNU Free Documentation License''.
``GNU Free Documentation License''.
 
 
(a) The FSF's Front-Cover Text is:
(a) The FSF's Front-Cover Text is:
 
 
     A GNU Manual
     A GNU Manual
 
 
(b) The FSF's Back-Cover Text is:
(b) The FSF's Back-Cover Text is:
 
 
     You have freedom to copy and modify this GNU Manual, like GNU
     You have freedom to copy and modify this GNU Manual, like GNU
     software.  Copies published by the Free Software Foundation raise
     software.  Copies published by the Free Software Foundation raise
     funds for GNU development.
     funds for GNU development.
@end copying
@end copying
 
 
@ifinfo
@ifinfo
@dircategory GNU Libraries
@dircategory GNU Libraries
@direntry
@direntry
* libgomp: (libgomp).                    GNU OpenMP runtime library
* libgomp: (libgomp).                    GNU OpenMP runtime library
@end direntry
@end direntry
 
 
This manual documents the GNU implementation of the OpenMP API for
This manual documents the GNU implementation of the OpenMP API for
multi-platform shared-memory parallel programming in C/C++ and Fortran.
multi-platform shared-memory parallel programming in C/C++ and Fortran.
 
 
Published by the Free Software Foundation
Published by the Free Software Foundation
51 Franklin Street, Fifth Floor
51 Franklin Street, Fifth Floor
Boston, MA 02110-1301 USA
Boston, MA 02110-1301 USA
 
 
@insertcopying
@insertcopying
@end ifinfo
@end ifinfo
 
 
 
 
@setchapternewpage odd
@setchapternewpage odd
 
 
@titlepage
@titlepage
@title The GNU OpenMP Implementation
@title The GNU OpenMP Implementation
@page
@page
@vskip 0pt plus 1filll
@vskip 0pt plus 1filll
@comment For the @value{version-GCC} Version*
@comment For the @value{version-GCC} Version*
@sp 1
@sp 1
Published by the Free Software Foundation @*
Published by the Free Software Foundation @*
51 Franklin Street, Fifth Floor@*
51 Franklin Street, Fifth Floor@*
Boston, MA 02110-1301, USA@*
Boston, MA 02110-1301, USA@*
@sp 1
@sp 1
@insertcopying
@insertcopying
@end titlepage
@end titlepage
 
 
@summarycontents
@summarycontents
@contents
@contents
@page
@page
 
 
 
 
@node Top
@node Top
@top Introduction
@top Introduction
@cindex Introduction
@cindex Introduction
 
 
This manual documents the usage of libgomp, the GNU implementation of the
This manual documents the usage of libgomp, the GNU implementation of the
@uref{http://www.openmp.org, OpenMP} Application Programming Interface (API)
@uref{http://www.openmp.org, OpenMP} Application Programming Interface (API)
for multi-platform shared-memory parallel programming in C/C++ and Fortran.
for multi-platform shared-memory parallel programming in C/C++ and Fortran.
 
 
 
 
 
 
@comment
@comment
@comment  When you add a new menu item, please keep the right hand
@comment  When you add a new menu item, please keep the right hand
@comment  aligned to the same column.  Do not use tabs.  This provides
@comment  aligned to the same column.  Do not use tabs.  This provides
@comment  better formatting.
@comment  better formatting.
@comment
@comment
@menu
@menu
* Enabling OpenMP::            How to enable OpenMP for your applications.
* Enabling OpenMP::            How to enable OpenMP for your applications.
* Runtime Library Routines::   The OpenMP runtime application programming
* Runtime Library Routines::   The OpenMP runtime application programming
                               interface.
                               interface.
* Environment Variables::      Influencing runtime behavior with environment
* Environment Variables::      Influencing runtime behavior with environment
                               variables.
                               variables.
* The libgomp ABI::            Notes on the external ABI presented by libgomp.
* The libgomp ABI::            Notes on the external ABI presented by libgomp.
* Reporting Bugs::             How to report bugs in GNU OpenMP.
* Reporting Bugs::             How to report bugs in GNU OpenMP.
* Copying::                    GNU general public license says
* Copying::                    GNU general public license says
                               how you can copy and share libgomp.
                               how you can copy and share libgomp.
* GNU Free Documentation License::
* GNU Free Documentation License::
                               How you can copy and share this manual.
                               How you can copy and share this manual.
* Funding::                    How to help assure continued work for free
* Funding::                    How to help assure continued work for free
                               software.
                               software.
* Index::                      Index of this documentation.
* Index::                      Index of this documentation.
@end menu
@end menu
 
 
 
 
@c ---------------------------------------------------------------------
@c ---------------------------------------------------------------------
@c Enabling OpenMP
@c Enabling OpenMP
@c ---------------------------------------------------------------------
@c ---------------------------------------------------------------------
 
 
@node Enabling OpenMP
@node Enabling OpenMP
@chapter Enabling OpenMP
@chapter Enabling OpenMP
 
 
To activate the OpenMP extensions for C/C++ and Fortran, the compile-time
To activate the OpenMP extensions for C/C++ and Fortran, the compile-time
flag @command{-fopenmp} must be specified. This enables the OpenMP directive
flag @command{-fopenmp} must be specified. This enables the OpenMP directive
@code{#pragma omp} in C/C++ and @code{!$omp} directives in free form,
@code{#pragma omp} in C/C++ and @code{!$omp} directives in free form,
@code{c$omp}, @code{*$omp} and @code{!$omp} directives in fixed form,
@code{c$omp}, @code{*$omp} and @code{!$omp} directives in fixed form,
@code{!$} conditional compilation sentinels in free form and @code{c$},
@code{!$} conditional compilation sentinels in free form and @code{c$},
@code{*$} and @code{!$} sentinels in fixed form, for Fortran. The flag also
@code{*$} and @code{!$} sentinels in fixed form, for Fortran. The flag also
arranges for automatic linking of the OpenMP runtime library
arranges for automatic linking of the OpenMP runtime library
(@ref{Runtime Library Routines}).
(@ref{Runtime Library Routines}).
 
 
A complete description of all OpenMP directives accepted may be found in
A complete description of all OpenMP directives accepted may be found in
the @uref{http://www.openmp.org, OpenMP Application Program Interface} manual,
the @uref{http://www.openmp.org, OpenMP Application Program Interface} manual,
version 2.5.
version 2.5.
 
 
 
 
@c ---------------------------------------------------------------------
@c ---------------------------------------------------------------------
@c Runtime Library Routines
@c Runtime Library Routines
@c ---------------------------------------------------------------------
@c ---------------------------------------------------------------------
 
 
@node Runtime Library Routines
@node Runtime Library Routines
@chapter Runtime Library Routines
@chapter Runtime Library Routines
 
 
The runtime routines described here are defined by section 3 of the OpenMP
The runtime routines described here are defined by section 3 of the OpenMP
specifications in version 2.5.
specifications in version 2.5.
 
 
Control threads, processors and the parallel environment.
Control threads, processors and the parallel environment.
 
 
@menu
@menu
* omp_get_dynamic::          Dynamic teams setting
* omp_get_dynamic::          Dynamic teams setting
* omp_get_max_threads::      Maximum number of threads
* omp_get_max_threads::      Maximum number of threads
* omp_get_nested::           Nested parallel regions
* omp_get_nested::           Nested parallel regions
* omp_get_num_procs::        Number of processors online
* omp_get_num_procs::        Number of processors online
* omp_get_num_threads::      Size of the active team
* omp_get_num_threads::      Size of the active team
* omp_get_thread_num::       Current thread ID
* omp_get_thread_num::       Current thread ID
* omp_in_parallel::          Whether a parallel region is active
* omp_in_parallel::          Whether a parallel region is active
* omp_set_dynamic::          Enable/disable dynamic teams
* omp_set_dynamic::          Enable/disable dynamic teams
* omp_set_nested::           Enable/disable nested parallel regions
* omp_set_nested::           Enable/disable nested parallel regions
* omp_set_num_threads::      Set upper team size limit
* omp_set_num_threads::      Set upper team size limit
@end menu
@end menu
 
 
Initialize, set, test, unset and destroy simple and nested locks.
Initialize, set, test, unset and destroy simple and nested locks.
 
 
@menu
@menu
* omp_init_lock::            Initialize simple lock
* omp_init_lock::            Initialize simple lock
* omp_set_lock::             Wait for and set simple lock
* omp_set_lock::             Wait for and set simple lock
* omp_test_lock::            Test and set simple lock if available
* omp_test_lock::            Test and set simple lock if available
* omp_unset_lock::           Unset simple lock
* omp_unset_lock::           Unset simple lock
* omp_destroy_lock::         Destroy simple lock
* omp_destroy_lock::         Destroy simple lock
* omp_init_nest_lock::       Initialize nested lock
* omp_init_nest_lock::       Initialize nested lock
* omp_set_nest_lock::        Wait for and set simple lock
* omp_set_nest_lock::        Wait for and set simple lock
* omp_test_nest_lock::       Test and set nested lock if available
* omp_test_nest_lock::       Test and set nested lock if available
* omp_unset_nest_lock::      Unset nested lock
* omp_unset_nest_lock::      Unset nested lock
* omp_destroy_nest_lock::    Destroy nested lock
* omp_destroy_nest_lock::    Destroy nested lock
@end menu
@end menu
 
 
Portable, thread-based, wall clock timer.
Portable, thread-based, wall clock timer.
 
 
@menu
@menu
* omp_get_wtick::            Get timer precision.
* omp_get_wtick::            Get timer precision.
* omp_get_wtime::            Elapsed wall clock time.
* omp_get_wtime::            Elapsed wall clock time.
@end menu
@end menu
 
 
@node omp_get_dynamic
@node omp_get_dynamic
@section @code{omp_get_dynamic} -- Dynamic teams setting
@section @code{omp_get_dynamic} -- Dynamic teams setting
@table @asis
@table @asis
@item @emph{Description}:
@item @emph{Description}:
This function returns @code{true} if enabled, @code{false} otherwise.
This function returns @code{true} if enabled, @code{false} otherwise.
Here, @code{true} and @code{false} represent their language-specific
Here, @code{true} and @code{false} represent their language-specific
counterparts.
counterparts.
 
 
The dynamic team setting may be initialized at startup by the
The dynamic team setting may be initialized at startup by the
@code{OMP_DYNAMIC} environment variable or at runtime using
@code{OMP_DYNAMIC} environment variable or at runtime using
@code{omp_set_dynamic}. If undefined, dynamic adjustment is
@code{omp_set_dynamic}. If undefined, dynamic adjustment is
disabled by default.
disabled by default.
 
 
@item @emph{C/C++}:
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{int omp_get_dynamic();}
@item @emph{Prototype}: @tab @code{int omp_get_dynamic();}
@end multitable
@end multitable
 
 
@item @emph{Fortran}:
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{logical function omp_get_dynamic()}
@item @emph{Interface}: @tab @code{logical function omp_get_dynamic()}
@end multitable
@end multitable
 
 
@item @emph{See also}:
@item @emph{See also}:
@ref{omp_set_dynamic}, @ref{OMP_DYNAMIC}
@ref{omp_set_dynamic}, @ref{OMP_DYNAMIC}
 
 
@item @emph{Reference}:
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.2.8.
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.2.8.
@end table
@end table
 
 
 
 
 
 
@node omp_get_max_threads
@node omp_get_max_threads
@section @code{omp_get_max_threads} -- Maximum number of threads
@section @code{omp_get_max_threads} -- Maximum number of threads
@table @asis
@table @asis
@item @emph{Description}:
@item @emph{Description}:
Return the maximum number of threads used for parallel regions that do
Return the maximum number of threads used for parallel regions that do
not use the clause @code{num_threads}.
not use the clause @code{num_threads}.
 
 
@item @emph{C/C++}:
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{int omp_get_max_threads();}
@item @emph{Prototype}: @tab @code{int omp_get_max_threads();}
@end multitable
@end multitable
 
 
@item @emph{Fortran}:
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{integer function omp_get_max_threads()}
@item @emph{Interface}: @tab @code{integer function omp_get_max_threads()}
@end multitable
@end multitable
 
 
@item @emph{See also}:
@item @emph{See also}:
@ref{omp_set_num_threads}, @ref{omp_set_dynamic}
@ref{omp_set_num_threads}, @ref{omp_set_dynamic}
 
 
@item @emph{Reference}:
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.2.3.
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.2.3.
@end table
@end table
 
 
 
 
 
 
@node omp_get_nested
@node omp_get_nested
@section @code{omp_get_nested} -- Nested parallel regions
@section @code{omp_get_nested} -- Nested parallel regions
@table @asis
@table @asis
@item @emph{Description}:
@item @emph{Description}:
This function returns @code{true} if nested parallel regions are
This function returns @code{true} if nested parallel regions are
enabled, @code{false} otherwise. Here, @code{true} and @code{false}
enabled, @code{false} otherwise. Here, @code{true} and @code{false}
represent their language-specific counterparts.
represent their language-specific counterparts.
 
 
Nested parallel regions may be initialized at startup by the
Nested parallel regions may be initialized at startup by the
@code{OMP_NESTED} environment variable or at runtime using
@code{OMP_NESTED} environment variable or at runtime using
@code{omp_set_nested}. If undefined, nested parallel regions are
@code{omp_set_nested}. If undefined, nested parallel regions are
disabled by default.
disabled by default.
 
 
@item @emph{C/C++}:
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{int omp_get_nested();}
@item @emph{Prototype}: @tab @code{int omp_get_nested();}
@end multitable
@end multitable
 
 
@item @emph{Fortran}:
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{integer function omp_get_nested()}
@item @emph{Interface}: @tab @code{integer function omp_get_nested()}
@end multitable
@end multitable
 
 
@item @emph{See also}:
@item @emph{See also}:
@ref{omp_set_nested}, @ref{OMP_NESTED}
@ref{omp_set_nested}, @ref{OMP_NESTED}
 
 
@item @emph{Reference}:
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.2.10.
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.2.10.
@end table
@end table
 
 
 
 
 
 
@node omp_get_num_procs
@node omp_get_num_procs
@section @code{omp_get_num_procs} -- Number of processors online
@section @code{omp_get_num_procs} -- Number of processors online
@table @asis
@table @asis
@item @emph{Description}:
@item @emph{Description}:
Returns the number of processors online.
Returns the number of processors online.
 
 
@item @emph{C/C++}:
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{int omp_get_num_procs();}
@item @emph{Prototype}: @tab @code{int omp_get_num_procs();}
@end multitable
@end multitable
 
 
@item @emph{Fortran}:
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{integer function omp_get_num_procs()}
@item @emph{Interface}: @tab @code{integer function omp_get_num_procs()}
@end multitable
@end multitable
 
 
@item @emph{Reference}:
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.2.5.
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.2.5.
@end table
@end table
 
 
 
 
 
 
@node omp_get_num_threads
@node omp_get_num_threads
@section @code{omp_get_num_threads} -- Size of the active team
@section @code{omp_get_num_threads} -- Size of the active team
@table @asis
@table @asis
@item @emph{Description}:
@item @emph{Description}:
The number of threads in the current team. In a sequential section of
The number of threads in the current team. In a sequential section of
the program @code{omp_get_num_threads} returns 1.
the program @code{omp_get_num_threads} returns 1.
 
 
The default team size may be initialized at startup by the
The default team size may be initialized at startup by the
@code{OMP_NUM_THREADS} environment variable. At runtime, the size
@code{OMP_NUM_THREADS} environment variable. At runtime, the size
of the current team may be set either by the @code{NUM_THREADS}
of the current team may be set either by the @code{NUM_THREADS}
clause or by @code{omp_set_num_threads}. If none of the above were
clause or by @code{omp_set_num_threads}. If none of the above were
used to define a specific value and @code{OMP_DYNAMIC} is disabled,
used to define a specific value and @code{OMP_DYNAMIC} is disabled,
one thread per CPU online is used.
one thread per CPU online is used.
 
 
@item @emph{C/C++}:
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{int omp_get_num_threads();}
@item @emph{Prototype}: @tab @code{int omp_get_num_threads();}
@end multitable
@end multitable
 
 
@item @emph{Fortran}:
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{integer function omp_get_num_threads()}
@item @emph{Interface}: @tab @code{integer function omp_get_num_threads()}
@end multitable
@end multitable
 
 
@item @emph{See also}:
@item @emph{See also}:
@ref{omp_get_max_threads}, @ref{omp_set_num_threads}, @ref{OMP_NUM_THREADS}
@ref{omp_get_max_threads}, @ref{omp_set_num_threads}, @ref{OMP_NUM_THREADS}
 
 
@item @emph{Reference}:
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.2.2.
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.2.2.
@end table
@end table
 
 
 
 
 
 
@node omp_get_thread_num
@node omp_get_thread_num
@section @code{omp_get_thread_num} -- Current thread ID
@section @code{omp_get_thread_num} -- Current thread ID
@table @asis
@table @asis
@item @emph{Description}:
@item @emph{Description}:
Unique thread identification number. In a sequential parts of the program,
Unique thread identification number. In a sequential parts of the program,
@code{omp_get_thread_num} always returns 0. In parallel regions the return
@code{omp_get_thread_num} always returns 0. In parallel regions the return
value varies from 0 to @code{omp_get_max_threads}-1 inclusive. The return
value varies from 0 to @code{omp_get_max_threads}-1 inclusive. The return
value of the master thread of a team is always 0.
value of the master thread of a team is always 0.
 
 
@item @emph{C/C++}:
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{int omp_get_thread_num();}
@item @emph{Prototype}: @tab @code{int omp_get_thread_num();}
@end multitable
@end multitable
 
 
@item @emph{Fortran}:
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{integer function omp_get_thread_num()}
@item @emph{Interface}: @tab @code{integer function omp_get_thread_num()}
@end multitable
@end multitable
 
 
@item @emph{See also}:
@item @emph{See also}:
@ref{omp_get_max_threads}
@ref{omp_get_max_threads}
 
 
@item @emph{Reference}:
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.2.4.
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.2.4.
@end table
@end table
 
 
 
 
 
 
@node omp_in_parallel
@node omp_in_parallel
@section @code{omp_in_parallel} -- Whether a parallel region is active
@section @code{omp_in_parallel} -- Whether a parallel region is active
@table @asis
@table @asis
@item @emph{Description}:
@item @emph{Description}:
This function returns @code{true} if currently running in parallel,
This function returns @code{true} if currently running in parallel,
@code{false} otherwise. Here, @code{true} and @code{false} represent
@code{false} otherwise. Here, @code{true} and @code{false} represent
their language-specific counterparts.
their language-specific counterparts.
 
 
@item @emph{C/C++}:
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{int omp_in_parallel();}
@item @emph{Prototype}: @tab @code{int omp_in_parallel();}
@end multitable
@end multitable
 
 
@item @emph{Fortran}:
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{logical function omp_in_parallel()}
@item @emph{Interface}: @tab @code{logical function omp_in_parallel()}
@end multitable
@end multitable
 
 
@item @emph{Reference}:
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.2.6.
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.2.6.
@end table
@end table
 
 
 
 
@node omp_set_dynamic
@node omp_set_dynamic
@section @code{omp_set_dynamic} -- Enable/disable dynamic teams
@section @code{omp_set_dynamic} -- Enable/disable dynamic teams
@table @asis
@table @asis
@item @emph{Description}:
@item @emph{Description}:
Enable or disable the dynamic adjustment of the number of threads
Enable or disable the dynamic adjustment of the number of threads
within a team. The function takes the language-specific equivalent
within a team. The function takes the language-specific equivalent
of @code{true} and @code{false}, where @code{true} enables dynamic
of @code{true} and @code{false}, where @code{true} enables dynamic
adjustment of team sizes and @code{false} disables it.
adjustment of team sizes and @code{false} disables it.
 
 
@item @emph{C/C++}:
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{void omp_set_dynamic(int);}
@item @emph{Prototype}: @tab @code{void omp_set_dynamic(int);}
@end multitable
@end multitable
 
 
@item @emph{Fortran}:
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{subroutine omp_set_dynamic(set)}
@item @emph{Interface}: @tab @code{subroutine omp_set_dynamic(set)}
@item                   @tab @code{integer, intent(in) :: set}
@item                   @tab @code{integer, intent(in) :: set}
@end multitable
@end multitable
 
 
@item @emph{See also}:
@item @emph{See also}:
@ref{OMP_DYNAMIC}, @ref{omp_get_dynamic}
@ref{OMP_DYNAMIC}, @ref{omp_get_dynamic}
 
 
@item @emph{Reference}:
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.2.7.
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.2.7.
@end table
@end table
 
 
 
 
 
 
@node omp_set_nested
@node omp_set_nested
@section @code{omp_set_nested} -- Enable/disable nested parallel regions
@section @code{omp_set_nested} -- Enable/disable nested parallel regions
@table @asis
@table @asis
@item @emph{Description}:
@item @emph{Description}:
Enable or disable nested parallel regions, i.e., whether team members
Enable or disable nested parallel regions, i.e., whether team members
are allowed to create new teams. The function takes the language-specific
are allowed to create new teams. The function takes the language-specific
equivalent of @code{true} and @code{false}, where @code{true} enables
equivalent of @code{true} and @code{false}, where @code{true} enables
dynamic adjustment of team sizes and @code{false} disables it.
dynamic adjustment of team sizes and @code{false} disables it.
 
 
@item @emph{C/C++}:
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{void omp_set_dynamic(int);}
@item @emph{Prototype}: @tab @code{void omp_set_dynamic(int);}
@end multitable
@end multitable
 
 
@item @emph{Fortran}:
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{subroutine omp_set_dynamic(set)}
@item @emph{Interface}: @tab @code{subroutine omp_set_dynamic(set)}
@item                   @tab @code{integer, intent(in) :: set}
@item                   @tab @code{integer, intent(in) :: set}
@end multitable
@end multitable
 
 
@item @emph{See also}:
@item @emph{See also}:
@ref{OMP_NESTED}, @ref{omp_get_nested}
@ref{OMP_NESTED}, @ref{omp_get_nested}
 
 
@item @emph{Reference}:
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.2.9.
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.2.9.
@end table
@end table
 
 
 
 
 
 
@node omp_set_num_threads
@node omp_set_num_threads
@section @code{omp_set_num_threads} -- Set upper team size limit
@section @code{omp_set_num_threads} -- Set upper team size limit
@table @asis
@table @asis
@item @emph{Description}:
@item @emph{Description}:
Specifies the number of threads used by default in subsequent parallel
Specifies the number of threads used by default in subsequent parallel
sections, if those do not specify a @code{num_threads} clause. The
sections, if those do not specify a @code{num_threads} clause. The
argument of @code{omp_set_num_threads} shall be a positive integer.
argument of @code{omp_set_num_threads} shall be a positive integer.
 
 
@item @emph{C/C++}:
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{void omp_set_num_threads(int);}
@item @emph{Prototype}: @tab @code{void omp_set_num_threads(int);}
@end multitable
@end multitable
 
 
@item @emph{Fortran}:
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{subroutine omp_set_num_threads(set)}
@item @emph{Interface}: @tab @code{subroutine omp_set_num_threads(set)}
@item                   @tab @code{integer, intent(in) :: set}
@item                   @tab @code{integer, intent(in) :: set}
@end multitable
@end multitable
 
 
@item @emph{See also}:
@item @emph{See also}:
@ref{OMP_NUM_THREADS}, @ref{omp_get_num_threads}, @ref{omp_get_max_threads}
@ref{OMP_NUM_THREADS}, @ref{omp_get_num_threads}, @ref{omp_get_max_threads}
 
 
@item @emph{Reference}:
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.2.1.
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.2.1.
@end table
@end table
 
 
 
 
 
 
@node omp_init_lock
@node omp_init_lock
@section @code{omp_init_lock} -- Initialize simple lock
@section @code{omp_init_lock} -- Initialize simple lock
@table @asis
@table @asis
@item @emph{Description}:
@item @emph{Description}:
Initialize a simple lock. After initialization, the lock is in
Initialize a simple lock. After initialization, the lock is in
an unlocked state.
an unlocked state.
 
 
@item @emph{C/C++}:
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{void omp_init_lock(omp_lock_t *lock);}
@item @emph{Prototype}: @tab @code{void omp_init_lock(omp_lock_t *lock);}
@end multitable
@end multitable
 
 
@item @emph{Fortran}:
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{subroutine omp_init_lock(lock)}
@item @emph{Interface}: @tab @code{subroutine omp_init_lock(lock)}
@item                   @tab @code{integer(omp_lock_kind), intent(out) :: lock}
@item                   @tab @code{integer(omp_lock_kind), intent(out) :: lock}
@end multitable
@end multitable
 
 
@item @emph{See also}:
@item @emph{See also}:
@ref{omp_destroy_lock}
@ref{omp_destroy_lock}
 
 
@item @emph{Reference}:
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.3.1.
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.3.1.
@end table
@end table
 
 
 
 
 
 
@node omp_set_lock
@node omp_set_lock
@section @code{omp_set_lock} -- Wait for and set simple lock
@section @code{omp_set_lock} -- Wait for and set simple lock
@table @asis
@table @asis
@item @emph{Description}:
@item @emph{Description}:
Before setting a simple lock, the lock variable must be initialized by
Before setting a simple lock, the lock variable must be initialized by
@code{omp_init_lock}. The calling thread is blocked until the lock
@code{omp_init_lock}. The calling thread is blocked until the lock
is available. If the lock is already held by the current thread,
is available. If the lock is already held by the current thread,
a deadlock occurs.
a deadlock occurs.
 
 
@item @emph{C/C++}:
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{void omp_set_lock(omp_lock_t *lock);}
@item @emph{Prototype}: @tab @code{void omp_set_lock(omp_lock_t *lock);}
@end multitable
@end multitable
 
 
@item @emph{Fortran}:
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{subroutine omp_set_lock(lock)}
@item @emph{Interface}: @tab @code{subroutine omp_set_lock(lock)}
@item                   @tab @code{integer(omp_lock_kind), intent(out) :: lock}
@item                   @tab @code{integer(omp_lock_kind), intent(out) :: lock}
@end multitable
@end multitable
 
 
@item @emph{See also}:
@item @emph{See also}:
@ref{omp_init_lock}, @ref{omp_test_lock}, @ref{omp_unset_lock}
@ref{omp_init_lock}, @ref{omp_test_lock}, @ref{omp_unset_lock}
 
 
@item @emph{Reference}:
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.3.3.
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.3.3.
@end table
@end table
 
 
 
 
 
 
@node omp_test_lock
@node omp_test_lock
@section @code{omp_test_lock} -- Test and set simple lock if available
@section @code{omp_test_lock} -- Test and set simple lock if available
@table @asis
@table @asis
@item @emph{Description}:
@item @emph{Description}:
Before setting a simple lock, the lock variable must be initialized by
Before setting a simple lock, the lock variable must be initialized by
@code{omp_init_lock}. Contrary to @code{omp_set_lock}, @code{omp_test_lock}
@code{omp_init_lock}. Contrary to @code{omp_set_lock}, @code{omp_test_lock}
does not block if the lock is not available. This function returns
does not block if the lock is not available. This function returns
@code{true} upon success,@code{false} otherwise. Here, @code{true} and
@code{true} upon success,@code{false} otherwise. Here, @code{true} and
@code{false} represent their language-specific counterparts.
@code{false} represent their language-specific counterparts.
 
 
@item @emph{C/C++}:
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{int omp_test_lock(omp_lock_t *lock);}
@item @emph{Prototype}: @tab @code{int omp_test_lock(omp_lock_t *lock);}
@end multitable
@end multitable
 
 
@item @emph{Fortran}:
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{subroutine omp_test_lock(lock)}
@item @emph{Interface}: @tab @code{subroutine omp_test_lock(lock)}
@item                   @tab @code{logical(omp_logical_kind) :: omp_test_lock}
@item                   @tab @code{logical(omp_logical_kind) :: omp_test_lock}
@item                   @tab @code{integer(omp_lock_kind), intent(out) :: lock}
@item                   @tab @code{integer(omp_lock_kind), intent(out) :: lock}
@end multitable
@end multitable
 
 
@item @emph{See also}:
@item @emph{See also}:
@ref{omp_init_lock}, @ref{omp_set_lock}, @ref{omp_set_lock}
@ref{omp_init_lock}, @ref{omp_set_lock}, @ref{omp_set_lock}
 
 
@item @emph{Reference}:
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.3.5.
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.3.5.
@end table
@end table
 
 
 
 
 
 
@node omp_unset_lock
@node omp_unset_lock
@section @code{omp_unset_lock} -- Unset simple lock
@section @code{omp_unset_lock} -- Unset simple lock
@table @asis
@table @asis
@item @emph{Description}:
@item @emph{Description}:
A simple lock about to be unset must have been locked by @code{omp_set_lock}
A simple lock about to be unset must have been locked by @code{omp_set_lock}
or @code{omp_test_lock} before. In addition, the lock must be held by the
or @code{omp_test_lock} before. In addition, the lock must be held by the
thread calling @code{omp_unset_lock}. Then, the lock becomes unlocked. If one
thread calling @code{omp_unset_lock}. Then, the lock becomes unlocked. If one
ore more threads attempted to set the lock before, one of them is chosen to,
ore more threads attempted to set the lock before, one of them is chosen to,
again, set the lock for itself.
again, set the lock for itself.
 
 
@item @emph{C/C++}:
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{void omp_unset_lock(omp_lock_t *lock);}
@item @emph{Prototype}: @tab @code{void omp_unset_lock(omp_lock_t *lock);}
@end multitable
@end multitable
 
 
@item @emph{Fortran}:
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{subroutine omp_unset_lock(lock)}
@item @emph{Interface}: @tab @code{subroutine omp_unset_lock(lock)}
@item                   @tab @code{integer(omp_lock_kind), intent(out) :: lock}
@item                   @tab @code{integer(omp_lock_kind), intent(out) :: lock}
@end multitable
@end multitable
 
 
@item @emph{See also}:
@item @emph{See also}:
@ref{omp_set_lock}, @ref{omp_test_lock}
@ref{omp_set_lock}, @ref{omp_test_lock}
 
 
@item @emph{Reference}:
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.3.4.
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.3.4.
@end table
@end table
 
 
 
 
 
 
@node omp_destroy_lock
@node omp_destroy_lock
@section @code{omp_destroy_lock} -- Destroy simple lock
@section @code{omp_destroy_lock} -- Destroy simple lock
@table @asis
@table @asis
@item @emph{Description}:
@item @emph{Description}:
Destroy a simple lock. In order to be destroyed, a simple lock must be
Destroy a simple lock. In order to be destroyed, a simple lock must be
in the unlocked state.
in the unlocked state.
 
 
@item @emph{C/C++}:
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{void omp_destroy_lock(omp_lock_t *);}
@item @emph{Prototype}: @tab @code{void omp_destroy_lock(omp_lock_t *);}
@end multitable
@end multitable
 
 
@item @emph{Fortran}:
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{subroutine omp_destroy_lock(lock)}
@item @emph{Interface}: @tab @code{subroutine omp_destroy_lock(lock)}
@item                   @tab @code{integer(omp_lock_kind), intent(inout) :: lock}
@item                   @tab @code{integer(omp_lock_kind), intent(inout) :: lock}
@end multitable
@end multitable
 
 
@item @emph{See also}:
@item @emph{See also}:
@ref{omp_init_lock}
@ref{omp_init_lock}
 
 
@item @emph{Reference}:
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.3.2.
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.3.2.
@end table
@end table
 
 
 
 
 
 
@node omp_init_nest_lock
@node omp_init_nest_lock
@section @code{omp_init_nest_lock} -- Initialize nested lock
@section @code{omp_init_nest_lock} -- Initialize nested lock
@table @asis
@table @asis
@item @emph{Description}:
@item @emph{Description}:
Initialize a nested lock. After initialization, the lock is in
Initialize a nested lock. After initialization, the lock is in
an unlocked state and the nesting count is set to zero.
an unlocked state and the nesting count is set to zero.
 
 
@item @emph{C/C++}:
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{void omp_init_nest_lock(omp_nest_lock_t *lock);}
@item @emph{Prototype}: @tab @code{void omp_init_nest_lock(omp_nest_lock_t *lock);}
@end multitable
@end multitable
 
 
@item @emph{Fortran}:
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{subroutine omp_init_nest_lock(lock)}
@item @emph{Interface}: @tab @code{subroutine omp_init_nest_lock(lock)}
@item                   @tab @code{integer(omp_nest_lock_kind), intent(out) :: lock}
@item                   @tab @code{integer(omp_nest_lock_kind), intent(out) :: lock}
@end multitable
@end multitable
 
 
@item @emph{See also}:
@item @emph{See also}:
@ref{omp_destroy_nest_lock}
@ref{omp_destroy_nest_lock}
 
 
@item @emph{Reference}:
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.3.1.
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.3.1.
@end table
@end table
 
 
 
 
@node omp_set_nest_lock
@node omp_set_nest_lock
@section @code{omp_set_nest_lock} -- Wait for and set simple lock
@section @code{omp_set_nest_lock} -- Wait for and set simple lock
@table @asis
@table @asis
@item @emph{Description}:
@item @emph{Description}:
Before setting a nested lock, the lock variable must be initialized by
Before setting a nested lock, the lock variable must be initialized by
@code{omp_init_nest_lock}. The calling thread is blocked until the lock
@code{omp_init_nest_lock}. The calling thread is blocked until the lock
is available. If the lock is already held by the current thread, the
is available. If the lock is already held by the current thread, the
nesting count for the lock in incremented.
nesting count for the lock in incremented.
 
 
@item @emph{C/C++}:
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{void omp_set_nest_lock(omp_nest_lock_t *lock);}
@item @emph{Prototype}: @tab @code{void omp_set_nest_lock(omp_nest_lock_t *lock);}
@end multitable
@end multitable
 
 
@item @emph{Fortran}:
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{subroutine omp_set_nest_lock(lock)}
@item @emph{Interface}: @tab @code{subroutine omp_set_nest_lock(lock)}
@item                   @tab @code{integer(omp_nest_lock_kind), intent(out) :: lock}
@item                   @tab @code{integer(omp_nest_lock_kind), intent(out) :: lock}
@end multitable
@end multitable
 
 
@item @emph{See also}:
@item @emph{See also}:
@ref{omp_init_nest_lock}, @ref{omp_unset_nest_lock}
@ref{omp_init_nest_lock}, @ref{omp_unset_nest_lock}
 
 
@item @emph{Reference}:
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.3.3.
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.3.3.
@end table
@end table
 
 
 
 
 
 
@node omp_test_nest_lock
@node omp_test_nest_lock
@section @code{omp_test_nest_lock} -- Test and set nested lock if available
@section @code{omp_test_nest_lock} -- Test and set nested lock if available
@table @asis
@table @asis
@item @emph{Description}:
@item @emph{Description}:
Before setting a nested lock, the lock variable must be initialized by
Before setting a nested lock, the lock variable must be initialized by
@code{omp_init_nest_lock}. Contrary to @code{omp_set_nest_lock},
@code{omp_init_nest_lock}. Contrary to @code{omp_set_nest_lock},
@code{omp_test_nest_lock} does not block if the lock is not available.
@code{omp_test_nest_lock} does not block if the lock is not available.
If the lock is already held by the current thread, the new nesting count
If the lock is already held by the current thread, the new nesting count
is returned. Otherwise, the return value equals zero.
is returned. Otherwise, the return value equals zero.
 
 
@item @emph{C/C++}:
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{int omp_test_nest_lock(omp_nest_lock_t *lock);}
@item @emph{Prototype}: @tab @code{int omp_test_nest_lock(omp_nest_lock_t *lock);}
@end multitable
@end multitable
 
 
@item @emph{Fortran}:
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{integer function omp_test_nest_lock(lock)}
@item @emph{Interface}: @tab @code{integer function omp_test_nest_lock(lock)}
@item                   @tab @code{integer(omp_integer_kind) :: omp_test_nest_lock}
@item                   @tab @code{integer(omp_integer_kind) :: omp_test_nest_lock}
@item                   @tab @code{integer(omp_nest_lock_kind), intent(inout) :: lock}
@item                   @tab @code{integer(omp_nest_lock_kind), intent(inout) :: lock}
@end multitable
@end multitable
 
 
 
 
@item @emph{See also}:
@item @emph{See also}:
@ref{omp_init_lock}, @ref{omp_set_lock}, @ref{omp_set_lock}
@ref{omp_init_lock}, @ref{omp_set_lock}, @ref{omp_set_lock}
 
 
@item @emph{Reference}:
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.3.5.
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.3.5.
@end table
@end table
 
 
 
 
 
 
@node omp_unset_nest_lock
@node omp_unset_nest_lock
@section @code{omp_unset_nest_lock} -- Unset nested lock
@section @code{omp_unset_nest_lock} -- Unset nested lock
@table @asis
@table @asis
@item @emph{Description}:
@item @emph{Description}:
A nested lock about to be unset must have been locked by @code{omp_set_nested_lock}
A nested lock about to be unset must have been locked by @code{omp_set_nested_lock}
or @code{omp_test_nested_lock} before. In addition, the lock must be held by the
or @code{omp_test_nested_lock} before. In addition, the lock must be held by the
thread calling @code{omp_unset_nested_lock}. If the nesting count drops to zero, the
thread calling @code{omp_unset_nested_lock}. If the nesting count drops to zero, the
lock becomes unlocked. If one ore more threads attempted to set the lock before,
lock becomes unlocked. If one ore more threads attempted to set the lock before,
one of them is chosen to, again, set the lock for itself.
one of them is chosen to, again, set the lock for itself.
 
 
@item @emph{C/C++}:
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{void omp_unset_nest_lock(omp_nest_lock_t *lock);}
@item @emph{Prototype}: @tab @code{void omp_unset_nest_lock(omp_nest_lock_t *lock);}
@end multitable
@end multitable
 
 
@item @emph{Fortran}:
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{subroutine omp_unset_nest_lock(lock)}
@item @emph{Interface}: @tab @code{subroutine omp_unset_nest_lock(lock)}
@item                   @tab @code{integer(omp_nest_lock_kind), intent(out) :: lock}
@item                   @tab @code{integer(omp_nest_lock_kind), intent(out) :: lock}
@end multitable
@end multitable
 
 
@item @emph{See also}:
@item @emph{See also}:
@ref{omp_set_nest_lock}
@ref{omp_set_nest_lock}
 
 
@item @emph{Reference}:
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.3.4.
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.3.4.
@end table
@end table
 
 
 
 
 
 
@node omp_destroy_nest_lock
@node omp_destroy_nest_lock
@section @code{omp_destroy_nest_lock} -- Destroy nested lock
@section @code{omp_destroy_nest_lock} -- Destroy nested lock
@table @asis
@table @asis
@item @emph{Description}:
@item @emph{Description}:
Destroy a nested lock. In order to be destroyed, a nested lock must be
Destroy a nested lock. In order to be destroyed, a nested lock must be
in the unlocked state and its nesting count must equal zero.
in the unlocked state and its nesting count must equal zero.
 
 
@item @emph{C/C++}:
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{void omp_destroy_nest_lock(omp_nest_lock_t *);}
@item @emph{Prototype}: @tab @code{void omp_destroy_nest_lock(omp_nest_lock_t *);}
@end multitable
@end multitable
 
 
@item @emph{Fortran}:
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{subroutine omp_destroy_nest_lock(lock)}
@item @emph{Interface}: @tab @code{subroutine omp_destroy_nest_lock(lock)}
@item                   @tab @code{integer(omp_nest_lock_kind), intent(inout) :: lock}
@item                   @tab @code{integer(omp_nest_lock_kind), intent(inout) :: lock}
@end multitable
@end multitable
 
 
@item @emph{See also}:
@item @emph{See also}:
@ref{omp_init_lock}
@ref{omp_init_lock}
 
 
@item @emph{Reference}:
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.3.2.
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.3.2.
@end table
@end table
 
 
 
 
 
 
@node omp_get_wtick
@node omp_get_wtick
@section @code{omp_get_wtick} -- Get timer precision
@section @code{omp_get_wtick} -- Get timer precision
@table @asis
@table @asis
@item @emph{Description}:
@item @emph{Description}:
Gets the timer precision, i.e., the number of seconds between two
Gets the timer precision, i.e., the number of seconds between two
successive clock ticks.
successive clock ticks.
 
 
@item @emph{C/C++}:
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{double omp_get_wtick();}
@item @emph{Prototype}: @tab @code{double omp_get_wtick();}
@end multitable
@end multitable
 
 
@item @emph{Fortran}:
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{double precision function omp_get_wtick()}
@item @emph{Interface}: @tab @code{double precision function omp_get_wtick()}
@end multitable
@end multitable
 
 
@item @emph{See also}:
@item @emph{See also}:
@ref{omp_get_wtime}
@ref{omp_get_wtime}
 
 
@item @emph{Reference}:
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.4.2.
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.4.2.
@end table
@end table
 
 
 
 
 
 
@node omp_get_wtime
@node omp_get_wtime
@section @code{omp_get_wtime} -- Elapsed wall clock time
@section @code{omp_get_wtime} -- Elapsed wall clock time
@table @asis
@table @asis
@item @emph{Description}:
@item @emph{Description}:
Elapsed wall clock time in seconds. The time is measured per thread, no
Elapsed wall clock time in seconds. The time is measured per thread, no
guarantee can bee made that two distinct threads measure the same time.
guarantee can bee made that two distinct threads measure the same time.
Time is measured from some "time in the past". On POSIX compliant systems
Time is measured from some "time in the past". On POSIX compliant systems
the seconds since the Epoch (00:00:00 UTC, January 1, 1970) are returned.
the seconds since the Epoch (00:00:00 UTC, January 1, 1970) are returned.
 
 
@item @emph{C/C++}:
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{double omp_get_wtime();}
@item @emph{Prototype}: @tab @code{double omp_get_wtime();}
@end multitable
@end multitable
 
 
@item @emph{Fortran}:
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{double precision function omp_get_wtime()}
@item @emph{Interface}: @tab @code{double precision function omp_get_wtime()}
@end multitable
@end multitable
 
 
@item @emph{See also}:
@item @emph{See also}:
@ref{omp_get_wtick}
@ref{omp_get_wtick}
 
 
@item @emph{Reference}:
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.4.1.
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.4.1.
@end table
@end table
 
 
 
 
 
 
@c ---------------------------------------------------------------------
@c ---------------------------------------------------------------------
@c Environment Variables
@c Environment Variables
@c ---------------------------------------------------------------------
@c ---------------------------------------------------------------------
 
 
@node Environment Variables
@node Environment Variables
@chapter Environment Variables
@chapter Environment Variables
 
 
The variables @env{OMP_DYNAMIC}, @env{OMP_NESTED}, @env{OMP_NUM_THREADS} and
The variables @env{OMP_DYNAMIC}, @env{OMP_NESTED}, @env{OMP_NUM_THREADS} and
@env{OMP_SCHEDULE} are defined by section 4 of the OpenMP specifications in
@env{OMP_SCHEDULE} are defined by section 4 of the OpenMP specifications in
version 2.5, while @env{GOMP_CPU_AFFINITY} and @env{GOMP_STACKSIZE} are GNU
version 2.5, while @env{GOMP_CPU_AFFINITY} and @env{GOMP_STACKSIZE} are GNU
extensions.
extensions.
 
 
@menu
@menu
* OMP_DYNAMIC::        Dynamic adjustment of threads
* OMP_DYNAMIC::        Dynamic adjustment of threads
* OMP_NESTED::         Nested parallel regions
* OMP_NESTED::         Nested parallel regions
* OMP_NUM_THREADS::    Specifies the number of threads to use
* OMP_NUM_THREADS::    Specifies the number of threads to use
* OMP_SCHEDULE::       How threads are scheduled
* OMP_SCHEDULE::       How threads are scheduled
* GOMP_CPU_AFFINITY::  Bind threads to specific CPUs
* GOMP_CPU_AFFINITY::  Bind threads to specific CPUs
* GOMP_STACKSIZE::     Set default thread stack size
* GOMP_STACKSIZE::     Set default thread stack size
@end menu
@end menu
 
 
 
 
@node OMP_DYNAMIC
@node OMP_DYNAMIC
@section @env{OMP_DYNAMIC} -- Dynamic adjustment of threads
@section @env{OMP_DYNAMIC} -- Dynamic adjustment of threads
@cindex Environment Variable
@cindex Environment Variable
@cindex Implementation specific setting
@cindex Implementation specific setting
@table @asis
@table @asis
@item @emph{Description}:
@item @emph{Description}:
Enable or disable the dynamic adjustment of the number of threads
Enable or disable the dynamic adjustment of the number of threads
within a team. The value of this environment variable shall be
within a team. The value of this environment variable shall be
@code{TRUE} or @code{FALSE}. If undefined, dynamic adjustment is
@code{TRUE} or @code{FALSE}. If undefined, dynamic adjustment is
disabled by default.
disabled by default.
 
 
@item @emph{See also}:
@item @emph{See also}:
@ref{omp_set_dynamic}
@ref{omp_set_dynamic}
 
 
@item @emph{Reference}:
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 4.3
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 4.3
@end table
@end table
 
 
 
 
 
 
@node OMP_NESTED
@node OMP_NESTED
@section @env{OMP_NESTED} -- Nested parallel regions
@section @env{OMP_NESTED} -- Nested parallel regions
@cindex Environment Variable
@cindex Environment Variable
@cindex Implementation specific setting
@cindex Implementation specific setting
@table @asis
@table @asis
@item @emph{Description}:
@item @emph{Description}:
Enable or disable nested parallel regions, i.e., whether team members
Enable or disable nested parallel regions, i.e., whether team members
are allowed to create new teams. The value of this environment variable
are allowed to create new teams. The value of this environment variable
shall be @code{TRUE} or @code{FALSE}. If undefined, nested parallel
shall be @code{TRUE} or @code{FALSE}. If undefined, nested parallel
regions are disabled by default.
regions are disabled by default.
 
 
@item @emph{See also}:
@item @emph{See also}:
@ref{omp_set_nested}
@ref{omp_set_nested}
 
 
@item @emph{Reference}:
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 4.4
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 4.4
@end table
@end table
 
 
 
 
 
 
@node OMP_NUM_THREADS
@node OMP_NUM_THREADS
@section @env{OMP_NUM_THREADS} -- Specifies the number of threads to use
@section @env{OMP_NUM_THREADS} -- Specifies the number of threads to use
@cindex Environment Variable
@cindex Environment Variable
@cindex Implementation specific setting
@cindex Implementation specific setting
@table @asis
@table @asis
@item @emph{Description}:
@item @emph{Description}:
Specifies the default number of threads to use in parallel regions. The
Specifies the default number of threads to use in parallel regions. The
value of this variable shall be positive integer. If undefined one thread
value of this variable shall be positive integer. If undefined one thread
per CPU online is used.
per CPU online is used.
 
 
@item @emph{See also}:
@item @emph{See also}:
@ref{omp_set_num_threads}
@ref{omp_set_num_threads}
 
 
@item @emph{Reference}:
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 4.2
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 4.2
@end table
@end table
 
 
 
 
 
 
@node OMP_SCHEDULE
@node OMP_SCHEDULE
@section @env{OMP_SCHEDULE} -- How threads are scheduled
@section @env{OMP_SCHEDULE} -- How threads are scheduled
@cindex Environment Variable
@cindex Environment Variable
@cindex Implementation specific setting
@cindex Implementation specific setting
@table @asis
@table @asis
@item @emph{Description}:
@item @emph{Description}:
Allows to specify @code{schedule type} and @code{chunk size}.
Allows to specify @code{schedule type} and @code{chunk size}.
The value of the variable shall have the form: @code{type[,chunk]} where
The value of the variable shall have the form: @code{type[,chunk]} where
@code{type} is one of @code{static}, @code{dynamic} or @code{guided}.
@code{type} is one of @code{static}, @code{dynamic} or @code{guided}.
The optional @code{chunk size} shall be a positive integer. If undefined,
The optional @code{chunk size} shall be a positive integer. If undefined,
dynamic scheduling and a chunk size of 1 is used.
dynamic scheduling and a chunk size of 1 is used.
 
 
@item @emph{Reference}:
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, sections 2.5.1 and 4.1
@uref{http://www.openmp.org/, OpenMP specifications v2.5}, sections 2.5.1 and 4.1
@end table
@end table
 
 
 
 
 
 
@node GOMP_CPU_AFFINITY
@node GOMP_CPU_AFFINITY
@section @env{GOMP_CPU_AFFINITY} -- Bind threads to specific CPUs
@section @env{GOMP_CPU_AFFINITY} -- Bind threads to specific CPUs
@cindex Environment Variable
@cindex Environment Variable
@table @asis
@table @asis
@item @emph{Description}:
@item @emph{Description}:
A patch for this extension has been submitted, but was not yet applied at the
A patch for this extension has been submitted, but was not yet applied at the
time of writing.
time of writing.
 
 
@item @emph{Reference}:
@item @emph{Reference}:
@uref{http://gcc.gnu.org/ml/gcc-patches/2006-05/msg00982.html,
@uref{http://gcc.gnu.org/ml/gcc-patches/2006-05/msg00982.html,
GCC Patches Mailinglist}
GCC Patches Mailinglist}
@uref{http://gcc.gnu.org/ml/gcc-patches/2006-05/msg01133.html,
@uref{http://gcc.gnu.org/ml/gcc-patches/2006-05/msg01133.html,
GCC Patches Mailinglist}
GCC Patches Mailinglist}
@end table
@end table
 
 
 
 
 
 
@node GOMP_STACKSIZE
@node GOMP_STACKSIZE
@section @env{GOMP_STACKSIZE} -- Set default thread stack size
@section @env{GOMP_STACKSIZE} -- Set default thread stack size
@cindex Environment Variable
@cindex Environment Variable
@cindex Implementation specific setting
@cindex Implementation specific setting
@table @asis
@table @asis
@item @emph{Description}:
@item @emph{Description}:
Set the default thread stack size in kilobytes. This is in opposition
Set the default thread stack size in kilobytes. This is in opposition
to @code{pthread_attr_setstacksize} which gets the number of bytes as an
to @code{pthread_attr_setstacksize} which gets the number of bytes as an
argument. If the stacksize can not be set due to system constraints, an
argument. If the stacksize can not be set due to system constraints, an
error is reported and the initial stacksize is left unchanged. If undefined,
error is reported and the initial stacksize is left unchanged. If undefined,
the stack size is system dependent.
the stack size is system dependent.
 
 
@item @emph{Reference}:
@item @emph{Reference}:
@uref{http://gcc.gnu.org/ml/gcc-patches/2006-06/msg00493.html,
@uref{http://gcc.gnu.org/ml/gcc-patches/2006-06/msg00493.html,
GCC Patches Mailinglist},
GCC Patches Mailinglist},
@uref{http://gcc.gnu.org/ml/gcc-patches/2006-06/msg00496.html,
@uref{http://gcc.gnu.org/ml/gcc-patches/2006-06/msg00496.html,
GCC Patches Mailinglist}
GCC Patches Mailinglist}
@end table
@end table
 
 
 
 
 
 
@c ---------------------------------------------------------------------
@c ---------------------------------------------------------------------
@c The libgomp ABI
@c The libgomp ABI
@c ---------------------------------------------------------------------
@c ---------------------------------------------------------------------
 
 
@node The libgomp ABI
@node The libgomp ABI
@chapter The libgomp ABI
@chapter The libgomp ABI
 
 
The following sections present notes on the external ABI as
The following sections present notes on the external ABI as
presented by libgomp. Only maintainers should need them.
presented by libgomp. Only maintainers should need them.
 
 
@menu
@menu
* Implementing MASTER construct::
* Implementing MASTER construct::
* Implementing CRITICAL construct::
* Implementing CRITICAL construct::
* Implementing ATOMIC construct::
* Implementing ATOMIC construct::
* Implementing FLUSH construct::
* Implementing FLUSH construct::
* Implementing BARRIER construct::
* Implementing BARRIER construct::
* Implementing THREADPRIVATE construct::
* Implementing THREADPRIVATE construct::
* Implementing PRIVATE clause::
* Implementing PRIVATE clause::
* Implementing FIRSTPRIVATE LASTPRIVATE COPYIN and COPYPRIVATE clauses::
* Implementing FIRSTPRIVATE LASTPRIVATE COPYIN and COPYPRIVATE clauses::
* Implementing REDUCTION clause::
* Implementing REDUCTION clause::
* Implementing PARALLEL construct::
* Implementing PARALLEL construct::
* Implementing FOR construct::
* Implementing FOR construct::
* Implementing ORDERED construct::
* Implementing ORDERED construct::
* Implementing SECTIONS construct::
* Implementing SECTIONS construct::
* Implementing SINGLE construct::
* Implementing SINGLE construct::
@end menu
@end menu
 
 
 
 
@node Implementing MASTER construct
@node Implementing MASTER construct
@section Implementing MASTER construct
@section Implementing MASTER construct
 
 
@smallexample
@smallexample
if (omp_get_thread_num () == 0)
if (omp_get_thread_num () == 0)
  block
  block
@end smallexample
@end smallexample
 
 
Alternately, we generate two copies of the parallel subfunction
Alternately, we generate two copies of the parallel subfunction
and only include this in the version run by the master thread.
and only include this in the version run by the master thread.
Surely that's not worthwhile though...
Surely that's not worthwhile though...
 
 
 
 
 
 
@node Implementing CRITICAL construct
@node Implementing CRITICAL construct
@section Implementing CRITICAL construct
@section Implementing CRITICAL construct
 
 
Without a specified name,
Without a specified name,
 
 
@smallexample
@smallexample
  void GOMP_critical_start (void);
  void GOMP_critical_start (void);
  void GOMP_critical_end (void);
  void GOMP_critical_end (void);
@end smallexample
@end smallexample
 
 
so that we don't get COPY relocations from libgomp to the main
so that we don't get COPY relocations from libgomp to the main
application.
application.
 
 
With a specified name, use omp_set_lock and omp_unset_lock with
With a specified name, use omp_set_lock and omp_unset_lock with
name being transformed into a variable declared like
name being transformed into a variable declared like
 
 
@smallexample
@smallexample
  omp_lock_t gomp_critical_user_<name> __attribute__((common))
  omp_lock_t gomp_critical_user_<name> __attribute__((common))
@end smallexample
@end smallexample
 
 
Ideally the ABI would specify that all zero is a valid unlocked
Ideally the ABI would specify that all zero is a valid unlocked
state, and so we wouldn't actually need to initialize this at
state, and so we wouldn't actually need to initialize this at
startup.
startup.
 
 
 
 
 
 
@node Implementing ATOMIC construct
@node Implementing ATOMIC construct
@section Implementing ATOMIC construct
@section Implementing ATOMIC construct
 
 
The target should implement the @code{__sync} builtins.
The target should implement the @code{__sync} builtins.
 
 
Failing that we could add
Failing that we could add
 
 
@smallexample
@smallexample
  void GOMP_atomic_enter (void)
  void GOMP_atomic_enter (void)
  void GOMP_atomic_exit (void)
  void GOMP_atomic_exit (void)
@end smallexample
@end smallexample
 
 
which reuses the regular lock code, but with yet another lock
which reuses the regular lock code, but with yet another lock
object private to the library.
object private to the library.
 
 
 
 
 
 
@node Implementing FLUSH construct
@node Implementing FLUSH construct
@section Implementing FLUSH construct
@section Implementing FLUSH construct
 
 
Expands to the @code{__sync_synchronize} builtin.
Expands to the @code{__sync_synchronize} builtin.
 
 
 
 
 
 
@node Implementing BARRIER construct
@node Implementing BARRIER construct
@section Implementing BARRIER construct
@section Implementing BARRIER construct
 
 
@smallexample
@smallexample
  void GOMP_barrier (void)
  void GOMP_barrier (void)
@end smallexample
@end smallexample
 
 
 
 
@node Implementing THREADPRIVATE construct
@node Implementing THREADPRIVATE construct
@section Implementing THREADPRIVATE construct
@section Implementing THREADPRIVATE construct
 
 
In _most_ cases we can map this directly to @code{__thread}.  Except
In _most_ cases we can map this directly to @code{__thread}.  Except
that OMP allows constructors for C++ objects.  We can either
that OMP allows constructors for C++ objects.  We can either
refuse to support this (how often is it used?) or we can
refuse to support this (how often is it used?) or we can
implement something akin to .ctors.
implement something akin to .ctors.
 
 
Even more ideally, this ctor feature is handled by extensions
Even more ideally, this ctor feature is handled by extensions
to the main pthreads library.  Failing that, we can have a set
to the main pthreads library.  Failing that, we can have a set
of entry points to register ctor functions to be called.
of entry points to register ctor functions to be called.
 
 
 
 
 
 
@node Implementing PRIVATE clause
@node Implementing PRIVATE clause
@section Implementing PRIVATE clause
@section Implementing PRIVATE clause
 
 
In association with a PARALLEL, or within the lexical extent
In association with a PARALLEL, or within the lexical extent
of a PARALLEL block, the variable becomes a local variable in
of a PARALLEL block, the variable becomes a local variable in
the parallel subfunction.
the parallel subfunction.
 
 
In association with FOR or SECTIONS blocks, create a new
In association with FOR or SECTIONS blocks, create a new
automatic variable within the current function.  This preserves
automatic variable within the current function.  This preserves
the semantic of new variable creation.
the semantic of new variable creation.
 
 
 
 
 
 
@node Implementing FIRSTPRIVATE LASTPRIVATE COPYIN and COPYPRIVATE clauses
@node Implementing FIRSTPRIVATE LASTPRIVATE COPYIN and COPYPRIVATE clauses
@section Implementing FIRSTPRIVATE LASTPRIVATE COPYIN and COPYPRIVATE clauses
@section Implementing FIRSTPRIVATE LASTPRIVATE COPYIN and COPYPRIVATE clauses
 
 
Seems simple enough for PARALLEL blocks.  Create a private
Seems simple enough for PARALLEL blocks.  Create a private
struct for communicating between parent and subfunction.
struct for communicating between parent and subfunction.
In the parent, copy in values for scalar and "small" structs;
In the parent, copy in values for scalar and "small" structs;
copy in addresses for others TREE_ADDRESSABLE types.  In the
copy in addresses for others TREE_ADDRESSABLE types.  In the
subfunction, copy the value into the local variable.
subfunction, copy the value into the local variable.
 
 
Not clear at all what to do with bare FOR or SECTION blocks.
Not clear at all what to do with bare FOR or SECTION blocks.
The only thing I can figure is that we do something like
The only thing I can figure is that we do something like
 
 
@smallexample
@smallexample
#pragma omp for firstprivate(x) lastprivate(y)
#pragma omp for firstprivate(x) lastprivate(y)
for (int i = 0; i < n; ++i)
for (int i = 0; i < n; ++i)
  body;
  body;
@end smallexample
@end smallexample
 
 
which becomes
which becomes
 
 
@smallexample
@smallexample
@{
@{
  int x = x, y;
  int x = x, y;
 
 
  // for stuff
  // for stuff
 
 
  if (i == n)
  if (i == n)
    y = y;
    y = y;
@}
@}
@end smallexample
@end smallexample
 
 
where the "x=x" and "y=y" assignments actually have different
where the "x=x" and "y=y" assignments actually have different
uids for the two variables, i.e. not something you could write
uids for the two variables, i.e. not something you could write
directly in C.  Presumably this only makes sense if the "outer"
directly in C.  Presumably this only makes sense if the "outer"
x and y are global variables.
x and y are global variables.
 
 
COPYPRIVATE would work the same way, except the structure
COPYPRIVATE would work the same way, except the structure
broadcast would have to happen via SINGLE machinery instead.
broadcast would have to happen via SINGLE machinery instead.
 
 
 
 
 
 
@node Implementing REDUCTION clause
@node Implementing REDUCTION clause
@section Implementing REDUCTION clause
@section Implementing REDUCTION clause
 
 
The private struct mentioned in the previous section should have
The private struct mentioned in the previous section should have
a pointer to an array of the type of the variable, indexed by the
a pointer to an array of the type of the variable, indexed by the
thread's @var{team_id}.  The thread stores its final value into the
thread's @var{team_id}.  The thread stores its final value into the
array, and after the barrier the master thread iterates over the
array, and after the barrier the master thread iterates over the
array to collect the values.
array to collect the values.
 
 
 
 
@node Implementing PARALLEL construct
@node Implementing PARALLEL construct
@section Implementing PARALLEL construct
@section Implementing PARALLEL construct
 
 
@smallexample
@smallexample
  #pragma omp parallel
  #pragma omp parallel
  @{
  @{
    body;
    body;
  @}
  @}
@end smallexample
@end smallexample
 
 
becomes
becomes
 
 
@smallexample
@smallexample
  void subfunction (void *data)
  void subfunction (void *data)
  @{
  @{
    use data;
    use data;
    body;
    body;
  @}
  @}
 
 
  setup data;
  setup data;
  GOMP_parallel_start (subfunction, &data, num_threads);
  GOMP_parallel_start (subfunction, &data, num_threads);
  subfunction (&data);
  subfunction (&data);
  GOMP_parallel_end ();
  GOMP_parallel_end ();
@end smallexample
@end smallexample
 
 
@smallexample
@smallexample
  void GOMP_parallel_start (void (*fn)(void *), void *data, unsigned num_threads)
  void GOMP_parallel_start (void (*fn)(void *), void *data, unsigned num_threads)
@end smallexample
@end smallexample
 
 
The @var{FN} argument is the subfunction to be run in parallel.
The @var{FN} argument is the subfunction to be run in parallel.
 
 
The @var{DATA} argument is a pointer to a structure used to
The @var{DATA} argument is a pointer to a structure used to
communicate data in and out of the subfunction, as discussed
communicate data in and out of the subfunction, as discussed
above with respect to FIRSTPRIVATE et al.
above with respect to FIRSTPRIVATE et al.
 
 
The @var{NUM_THREADS} argument is 1 if an IF clause is present
The @var{NUM_THREADS} argument is 1 if an IF clause is present
and false, or the value of the NUM_THREADS clause, if
and false, or the value of the NUM_THREADS clause, if
present, or 0.
present, or 0.
 
 
The function needs to create the appropriate number of
The function needs to create the appropriate number of
threads and/or launch them from the dock.  It needs to
threads and/or launch them from the dock.  It needs to
create the team structure and assign team ids.
create the team structure and assign team ids.
 
 
@smallexample
@smallexample
  void GOMP_parallel_end (void)
  void GOMP_parallel_end (void)
@end smallexample
@end smallexample
 
 
Tears down the team and returns us to the previous @code{omp_in_parallel()} state.
Tears down the team and returns us to the previous @code{omp_in_parallel()} state.
 
 
 
 
 
 
@node Implementing FOR construct
@node Implementing FOR construct
@section Implementing FOR construct
@section Implementing FOR construct
 
 
@smallexample
@smallexample
  #pragma omp parallel for
  #pragma omp parallel for
  for (i = lb; i <= ub; i++)
  for (i = lb; i <= ub; i++)
    body;
    body;
@end smallexample
@end smallexample
 
 
becomes
becomes
 
 
@smallexample
@smallexample
  void subfunction (void *data)
  void subfunction (void *data)
  @{
  @{
    long _s0, _e0;
    long _s0, _e0;
    while (GOMP_loop_static_next (&_s0, &_e0))
    while (GOMP_loop_static_next (&_s0, &_e0))
    @{
    @{
      long _e1 = _e0, i;
      long _e1 = _e0, i;
      for (i = _s0; i < _e1; i++)
      for (i = _s0; i < _e1; i++)
        body;
        body;
    @}
    @}
    GOMP_loop_end_nowait ();
    GOMP_loop_end_nowait ();
  @}
  @}
 
 
  GOMP_parallel_loop_static (subfunction, NULL, 0, lb, ub+1, 1, 0);
  GOMP_parallel_loop_static (subfunction, NULL, 0, lb, ub+1, 1, 0);
  subfunction (NULL);
  subfunction (NULL);
  GOMP_parallel_end ();
  GOMP_parallel_end ();
@end smallexample
@end smallexample
 
 
@smallexample
@smallexample
  #pragma omp for schedule(runtime)
  #pragma omp for schedule(runtime)
  for (i = 0; i < n; i++)
  for (i = 0; i < n; i++)
    body;
    body;
@end smallexample
@end smallexample
 
 
becomes
becomes
 
 
@smallexample
@smallexample
  @{
  @{
    long i, _s0, _e0;
    long i, _s0, _e0;
    if (GOMP_loop_runtime_start (0, n, 1, &_s0, &_e0))
    if (GOMP_loop_runtime_start (0, n, 1, &_s0, &_e0))
      do @{
      do @{
        long _e1 = _e0;
        long _e1 = _e0;
        for (i = _s0, i < _e0; i++)
        for (i = _s0, i < _e0; i++)
          body;
          body;
      @} while (GOMP_loop_runtime_next (&_s0, _&e0));
      @} while (GOMP_loop_runtime_next (&_s0, _&e0));
    GOMP_loop_end ();
    GOMP_loop_end ();
  @}
  @}
@end smallexample
@end smallexample
 
 
Note that while it looks like there is trickyness to propagating
Note that while it looks like there is trickyness to propagating
a non-constant STEP, there isn't really.  We're explicitly allowed
a non-constant STEP, there isn't really.  We're explicitly allowed
to evaluate it as many times as we want, and any variables involved
to evaluate it as many times as we want, and any variables involved
should automatically be handled as PRIVATE or SHARED like any other
should automatically be handled as PRIVATE or SHARED like any other
variables.  So the expression should remain evaluable in the
variables.  So the expression should remain evaluable in the
subfunction.  We can also pull it into a local variable if we like,
subfunction.  We can also pull it into a local variable if we like,
but since its supposed to remain unchanged, we can also not if we like.
but since its supposed to remain unchanged, we can also not if we like.
 
 
If we have SCHEDULE(STATIC), and no ORDERED, then we ought to be
If we have SCHEDULE(STATIC), and no ORDERED, then we ought to be
able to get away with no work-sharing context at all, since we can
able to get away with no work-sharing context at all, since we can
simply perform the arithmetic directly in each thread to divide up
simply perform the arithmetic directly in each thread to divide up
the iterations.  Which would mean that we wouldn't need to call any
the iterations.  Which would mean that we wouldn't need to call any
of these routines.
of these routines.
 
 
There are separate routines for handling loops with an ORDERED
There are separate routines for handling loops with an ORDERED
clause.  Bookkeeping for that is non-trivial...
clause.  Bookkeeping for that is non-trivial...
 
 
 
 
 
 
@node Implementing ORDERED construct
@node Implementing ORDERED construct
@section Implementing ORDERED construct
@section Implementing ORDERED construct
 
 
@smallexample
@smallexample
  void GOMP_ordered_start (void)
  void GOMP_ordered_start (void)
  void GOMP_ordered_end (void)
  void GOMP_ordered_end (void)
@end smallexample
@end smallexample
 
 
 
 
 
 
@node Implementing SECTIONS construct
@node Implementing SECTIONS construct
@section Implementing SECTIONS construct
@section Implementing SECTIONS construct
 
 
A block as
A block as
 
 
@smallexample
@smallexample
  #pragma omp sections
  #pragma omp sections
  @{
  @{
    #pragma omp section
    #pragma omp section
    stmt1;
    stmt1;
    #pragma omp section
    #pragma omp section
    stmt2;
    stmt2;
    #pragma omp section
    #pragma omp section
    stmt3;
    stmt3;
  @}
  @}
@end smallexample
@end smallexample
 
 
becomes
becomes
 
 
@smallexample
@smallexample
  for (i = GOMP_sections_start (3); i != 0; i = GOMP_sections_next ())
  for (i = GOMP_sections_start (3); i != 0; i = GOMP_sections_next ())
    switch (i)
    switch (i)
      @{
      @{
      case 1:
      case 1:
        stmt1;
        stmt1;
        break;
        break;
      case 2:
      case 2:
        stmt2;
        stmt2;
        break;
        break;
      case 3:
      case 3:
        stmt3;
        stmt3;
        break;
        break;
      @}
      @}
  GOMP_barrier ();
  GOMP_barrier ();
@end smallexample
@end smallexample
 
 
 
 
@node Implementing SINGLE construct
@node Implementing SINGLE construct
@section Implementing SINGLE construct
@section Implementing SINGLE construct
 
 
A block like
A block like
 
 
@smallexample
@smallexample
  #pragma omp single
  #pragma omp single
  @{
  @{
    body;
    body;
  @}
  @}
@end smallexample
@end smallexample
 
 
becomes
becomes
 
 
@smallexample
@smallexample
  if (GOMP_single_start ())
  if (GOMP_single_start ())
    body;
    body;
  GOMP_barrier ();
  GOMP_barrier ();
@end smallexample
@end smallexample
 
 
while
while
 
 
@smallexample
@smallexample
  #pragma omp single copyprivate(x)
  #pragma omp single copyprivate(x)
    body;
    body;
@end smallexample
@end smallexample
 
 
becomes
becomes
 
 
@smallexample
@smallexample
  datap = GOMP_single_copy_start ();
  datap = GOMP_single_copy_start ();
  if (datap == NULL)
  if (datap == NULL)
    @{
    @{
      body;
      body;
      data.x = x;
      data.x = x;
      GOMP_single_copy_end (&data);
      GOMP_single_copy_end (&data);
    @}
    @}
  else
  else
    x = datap->x;
    x = datap->x;
  GOMP_barrier ();
  GOMP_barrier ();
@end smallexample
@end smallexample
 
 
 
 
 
 
@c ---------------------------------------------------------------------
@c ---------------------------------------------------------------------
@c
@c
@c ---------------------------------------------------------------------
@c ---------------------------------------------------------------------
 
 
@node Reporting Bugs
@node Reporting Bugs
@chapter Reporting Bugs
@chapter Reporting Bugs
 
 
Bugs in the GNU OpenMP implementation should be reported via
Bugs in the GNU OpenMP implementation should be reported via
@uref{http://gcc.gnu.org/bugzilla/, bugzilla}. In all cases, please add
@uref{http://gcc.gnu.org/bugzilla/, bugzilla}. In all cases, please add
"openmp" to the keywords field in the bug report.
"openmp" to the keywords field in the bug report.
 
 
 
 
 
 
@c ---------------------------------------------------------------------
@c ---------------------------------------------------------------------
@c GNU General Public License
@c GNU General Public License
@c ---------------------------------------------------------------------
@c ---------------------------------------------------------------------
 
 
@include gpl.texi
@include gpl.texi
 
 
 
 
 
 
@c ---------------------------------------------------------------------
@c ---------------------------------------------------------------------
@c GNU Free Documentation License
@c GNU Free Documentation License
@c ---------------------------------------------------------------------
@c ---------------------------------------------------------------------
 
 
@include fdl.texi
@include fdl.texi
 
 
 
 
 
 
@c ---------------------------------------------------------------------
@c ---------------------------------------------------------------------
@c Funding Free Software
@c Funding Free Software
@c ---------------------------------------------------------------------
@c ---------------------------------------------------------------------
 
 
@include funding.texi
@include funding.texi
 
 
@c ---------------------------------------------------------------------
@c ---------------------------------------------------------------------
@c Index
@c Index
@c ---------------------------------------------------------------------
@c ---------------------------------------------------------------------
 
 
@node Index
@node Index
@unnumbered Index
@unnumbered Index
 
 
@printindex cp
@printindex cp
 
 
@bye
@bye
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.