OSDN Git Service

Check if GCC uses assembler cfi support
[pf3gnuchains/gcc-fork.git] / libgomp / libgomp.texi
index f92a5da..29c078b 100644 (file)
@@ -7,13 +7,12 @@
 
 
 @copying
-Copyright @copyright{} 2006 Free Software Foundation, Inc.
+Copyright @copyright{} 2006, 2007, 2008, 2010, 2011 Free Software Foundation, Inc.
 
 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.3 or
 any later version published by the Free Software Foundation; with the
-Invariant Sections being ``GNU General Public License'' and ``Funding
-Free Software'', the Front-Cover
+Invariant Sections being ``Funding Free Software'', the Front-Cover
 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
 ``GNU Free Documentation License''.
@@ -117,7 +116,7 @@ arranges for automatic linking of the OpenMP runtime library
 
 A complete description of all OpenMP directives accepted may be found in 
 the @uref{http://www.openmp.org, OpenMP Application Program Interface} manual,
-version 2.5.
+version 3.1.
 
 
 @c ---------------------------------------------------------------------
@@ -128,21 +127,32 @@ version 2.5.
 @chapter Runtime Library Routines
 
 The runtime routines described here are defined by section 3 of the OpenMP 
-specifications in version 2.5.
+specifications in version 3.1. The routines are structured in following
+three parts:
 
 Control threads, processors and the parallel environment.
 
 @menu
-* omp_get_dynamic::          Dynamic teams setting
-* omp_get_max_threads::      Maximum number of threads
-* omp_get_nested::           Nested parallel regions
-* omp_get_num_procs::        Number of processors online
-* omp_get_num_threads::      Size of the active team
-* omp_get_thread_num::       Current thread ID
-* omp_in_parallel::          Whether a parallel region is active
-* omp_set_dynamic::          Enable/disable dynamic teams
-* omp_set_nested::           Enable/disable nested parallel regions
-* omp_set_num_threads::      Set upper team size limit
+* omp_get_active_level::        Number of active parallel regions
+* omp_get_ancestor_thread_num:: Ancestor thread ID
+* omp_get_dynamic::             Dynamic teams setting
+* omp_get_level::               Number of parallel regions
+* omp_get_max_active_levels::   Maximum number of active regions
+* omp_get_max_threads::         Maximum number of threads of parallel region
+* omp_get_nested::              Nested parallel regions
+* omp_get_num_procs::           Number of processors online
+* omp_get_num_threads::         Size of the active team
+* omp_get_schedule::            Obtain the runtime scheduling method
+* omp_get_team_size::           Number of threads in a team
+* omp_get_thread_limit::        Maximum number of threads
+* omp_get_thread_num::          Current thread ID
+* omp_in_parallel::             Whether a parallel region is active
+* omp_in_final::                Whether in final or included task region
+* omp_set_dynamic::             Enable/disable dynamic teams
+* omp_set_max_active_levels::   Limits the number of active parallel regions
+* omp_set_nested::              Enable/disable nested parallel regions
+* omp_set_num_threads::         Set upper team size limit
+* omp_set_schedule::            Set the runtime scheduling method
 @end menu
 
 Initialize, set, test, unset and destroy simple and nested locks.
@@ -167,6 +177,63 @@ Portable, thread-based, wall clock timer.
 * omp_get_wtime::            Elapsed wall clock time.
 @end menu
 
+
+
+@node omp_get_active_level
+@section @code{omp_get_active_level} -- Number of parallel regions
+@table @asis
+@item @emph{Description}:
+This function returns the nesting level for the active parallel blocks,
+which enclose the calling call.
+
+@item @emph{C/C++}
+@multitable @columnfractions .20 .80
+@item @emph{Prototype}: @tab @code{int omp_get_active_level(void);}
+@end multitable
+
+@item @emph{Fortran}:
+@multitable @columnfractions .20 .80
+@item @emph{Interface}: @tab @code{integer function omp_get_active_level()}
+@end multitable
+
+@item @emph{See also}:
+@ref{omp_get_level}, @ref{omp_get_max_active_levels}, @ref{omp_set_max_active_levels}
+
+@item @emph{Reference}:
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.19.
+@end table
+
+
+
+@node omp_get_ancestor_thread_num
+@section @code{omp_get_ancestor_thread_num} -- Ancestor thread ID
+@table @asis
+@item @emph{Description}:
+This function returns the thread identification number for the given
+nesting level of the current thread. For values of @var{level} outside
+zero to @code{omp_get_level} -1 is returned; if @var{level} is
+@code{omp_get_level} the result is identical to @code{omp_get_thread_num}.
+
+@item @emph{C/C++}
+@multitable @columnfractions .20 .80
+@item @emph{Prototype}: @tab @code{int omp_get_ancestor_thread_num(int level);}
+@end multitable
+
+@item @emph{Fortran}:
+@multitable @columnfractions .20 .80
+@item @emph{Interface}: @tab @code{integer function omp_get_ancestor_thread_num(level)}
+@item                   @tab @code{integer level}
+@end multitable
+
+@item @emph{See also}:
+@ref{omp_get_level}, @ref{omp_get_thread_num}, @ref{omp_get_team_size}
+
+@item @emph{Reference}:
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.17.
+@end table
+
+
+
 @node omp_get_dynamic
 @section @code{omp_get_dynamic} -- Dynamic teams setting
 @table @asis
@@ -182,7 +249,7 @@ disabled by default.
 
 @item @emph{C/C++}:
 @multitable @columnfractions .20 .80
-@item @emph{Prototype}: @tab @code{int omp_get_dynamic();}
+@item @emph{Prototype}: @tab @code{int omp_get_dynamic(void);}
 @end multitable
 
 @item @emph{Fortran}:
@@ -194,21 +261,72 @@ disabled by default.
 @ref{omp_set_dynamic}, @ref{OMP_DYNAMIC}
 
 @item @emph{Reference}:
-@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.2.8.
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.8.
+@end table
+
+
+
+@node omp_get_level
+@section @code{omp_get_level} -- Obtain the current nesting level
+@table @asis
+@item @emph{Description}:
+This function returns the nesting level for the parallel blocks,
+which enclose the calling call.
+
+@item @emph{C/C++}
+@multitable @columnfractions .20 .80
+@item @emph{Prototype}: @tab @code{int omp_get_level(void);}
+@end multitable
+
+@item @emph{Fortran}:
+@multitable @columnfractions .20 .80
+@item @emph{Interface}: @tab @code{integer function omp_level()}
+@end multitable
+
+@item @emph{See also}:
+@ref{omp_get_active_level}
+
+@item @emph{Reference}:
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.16.
+@end table
+
+
+
+@node omp_get_max_active_levels
+@section @code{omp_get_max_active_levels} -- Maximum number of active regions
+@table @asis
+@item @emph{Description}:
+This function obtains the maximum allowed number of nested, active parallel regions.
+
+@item @emph{C/C++}
+@multitable @columnfractions .20 .80
+@item @emph{Prototype}: @tab @code{int omp_get_max_active_levels(void);}
+@end multitable
+
+@item @emph{Fortran}:
+@multitable @columnfractions .20 .80
+@item @emph{Interface}: @tab @code{integer function omp_get_max_active_levels()}
+@end multitable
+
+@item @emph{See also}:
+@ref{omp_set_max_active_levels}, @ref{omp_get_active_level}
+
+@item @emph{Reference}:
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.15.
 @end table
 
 
 
 @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 of parallel region
 @table @asis
 @item @emph{Description}:
-Return the maximum number of threads used for parallel regions that do
-not use the clause @code{num_threads}.
+Return the maximum number of threads used for the current parallel region
+that does not use the clause @code{num_threads}.
 
 @item @emph{C/C++}:
 @multitable @columnfractions .20 .80
-@item @emph{Prototype}: @tab @code{int omp_get_max_threads();}
+@item @emph{Prototype}: @tab @code{int omp_get_max_threads(void);}
 @end multitable
 
 @item @emph{Fortran}:
@@ -217,10 +335,10 @@ not use the clause @code{num_threads}.
 @end multitable
 
 @item @emph{See also}:
-@ref{omp_set_num_threads}, @ref{omp_set_dynamic}
+@ref{omp_set_num_threads}, @ref{omp_set_dynamic}, @ref{omp_get_thread_limit}
 
 @item @emph{Reference}:
-@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.2.3.
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.3.
 @end table
 
 
@@ -240,19 +358,19 @@ disabled by default.
 
 @item @emph{C/C++}:
 @multitable @columnfractions .20 .80
-@item @emph{Prototype}: @tab @code{int omp_get_nested();}
+@item @emph{Prototype}: @tab @code{int omp_get_nested(void);}
 @end multitable
 
 @item @emph{Fortran}:
 @multitable @columnfractions .20 .80
-@item @emph{Interface}: @tab @code{integer function omp_get_nested()}
+@item @emph{Interface}: @tab @code{logical function omp_get_nested()}
 @end multitable
 
 @item @emph{See also}:
 @ref{omp_set_nested}, @ref{OMP_NESTED}
 
 @item @emph{Reference}:
-@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.2.10.
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.10.
 @end table
 
 
@@ -265,7 +383,7 @@ Returns the number of processors online.
 
 @item @emph{C/C++}:
 @multitable @columnfractions .20 .80
-@item @emph{Prototype}: @tab @code{int omp_get_num_procs();}
+@item @emph{Prototype}: @tab @code{int omp_get_num_procs(void);}
 @end multitable
 
 @item @emph{Fortran}:
@@ -274,7 +392,7 @@ Returns the number of processors online.
 @end multitable
 
 @item @emph{Reference}:
-@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.2.5.
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.5.
 @end table
 
 
@@ -283,7 +401,7 @@ Returns the number of processors online.
 @section @code{omp_get_num_threads} -- Size of the active team
 @table @asis
 @item @emph{Description}:
-The number of threads in the current team. In a sequential section of 
+Returns the number of threads in the current team. In a sequential section of 
 the program @code{omp_get_num_threads} returns 1.
 
 The default team size may be initialized at startup by the 
@@ -295,7 +413,7 @@ one thread per CPU online is used.
 
 @item @emph{C/C++}:
 @multitable @columnfractions .20 .80
-@item @emph{Prototype}: @tab @code{int omp_get_num_threads();}
+@item @emph{Prototype}: @tab @code{int omp_get_num_threads(void);}
 @end multitable
 
 @item @emph{Fortran}:
@@ -307,7 +425,92 @@ one thread per CPU online is used.
 @ref{omp_get_max_threads}, @ref{omp_set_num_threads}, @ref{OMP_NUM_THREADS}
 
 @item @emph{Reference}:
-@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.2.2.
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.2.
+@end table
+
+
+
+@node omp_get_schedule
+@section @code{omp_get_schedule} -- Obtain the runtime scheduling method
+@table @asis
+@item @emph{Description}:
+Obtain the runtime scheduling method. The @var{kind} argument will be
+set to the value @code{omp_sched_static}, @code{omp_sched_dynamic},
+@code{omp_sched_guided} or @code{omp_sched_auto}. The second argument,
+@var{modifier}, is set to the chunk size.
+
+@item @emph{C/C++}
+@multitable @columnfractions .20 .80
+@item @emph{Prototype}: @tab @code{void omp_schedule(omp_sched_t *kind, int *modifier);}
+@end multitable
+
+@item @emph{Fortran}:
+@multitable @columnfractions .20 .80
+@item @emph{Interface}: @tab @code{subroutine omp_schedule(kind, modifier)}
+@item                   @tab @code{integer(kind=omp_sched_kind) kind}
+@item                   @tab @code{integer modifier}
+@end multitable
+
+@item @emph{See also}:
+@ref{omp_set_schedule}, @ref{OMP_SCHEDULE}
+
+@item @emph{Reference}:
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.12.
+@end table
+
+
+
+@node omp_get_team_size
+@section @code{omp_get_team_size} -- Number of threads in a team
+@table @asis
+@item @emph{Description}:
+This function returns the number of threads in a thread team to which
+either the current thread or its ancestor belongs. For values of @var{level}
+outside zero to @code{omp_get_level}, -1 is returned; if @var{level} is zero,
+1 is returned, and for @code{omp_get_level}, the result is identical
+to @code{omp_get_num_threads}.
+
+@item @emph{C/C++}:
+@multitable @columnfractions .20 .80
+@item @emph{Prototype}: @tab @code{int omp_get_team_size(int level);}
+@end multitable
+
+@item @emph{Fortran}:
+@multitable @columnfractions .20 .80
+@item @emph{Interface}: @tab @code{integer function omp_get_team_size(level)}
+@item                   @tab @code{integer level}
+@end multitable
+
+@item @emph{See also}:
+@ref{omp_get_num_threads}, @ref{omp_get_level}, @ref{omp_get_ancestor_thread_num}
+
+@item @emph{Reference}:
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.18.
+@end table
+
+
+
+@node omp_get_thread_limit
+@section @code{omp_get_thread_limit} -- Maximum number of threads
+@table @asis
+@item @emph{Description}:
+Return the maximum number of threads of the program.
+
+@item @emph{C/C++}:
+@multitable @columnfractions .20 .80
+@item @emph{Prototype}: @tab @code{int omp_get_thread_limit(void);}
+@end multitable
+
+@item @emph{Fortran}:
+@multitable @columnfractions .20 .80
+@item @emph{Interface}: @tab @code{integer function omp_get_thread_limit()}
+@end multitable
+
+@item @emph{See also}:
+@ref{omp_get_max_threads}, @ref{OMP_THREAD_LIMIT}
+
+@item @emph{Reference}:
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.13.
 @end table
 
 
@@ -316,14 +519,15 @@ one thread per CPU online is used.
 @section @code{omp_get_thread_num} -- Current thread ID
 @table @asis
 @item @emph{Description}:
-Unique thread identification number. In a sequential parts of the program, 
-@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 
+Returns a unique thread identification number within the current team.
+In a sequential parts of the program, @code{omp_get_thread_num}
+always returns 0. In parallel regions the return value varies
+from 0 to @code{omp_get_num_threads}-1 inclusive. The return 
 value of the master thread of a team is always 0.
 
 @item @emph{C/C++}:
 @multitable @columnfractions .20 .80
-@item @emph{Prototype}: @tab @code{int omp_get_thread_num();}
+@item @emph{Prototype}: @tab @code{int omp_get_thread_num(void);}
 @end multitable
 
 @item @emph{Fortran}:
@@ -332,10 +536,10 @@ value of the master thread of a team is always 0.
 @end multitable
 
 @item @emph{See also}:
-@ref{omp_get_max_threads}
+@ref{omp_get_num_threads}, @ref{omp_get_ancestor_thread_num}
 
 @item @emph{Reference}:
-@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.2.4.
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.4.
 @end table
 
 
@@ -350,7 +554,7 @@ their language-specific counterparts.
 
 @item @emph{C/C++}:
 @multitable @columnfractions .20 .80
-@item @emph{Prototype}: @tab @code{int omp_in_parallel();}
+@item @emph{Prototype}: @tab @code{int omp_in_parallel(void);}
 @end multitable
 
 @item @emph{Fortran}:
@@ -359,7 +563,30 @@ their language-specific counterparts.
 @end multitable
 
 @item @emph{Reference}:
-@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.2.6.
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.6.
+@end table
+
+
+@node omp_in_final
+@section @code{omp_in_final} -- Whether in final or included task region
+@table @asis
+@item @emph{Description}:
+This function returns @code{true} if currently running in a final
+or included task region, @code{false} otherwise. Here, @code{true}
+and @code{false} represent their language-specific counterparts.
+
+@item @emph{C/C++}:
+@multitable @columnfractions .20 .80
+@item @emph{Prototype}: @tab @code{int omp_in_final(void);}
+@end multitable
+
+@item @emph{Fortran}:
+@multitable @columnfractions .20 .80
+@item @emph{Interface}: @tab @code{logical function omp_in_final()}
+@end multitable
+
+@item @emph{Reference}:
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.20.
 @end table
 
 
@@ -374,20 +601,47 @@ adjustment of team sizes and @code{false} disables it.
 
 @item @emph{C/C++}:
 @multitable @columnfractions .20 .80
-@item @emph{Prototype}: @tab @code{void omp_set_dynamic(int);}
+@item @emph{Prototype}: @tab @code{void omp_set_dynamic(int set);}
 @end multitable
 
 @item @emph{Fortran}:
 @multitable @columnfractions .20 .80
 @item @emph{Interface}: @tab @code{subroutine omp_set_dynamic(set)}
-@item                   @tab @code{integer, intent(in) :: set}
+@item                   @tab @code{logical, intent(in) :: set}
 @end multitable
 
 @item @emph{See also}:
 @ref{OMP_DYNAMIC}, @ref{omp_get_dynamic}
 
 @item @emph{Reference}:
-@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.2.7.
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.7.
+@end table
+
+
+
+@node omp_set_max_active_levels
+@section @code{omp_set_max_active_levels} -- Limits the number of active parallel regions
+@table @asis
+@item @emph{Description}:
+This function limits the maximum allowed number of nested, active
+parallel regions.
+
+@item @emph{C/C++}
+@multitable @columnfractions .20 .80
+@item @emph{Prototype}: @tab @code{void omp_set_max_active_levels(int max_levels);}
+@end multitable
+
+@item @emph{Fortran}:
+@multitable @columnfractions .20 .80
+@item @emph{Interface}: @tab @code{subroutine omp_set_max_active_levels(max_levels)}
+@item                   @tab @code{integer max_levels}
+@end multitable
+
+@item @emph{See also}:
+@ref{omp_get_max_active_levels}, @ref{omp_get_active_level}
+
+@item @emph{Reference}:
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.14.
 @end table
 
 
@@ -403,20 +657,20 @@ dynamic adjustment of team sizes and @code{false} disables it.
 
 @item @emph{C/C++}:
 @multitable @columnfractions .20 .80
-@item @emph{Prototype}: @tab @code{void omp_set_dynamic(int);}
+@item @emph{Prototype}: @tab @code{void omp_set_nested(int set);}
 @end multitable
 
 @item @emph{Fortran}:
 @multitable @columnfractions .20 .80
-@item @emph{Interface}: @tab @code{subroutine omp_set_dynamic(set)}
-@item                   @tab @code{integer, intent(in) :: set}
+@item @emph{Interface}: @tab @code{subroutine omp_set_nested(set)}
+@item                   @tab @code{logical, intent(in) :: set}
 @end multitable
 
 @item @emph{See also}:
 @ref{OMP_NESTED}, @ref{omp_get_nested}
 
 @item @emph{Reference}:
-@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.2.9.
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.9.
 @end table
 
 
@@ -431,20 +685,53 @@ argument of @code{omp_set_num_threads} shall be a positive integer.
 
 @item @emph{C/C++}:
 @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 n);}
 @end multitable
 
 @item @emph{Fortran}:
 @multitable @columnfractions .20 .80
-@item @emph{Interface}: @tab @code{subroutine omp_set_num_threads(set)}
-@item                   @tab @code{integer, intent(in) :: set}
+@item @emph{Interface}: @tab @code{subroutine omp_set_num_threads(n)}
+@item                   @tab @code{integer, intent(in) :: n}
 @end multitable
 
 @item @emph{See also}:
 @ref{OMP_NUM_THREADS}, @ref{omp_get_num_threads}, @ref{omp_get_max_threads}
 
 @item @emph{Reference}:
-@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.2.1.
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.1.
+@end table
+
+
+
+@node omp_set_schedule
+@section @code{omp_set_schedule} -- Set the runtime scheduling method
+@table @asis
+@item @emph{Description}:
+Sets the runtime scheduling method. The @var{kind} argument can have the
+value @code{omp_sched_static}, @code{omp_sched_dynamic},
+@code{omp_sched_guided} or @code{omp_sched_auto}. Except for
+@code{omp_sched_auto}, the chunk size is set to the value of
+@var{modifier} if positive, or to the default value if zero or negative.
+For @code{omp_sched_auto} the @var{modifier} argument is ignored.
+
+@item @emph{C/C++}
+@multitable @columnfractions .20 .80
+@item @emph{Prototype}: @tab @code{void omp_set_schedule(omp_sched_t *kind, int *modifier);}
+@end multitable
+
+@item @emph{Fortran}:
+@multitable @columnfractions .20 .80
+@item @emph{Interface}: @tab @code{subroutine omp_set_schedule(kind, modifier)}
+@item                   @tab @code{integer(kind=omp_sched_kind) kind}
+@item                   @tab @code{integer modifier}
+@end multitable
+
+@item @emph{See also}:
+@ref{omp_get_schedule}
+@ref{OMP_SCHEDULE}
+
+@item @emph{Reference}:
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.11.
 @end table
 
 
@@ -453,7 +740,7 @@ argument of @code{omp_set_num_threads} shall be a positive integer.
 @section @code{omp_init_lock} -- Initialize simple lock
 @table @asis
 @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.
 
 @item @emph{C/C++}:
@@ -471,7 +758,7 @@ an unlocked state.
 @ref{omp_destroy_lock}
 
 @item @emph{Reference}: 
-@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.3.1.
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.1.
 @end table
 
 
@@ -493,14 +780,14 @@ a deadlock occurs.
 @item @emph{Fortran}:
 @multitable @columnfractions .20 .80
 @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(inout) :: lock}
 @end multitable
 
 @item @emph{See also}:
 @ref{omp_init_lock}, @ref{omp_test_lock}, @ref{omp_unset_lock}
 
 @item @emph{Reference}: 
-@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.3.3.
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.3.
 @end table
 
 
@@ -512,7 +799,7 @@ a deadlock occurs.
 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} 
 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.
 
 @item @emph{C/C++}:
@@ -522,16 +809,15 @@ does not block if the lock is not available. This function returns
 
 @item @emph{Fortran}:
 @multitable @columnfractions .20 .80
-@item @emph{Interface}: @tab @code{subroutine omp_test_lock(lock)}
-@item                   @tab @code{logical(omp_logical_kind) :: omp_test_lock}
-@item                   @tab @code{integer(omp_lock_kind), intent(out) :: lock}
+@item @emph{Interface}: @tab @code{logical function omp_test_lock(lock)}
+@item                   @tab @code{integer(omp_lock_kind), intent(inout) :: lock}
 @end multitable
 
 @item @emph{See also}:
 @ref{omp_init_lock}, @ref{omp_set_lock}, @ref{omp_set_lock}
 
 @item @emph{Reference}: 
-@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.3.5.
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.5.
 @end table
 
 
@@ -543,8 +829,8 @@ does not block if the lock is not available. This function returns
 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 
 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, 
-again, set the lock for itself.
+or more threads attempted to set the lock before, one of them is chosen to, 
+again, set the lock to itself.
 
 @item @emph{C/C++}:
 @multitable @columnfractions .20 .80
@@ -554,14 +840,14 @@ again, set the lock for itself.
 @item @emph{Fortran}:
 @multitable @columnfractions .20 .80
 @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(inout) :: lock}
 @end multitable
 
 @item @emph{See also}:
 @ref{omp_set_lock}, @ref{omp_test_lock}
 
 @item @emph{Reference}: 
-@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.3.4.
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.4.
 @end table
 
 
@@ -575,7 +861,7 @@ in the unlocked state.
 
 @item @emph{C/C++}:
 @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 *lock);}
 @end multitable
 
 @item @emph{Fortran}:
@@ -588,7 +874,7 @@ in the unlocked state.
 @ref{omp_init_lock}
 
 @item @emph{Reference}: 
-@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.3.2.
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.2.
 @end table
 
 
@@ -597,7 +883,7 @@ in the unlocked state.
 @section @code{omp_init_nest_lock} -- Initialize nested lock
 @table @asis
 @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.
 
 @item @emph{C/C++}:
@@ -615,18 +901,18 @@ an unlocked state and the nesting count is set to zero.
 @ref{omp_destroy_nest_lock}
 
 @item @emph{Reference}:
-@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.3.1.
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.1.
 @end table
 
 
 @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 nested lock
 @table @asis
 @item @emph{Description}:
 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 
 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 is incremented.
 
 @item @emph{C/C++}:
 @multitable @columnfractions .20 .80
@@ -636,14 +922,14 @@ nesting count for the lock in incremented.
 @item @emph{Fortran}:
 @multitable @columnfractions .20 .80
 @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(inout) :: lock}
 @end multitable
 
 @item @emph{See also}:
 @ref{omp_init_nest_lock}, @ref{omp_unset_nest_lock}
 
 @item @emph{Reference}: 
-@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.3.3.
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.3.
 @end table
 
 
@@ -665,8 +951,7 @@ is returned. Otherwise, the return value equals zero.
 
 @item @emph{Fortran}:
 @multitable @columnfractions .20 .80
-@item @emph{Interface}: @tab @code{integer function omp_test_nest_lock(lock)}
-@item                   @tab @code{integer(omp_integer_kind) :: omp_test_nest_lock}
+@item @emph{Interface}: @tab @code{logical function omp_test_nest_lock(lock)}
 @item                   @tab @code{integer(omp_nest_lock_kind), intent(inout) :: lock}
 @end multitable
 
@@ -675,7 +960,7 @@ is returned. Otherwise, the return value equals zero.
 @ref{omp_init_lock}, @ref{omp_set_lock}, @ref{omp_set_lock}
 
 @item @emph{Reference}: 
-@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.3.5.
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.5.
 @end table
 
 
@@ -688,7 +973,7 @@ A nested lock about to be unset must have been locked by @code{omp_set_nested_lo
 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 
 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 to itself.
 
 @item @emph{C/C++}:
 @multitable @columnfractions .20 .80
@@ -698,14 +983,14 @@ one of them is chosen to, again, set the lock for itself.
 @item @emph{Fortran}:
 @multitable @columnfractions .20 .80
 @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(inout) :: lock}
 @end multitable
 
 @item @emph{See also}:
 @ref{omp_set_nest_lock}
 
 @item @emph{Reference}: 
-@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.3.4.
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.4.
 @end table
 
 
@@ -732,7 +1017,7 @@ in the unlocked state and its nesting count must equal zero.
 @ref{omp_init_lock}
 
 @item @emph{Reference}: 
-@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.3.2.
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.2.
 @end table
 
 
@@ -746,7 +1031,7 @@ successive clock ticks.
 
 @item @emph{C/C++}:
 @multitable @columnfractions .20 .80
-@item @emph{Prototype}: @tab @code{double omp_get_wtick();}
+@item @emph{Prototype}: @tab @code{double omp_get_wtick(void);}
 @end multitable
 
 @item @emph{Fortran}:
@@ -758,7 +1043,7 @@ successive clock ticks.
 @ref{omp_get_wtime}
 
 @item @emph{Reference}: 
-@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.4.2.
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.4.2.
 @end table
 
 
@@ -768,13 +1053,13 @@ successive clock ticks.
 @table @asis
 @item @emph{Description}:
 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.
-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.
+guarantee can be made that two distinct threads measure the same time.
+Time is measured from some "time in the past", which is an arbitrary time
+guaranteed not to change during the execution of the program.
 
 @item @emph{C/C++}:
 @multitable @columnfractions .20 .80
-@item @emph{Prototype}: @tab @code{double omp_get_wtime();}
+@item @emph{Prototype}: @tab @code{double omp_get_wtime(void);}
 @end multitable
 
 @item @emph{Fortran}:
@@ -786,7 +1071,7 @@ the seconds since the Epoch (00:00:00 UTC, January 1, 1970) are returned.
 @ref{omp_get_wtick}
 
 @item @emph{Reference}: 
-@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 3.4.1.
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.4.1.
 @end table
 
 
@@ -798,25 +1083,31 @@ the seconds since the Epoch (00:00:00 UTC, January 1, 1970) are returned.
 @node Environment Variables
 @chapter Environment Variables
 
-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 
-version 2.5, while @env{GOMP_CPU_AFFINITY} and @env{GOMP_STACKSIZE} are GNU 
+The variables @env{OMP_DYNAMIC}, @env{OMP_MAX_ACTIVE_LEVELS},
+@env{OMP_NESTED}, @env{OMP_NUM_THREADS}, @env{OMP_SCHEDULE},
+@env{OMP_STACKSIZE},@env{OMP_THREAD_LIMIT} and @env{OMP_WAIT_POLICY}
+are defined by section 4 of the OpenMP specifications in version 3.1,
+while @env{GOMP_CPU_AFFINITY} and @env{GOMP_STACKSIZE} are GNU 
 extensions.
 
 @menu
-* OMP_DYNAMIC::        Dynamic adjustment of threads
-* OMP_NESTED::         Nested parallel regions
-* OMP_NUM_THREADS::    Specifies the number of threads to use
-* OMP_SCHEDULE::       How threads are scheduled
-* GOMP_CPU_AFFINITY::  Bind threads to specific CPUs
-* GOMP_STACKSIZE::     Set default thread stack size
+* OMP_DYNAMIC::           Dynamic adjustment of threads
+* OMP_MAX_ACTIVE_LEVELS:: Set the maximum number of nested parallel regions
+* OMP_NESTED::            Nested parallel regions
+* OMP_NUM_THREADS::       Specifies the number of threads to use
+* OMP_STACKSIZE::         Set default thread stack size
+* OMP_SCHEDULE::          How threads are scheduled
+* OMP_THREAD_LIMIT::      Set the maximum number of threads
+* OMP_WAIT_POLICY::       How waiting threads are handled
+* OMP_PROC_BIND::         Whether theads may be moved between CPUs
+* GOMP_CPU_AFFINITY::     Bind threads to specific CPUs
+* GOMP_STACKSIZE::        Set default thread stack size
 @end menu
 
 
 @node OMP_DYNAMIC
 @section @env{OMP_DYNAMIC} -- Dynamic adjustment of threads
 @cindex Environment Variable
-@cindex Implementation specific setting
 @table @asis
 @item @emph{Description}:
 Enable or disable the dynamic adjustment of the number of threads 
@@ -828,7 +1119,25 @@ disabled by default.
 @ref{omp_set_dynamic}
 
 @item @emph{Reference}: 
-@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 4.3
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 4.3
+@end table
+
+
+
+@node OMP_MAX_ACTIVE_LEVELS
+@section @env{OMP_MAX_ACTIVE_LEVELS} -- Set the maximum number of nested parallel regions
+@cindex Environment Variable
+@table @asis
+@item @emph{Description}:
+Specifies the initial value for the maximum number of nested parallel
+regions. The value of this variable shall be a positive integer.
+If undefined, the number of active levels is unlimited.
+
+@item @emph{See also}:
+@ref{omp_set_max_active_levels}
+
+@item @emph{Reference}: 
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 4.8
 @end table
 
 
@@ -848,7 +1157,7 @@ regions are disabled by default.
 @ref{omp_set_nested}
 
 @item @emph{Reference}: 
-@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 4.4
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 4.5
 @end table
 
 
@@ -860,14 +1169,15 @@ regions are disabled by default.
 @table @asis
 @item @emph{Description}:
 Specifies the default number of threads to use in parallel regions. The 
-value of this variable shall be positive integer. If undefined one thread 
-per CPU online is used.
+value of this variable shall be a comma-separated list of positive integers;
+the value specified the number of threads to use for the corresponding nested
+level. If undefined one thread per CPU is used.
 
 @item @emph{See also}:
 @ref{omp_set_num_threads}
 
 @item @emph{Reference}: 
-@uref{http://www.openmp.org/, OpenMP specifications v2.5}, section 4.2
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 4.2
 @end table
 
 
@@ -880,12 +1190,88 @@ per CPU online is used.
 @item @emph{Description}:
 Allows to specify @code{schedule type} and @code{chunk size}. 
 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}. 
-The optional @code{chunk size} shall be a positive integer. If undefined,
+@code{type} is one of @code{static}, @code{dynamic}, @code{guided} or @code{auto}
+The optional @code{chunk} size shall be a positive integer. If undefined,
 dynamic scheduling and a chunk size of 1 is used.
 
+@item @emph{See also}:
+@ref{omp_set_schedule}
+
+@item @emph{Reference}: 
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, sections 2.5.1 and 4.1
+@end table
+
+
+
+@node OMP_STACKSIZE
+@section @env{OMP_STACKSIZE} -- Set default thread stack size
+@cindex Environment Variable
+@table @asis
+@item @emph{Description}:
+Set the default thread stack size in kilobytes, unless the number
+is suffixed by @code{B}, @code{K}, @code{M} or @code{G}, in which
+case the size is, respectively, in bytes, kilobytes, megabytes
+or gigabytes. This is different from @code{pthread_attr_setstacksize}
+which gets the number of bytes as an argument. If the stack size cannot
+be set due to system constraints, an error is reported and the initial
+stack size is left unchanged. If undefined, the stack size is system
+dependent.
+
+@item @emph{Reference}: 
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, sections 4.6
+@end table
+
+
+
+@node OMP_THREAD_LIMIT
+@section @env{OMP_THREAD_LIMIT} -- Set the maximum number of threads
+@cindex Environment Variable
+@table @asis
+@item @emph{Description}:
+Specifies the number of threads to use for the whole program. The
+value of this variable shall be a positive integer. If undefined,
+the number of threads is not limited.
+
+@item @emph{See also}:
+@ref{OMP_NUM_THREADS}
+@ref{omp_get_thread_limit}
+
+@item @emph{Reference}: 
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 4.9
+@end table
+
+
+
+@node OMP_WAIT_POLICY
+@section @env{OMP_WAIT_POLICY} -- How waiting threads are handled
+@cindex Environment Variable
+@table @asis
+@item @emph{Description}:
+Specifies whether waiting threads should be active or passive. If
+the value is @code{PASSIVE}, waiting threads should not consume CPU
+power while waiting; while the value is @code{ACTIVE} specifies that
+they should.
+
 @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 v3.1}, sections 4.7
+@end table
+
+
+
+@node OMP_PROC_BIND
+@section @env{OMP_PROC_BIND} -- Whether theads may be moved between CPUs
+@cindex Environment Variable
+@table @asis
+@item @emph{Description}:
+Specifies whether threads may be moved between processors. If set to
+@code{true}, OpenMP theads should not be moved, if set to @code{false}
+they may be moved.
+
+@item @emph{See also}:
+@ref{GOMP_CPU_AFFINITY}
+
+@item @emph{Reference}: 
+@uref{http://www.openmp.org/, OpenMP specifications v3.1}, sections 4.4
 @end table
 
 
@@ -895,15 +1281,15 @@ dynamic scheduling and a chunk size of 1 is used.
 @cindex Environment Variable
 @table @asis
 @item @emph{Description}:
-Binds threads to specific CPUs. The variable should contain a space- or
-comma-separated list of CPUs. This list may contain different kind of 
+Binds threads to specific CPUs. The variable should contain a space-separated
+or comma-separated list of CPUs. This list may contain different kinds of 
 entries: either single CPU numbers in any order, a range of CPUs (M-N) 
-or a range with some stride (M-N:S). CPU numbers are zero based. For example,
+or a range with some stride (M-N:S).  CPU numbers are zero based. For example,
 @code{GOMP_CPU_AFFINITY="0 3 1-2 4-15:2"} will bind the initial thread
 to CPU 0, the second to CPU 3, the third to CPU 1, the fourth to 
 CPU 2, the fifth to CPU 4, the sixth through tenth to CPUs 6, 8, 10, 12,
 and 14 respectively and then start assigning back from the beginning of
-the list. @code{GOMP_CPU_AFFINITY=0} binds all threads to CPU 0.
+the list.  @code{GOMP_CPU_AFFINITY=0} binds all threads to CPU 0.
 
 There is no GNU OpenMP library routine to determine whether a CPU affinity 
 specification is in effect. As a workaround, language-specific library 
@@ -914,6 +1300,9 @@ or disabled during the runtime of the application.
 
 If this environment variable is omitted, the host system will handle the 
 assignment of threads to CPUs. 
+
+@item @emph{See also}:
+@ref{OMP_PROC_BIND}
 @end table
 
 
@@ -924,12 +1313,15 @@ assignment of threads to CPUs.
 @cindex Implementation specific setting
 @table @asis
 @item @emph{Description}:
-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 
-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,
+Set the default thread stack size in kilobytes. This is different from
+@code{pthread_attr_setstacksize} which gets the number of bytes as an 
+argument. If the stack size cannot be set due to system constraints, an 
+error is reported and the initial stack size is left unchanged. If undefined,
 the stack size is system dependent.
 
+@item @emph{See also}:
+@ref{OMP_STACKSIZE}
+
 @item @emph{Reference}: 
 @uref{http://gcc.gnu.org/ml/gcc-patches/2006-06/msg00493.html, 
 GCC Patches Mailinglist}, 
@@ -947,7 +1339,7 @@ GCC Patches Mailinglist}
 @chapter The libgomp ABI
 
 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
 * Implementing MASTER construct::
@@ -977,7 +1369,7 @@ if (omp_get_thread_num () == 0)
 
 Alternately, we generate two copies of the parallel subfunction
 and only include this in the version run by the master thread.
-Surely that's not worthwhile though...
+Surely this is not worthwhile though...
 
 
 
@@ -1002,7 +1394,7 @@ name being transformed into a variable declared like
 @end smallexample
 
 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 need to initialize this at
 startup.
 
 
@@ -1069,14 +1461,14 @@ the semantic of new variable creation.
 @node Implementing FIRSTPRIVATE LASTPRIVATE COPYIN and COPYPRIVATE clauses
 @section Implementing FIRSTPRIVATE LASTPRIVATE COPYIN and COPYPRIVATE clauses
 
-Seems simple enough for PARALLEL blocks.  Create a private 
-struct for communicating between parent and subfunction.
+This seems simple enough for PARALLEL blocks.  Create a private 
+struct for communicating between the parent and subfunction.
 In the parent, copy in values for scalar and "small" structs;
 copy in addresses for others TREE_ADDRESSABLE types.  In the 
 subfunction, copy the value into the local variable.
 
-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
+It is not clear what to do with bare FOR or SECTION blocks.
+The only thing I can figure is that we do something like:
 
 @smallexample
 #pragma omp for firstprivate(x) lastprivate(y)
@@ -1113,7 +1505,7 @@ broadcast would have to happen via SINGLE machinery instead.
 The private struct mentioned in the previous section should have 
 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 
-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.
 
 
@@ -1218,7 +1610,7 @@ becomes
   @}
 @end smallexample
 
-Note that while it looks like there is trickyness to propagating
+Note that while it looks like there is trickiness to propagating
 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
 should automatically be handled as PRIVATE or SHARED like any other
@@ -1336,7 +1728,7 @@ becomes
 @chapter Reporting Bugs
 
 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}.  For all cases, please add 
 "openmp" to the keywords field in the bug report.