head	1.1;
branch	1.1.1;
access;
symbols
	netbsd-11-0-RC5:1.1.1.12
	netbsd-11-0-RC4:1.1.1.12
	netbsd-11-0-RC3:1.1.1.12
	netbsd-11-0-RC2:1.1.1.12
	netbsd-11-0-RC1:1.1.1.12
	gcc-14-3-0:1.1.1.13
	perseant-exfatfs-base-20250801:1.1.1.12
	netbsd-11:1.1.1.12.0.4
	netbsd-11-base:1.1.1.12
	gcc-12-5-0:1.1.1.12
	netbsd-10-1-RELEASE:1.1.1.10.6.1
	perseant-exfatfs-base-20240630:1.1.1.12
	gcc-12-4-0:1.1.1.12
	perseant-exfatfs:1.1.1.12.0.2
	perseant-exfatfs-base:1.1.1.12
	netbsd-8-3-RELEASE:1.1.1.3
	netbsd-9-4-RELEASE:1.1.1.5
	netbsd-10-0-RELEASE:1.1.1.10.6.1
	netbsd-10-0-RC6:1.1.1.10.6.1
	netbsd-10-0-RC5:1.1.1.10.6.1
	netbsd-10-0-RC4:1.1.1.10.6.1
	netbsd-10-0-RC3:1.1.1.10.6.1
	netbsd-10-0-RC2:1.1.1.10.6.1
	netbsd-10-0-RC1:1.1.1.10.6.1
	gcc-12-3-0:1.1.1.12
	gcc-10-5-0:1.1.1.11
	netbsd-10:1.1.1.10.0.6
	netbsd-10-base:1.1.1.10
	netbsd-9-3-RELEASE:1.1.1.5
	gcc-10-4-0:1.1.1.10
	cjep_sun2x-base1:1.1.1.10
	cjep_sun2x:1.1.1.10.0.4
	cjep_sun2x-base:1.1.1.10
	cjep_staticlib_x-base1:1.1.1.10
	netbsd-9-2-RELEASE:1.1.1.5
	cjep_staticlib_x:1.1.1.10.0.2
	cjep_staticlib_x-base:1.1.1.10
	gcc-10-3-0:1.1.1.10
	netbsd-9-1-RELEASE:1.1.1.5
	gcc-9-3-0:1.1.1.9
	gcc-7-5-0:1.1.1.7
	phil-wifi-20200421:1.1.1.6
	phil-wifi-20200411:1.1.1.6
	is-mlppp:1.1.1.6.0.2
	is-mlppp-base:1.1.1.6
	phil-wifi-20200406:1.1.1.6
	netbsd-8-2-RELEASE:1.1.1.3
	gcc-8-4-0:1.1.1.8
	netbsd-9-0-RELEASE:1.1.1.5
	netbsd-9-0-RC2:1.1.1.5
	netbsd-9-0-RC1:1.1.1.5
	phil-wifi-20191119:1.1.1.6
	gcc-8-3-0:1.1.1.6
	netbsd-9:1.1.1.5.0.2
	netbsd-9-base:1.1.1.5
	phil-wifi-20190609:1.1.1.5
	netbsd-8-1-RELEASE:1.1.1.3
	netbsd-8-1-RC1:1.1.1.3
	pgoyette-compat-merge-20190127:1.1.1.4.2.1
	pgoyette-compat-20190127:1.1.1.5
	gcc-7-4-0:1.1.1.5
	pgoyette-compat-20190118:1.1.1.4
	pgoyette-compat-1226:1.1.1.4
	pgoyette-compat-1126:1.1.1.4
	gcc-6-5-0:1.1.1.4
	pgoyette-compat-1020:1.1.1.4
	pgoyette-compat-0930:1.1.1.4
	pgoyette-compat-0906:1.1.1.4
	netbsd-7-2-RELEASE:1.1.1.2
	pgoyette-compat-0728:1.1.1.4
	netbsd-8-0-RELEASE:1.1.1.3
	phil-wifi:1.1.1.4.0.4
	phil-wifi-base:1.1.1.4
	pgoyette-compat-0625:1.1.1.4
	netbsd-8-0-RC2:1.1.1.3
	pgoyette-compat-0521:1.1.1.4
	pgoyette-compat-0502:1.1.1.4
	pgoyette-compat-0422:1.1.1.4
	netbsd-8-0-RC1:1.1.1.3
	pgoyette-compat-0415:1.1.1.4
	pgoyette-compat-0407:1.1.1.4
	pgoyette-compat-0330:1.1.1.4
	pgoyette-compat-0322:1.1.1.4
	pgoyette-compat-0315:1.1.1.4
	netbsd-7-1-2-RELEASE:1.1.1.2
	pgoyette-compat:1.1.1.4.0.2
	pgoyette-compat-base:1.1.1.4
	gcc-6-4-0:1.1.1.4
	netbsd-7-1-1-RELEASE:1.1.1.2
	gcc-5-5-0:1.1.1.3
	matt-nb8-mediatek:1.1.1.3.0.12
	matt-nb8-mediatek-base:1.1.1.3
	perseant-stdc-iso10646:1.1.1.3.0.10
	perseant-stdc-iso10646-base:1.1.1.3
	netbsd-8:1.1.1.3.0.8
	netbsd-8-base:1.1.1.3
	prg-localcount2-base3:1.1.1.3
	prg-localcount2-base2:1.1.1.3
	prg-localcount2-base1:1.1.1.3
	prg-localcount2:1.1.1.3.0.6
	prg-localcount2-base:1.1.1.3
	pgoyette-localcount-20170426:1.1.1.3
	bouyer-socketcan-base1:1.1.1.3
	pgoyette-localcount-20170320:1.1.1.3
	netbsd-7-1:1.1.1.2.0.10
	netbsd-7-1-RELEASE:1.1.1.2
	netbsd-7-1-RC2:1.1.1.2
	netbsd-7-nhusb-base-20170116:1.1.1.2
	bouyer-socketcan:1.1.1.3.0.4
	bouyer-socketcan-base:1.1.1.3
	pgoyette-localcount-20170107:1.1.1.3
	netbsd-7-1-RC1:1.1.1.2
	pgoyette-localcount-20161104:1.1.1.3
	netbsd-7-0-2-RELEASE:1.1.1.2
	localcount-20160914:1.1.1.3
	netbsd-7-nhusb:1.1.1.2.0.8
	netbsd-7-nhusb-base:1.1.1.2
	pgoyette-localcount-20160806:1.1.1.3
	pgoyette-localcount-20160726:1.1.1.3
	pgoyette-localcount:1.1.1.3.0.2
	pgoyette-localcount-base:1.1.1.3
	gcc-5-4-0:1.1.1.3
	netbsd-7-0-1-RELEASE:1.1.1.2
	gcc-5-3-0:1.1.1.3
	netbsd-7-0:1.1.1.2.0.6
	netbsd-7-0-RELEASE:1.1.1.2
	gcc-4-8-5-pre-gcc-old-import:1.1.1.2
	netbsd-7-0-RC3:1.1.1.2
	netbsd-7-0-RC2:1.1.1.2
	post-gcc-4-8-5-merge:1.1.1.2
	gcc-4-8-5:1.1.1.2
	netbsd-7-0-RC1:1.1.1.2
	gcc-4-8-4:1.1.1.2
	gcc-4-8-20141009:1.1.1.2
	netbsd-6-0-6-RELEASE:1.1.1.1
	netbsd-6-1-5-RELEASE:1.1.1.1
	netbsd-7:1.1.1.2.0.4
	netbsd-7-base:1.1.1.2
	gcc-4-8-3:1.1.1.2
	yamt-pagecache-base9:1.1.1.2
	yamt-pagecache-tag8:1.1.1.1
	netbsd-6-1-4-RELEASE:1.1.1.1
	netbsd-6-0-5-RELEASE:1.1.1.1
	tls-earlyentropy:1.1.1.2.0.2
	tls-earlyentropy-base:1.1.1.2
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.1.1.2
	riastradh-drm2-base3:1.1.1.2
	gcc-4-8-3-pre-r208254:1.1.1.2
	gcc-4-8-3-pre-r206687:1.1.1.2
	imported-to-gcc-old-20140227-0107:1.1.1.1
	netbsd-6-1-3-RELEASE:1.1.1.1
	netbsd-6-0-4-RELEASE:1.1.1.1
	netbsd-6-1-2-RELEASE:1.1.1.1
	netbsd-6-0-3-RELEASE:1.1.1.1
	netbsd-6-1-1-RELEASE:1.1.1.1
	riastradh-drm2-base2:1.1.1.1
	riastradh-drm2-base1:1.1.1.1
	riastradh-drm2:1.1.1.1.0.12
	riastradh-drm2-base:1.1.1.1
	netbsd-6-1:1.1.1.1.0.16
	netbsd-6-0-2-RELEASE:1.1.1.1
	netbsd-6-1-RELEASE:1.1.1.1
	netbsd-6-1-RC4:1.1.1.1
	netbsd-6-1-RC3:1.1.1.1
	agc-symver:1.1.1.1.0.14
	agc-symver-base:1.1.1.1
	netbsd-6-1-RC2:1.1.1.1
	netbsd-6-1-RC1:1.1.1.1
	yamt-pagecache-base8:1.1.1.1
	netbsd-6-0-1-RELEASE:1.1.1.1
	yamt-pagecache-base7:1.1.1.1
	matt-nb6-plus-nbase:1.1.1.1
	yamt-pagecache-base6:1.1.1.1
	netbsd-6-0:1.1.1.1.0.10
	netbsd-6-0-RELEASE:1.1.1.1
	gcc-4-5-4:1.1.1.1
	netbsd-6-0-RC2:1.1.1.1
	tls-maxphys:1.1.1.1.0.8
	tls-maxphys-base:1.1.1.2
	matt-nb6-plus:1.1.1.1.0.6
	matt-nb6-plus-base:1.1.1.1
	netbsd-6-0-RC1:1.1.1.1
	yamt-pagecache-base5:1.1.1.1
	yamt-pagecache-base4:1.1.1.1
	netbsd-6:1.1.1.1.0.4
	netbsd-6-base:1.1.1.1
	yamt-pagecache-base3:1.1.1.1
	yamt-pagecache-base2:1.1.1.1
	yamt-pagecache:1.1.1.1.0.2
	yamt-pagecache-base:1.1.1.1
	gcc-4-5-3:1.1.1.1
	FSF:1.1.1;
locks; strict;
comment	@# @;


1.1
date	2011.06.21.01.23.13;	author mrg;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	2011.06.21.01.23.13;	author mrg;	state Exp;
branches
	1.1.1.1.2.1
	1.1.1.1.8.1;
next	1.1.1.2;

1.1.1.2
date	2014.03.01.08.41.18;	author mrg;	state Exp;
branches;
next	1.1.1.3;
commitid	TtaB91QNTknAoYqx;

1.1.1.3
date	2016.01.24.06.05.55;	author mrg;	state Exp;
branches;
next	1.1.1.4;
commitid	uWWfbLp08zOK79Sy;

1.1.1.4
date	2018.02.02.01.58.44;	author mrg;	state Exp;
branches
	1.1.1.4.2.1
	1.1.1.4.4.1;
next	1.1.1.5;
commitid	XNKaycqpfhzd5epA;

1.1.1.5
date	2019.01.19.10.14.02;	author mrg;	state Exp;
branches;
next	1.1.1.6;
commitid	VQ8OwWIg5RS9kn8B;

1.1.1.6
date	2019.10.01.09.36.04;	author mrg;	state Exp;
branches;
next	1.1.1.7;
commitid	smvgr2IPAQDr89FB;

1.1.1.7
date	2020.08.11.05.10.31;	author mrg;	state Exp;
branches;
next	1.1.1.8;
commitid	5dBRDT7i6e65xBjC;

1.1.1.8
date	2020.08.11.05.30.06;	author mrg;	state Exp;
branches;
next	1.1.1.9;
commitid	7AI4OfpLi4eqEBjC;

1.1.1.9
date	2020.09.05.07.52.06;	author mrg;	state Exp;
branches;
next	1.1.1.10;
commitid	ZRYA7IOuwfMjAPmC;

1.1.1.10
date	2021.04.10.22.09.57;	author mrg;	state Exp;
branches
	1.1.1.10.6.1;
next	1.1.1.11;
commitid	eC4g0MRpqTvEkNOC;

1.1.1.11
date	2023.07.11.00.32.44;	author mrg;	state Exp;
branches;
next	1.1.1.12;
commitid	3yo4S98RsOFBNjwE;

1.1.1.12
date	2023.07.30.05.21.15;	author mrg;	state Exp;
branches;
next	1.1.1.13;
commitid	tk6nV4mbc9nVEMyE;

1.1.1.13
date	2025.09.13.23.45.42;	author mrg;	state Exp;
branches;
next	;
commitid	KwhwN4krNWa6XBaG;

1.1.1.1.2.1
date	2014.05.22.16.36.37;	author yamt;	state Exp;
branches;
next	;
commitid	Birywjruwc00pyBx;

1.1.1.1.8.1
date	2014.08.19.23.54.32;	author tls;	state Exp;
branches;
next	;
commitid	jTnpym9Qu0o4R1Nx;

1.1.1.4.2.1
date	2019.01.26.21.59.11;	author pgoyette;	state Exp;
branches;
next	;
commitid	JKpcmvSjdT25dl9B;

1.1.1.4.4.1
date	2019.06.10.21.54.22;	author christos;	state Exp;
branches;
next	1.1.1.4.4.2;
commitid	jtc8rnCzWiEEHGqB;

1.1.1.4.4.2
date	2020.04.13.07.58.15;	author martin;	state Exp;
branches;
next	;
commitid	X01YhRUPVUDaec4C;

1.1.1.10.6.1
date	2023.07.13.09.18.29;	author martin;	state Exp;
branches;
next	;
commitid	nTDZbluVjX9bCCwE;


desc
@@


1.1
log
@Initial revision
@
text
@\input texinfo @@c -*-texinfo-*-

@@c %**start of header
@@setfilename libgomp.info
@@settitle GNU libgomp
@@c %**end of header


@@copying
Copyright @@copyright{} 2006, 2007, 2008 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.2 or
any later version published by the Free Software Foundation; with the
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''.

(a) The FSF's Front-Cover Text is:

     A GNU Manual

(b) The FSF's Back-Cover Text is:

     You have freedom to copy and modify this GNU Manual, like GNU
     software.  Copies published by the Free Software Foundation raise
     funds for GNU development.
@@end copying

@@ifinfo
@@dircategory GNU Libraries
@@direntry
* libgomp: (libgomp).                    GNU OpenMP runtime library
@@end direntry

This manual documents the GNU implementation of the OpenMP API for 
multi-platform shared-memory parallel programming in C/C++ and Fortran.

Published by the Free Software Foundation
51 Franklin Street, Fifth Floor
Boston, MA 02110-1301 USA

@@insertcopying
@@end ifinfo


@@setchapternewpage odd

@@titlepage
@@title The GNU OpenMP Implementation
@@page
@@vskip 0pt plus 1filll
@@comment For the @@value{version-GCC} Version*
@@sp 1
Published by the Free Software Foundation @@*
51 Franklin Street, Fifth Floor@@*
Boston, MA 02110-1301, USA@@*
@@sp 1
@@insertcopying
@@end titlepage

@@summarycontents
@@contents
@@page


@@node Top
@@top Introduction
@@cindex Introduction

This manual documents the usage of libgomp, the GNU implementation of the 
@@uref{http://www.openmp.org, OpenMP} Application Programming Interface (API)
for multi-platform shared-memory parallel programming in C/C++ and Fortran.



@@comment
@@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  better formatting.
@@comment
@@menu
* Enabling OpenMP::            How to enable OpenMP for your applications.
* Runtime Library Routines::   The OpenMP runtime application programming 
                               interface.
* Environment Variables::      Influencing runtime behavior with environment 
                               variables.
* The libgomp ABI::            Notes on the external ABI presented by libgomp.
* Reporting Bugs::             How to report bugs in GNU OpenMP.
* Copying::                    GNU general public license says
                               how you can copy and share libgomp.
* GNU Free Documentation License::
                               How you can copy and share this manual.
* Funding::                    How to help assure continued work for free 
                               software.
* Index::                      Index of this documentation.
@@end menu


@@c ---------------------------------------------------------------------
@@c Enabling OpenMP
@@c ---------------------------------------------------------------------

@@node Enabling OpenMP
@@chapter Enabling OpenMP

To activate the OpenMP extensions for C/C++ and Fortran, the compile-time 
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{c$omp}, @@code{*$omp} and @@code{!$omp} directives in fixed form, 
@@code{!$} conditional compilation sentinels in free form and @@code{c$},
@@code{*$} and @@code{!$} sentinels in fixed form, for Fortran. The flag also
arranges for automatic linking of the OpenMP runtime library 
(@@ref{Runtime Library Routines}).

A complete description of all OpenMP directives accepted may be found in 
the @@uref{http://www.openmp.org, OpenMP Application Program Interface} manual,
version 3.0.


@@c ---------------------------------------------------------------------
@@c Runtime Library Routines
@@c ---------------------------------------------------------------------

@@node Runtime Library Routines
@@chapter Runtime Library Routines

The runtime routines described here are defined by section 3 of the OpenMP 
specifications in version 3.0. The routines are structured in following
three parts:

Control threads, processors and the parallel environment.

@@menu
* 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::   Maximal number of active regions
* omp_get_max_threads::         Maximal 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::        Maximal number of threads
* 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_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.

@@menu
* omp_init_lock::            Initialize simple lock
* omp_set_lock::             Wait for and set simple lock
* omp_test_lock::            Test and set simple lock if available
* omp_unset_lock::           Unset simple lock
* omp_destroy_lock::         Destroy simple lock
* omp_init_nest_lock::       Initialize nested lock
* omp_set_nest_lock::        Wait for and set simple lock
* omp_test_nest_lock::       Test and set nested lock if available
* omp_unset_nest_lock::      Unset nested lock
* omp_destroy_nest_lock::    Destroy nested lock
@@end menu

Portable, thread-based, wall clock timer.

@@menu
* omp_get_wtick::            Get timer precision.
* 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();}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{integer 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.0}, 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 omp_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.0}, section 3.2.17.
@@end table



@@node omp_get_dynamic
@@section @@code{omp_get_dynamic} -- Dynamic teams setting
@@table @@asis
@@item @@emph{Description}:
This function returns @@code{true} if enabled, @@code{false} otherwise. 
Here, @@code{true} and @@code{false} represent their language-specific 
counterparts.

The dynamic team setting may be initialized at startup by the 
@@code{OMP_DYNAMIC} environment variable or at runtime using 
@@code{omp_set_dynamic}. If undefined, dynamic adjustment is 
disabled by default.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{int omp_get_dynamic();}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{logical function omp_get_dynamic()}
@@end multitable

@@item @@emph{See also}:
@@ref{omp_set_dynamic}, @@ref{OMP_DYNAMIC}

@@item @@emph{Reference}:
@@uref{http://www.openmp.org/, OpenMP specifications v3.0}, 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();}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{integer omp_level()}
@@end multitable

@@item @@emph{See also}:
@@ref{omp_get_active_level}

@@item @@emph{Reference}:
@@uref{http://www.openmp.org/, OpenMP specifications v3.0}, section 3.2.16.
@@end table



@@node omp_get_max_active_levels
@@section @@code{omp_set_max_active_levels} -- Maximal number of active regions
@@table @@asis
@@item @@emph{Description}:
This function obtains the maximally 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();}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{int 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.0}, section 3.2.14.
@@end table



@@node omp_get_max_threads
@@section @@code{omp_get_max_threads} -- Maximal number of threads of parallel region
@@table @@asis
@@item @@emph{Description}:
Return the maximal 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();}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_max_threads()}
@@end multitable

@@item @@emph{See also}:
@@ref{omp_set_num_threads}, @@ref{omp_set_dynamic}, @@ref{omp_get_thread_limit}

@@item @@emph{Reference}:
@@uref{http://www.openmp.org/, OpenMP specifications v3.0}, section 3.2.3.
@@end table



@@node omp_get_nested
@@section @@code{omp_get_nested} -- Nested parallel regions
@@table @@asis
@@item @@emph{Description}:
This function returns @@code{true} if nested parallel regions are
enabled, @@code{false} otherwise. Here, @@code{true} and @@code{false} 
represent their language-specific counterparts.

Nested parallel regions may be initialized at startup by the 
@@code{OMP_NESTED} environment variable or at runtime using 
@@code{omp_set_nested}. If undefined, nested parallel regions are
disabled by default.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{int omp_get_nested();}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{integer 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 v3.0}, section 3.2.10.
@@end table



@@node omp_get_num_procs
@@section @@code{omp_get_num_procs} -- Number of processors online
@@table @@asis
@@item @@emph{Description}:
Returns the number of processors online.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{int omp_get_num_procs();}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_num_procs()}
@@end multitable

@@item @@emph{Reference}:
@@uref{http://www.openmp.org/, OpenMP specifications v3.0}, section 3.2.5.
@@end table



@@node omp_get_num_threads
@@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 
the program @@code{omp_get_num_threads} returns 1.

The default team size may be initialized at startup by the 
@@code{OMP_NUM_THREADS} environment variable. At runtime, the size 
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 
used to define a specific value and @@code{OMP_DYNAMIC} is disabled,
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();}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_num_threads()}
@@end multitable

@@item @@emph{See also}:
@@ref{omp_get_max_threads}, @@ref{omp_set_num_threads}, @@ref{OMP_NUM_THREADS}

@@item @@emph{Reference}:
@@uref{http://www.openmp.org/, OpenMP specifications v3.0}, 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 runtime the scheduling method. The @@var{kind} argument will be
set to the value @@code{omp_sched_static}, @@code{omp_sched_dynamic},
@@code{opm_sched_guided} or @@code{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{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.0}, 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_time_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.0}, section 3.2.18.
@@end table



@@node omp_get_thread_limit
@@section @@code{omp_get_thread_limit} -- Maximal number of threads
@@table @@asis
@@item @@emph{Description}:
Return the maximal number of threads of the program.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{int omp_get_thread_limit();}
@@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.0}, section 3.2.13.
@@end table



@@node omp_get_thread_num 
@@section @@code{omp_get_thread_num} -- Current thread ID
@@table @@asis
@@item @@emph{Description}:
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();}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_thread_num()}
@@end multitable

@@item @@emph{See also}:
@@ref{omp_get_num_threads}, @@ref{omp_get_ancestor_thread_num}

@@item @@emph{Reference}:
@@uref{http://www.openmp.org/, OpenMP specifications v3.0}, section 3.2.4.
@@end table



@@node omp_in_parallel
@@section @@code{omp_in_parallel} -- Whether a parallel region is active
@@table @@asis
@@item @@emph{Description}:
This function returns @@code{true} if currently running in parallel, 
@@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_parallel();}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{logical function omp_in_parallel()}
@@end multitable

@@item @@emph{Reference}:
@@uref{http://www.openmp.org/, OpenMP specifications v3.0}, section 3.2.6.
@@end table


@@node omp_set_dynamic
@@section @@code{omp_set_dynamic} -- Enable/disable dynamic teams
@@table @@asis
@@item @@emph{Description}:
Enable or disable the dynamic adjustment of the number of threads 
within a team. The function takes the language-specific equivalent
of @@code{true} and @@code{false}, where @@code{true} enables 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);}
@@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}
@@end multitable

@@item @@emph{See also}:
@@ref{OMP_DYNAMIC}, @@ref{omp_get_dynamic}

@@item @@emph{Reference}:
@@uref{http://www.openmp.org/, OpenMP specifications v3.0}, 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 maximally allowed number of nested, active parallel regions.

@@item @@emph{C/C++}
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{omp_set_max_active_levels(int max_levels);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{omp_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.0}, section 3.2.14.
@@end table



@@node omp_set_nested
@@section @@code{omp_set_nested} -- Enable/disable nested parallel regions
@@table @@asis
@@item @@emph{Description}:
Enable or disable nested parallel regions, i.e., whether team members
are allowed to create new teams. The function takes the language-specific 
equivalent of @@code{true} and @@code{false}, where @@code{true} enables 
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);}
@@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}
@@end multitable

@@item @@emph{See also}:
@@ref{OMP_NESTED}, @@ref{omp_get_nested}

@@item @@emph{Reference}:
@@uref{http://www.openmp.org/, OpenMP specifications v3.0}, section 3.2.9.
@@end table



@@node omp_set_num_threads
@@section @@code{omp_set_num_threads} -- Set upper team size limit
@@table @@asis
@@item @@emph{Description}:
Specifies the number of threads used by default in subsequent parallel 
sections, if those do not specify a @@code{num_threads} clause. The 
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);}
@@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}
@@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 v3.0}, 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{opm_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{int 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_get_schedule}
@@ref{OMP_SCHEDULE}

@@item @@emph{Reference}:
@@uref{http://www.openmp.org/, OpenMP specifications v3.0}, section 3.2.11.
@@end table



@@node omp_init_lock
@@section @@code{omp_init_lock} -- Initialize simple lock
@@table @@asis
@@item @@emph{Description}:
Initialize a simple lock. After initialization, the lock is in 
an unlocked state.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{void omp_init_lock(omp_lock_t *lock);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{subroutine omp_init_lock(lock)}
@@item                   @@tab @@code{integer(omp_lock_kind), intent(out) :: lock}
@@end multitable

@@item @@emph{See also}:
@@ref{omp_destroy_lock}

@@item @@emph{Reference}: 
@@uref{http://www.openmp.org/, OpenMP specifications v3.0}, section 3.3.1.
@@end table



@@node omp_set_lock
@@section @@code{omp_set_lock} -- Wait for and set simple lock
@@table @@asis
@@item @@emph{Description}:
Before setting a simple lock, the lock variable must be initialized by 
@@code{omp_init_lock}. The calling thread is blocked until the lock 
is available. If the lock is already held by the current thread, 
a deadlock occurs.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{void omp_set_lock(omp_lock_t *lock);}
@@end multitable

@@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}
@@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 v3.0}, section 3.3.3.
@@end table



@@node omp_test_lock
@@section @@code{omp_test_lock} -- Test and set simple lock if available
@@table @@asis
@@item @@emph{Description}:
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{false} represent their language-specific counterparts.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{int omp_test_lock(omp_lock_t *lock);}
@@end multitable

@@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}
@@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 v3.0}, section 3.3.5.
@@end table



@@node omp_unset_lock
@@section @@code{omp_unset_lock} -- Unset simple lock
@@table @@asis
@@item @@emph{Description}:
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.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{void omp_unset_lock(omp_lock_t *lock);}
@@end multitable

@@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}
@@end multitable

@@item @@emph{See also}:
@@ref{omp_set_lock}, @@ref{omp_test_lock}

@@item @@emph{Reference}: 
@@uref{http://www.openmp.org/, OpenMP specifications v3.0}, section 3.3.4.
@@end table



@@node omp_destroy_lock
@@section @@code{omp_destroy_lock} -- Destroy simple lock
@@table @@asis
@@item @@emph{Description}:
Destroy a simple lock. In order to be destroyed, a simple lock must be 
in the unlocked state. 

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{void omp_destroy_lock(omp_lock_t *);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{subroutine omp_destroy_lock(lock)}
@@item                   @@tab @@code{integer(omp_lock_kind), intent(inout) :: lock}
@@end multitable

@@item @@emph{See also}:
@@ref{omp_init_lock}

@@item @@emph{Reference}: 
@@uref{http://www.openmp.org/, OpenMP specifications v3.0}, section 3.3.2.
@@end table



@@node omp_init_nest_lock
@@section @@code{omp_init_nest_lock} -- Initialize nested lock
@@table @@asis
@@item @@emph{Description}:
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++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{void omp_init_nest_lock(omp_nest_lock_t *lock);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{subroutine omp_init_nest_lock(lock)}
@@item                   @@tab @@code{integer(omp_nest_lock_kind), intent(out) :: lock}
@@end multitable

@@item @@emph{See also}:
@@ref{omp_destroy_nest_lock}

@@item @@emph{Reference}:
@@uref{http://www.openmp.org/, OpenMP specifications v3.0}, section 3.3.1.
@@end table


@@node omp_set_nest_lock
@@section @@code{omp_set_nest_lock} -- Wait for and set simple 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.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{void omp_set_nest_lock(omp_nest_lock_t *lock);}
@@end multitable

@@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}
@@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 v3.0}, section 3.3.3.
@@end table



@@node omp_test_nest_lock
@@section @@code{omp_test_nest_lock} -- Test and set nested lock if available
@@table @@asis
@@item @@emph{Description}:
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_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 
is returned. Otherwise, the return value equals zero.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{int omp_test_nest_lock(omp_nest_lock_t *lock);}
@@end multitable

@@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                   @@tab @@code{integer(omp_nest_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 v3.0}, section 3.3.5.
@@end table



@@node omp_unset_nest_lock
@@section @@code{omp_unset_nest_lock} -- Unset nested lock
@@table @@asis
@@item @@emph{Description}:
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 
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.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{void omp_unset_nest_lock(omp_nest_lock_t *lock);}
@@end multitable

@@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}
@@end multitable

@@item @@emph{See also}:
@@ref{omp_set_nest_lock}

@@item @@emph{Reference}: 
@@uref{http://www.openmp.org/, OpenMP specifications v3.0}, section 3.3.4.
@@end table



@@node omp_destroy_nest_lock
@@section @@code{omp_destroy_nest_lock} -- Destroy nested lock
@@table @@asis
@@item @@emph{Description}:
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.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{void omp_destroy_nest_lock(omp_nest_lock_t *);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{subroutine omp_destroy_nest_lock(lock)}
@@item                   @@tab @@code{integer(omp_nest_lock_kind), intent(inout) :: lock}
@@end multitable

@@item @@emph{See also}:
@@ref{omp_init_lock}

@@item @@emph{Reference}: 
@@uref{http://www.openmp.org/, OpenMP specifications v3.0}, section 3.3.2.
@@end table



@@node omp_get_wtick
@@section @@code{omp_get_wtick} -- Get timer precision
@@table @@asis
@@item @@emph{Description}:
Gets the timer precision, i.e., the number of seconds between two 
successive clock ticks.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{double omp_get_wtick();}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{double precision function omp_get_wtick()}
@@end multitable

@@item @@emph{See also}:
@@ref{omp_get_wtime}

@@item @@emph{Reference}: 
@@uref{http://www.openmp.org/, OpenMP specifications v3.0}, section 3.4.2.
@@end table



@@node omp_get_wtime
@@section @@code{omp_get_wtime} -- Elapsed wall clock time
@@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.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{double omp_get_wtime();}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{double precision function omp_get_wtime()}
@@end multitable

@@item @@emph{See also}:
@@ref{omp_get_wtick}

@@item @@emph{Reference}: 
@@uref{http://www.openmp.org/, OpenMP specifications v3.0}, section 3.4.1.
@@end table



@@c ---------------------------------------------------------------------
@@c Environment Variables
@@c ---------------------------------------------------------------------

@@node Environment Variables
@@chapter Environment Variables

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.0,
while @@env{GOMP_CPU_AFFINITY} and @@env{GOMP_STACKSIZE} are GNU 
extensions.

@@menu
* OMP_DYNAMIC::           Dynamic adjustment of threads
* OMP_MAX_ACTIVE_LEVELS:: Set the maximal 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 maximal number of threads
* OMP_WAIT_POLICY::       How waiting threads are handled
* 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
@@table @@asis
@@item @@emph{Description}:
Enable or disable the dynamic adjustment of the number of threads 
within a team. The value of this environment variable shall be 
@@code{TRUE} or @@code{FALSE}. If undefined, dynamic adjustment is
disabled by default.

@@item @@emph{See also}:
@@ref{omp_set_dynamic}

@@item @@emph{Reference}: 
@@uref{http://www.openmp.org/, OpenMP specifications v3.0}, section 4.3
@@end table



@@node OMP_MAX_ACTIVE_LEVELS
@@section @@env{OMP_MAX_ACTIVE_LEVELS} -- Set the maximal number of nested parallel regions
@@cindex Environment Variable
@@table @@asis
@@item @@emph{Description}:
Specifies the initial value for the maximal number of nested parallel
regions. The value of this variable shall be 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.0}, section 4.7
@@end table



@@node OMP_NESTED
@@section @@env{OMP_NESTED} -- Nested parallel regions
@@cindex Environment Variable
@@cindex Implementation specific setting
@@table @@asis
@@item @@emph{Description}:
Enable or disable nested parallel regions, i.e., whether team members
are allowed to create new teams. The value of this environment variable 
shall be @@code{TRUE} or @@code{FALSE}. If undefined, nested parallel 
regions are disabled by default.

@@item @@emph{See also}:
@@ref{omp_set_nested}

@@item @@emph{Reference}: 
@@uref{http://www.openmp.org/, OpenMP specifications v3.0}, section 4.4
@@end table



@@node OMP_NUM_THREADS
@@section @@env{OMP_NUM_THREADS} -- Specifies the number of threads to use
@@cindex Environment Variable
@@cindex Implementation specific setting
@@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.

@@item @@emph{See also}:
@@ref{omp_set_num_threads}

@@item @@emph{Reference}: 
@@uref{http://www.openmp.org/, OpenMP specifications v3.0}, section 4.2
@@end table



@@node OMP_SCHEDULE
@@section @@env{OMP_SCHEDULE} -- How threads are scheduled
@@cindex Environment Variable
@@cindex Implementation specific setting
@@table @@asis
@@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}, @@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.0}, 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 stacksize can not
be set due to system constraints, an error is reported and the initial
stacksize is left unchanged. If undefined, the stack size is system
dependent.

@@item @@emph{Reference}: 
@@uref{http://www.openmp.org/, OpenMP specifications v3.0}, sections 4.5
@@end table



@@node OMP_THREAD_LIMIT
@@section @@env{OMP_THREAD_LIMIT} -- Set the maximal 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 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.0}, section 4.8
@@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 v3.0}, sections 4.6
@@end table



@@node GOMP_CPU_AFFINITY
@@section @@env{GOMP_CPU_AFFINITY} -- Bind threads to specific CPUs
@@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 
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,
@@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.

There is no GNU OpenMP library routine to determine whether a CPU affinity 
specification is in effect. As a workaround, language-specific library 
functions, e.g., @@code{getenv} in C or @@code{GET_ENVIRONMENT_VARIABLE} in 
Fortran, may be used to query the setting of the @@code{GOMP_CPU_AFFINITY} 
environment variable. A defined CPU affinity on startup cannot be changed 
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. 
@@end table



@@node GOMP_STACKSIZE
@@section @@env{GOMP_STACKSIZE} -- Set default thread stack size
@@cindex Environment Variable
@@cindex Implementation specific setting
@@table @@asis
@@item @@emph{Description}:
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 stacksize can not be set due to system constraints, an 
error is reported and the initial stacksize is left unchanged. If undefined,
the stack size is system dependent.

@@item @@emph{See also}:
@@ref{GOMP_STACKSIZE}

@@item @@emph{Reference}: 
@@uref{http://gcc.gnu.org/ml/gcc-patches/2006-06/msg00493.html, 
GCC Patches Mailinglist}, 
@@uref{http://gcc.gnu.org/ml/gcc-patches/2006-06/msg00496.html,
GCC Patches Mailinglist}
@@end table



@@c ---------------------------------------------------------------------
@@c The libgomp ABI
@@c ---------------------------------------------------------------------

@@node The libgomp ABI
@@chapter The libgomp ABI

The following sections present notes on the external ABI as 
presented by libgomp. Only maintainers should need them.

@@menu
* Implementing MASTER construct::
* Implementing CRITICAL construct::
* Implementing ATOMIC construct::
* Implementing FLUSH construct::
* Implementing BARRIER construct::
* Implementing THREADPRIVATE construct::
* Implementing PRIVATE clause::
* Implementing FIRSTPRIVATE LASTPRIVATE COPYIN and COPYPRIVATE clauses::
* Implementing REDUCTION clause::
* Implementing PARALLEL construct::
* Implementing FOR construct::
* Implementing ORDERED construct::
* Implementing SECTIONS construct::
* Implementing SINGLE construct::
@@end menu


@@node Implementing MASTER construct
@@section Implementing MASTER construct

@@smallexample
if (omp_get_thread_num () == 0)
  block
@@end smallexample

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...



@@node Implementing CRITICAL construct
@@section Implementing CRITICAL construct

Without a specified name,

@@smallexample
  void GOMP_critical_start (void);
  void GOMP_critical_end (void);
@@end smallexample

so that we don't get COPY relocations from libgomp to the main
application.

With a specified name, use omp_set_lock and omp_unset_lock with
name being transformed into a variable declared like

@@smallexample
  omp_lock_t gomp_critical_user_<name> __attribute__((common))
@@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
startup.



@@node Implementing ATOMIC construct
@@section Implementing ATOMIC construct

The target should implement the @@code{__sync} builtins.

Failing that we could add

@@smallexample
  void GOMP_atomic_enter (void)
  void GOMP_atomic_exit (void)
@@end smallexample

which reuses the regular lock code, but with yet another lock
object private to the library.



@@node Implementing FLUSH construct
@@section Implementing FLUSH construct

Expands to the @@code{__sync_synchronize} builtin.



@@node Implementing BARRIER construct
@@section Implementing BARRIER construct

@@smallexample
  void GOMP_barrier (void)
@@end smallexample


@@node Implementing THREADPRIVATE construct
@@section Implementing THREADPRIVATE construct

In _most_ cases we can map this directly to @@code{__thread}.  Except
that OMP allows constructors for C++ objects.  We can either
refuse to support this (how often is it used?) or we can 
implement something akin to .ctors.

Even more ideally, this ctor feature is handled by extensions
to the main pthreads library.  Failing that, we can have a set
of entry points to register ctor functions to be called.



@@node Implementing PRIVATE clause
@@section Implementing PRIVATE clause

In association with a PARALLEL, or within the lexical extent
of a PARALLEL block, the variable becomes a local variable in
the parallel subfunction.

In association with FOR or SECTIONS blocks, create a new
automatic variable within the current function.  This preserves
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.
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

@@smallexample
#pragma omp for firstprivate(x) lastprivate(y)
for (int i = 0; i < n; ++i)
  body;
@@end smallexample

which becomes

@@smallexample
@@{
  int x = x, y;

  // for stuff

  if (i == n)
    y = y;
@@}
@@end smallexample

where the "x=x" and "y=y" assignments actually have different
uids for the two variables, i.e. not something you could write
directly in C.  Presumably this only makes sense if the "outer"
x and y are global variables.

COPYPRIVATE would work the same way, except the structure 
broadcast would have to happen via SINGLE machinery instead.



@@node Implementing REDUCTION clause
@@section Implementing REDUCTION clause

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 to collect the values.


@@node Implementing PARALLEL construct
@@section Implementing PARALLEL construct

@@smallexample
  #pragma omp parallel
  @@{
    body;
  @@}
@@end smallexample

becomes

@@smallexample
  void subfunction (void *data)
  @@{
    use data;
    body;
  @@}

  setup data;
  GOMP_parallel_start (subfunction, &data, num_threads);
  subfunction (&data);
  GOMP_parallel_end ();
@@end smallexample

@@smallexample
  void GOMP_parallel_start (void (*fn)(void *), void *data, unsigned num_threads)
@@end smallexample

The @@var{FN} argument is the subfunction to be run in parallel.

The @@var{DATA} argument is a pointer to a structure used to 
communicate data in and out of the subfunction, as discussed
above with respect to FIRSTPRIVATE et al.

The @@var{NUM_THREADS} argument is 1 if an IF clause is present
and false, or the value of the NUM_THREADS clause, if
present, or 0.

The function needs to create the appropriate number of
threads and/or launch them from the dock.  It needs to
create the team structure and assign team ids.

@@smallexample
  void GOMP_parallel_end (void)
@@end smallexample

Tears down the team and returns us to the previous @@code{omp_in_parallel()} state.



@@node Implementing FOR construct
@@section Implementing FOR construct

@@smallexample
  #pragma omp parallel for
  for (i = lb; i <= ub; i++)
    body;
@@end smallexample

becomes

@@smallexample
  void subfunction (void *data)
  @@{
    long _s0, _e0;
    while (GOMP_loop_static_next (&_s0, &_e0))
    @@{
      long _e1 = _e0, i;
      for (i = _s0; i < _e1; i++)
        body;
    @@}
    GOMP_loop_end_nowait ();
  @@}

  GOMP_parallel_loop_static (subfunction, NULL, 0, lb, ub+1, 1, 0);
  subfunction (NULL);
  GOMP_parallel_end ();
@@end smallexample

@@smallexample
  #pragma omp for schedule(runtime)
  for (i = 0; i < n; i++)
    body;
@@end smallexample

becomes

@@smallexample
  @@{
    long i, _s0, _e0;
    if (GOMP_loop_runtime_start (0, n, 1, &_s0, &_e0))
      do @@{
        long _e1 = _e0;
        for (i = _s0, i < _e0; i++)
          body;
      @@} while (GOMP_loop_runtime_next (&_s0, _&e0));
    GOMP_loop_end ();
  @@}
@@end smallexample

Note that while it looks like there is trickyness 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
variables.  So the expression should remain evaluable in the 
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.

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
simply perform the arithmetic directly in each thread to divide up
the iterations.  Which would mean that we wouldn't need to call any
of these routines.

There are separate routines for handling loops with an ORDERED
clause.  Bookkeeping for that is non-trivial...



@@node Implementing ORDERED construct
@@section Implementing ORDERED construct

@@smallexample
  void GOMP_ordered_start (void)
  void GOMP_ordered_end (void)
@@end smallexample



@@node Implementing SECTIONS construct
@@section Implementing SECTIONS construct

A block as 

@@smallexample
  #pragma omp sections
  @@{
    #pragma omp section
    stmt1;
    #pragma omp section
    stmt2;
    #pragma omp section
    stmt3;
  @@}
@@end smallexample

becomes

@@smallexample
  for (i = GOMP_sections_start (3); i != 0; i = GOMP_sections_next ())
    switch (i)
      @@{
      case 1:
        stmt1;
        break;
      case 2:
        stmt2;
        break;
      case 3:
        stmt3;
        break;
      @@}
  GOMP_barrier ();
@@end smallexample


@@node Implementing SINGLE construct
@@section Implementing SINGLE construct

A block like 

@@smallexample
  #pragma omp single
  @@{
    body;
  @@}
@@end smallexample

becomes

@@smallexample
  if (GOMP_single_start ())
    body;
  GOMP_barrier ();
@@end smallexample

while 

@@smallexample
  #pragma omp single copyprivate(x)
    body;
@@end smallexample

becomes

@@smallexample
  datap = GOMP_single_copy_start ();
  if (datap == NULL)
    @@{
      body;
      data.x = x;
      GOMP_single_copy_end (&data);
    @@}
  else
    x = datap->x;
  GOMP_barrier ();
@@end smallexample



@@c ---------------------------------------------------------------------
@@c 
@@c ---------------------------------------------------------------------

@@node Reporting Bugs
@@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 
"openmp" to the keywords field in the bug report.



@@c ---------------------------------------------------------------------
@@c GNU General Public License
@@c ---------------------------------------------------------------------

@@include gpl.texi



@@c ---------------------------------------------------------------------
@@c GNU Free Documentation License
@@c ---------------------------------------------------------------------

@@include fdl.texi



@@c ---------------------------------------------------------------------
@@c Funding Free Software
@@c ---------------------------------------------------------------------

@@include funding.texi

@@c ---------------------------------------------------------------------
@@c Index
@@c ---------------------------------------------------------------------

@@node Index
@@unnumbered Index

@@printindex cp

@@bye
@


1.1.1.1
log
@initial import of GCC 4.5.3 sources.  changes since 4.1 are way too numerous
to review, please see http://gcc.gnu.org/gcc-4.5/changes.html (and the 4.2,
4.3 and 4.4 versions, too.)

this includes the core, c++, objc and the non java/ada/fortran parts of the
testsuite.
@
text
@@


1.1.1.1.8.1
log
@Rebase to HEAD as of a few days ago.
@
text
@d10 1
a10 1
Copyright @@copyright{} 2006-2013 Free Software Foundation, Inc.
d13 1
a13 1
under the terms of the GNU Free Documentation License, Version 1.3 or
d97 1
a97 1
* Library Index::              Index of this documentation.
d119 1
a119 1
version 3.1.
d130 1
a130 1
specifications in version 3.1. The routines are structured in following
d140 2
a141 2
* omp_get_max_active_levels::   Maximum number of active regions
* omp_get_max_threads::         Maximum number of threads of parallel region
d147 1
a147 1
* omp_get_thread_limit::        Maximum number of threads
a149 1
* omp_in_final::                Whether in final or included task region
d190 1
a190 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_active_level(void);}
d195 1
a195 1
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_active_level()}
d202 1
a202 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.19.
d223 1
a223 1
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_ancestor_thread_num(level)}
d231 1
a231 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.17.
d251 1
a251 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_dynamic(void);}
d263 1
a263 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.8.
d277 1
a277 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_level(void);}
d282 1
a282 1
@@item @@emph{Interface}: @@tab @@code{integer function omp_level()}
d289 1
a289 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.16.
d295 1
a295 1
@@section @@code{omp_get_max_active_levels} -- Maximum number of active regions
d298 1
a298 1
This function obtains the maximum allowed number of nested, active parallel regions.
d302 1
a302 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_max_active_levels(void);}
d307 1
a307 1
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_max_active_levels()}
d314 1
a314 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.15.
d320 1
a320 1
@@section @@code{omp_get_max_threads} -- Maximum number of threads of parallel region
d323 1
a323 1
Return the maximum number of threads used for the current parallel region
d328 1
a328 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_max_threads(void);}
d340 1
a340 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.3.
d360 1
a360 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_nested(void);}
d365 1
a365 1
@@item @@emph{Interface}: @@tab @@code{logical function omp_get_nested()}
d372 1
a372 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.10.
d385 1
a385 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_num_procs(void);}
d394 1
a394 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.5.
d403 1
a403 1
Returns the number of threads in the current team. In a sequential section of 
d415 1
a415 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_num_threads(void);}
d427 1
a427 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.2.
d436 1
a436 1
Obtain the runtime scheduling method. The @@var{kind} argument will be
d438 2
a439 2
@@code{omp_sched_guided} or @@code{omp_sched_auto}. The second argument,
@@var{modifier}, is set to the chunk size.
d443 1
a443 1
@@item @@emph{Prototype}: @@tab @@code{void omp_schedule(omp_sched_t *kind, int *modifier);}
d457 1
a457 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.12.
d468 2
a469 2
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
d474 1
a474 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_team_size(int level);}
d487 1
a487 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.18.
d493 1
a493 1
@@section @@code{omp_get_thread_limit} -- Maximum number of threads
d496 1
a496 1
Return the maximum number of threads of the program.
d500 1
a500 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_thread_limit(void);}
d512 1
a512 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.13.
d521 1
a521 1
Returns a unique thread identification number within the current team.
d529 1
a529 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_thread_num(void);}
d541 1
a541 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.4.
d556 1
a556 1
@@item @@emph{Prototype}: @@tab @@code{int omp_in_parallel(void);}
d565 1
a565 24
@@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.
d580 1
a580 1
@@item @@emph{Prototype}: @@tab @@code{void omp_set_dynamic(int set);}
d586 1
a586 1
@@item                   @@tab @@code{logical, intent(in) :: set}
d593 1
a593 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.7.
d602 1
a602 2
This function limits the maximum allowed number of nested, active
parallel regions.
d606 1
a606 1
@@item @@emph{Prototype}: @@tab @@code{void omp_set_max_active_levels(int max_levels);}
d611 1
a611 1
@@item @@emph{Interface}: @@tab @@code{subroutine omp_set_max_active_levels(max_levels)}
d619 1
a619 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.14.
d635 1
a635 1
@@item @@emph{Prototype}: @@tab @@code{void omp_set_nested(int set);}
d640 2
a641 2
@@item @@emph{Interface}: @@tab @@code{subroutine omp_set_nested(set)}
@@item                   @@tab @@code{logical, intent(in) :: set}
d648 1
a648 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.9.
d663 1
a663 1
@@item @@emph{Prototype}: @@tab @@code{void omp_set_num_threads(int n);}
d668 2
a669 2
@@item @@emph{Interface}: @@tab @@code{subroutine omp_set_num_threads(n)}
@@item                   @@tab @@code{integer, intent(in) :: n}
d676 1
a676 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.1.
d687 1
a687 1
@@code{omp_sched_guided} or @@code{omp_sched_auto}. Except for
d689 1
a689 1
@@var{modifier} if positive, or to the default value if zero or negative.
d694 1
a694 1
@@item @@emph{Prototype}: @@tab @@code{void omp_set_schedule(omp_sched_t *kind, int *modifier);}
d699 1
a699 1
@@item @@emph{Interface}: @@tab @@code{subroutine omp_set_schedule(kind, modifier)}
d709 1
a709 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.11.
d718 1
a718 1
Initialize a simple lock.  After initialization, the lock is in 
d736 1
a736 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.1.
d758 1
a758 1
@@item                   @@tab @@code{integer(omp_lock_kind), intent(inout) :: lock}
d765 1
a765 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.3.
d787 3
a789 2
@@item @@emph{Interface}: @@tab @@code{logical function omp_test_lock(lock)}
@@item                   @@tab @@code{integer(omp_lock_kind), intent(inout) :: lock}
d796 1
a796 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.5.
d808 2
a809 2
or more threads attempted to set the lock before, one of them is chosen to, 
again, set the lock to itself.
d819 1
a819 1
@@item                   @@tab @@code{integer(omp_lock_kind), intent(inout) :: lock}
d826 1
a826 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.4.
d840 1
a840 1
@@item @@emph{Prototype}: @@tab @@code{void omp_destroy_lock(omp_lock_t *lock);}
d853 1
a853 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.2.
d862 1
a862 1
Initialize a nested lock.  After initialization, the lock is in 
d880 1
a880 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.1.
d885 1
a885 1
@@section @@code{omp_set_nest_lock} -- Wait for and set nested lock
d891 1
a891 1
nesting count for the lock is incremented.
d901 1
a901 1
@@item                   @@tab @@code{integer(omp_nest_lock_kind), intent(inout) :: lock}
d908 1
a908 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.3.
d930 2
a931 1
@@item @@emph{Interface}: @@tab @@code{logical function omp_test_nest_lock(lock)}
d940 1
a940 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.5.
d953 1
a953 1
one of them is chosen to, again, set the lock to itself.
d963 1
a963 1
@@item                   @@tab @@code{integer(omp_nest_lock_kind), intent(inout) :: lock}
d970 1
a970 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.4.
d997 1
a997 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.2.
d1011 1
a1011 1
@@item @@emph{Prototype}: @@tab @@code{double omp_get_wtick(void);}
d1023 1
a1023 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.4.2.
d1033 3
a1035 3
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.
d1039 1
a1039 1
@@item @@emph{Prototype}: @@tab @@code{double omp_get_wtime(void);}
d1051 1
a1051 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.4.1.
d1066 1
a1066 1
are defined by section 4 of the OpenMP specifications in version 3.1,
d1072 1
a1072 1
* OMP_MAX_ACTIVE_LEVELS:: Set the maximum number of nested parallel regions
d1077 1
a1077 1
* OMP_THREAD_LIMIT::      Set the maximum number of threads
a1078 1
* OMP_PROC_BIND::         Whether theads may be moved between CPUs
d1098 1
a1098 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 4.3
d1104 1
a1104 1
@@section @@env{OMP_MAX_ACTIVE_LEVELS} -- Set the maximum number of nested parallel regions
d1108 2
a1109 2
Specifies the initial value for the maximum number of nested parallel
regions. The value of this variable shall be a positive integer.
d1116 1
a1116 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 4.8
d1136 1
a1136 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 4.5
d1148 2
a1149 3
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.
d1155 1
a1155 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 4.2
d1176 1
a1176 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, sections 2.5.1 and 4.1
d1190 1
a1190 1
which gets the number of bytes as an argument. If the stack size cannot
d1192 1
a1192 1
stack size is left unchanged. If undefined, the stack size is system
d1196 1
a1196 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, sections 4.6
d1202 1
a1202 1
@@section @@env{OMP_THREAD_LIMIT} -- Set the maximum number of threads
d1207 1
a1207 1
value of this variable shall be a positive integer. If undefined,
d1215 1
a1215 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 4.9
d1231 1
a1231 19
@@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
d1241 2
a1242 2
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 
d1244 1
a1244 1
or a range with some stride (M-N:S).  CPU numbers are zero based. For example,
d1249 1
a1249 1
the list.  @@code{GOMP_CPU_AFFINITY=0} binds all threads to CPU 0.
a1259 3

@@item @@emph{See also}:
@@ref{OMP_PROC_BIND}
d1272 2
a1273 2
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,
d1277 1
a1277 1
@@ref{OMP_STACKSIZE}
d1296 1
a1296 1
presented by libgomp.  Only maintainers should need them.
d1326 1
a1326 1
Surely this is not worthwhile though...
d1351 1
a1351 1
state, and so we wouldn't need to initialize this at
d1418 2
a1419 2
This seems simple enough for PARALLEL blocks.  Create a private 
struct for communicating between the parent and subfunction.
d1424 2
a1425 2
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:
d1462 1
a1462 1
array, and after the barrier, the master thread iterates over the
d1567 1
a1567 1
Note that while it looks like there is trickiness to propagating
d1685 1
a1685 1
@@uref{http://gcc.gnu.org/bugzilla/, bugzilla}.  For all cases, please add 
d1694 1
a1694 1
@@include gpl_v3.texi
d1716 2
a1717 2
@@node Library Index
@@unnumbered Library Index
@


1.1.1.1.2.1
log
@sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs.  ("Protocol error: too many arguments")
@
text
@d10 1
a10 1
Copyright @@copyright{} 2006-2013 Free Software Foundation, Inc.
d13 1
a13 1
under the terms of the GNU Free Documentation License, Version 1.3 or
d97 1
a97 1
* Library Index::              Index of this documentation.
d119 1
a119 1
version 3.1.
d130 1
a130 1
specifications in version 3.1. The routines are structured in following
d140 2
a141 2
* omp_get_max_active_levels::   Maximum number of active regions
* omp_get_max_threads::         Maximum number of threads of parallel region
d147 1
a147 1
* omp_get_thread_limit::        Maximum number of threads
a149 1
* omp_in_final::                Whether in final or included task region
d190 1
a190 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_active_level(void);}
d195 1
a195 1
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_active_level()}
d202 1
a202 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.19.
d223 1
a223 1
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_ancestor_thread_num(level)}
d231 1
a231 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.17.
d251 1
a251 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_dynamic(void);}
d263 1
a263 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.8.
d277 1
a277 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_level(void);}
d282 1
a282 1
@@item @@emph{Interface}: @@tab @@code{integer function omp_level()}
d289 1
a289 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.16.
d295 1
a295 1
@@section @@code{omp_get_max_active_levels} -- Maximum number of active regions
d298 1
a298 1
This function obtains the maximum allowed number of nested, active parallel regions.
d302 1
a302 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_max_active_levels(void);}
d307 1
a307 1
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_max_active_levels()}
d314 1
a314 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.15.
d320 1
a320 1
@@section @@code{omp_get_max_threads} -- Maximum number of threads of parallel region
d323 1
a323 1
Return the maximum number of threads used for the current parallel region
d328 1
a328 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_max_threads(void);}
d340 1
a340 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.3.
d360 1
a360 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_nested(void);}
d365 1
a365 1
@@item @@emph{Interface}: @@tab @@code{logical function omp_get_nested()}
d372 1
a372 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.10.
d385 1
a385 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_num_procs(void);}
d394 1
a394 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.5.
d403 1
a403 1
Returns the number of threads in the current team. In a sequential section of 
d415 1
a415 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_num_threads(void);}
d427 1
a427 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.2.
d436 1
a436 1
Obtain the runtime scheduling method. The @@var{kind} argument will be
d438 2
a439 2
@@code{omp_sched_guided} or @@code{omp_sched_auto}. The second argument,
@@var{modifier}, is set to the chunk size.
d443 1
a443 1
@@item @@emph{Prototype}: @@tab @@code{void omp_schedule(omp_sched_t *kind, int *modifier);}
d457 1
a457 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.12.
d468 2
a469 2
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
d474 1
a474 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_team_size(int level);}
d487 1
a487 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.18.
d493 1
a493 1
@@section @@code{omp_get_thread_limit} -- Maximum number of threads
d496 1
a496 1
Return the maximum number of threads of the program.
d500 1
a500 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_thread_limit(void);}
d512 1
a512 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.13.
d521 1
a521 1
Returns a unique thread identification number within the current team.
d529 1
a529 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_thread_num(void);}
d541 1
a541 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.4.
d556 1
a556 1
@@item @@emph{Prototype}: @@tab @@code{int omp_in_parallel(void);}
d565 1
a565 24
@@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.
d580 1
a580 1
@@item @@emph{Prototype}: @@tab @@code{void omp_set_dynamic(int set);}
d586 1
a586 1
@@item                   @@tab @@code{logical, intent(in) :: set}
d593 1
a593 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.7.
d602 1
a602 2
This function limits the maximum allowed number of nested, active
parallel regions.
d606 1
a606 1
@@item @@emph{Prototype}: @@tab @@code{void omp_set_max_active_levels(int max_levels);}
d611 1
a611 1
@@item @@emph{Interface}: @@tab @@code{subroutine omp_set_max_active_levels(max_levels)}
d619 1
a619 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.14.
d635 1
a635 1
@@item @@emph{Prototype}: @@tab @@code{void omp_set_nested(int set);}
d640 2
a641 2
@@item @@emph{Interface}: @@tab @@code{subroutine omp_set_nested(set)}
@@item                   @@tab @@code{logical, intent(in) :: set}
d648 1
a648 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.9.
d663 1
a663 1
@@item @@emph{Prototype}: @@tab @@code{void omp_set_num_threads(int n);}
d668 2
a669 2
@@item @@emph{Interface}: @@tab @@code{subroutine omp_set_num_threads(n)}
@@item                   @@tab @@code{integer, intent(in) :: n}
d676 1
a676 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.1.
d687 1
a687 1
@@code{omp_sched_guided} or @@code{omp_sched_auto}. Except for
d689 1
a689 1
@@var{modifier} if positive, or to the default value if zero or negative.
d694 1
a694 1
@@item @@emph{Prototype}: @@tab @@code{void omp_set_schedule(omp_sched_t *kind, int *modifier);}
d699 1
a699 1
@@item @@emph{Interface}: @@tab @@code{subroutine omp_set_schedule(kind, modifier)}
d709 1
a709 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.11.
d718 1
a718 1
Initialize a simple lock.  After initialization, the lock is in 
d736 1
a736 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.1.
d758 1
a758 1
@@item                   @@tab @@code{integer(omp_lock_kind), intent(inout) :: lock}
d765 1
a765 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.3.
d787 3
a789 2
@@item @@emph{Interface}: @@tab @@code{logical function omp_test_lock(lock)}
@@item                   @@tab @@code{integer(omp_lock_kind), intent(inout) :: lock}
d796 1
a796 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.5.
d808 2
a809 2
or more threads attempted to set the lock before, one of them is chosen to, 
again, set the lock to itself.
d819 1
a819 1
@@item                   @@tab @@code{integer(omp_lock_kind), intent(inout) :: lock}
d826 1
a826 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.4.
d840 1
a840 1
@@item @@emph{Prototype}: @@tab @@code{void omp_destroy_lock(omp_lock_t *lock);}
d853 1
a853 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.2.
d862 1
a862 1
Initialize a nested lock.  After initialization, the lock is in 
d880 1
a880 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.1.
d885 1
a885 1
@@section @@code{omp_set_nest_lock} -- Wait for and set nested lock
d891 1
a891 1
nesting count for the lock is incremented.
d901 1
a901 1
@@item                   @@tab @@code{integer(omp_nest_lock_kind), intent(inout) :: lock}
d908 1
a908 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.3.
d930 2
a931 1
@@item @@emph{Interface}: @@tab @@code{logical function omp_test_nest_lock(lock)}
d940 1
a940 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.5.
d953 1
a953 1
one of them is chosen to, again, set the lock to itself.
d963 1
a963 1
@@item                   @@tab @@code{integer(omp_nest_lock_kind), intent(inout) :: lock}
d970 1
a970 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.4.
d997 1
a997 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.2.
d1011 1
a1011 1
@@item @@emph{Prototype}: @@tab @@code{double omp_get_wtick(void);}
d1023 1
a1023 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.4.2.
d1033 3
a1035 3
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.
d1039 1
a1039 1
@@item @@emph{Prototype}: @@tab @@code{double omp_get_wtime(void);}
d1051 1
a1051 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.4.1.
d1066 1
a1066 1
are defined by section 4 of the OpenMP specifications in version 3.1,
d1072 1
a1072 1
* OMP_MAX_ACTIVE_LEVELS:: Set the maximum number of nested parallel regions
d1077 1
a1077 1
* OMP_THREAD_LIMIT::      Set the maximum number of threads
a1078 1
* OMP_PROC_BIND::         Whether theads may be moved between CPUs
d1098 1
a1098 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 4.3
d1104 1
a1104 1
@@section @@env{OMP_MAX_ACTIVE_LEVELS} -- Set the maximum number of nested parallel regions
d1108 2
a1109 2
Specifies the initial value for the maximum number of nested parallel
regions. The value of this variable shall be a positive integer.
d1116 1
a1116 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 4.8
d1136 1
a1136 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 4.5
d1148 2
a1149 3
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.
d1155 1
a1155 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 4.2
d1176 1
a1176 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, sections 2.5.1 and 4.1
d1190 1
a1190 1
which gets the number of bytes as an argument. If the stack size cannot
d1192 1
a1192 1
stack size is left unchanged. If undefined, the stack size is system
d1196 1
a1196 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, sections 4.6
d1202 1
a1202 1
@@section @@env{OMP_THREAD_LIMIT} -- Set the maximum number of threads
d1207 1
a1207 1
value of this variable shall be a positive integer. If undefined,
d1215 1
a1215 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 4.9
d1231 1
a1231 19
@@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
d1241 2
a1242 2
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 
d1244 1
a1244 1
or a range with some stride (M-N:S).  CPU numbers are zero based. For example,
d1249 1
a1249 1
the list.  @@code{GOMP_CPU_AFFINITY=0} binds all threads to CPU 0.
a1259 3

@@item @@emph{See also}:
@@ref{OMP_PROC_BIND}
d1272 2
a1273 2
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,
d1277 1
a1277 1
@@ref{OMP_STACKSIZE}
d1296 1
a1296 1
presented by libgomp.  Only maintainers should need them.
d1326 1
a1326 1
Surely this is not worthwhile though...
d1351 1
a1351 1
state, and so we wouldn't need to initialize this at
d1418 2
a1419 2
This seems simple enough for PARALLEL blocks.  Create a private 
struct for communicating between the parent and subfunction.
d1424 2
a1425 2
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:
d1462 1
a1462 1
array, and after the barrier, the master thread iterates over the
d1567 1
a1567 1
Note that while it looks like there is trickiness to propagating
d1685 1
a1685 1
@@uref{http://gcc.gnu.org/bugzilla/, bugzilla}.  For all cases, please add 
d1694 1
a1694 1
@@include gpl_v3.texi
d1716 2
a1717 2
@@node Library Index
@@unnumbered Library Index
@


1.1.1.2
log
@import GCC 4.8 branch at r206687.

highlights from: http://gcc.gnu.org/gcc-4.6/changes.html

   GCC now has stricter checks for invalid command-line options
   New -Wunused-but-set-variable and -Wunused-but-set-parameter
      warnings
   Many platforms have been obsoleted
   Link-time optimization improvements
   A new switch -fstack-usage has been added
   A new function attribute leaf was introduced
   A new warning, enabled by -Wdouble-promotion
   Support for selectively enabling and disabling warnings via
      #pragma GCC diagnostic has been added
   There is now experimental support for some features from the
      upcoming C1X revision of the ISO C standard
   Improved experimental support for the upcoming C++0x ISO C++
      standard
   G++ now issues clearer diagnostics in several cases
   Updates for ARM, x86, MIPS, PPC/PPC64, SPARC
   Darwin, FreeBSD, Solaris 2, MinGW and Cygwin now all support
      __float128 on 32-bit and 64-bit x86 targets. [*1]

highlights from: http://gcc.gnu.org/gcc-4.7/changes.html

   The -fconserve-space flag has been deprecated
   Support for a new parameter --param case-values-threshold=n
      was added
   Interprocedural and Link-time optimization improvements
   A new built-in, __builtin_assume_aligned, has been added
   A new warning option -Wunused-local-typedefs was added
   A new experimental command-line option -ftrack-macro-expansion
      was added
   Support for atomic operations specifying the C++11/C11 memory
      model has been added
   There is support for some more features from the C11 revision
      of the ISO C standard
   Improved experimental support for the new ISO C++ standard,
      C++11
   Updates for ARM, x86, MIPS, PPC/PPC64, SH, SPARC, TILE*
   A new option (-grecord-gcc-switches) was added

highlights from: http://gcc.gnu.org/gcc-4.8/changes.html

   GCC now uses C++ as its implementation language.  This means
      that to build GCC from sources, you will need a C++
      compiler that understands C++ 2003
   DWARF4 is now the default when generating DWARF debug
      information
   A new general optimization level, -Og, has been introduced
   A new option -ftree-partial-pre was added
   The option -fconserve-space has been removed
   The command-line options -fipa-struct-reorg and
      -fipa-matrix-reorg have been removed
   Interprocedural and Link-time optimization improvements
   AddressSanitizer, a fast memory error detector, has been
      added  [*2]
   A new -Wsizeof-pointer-memaccess warning has been added
   G++ now supports a -std=c++1y option for experimentation
      with features proposed for the next revision of the
      standard, expected around 2014
   Improved experimental support for the new ISO C++ standard,
      C++11
   A new port has been added to support AArch64
   Updates for ARM, x86, MIPS, PPC/PPC64, SH, SPARC, TILE*


[*1] we should support this too!
[*2] we should look into this.
     https://code.google.com/p/address-sanitizer/
@
text
@d10 1
a10 1
Copyright @@copyright{} 2006-2013 Free Software Foundation, Inc.
d13 1
a13 1
under the terms of the GNU Free Documentation License, Version 1.3 or
d97 1
a97 1
* Library Index::              Index of this documentation.
d119 1
a119 1
version 3.1.
d130 1
a130 1
specifications in version 3.1. The routines are structured in following
d140 2
a141 2
* omp_get_max_active_levels::   Maximum number of active regions
* omp_get_max_threads::         Maximum number of threads of parallel region
d147 1
a147 1
* omp_get_thread_limit::        Maximum number of threads
a149 1
* omp_in_final::                Whether in final or included task region
d190 1
a190 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_active_level(void);}
d195 1
a195 1
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_active_level()}
d202 1
a202 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.19.
d223 1
a223 1
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_ancestor_thread_num(level)}
d231 1
a231 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.17.
d251 1
a251 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_dynamic(void);}
d263 1
a263 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.8.
d277 1
a277 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_level(void);}
d282 1
a282 1
@@item @@emph{Interface}: @@tab @@code{integer function omp_level()}
d289 1
a289 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.16.
d295 1
a295 1
@@section @@code{omp_get_max_active_levels} -- Maximum number of active regions
d298 1
a298 1
This function obtains the maximum allowed number of nested, active parallel regions.
d302 1
a302 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_max_active_levels(void);}
d307 1
a307 1
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_max_active_levels()}
d314 1
a314 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.15.
d320 1
a320 1
@@section @@code{omp_get_max_threads} -- Maximum number of threads of parallel region
d323 1
a323 1
Return the maximum number of threads used for the current parallel region
d328 1
a328 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_max_threads(void);}
d340 1
a340 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.3.
d360 1
a360 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_nested(void);}
d365 1
a365 1
@@item @@emph{Interface}: @@tab @@code{logical function omp_get_nested()}
d372 1
a372 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.10.
d385 1
a385 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_num_procs(void);}
d394 1
a394 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.5.
d403 1
a403 1
Returns the number of threads in the current team. In a sequential section of 
d415 1
a415 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_num_threads(void);}
d427 1
a427 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.2.
d436 1
a436 1
Obtain the runtime scheduling method. The @@var{kind} argument will be
d438 2
a439 2
@@code{omp_sched_guided} or @@code{omp_sched_auto}. The second argument,
@@var{modifier}, is set to the chunk size.
d443 1
a443 1
@@item @@emph{Prototype}: @@tab @@code{void omp_schedule(omp_sched_t *kind, int *modifier);}
d457 1
a457 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.12.
d468 2
a469 2
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
d474 1
a474 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_team_size(int level);}
d487 1
a487 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.18.
d493 1
a493 1
@@section @@code{omp_get_thread_limit} -- Maximum number of threads
d496 1
a496 1
Return the maximum number of threads of the program.
d500 1
a500 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_thread_limit(void);}
d512 1
a512 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.13.
d521 1
a521 1
Returns a unique thread identification number within the current team.
d529 1
a529 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_thread_num(void);}
d541 1
a541 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.4.
d556 1
a556 1
@@item @@emph{Prototype}: @@tab @@code{int omp_in_parallel(void);}
d565 1
a565 24
@@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.
d580 1
a580 1
@@item @@emph{Prototype}: @@tab @@code{void omp_set_dynamic(int set);}
d586 1
a586 1
@@item                   @@tab @@code{logical, intent(in) :: set}
d593 1
a593 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.7.
d602 1
a602 2
This function limits the maximum allowed number of nested, active
parallel regions.
d606 1
a606 1
@@item @@emph{Prototype}: @@tab @@code{void omp_set_max_active_levels(int max_levels);}
d611 1
a611 1
@@item @@emph{Interface}: @@tab @@code{subroutine omp_set_max_active_levels(max_levels)}
d619 1
a619 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.14.
d635 1
a635 1
@@item @@emph{Prototype}: @@tab @@code{void omp_set_nested(int set);}
d640 2
a641 2
@@item @@emph{Interface}: @@tab @@code{subroutine omp_set_nested(set)}
@@item                   @@tab @@code{logical, intent(in) :: set}
d648 1
a648 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.9.
d663 1
a663 1
@@item @@emph{Prototype}: @@tab @@code{void omp_set_num_threads(int n);}
d668 2
a669 2
@@item @@emph{Interface}: @@tab @@code{subroutine omp_set_num_threads(n)}
@@item                   @@tab @@code{integer, intent(in) :: n}
d676 1
a676 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.1.
d687 1
a687 1
@@code{omp_sched_guided} or @@code{omp_sched_auto}. Except for
d689 1
a689 1
@@var{modifier} if positive, or to the default value if zero or negative.
d694 1
a694 1
@@item @@emph{Prototype}: @@tab @@code{void omp_set_schedule(omp_sched_t *kind, int *modifier);}
d699 1
a699 1
@@item @@emph{Interface}: @@tab @@code{subroutine omp_set_schedule(kind, modifier)}
d709 1
a709 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.2.11.
d718 1
a718 1
Initialize a simple lock.  After initialization, the lock is in 
d736 1
a736 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.1.
d758 1
a758 1
@@item                   @@tab @@code{integer(omp_lock_kind), intent(inout) :: lock}
d765 1
a765 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.3.
d787 3
a789 2
@@item @@emph{Interface}: @@tab @@code{logical function omp_test_lock(lock)}
@@item                   @@tab @@code{integer(omp_lock_kind), intent(inout) :: lock}
d796 1
a796 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.5.
d808 2
a809 2
or more threads attempted to set the lock before, one of them is chosen to, 
again, set the lock to itself.
d819 1
a819 1
@@item                   @@tab @@code{integer(omp_lock_kind), intent(inout) :: lock}
d826 1
a826 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.4.
d840 1
a840 1
@@item @@emph{Prototype}: @@tab @@code{void omp_destroy_lock(omp_lock_t *lock);}
d853 1
a853 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.2.
d862 1
a862 1
Initialize a nested lock.  After initialization, the lock is in 
d880 1
a880 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.1.
d885 1
a885 1
@@section @@code{omp_set_nest_lock} -- Wait for and set nested lock
d891 1
a891 1
nesting count for the lock is incremented.
d901 1
a901 1
@@item                   @@tab @@code{integer(omp_nest_lock_kind), intent(inout) :: lock}
d908 1
a908 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.3.
d930 2
a931 1
@@item @@emph{Interface}: @@tab @@code{logical function omp_test_nest_lock(lock)}
d940 1
a940 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.5.
d953 1
a953 1
one of them is chosen to, again, set the lock to itself.
d963 1
a963 1
@@item                   @@tab @@code{integer(omp_nest_lock_kind), intent(inout) :: lock}
d970 1
a970 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.4.
d997 1
a997 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.3.2.
d1011 1
a1011 1
@@item @@emph{Prototype}: @@tab @@code{double omp_get_wtick(void);}
d1023 1
a1023 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.4.2.
d1033 3
a1035 3
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.
d1039 1
a1039 1
@@item @@emph{Prototype}: @@tab @@code{double omp_get_wtime(void);}
d1051 1
a1051 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 3.4.1.
d1066 1
a1066 1
are defined by section 4 of the OpenMP specifications in version 3.1,
d1072 1
a1072 1
* OMP_MAX_ACTIVE_LEVELS:: Set the maximum number of nested parallel regions
d1077 1
a1077 1
* OMP_THREAD_LIMIT::      Set the maximum number of threads
a1078 1
* OMP_PROC_BIND::         Whether theads may be moved between CPUs
d1098 1
a1098 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 4.3
d1104 1
a1104 1
@@section @@env{OMP_MAX_ACTIVE_LEVELS} -- Set the maximum number of nested parallel regions
d1108 2
a1109 2
Specifies the initial value for the maximum number of nested parallel
regions. The value of this variable shall be a positive integer.
d1116 1
a1116 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 4.8
d1136 1
a1136 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 4.5
d1148 2
a1149 3
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.
d1155 1
a1155 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 4.2
d1176 1
a1176 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, sections 2.5.1 and 4.1
d1190 1
a1190 1
which gets the number of bytes as an argument. If the stack size cannot
d1192 1
a1192 1
stack size is left unchanged. If undefined, the stack size is system
d1196 1
a1196 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, sections 4.6
d1202 1
a1202 1
@@section @@env{OMP_THREAD_LIMIT} -- Set the maximum number of threads
d1207 1
a1207 1
value of this variable shall be a positive integer. If undefined,
d1215 1
a1215 1
@@uref{http://www.openmp.org/, OpenMP specifications v3.1}, section 4.9
d1231 1
a1231 19
@@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
d1241 2
a1242 2
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 
d1244 1
a1244 1
or a range with some stride (M-N:S).  CPU numbers are zero based. For example,
d1249 1
a1249 1
the list.  @@code{GOMP_CPU_AFFINITY=0} binds all threads to CPU 0.
a1259 3

@@item @@emph{See also}:
@@ref{OMP_PROC_BIND}
d1272 2
a1273 2
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,
d1277 1
a1277 1
@@ref{OMP_STACKSIZE}
d1296 1
a1296 1
presented by libgomp.  Only maintainers should need them.
d1326 1
a1326 1
Surely this is not worthwhile though...
d1351 1
a1351 1
state, and so we wouldn't need to initialize this at
d1418 2
a1419 2
This seems simple enough for PARALLEL blocks.  Create a private 
struct for communicating between the parent and subfunction.
d1424 2
a1425 2
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:
d1462 1
a1462 1
array, and after the barrier, the master thread iterates over the
d1567 1
a1567 1
Note that while it looks like there is trickiness to propagating
d1685 1
a1685 1
@@uref{http://gcc.gnu.org/bugzilla/, bugzilla}.  For all cases, please add 
d1694 1
a1694 1
@@include gpl_v3.texi
d1716 2
a1717 2
@@node Library Index
@@unnumbered Library Index
@


1.1.1.3
log
@import GCC 5.3.0.  see these urls for details which are too large to
include here:

	http://gcc.gnu.org/gcc-4.9/changes.html
	http://gcc.gnu.org/gcc-5/changes.html

(note that GCC 5.x is a release stream like GCC 4.9.x, 4.8.x, etc.)


the main issues we will have are:

The default mode for C is now -std=gnu11 instead of -std=gnu89.

ARM:
The deprecated option -mwords-little-endian has been removed.
The options -mapcs, -mapcs-frame, -mtpcs-frame and -mtpcs-leaf-frame
 which are only applicable to the old ABI have been deprecated.

MIPS:
The o32 ABI has been modified and extended. The o32 64-bit
 floating-point register support is now obsolete and has been removed.
 It has been replaced by three ABI extensions FPXX, FP64A, and FP64.
 The meaning of the -mfp64 command-line option has changed. It is now
 used to enable the FP64A and FP64 ABI extensions.
@
text
@d10 1
a10 1
Copyright @@copyright{} 2006-2015 Free Software Foundation, Inc.
d34 1
a34 1
* libgomp: (libgomp).          GNU Offloading and Multi Processing Runtime Library.
d37 2
a38 4
This manual documents libgomp, the GNU Offloading and Multi Processing
Runtime library.  This is the GNU implementation of the OpenMP and
OpenACC APIs for parallel and accelerator programming in C/C++ and
Fortran.
d51 1
a51 2
@@title GNU Offloading and Multi Processing Runtime Library
@@subtitle The GNU OpenMP and OpenACC Implementation
d72 3
a74 13
This manual documents the usage of libgomp, the GNU Offloading and
Multi Processing Runtime Library.  This includes the GNU
implementation of the @@uref{http://www.openmp.org, OpenMP} Application
Programming Interface (API) for multi-platform shared-memory parallel
programming in C/C++ and Fortran, and the GNU implementation of the
@@uref{http://www.openacc.org/, OpenACC} Application Programming
Interface (API) for offloading of code to accelerator devices in C/C++
and Fortran.

Originally, libgomp implemented the GNU OpenMP Runtime Library.  Based
on this, support for OpenACC and offloading (both OpenACC and OpenMP
4's target construct) has been added later on, and the library's name
changed to GNU Offloading and Multi Processing Runtime Library.
d90 1
a90 2
* Reporting Bugs::             How to report bugs in the GNU Offloading and
                               Multi Processing Runtime Library.
d109 1
a109 1
flag @@command{-fopenmp} must be specified.  This enables the OpenMP directive
d113 1
a113 1
@@code{*$} and @@code{!$} sentinels in fixed form, for Fortran.  The flag also
d119 1
a119 1
version 4.0.
d129 2
a130 2
The runtime routines described here are defined by Section 3 of the OpenMP
specification in version 4.0.  The routines are structured in following
d133 2
a135 3
Control threads, processors and the parallel environment.  They have C
linkage, and do not throw exceptions.

a137 2
* omp_get_cancellation::        Whether cancellation support is enabled
* omp_get_default_device::      Get the default device for target regions
a142 1
* omp_get_num_devices::         Number of target devices
a143 1
* omp_get_num_teams::           Number of teams
a144 1
* omp_get_proc_bind::           Whether theads may be moved between CPUs
a145 1
* omp_get_team_num::            Get team number
a150 2
* omp_is_initial_device::       Whether executing on the host device
* omp_set_default_device::      Set the default device for target regions
d156 1
d160 1
d171 1
d175 1
d203 1
a203 1
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.20.
d213 1
a213 1
nesting level of the current thread.  For values of @@var{level} outside
d232 1
a232 54
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.18.
@@end table



@@node omp_get_cancellation
@@section @@code{omp_get_cancellation} -- Whether cancellation support is enabled
@@table @@asis
@@item @@emph{Description}:
This function returns @@code{true} if cancellation is activated, @@code{false}
otherwise.  Here, @@code{true} and @@code{false} represent their language-specific
counterparts.  Unless @@env{OMP_CANCELLATION} is set true, cancellations are
deactivated.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{int omp_get_cancellation(void);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{logical function omp_get_cancellation()}
@@end multitable

@@item @@emph{See also}:
@@ref{OMP_CANCELLATION}

@@item @@emph{Reference}:
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.9.
@@end table



@@node omp_get_default_device
@@section @@code{omp_get_default_device} -- Get the default device for target regions
@@table @@asis
@@item @@emph{Description}:
Get the default device for target regions without device clause.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{int omp_get_default_device(void);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_default_device()}
@@end multitable

@@item @@emph{See also}:
@@ref{OMP_DEFAULT_DEVICE}, @@ref{omp_set_default_device}

@@item @@emph{Reference}:
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.24.
d246 2
a247 2
@@env{OMP_DYNAMIC} environment variable or at runtime using
@@code{omp_set_dynamic}.  If undefined, dynamic adjustment is
d264 1
a264 1
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.8.
d290 1
a290 1
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.17.
d315 1
a315 1
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.16.
d341 1
a341 1
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.3.
d351 1
a351 1
enabled, @@code{false} otherwise.  Here, @@code{true} and @@code{false}
d355 2
a356 2
@@env{OMP_NESTED} environment variable or at runtime using
@@code{omp_set_nested}.  If undefined, nested parallel regions are
d373 1
a373 23
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.11.
@@end table



@@node omp_get_num_devices
@@section @@code{omp_get_num_devices} -- Number of target devices
@@table @@asis
@@item @@emph{Description}:
Returns the number of target devices.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{int omp_get_num_devices(void);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_num_devices()}
@@end multitable

@@item @@emph{Reference}:
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.25.
d382 1
a382 1
Returns the number of processors online on that device.
d395 1
a395 23
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.5.
@@end table



@@node omp_get_num_teams
@@section @@code{omp_get_num_teams} -- Number of teams
@@table @@asis
@@item @@emph{Description}:
Returns the number of teams in the current team region.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{int omp_get_num_teams(void);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_num_teams()}
@@end multitable

@@item @@emph{Reference}:
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.26.
d404 1
a404 1
Returns the number of threads in the current team.  In a sequential section of
d408 1
a408 1
@@env{OMP_NUM_THREADS} environment variable.  At runtime, the size
d410 2
a411 2
clause or by @@code{omp_set_num_threads}.  If none of the above were
used to define a specific value and @@env{OMP_DYNAMIC} is disabled,
d428 1
a428 29
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.2.
@@end table



@@node omp_get_proc_bind
@@section @@code{omp_get_proc_bind} -- Whether theads may be moved between CPUs
@@table @@asis
@@item @@emph{Description}:
This functions returns the currently active thread affinity policy, which is
set via @@env{OMP_PROC_BIND}.  Possible values are @@code{omp_proc_bind_false},
@@code{omp_proc_bind_true}, @@code{omp_proc_bind_master},
@@code{omp_proc_bind_close} and @@code{omp_proc_bind_spread}.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{omp_proc_bind_t omp_get_proc_bind(void);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{integer(kind=omp_proc_bind_kind) function omp_get_proc_bind()}
@@end multitable

@@item @@emph{See also}:
@@ref{OMP_PROC_BIND}, @@ref{OMP_PLACES}, @@ref{GOMP_CPU_AFFINITY},

@@item @@emph{Reference}:
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.22.
d437 1
a437 1
Obtain the runtime scheduling method.  The @@var{kind} argument will be
d439 1
a439 1
@@code{omp_sched_guided} or @@code{omp_sched_auto}.  The second argument,
d444 1
a444 1
@@item @@emph{Prototype}: @@tab @@code{void omp_get_schedule(omp_sched_t *kind, int *modifier);}
d449 1
a449 1
@@item @@emph{Interface}: @@tab @@code{subroutine omp_get_schedule(kind, modifier)}
d458 1
a458 23
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.13.
@@end table



@@node omp_get_team_num
@@section @@code{omp_get_team_num} -- Get team number
@@table @@asis
@@item @@emph{Description}:
Returns the team number of the calling thread.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{int omp_get_team_num(void);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_team_num()}
@@end multitable

@@item @@emph{Reference}:
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.27.
d468 1
a468 1
either the current thread or its ancestor belongs.  For values of @@var{level}
d488 1
a488 1
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.19.
d513 1
a513 1
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.14.
d518 1
a518 1
@@node omp_get_thread_num
d524 2
a525 2
always returns 0.  In parallel regions the return value varies
from 0 to @@code{omp_get_num_threads}-1 inclusive.  The return
d542 1
a542 1
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.4.
d551 2
a552 2
This function returns @@code{true} if currently running in parallel,
@@code{false} otherwise.  Here, @@code{true} and @@code{false} represent
d566 1
a566 1
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.6.
d575 1
a575 1
or included task region, @@code{false} otherwise.  Here, @@code{true}
d589 1
a589 1
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.21.
a592 52

@@node omp_is_initial_device
@@section @@code{omp_is_initial_device} -- Whether executing on the host device
@@table @@asis
@@item @@emph{Description}:
This function returns @@code{true} if currently running on the host device,
@@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_is_initial_device(void);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{logical function omp_is_initial_device()}
@@end multitable

@@item @@emph{Reference}:
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.28.
@@end table



@@node omp_set_default_device
@@section @@code{omp_set_default_device} -- Set the default device for target regions
@@table @@asis
@@item @@emph{Description}:
Set the default device for target regions without device clause.  The argument
shall be a nonnegative device number.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{void omp_set_default_device(int device_num);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{subroutine omp_set_default_device(device_num)}
@@item                   @@tab @@code{integer device_num}
@@end multitable

@@item @@emph{See also}:
@@ref{OMP_DEFAULT_DEVICE}, @@ref{omp_get_default_device}

@@item @@emph{Reference}:
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.23.
@@end table



d598 1
a598 1
within a team.  The function takes the language-specific equivalent
d604 1
a604 1
@@item @@emph{Prototype}: @@tab @@code{void omp_set_dynamic(int dynamic_threads);}
d609 2
a610 2
@@item @@emph{Interface}: @@tab @@code{subroutine omp_set_dynamic(dynamic_threads)}
@@item                   @@tab @@code{logical, intent(in) :: dynamic_threads}
d617 1
a617 1
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.7.
d644 1
a644 1
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.15.
d654 1
a654 1
are allowed to create new teams.  The function takes the language-specific
d660 1
a660 1
@@item @@emph{Prototype}: @@tab @@code{void omp_set_nested(int nested);}
d665 2
a666 2
@@item @@emph{Interface}: @@tab @@code{subroutine omp_set_nested(nested)}
@@item                   @@tab @@code{logical, intent(in) :: nested}
d673 1
a673 1
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.10.
d683 2
a684 2
sections, if those do not specify a @@code{num_threads} clause.  The
argument of @@code{omp_set_num_threads} shall be a positive integer.
d688 1
a688 1
@@item @@emph{Prototype}: @@tab @@code{void omp_set_num_threads(int num_threads);}
d693 2
a694 2
@@item @@emph{Interface}: @@tab @@code{subroutine omp_set_num_threads(num_threads)}
@@item                   @@tab @@code{integer, intent(in) :: num_threads}
d701 1
a701 1
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.1.
d710 1
a710 1
Sets the runtime scheduling method.  The @@var{kind} argument can have the
d712 1
a712 1
@@code{omp_sched_guided} or @@code{omp_sched_auto}.  Except for
d719 1
a719 1
@@item @@emph{Prototype}: @@tab @@code{void omp_set_schedule(omp_sched_t kind, int modifier);}
d734 1
a734 1
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.12.
d743 1
a743 1
Initialize a simple lock.  After initialization, the lock is in
d753 2
a754 2
@@item @@emph{Interface}: @@tab @@code{subroutine omp_init_lock(svar)}
@@item                   @@tab @@code{integer(omp_lock_kind), intent(out) :: svar}
d761 1
a761 1
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.3.1.
d771 2
a772 2
@@code{omp_init_lock}.  The calling thread is blocked until the lock 
is available.  If the lock is already held by the current thread, 
d782 2
a783 2
@@item @@emph{Interface}: @@tab @@code{subroutine omp_set_lock(svar)}
@@item                   @@tab @@code{integer(omp_lock_kind), intent(inout) :: svar}
d790 1
a790 1
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.3.3.
d800 3
a802 3
@@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
d812 2
a813 2
@@item @@emph{Interface}: @@tab @@code{logical function omp_test_lock(svar)}
@@item                   @@tab @@code{integer(omp_lock_kind), intent(inout) :: svar}
d820 1
a820 1
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.3.5.
d830 3
a832 3
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
or more threads attempted to set the lock before, one of them is chosen to,
d842 2
a843 2
@@item @@emph{Interface}: @@tab @@code{subroutine omp_unset_lock(svar)}
@@item                   @@tab @@code{integer(omp_lock_kind), intent(inout) :: svar}
d850 1
a850 1
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.3.4.
d859 1
a859 1
Destroy a simple lock.  In order to be destroyed, a simple lock must be
d869 2
a870 2
@@item @@emph{Interface}: @@tab @@code{subroutine omp_destroy_lock(svar)}
@@item                   @@tab @@code{integer(omp_lock_kind), intent(inout) :: svar}
d877 1
a877 1
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.3.2.
d886 1
a886 1
Initialize a nested lock.  After initialization, the lock is in
d896 2
a897 2
@@item @@emph{Interface}: @@tab @@code{subroutine omp_init_nest_lock(nvar)}
@@item                   @@tab @@code{integer(omp_nest_lock_kind), intent(out) :: nvar}
d904 1
a904 1
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.3.1.
d913 2
a914 2
@@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
d924 2
a925 2
@@item @@emph{Interface}: @@tab @@code{subroutine omp_set_nest_lock(nvar)}
@@item                   @@tab @@code{integer(omp_nest_lock_kind), intent(inout) :: nvar}
d932 1
a932 1
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.3.3.
d942 1
a942 1
@@code{omp_init_nest_lock}.  Contrary to @@code{omp_set_nest_lock},
d945 1
a945 1
is returned.  Otherwise, the return value equals zero.
d954 2
a955 2
@@item @@emph{Interface}: @@tab @@code{logical function omp_test_nest_lock(nvar)}
@@item                   @@tab @@code{integer(omp_nest_lock_kind), intent(inout) :: nvar}
d963 1
a963 1
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.3.5.
d973 3
a975 3
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,
d985 2
a986 2
@@item @@emph{Interface}: @@tab @@code{subroutine omp_unset_nest_lock(nvar)}
@@item                   @@tab @@code{integer(omp_nest_lock_kind), intent(inout) :: nvar}
d993 1
a993 1
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.3.4.
d1002 1
a1002 1
Destroy a nested lock.  In order to be destroyed, a nested lock must be
d1012 2
a1013 2
@@item @@emph{Interface}: @@tab @@code{subroutine omp_destroy_nest_lock(nvar)}
@@item                   @@tab @@code{integer(omp_nest_lock_kind), intent(inout) :: nvar}
d1020 1
a1020 1
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.3.2.
d1046 1
a1046 1
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.4.2.
d1055 1
a1055 1
Elapsed wall clock time in seconds.  The time is measured per thread, no
d1074 1
a1074 1
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.4.1.
d1086 6
a1091 3
The environment variables which beginning with @@env{OMP_} are defined by
section 4 of the OpenMP specification in version 4.0, while those
beginning with @@env{GOMP_} are GNU extensions.
a1093 3
* OMP_CANCELLATION::      Set whether cancellation is activated
* OMP_DISPLAY_ENV::       Show OpenMP version and environment variables
* OMP_DEFAULT_DEVICE::    Set the device used in target regions
a1097 2
* OMP_PROC_BIND::         Whether theads may be moved between CPUs
* OMP_PLACES::            Specifies on which CPUs the theads should be placed
d1102 1
a1103 1
* GOMP_DEBUG::            Enable debugging output
a1104 1
* GOMP_SPINCOUNT::        Set the busy-wait spin count
a1107 56
@@node OMP_CANCELLATION
@@section @@env{OMP_CANCELLATION} -- Set whether cancellation is activated
@@cindex Environment Variable
@@table @@asis
@@item @@emph{Description}:
If set to @@code{TRUE}, the cancellation is activated.  If set to @@code{FALSE} or
if unset, cancellation is disabled and the @@code{cancel} construct is ignored.

@@item @@emph{See also}:
@@ref{omp_get_cancellation}

@@item @@emph{Reference}:
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 4.11
@@end table



@@node OMP_DISPLAY_ENV
@@section @@env{OMP_DISPLAY_ENV} -- Show OpenMP version and environment variables
@@cindex Environment Variable
@@table @@asis
@@item @@emph{Description}:
If set to @@code{TRUE}, the OpenMP version number and the values
associated with the OpenMP environment variables are printed to @@code{stderr}.
If set to @@code{VERBOSE}, it additionally shows the value of the environment
variables which are GNU extensions.  If undefined or set to @@code{FALSE},
this information will not be shown.


@@item @@emph{Reference}:
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 4.12
@@end table



@@node OMP_DEFAULT_DEVICE
@@section @@env{OMP_DEFAULT_DEVICE} -- Set the device used in target regions
@@cindex Environment Variable
@@table @@asis
@@item @@emph{Description}:
Set to choose the device which is used in a @@code{target} region, unless the
value is overridden by @@code{omp_set_default_device} or by a @@code{device}
clause.  The value shall be the nonnegative device number. If no device with
the given device number exists, the code is executed on the host.  If unset,
device number 0 will be used.


@@item @@emph{See also}:
@@ref{omp_get_default_device}, @@ref{omp_set_default_device},

@@item @@emph{Reference}:
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 4.11
@@end table



d1114 2
a1115 2
within a team.  The value of this environment variable shall be 
@@code{TRUE} or @@code{FALSE}.  If undefined, dynamic adjustment is
d1122 1
a1122 1
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 4.3
d1133 1
a1133 1
regions.  The value of this variable shall be a positive integer.
d1140 1
a1140 1
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 4.9
d1152 2
a1153 2
are allowed to create new teams.  The value of this environment variable 
shall be @@code{TRUE} or @@code{FALSE}.  If undefined, nested parallel 
d1160 1
a1160 1
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 4.6
d1171 1
a1171 1
Specifies the default number of threads to use in parallel regions.  The 
d1174 1
a1174 1
level.  If undefined one thread per CPU is used.
d1180 1
a1180 1
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 4.2
d1185 2
a1186 2
@@node OMP_PROC_BIND
@@section @@env{OMP_PROC_BIND} -- Whether theads may be moved between CPUs
d1188 1
d1191 5
a1195 12
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.  Alternatively, a comma separated list with the
values @@code{MASTER}, @@code{CLOSE} and @@code{SPREAD} can be used to specify
the thread affinity policy for the corresponding nesting level.  With
@@code{MASTER} the worker threads are in the same place partition as the
master thread.  With @@code{CLOSE} those are kept close to the master thread
in contiguous place partitions.  And with @@code{SPREAD} a sparse distribution
across the place partitions is used.

When undefined, @@env{OMP_PROC_BIND} defaults to @@code{TRUE} when
@@env{OMP_PLACES} or @@env{GOMP_CPU_AFFINITY} is set and @@code{FALSE} otherwise.
d1198 1
a1198 1
@@ref{OMP_PLACES}, @@ref{GOMP_CPU_AFFINITY}, @@ref{omp_get_proc_bind}
d1200 2
a1201 44
@@item @@emph{Reference}:
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 4.4
@@end table



@@node OMP_PLACES
@@section @@env{OMP_PLACES} -- Specifies on which CPUs the theads should be placed
@@cindex Environment Variable
@@table @@asis
@@item @@emph{Description}:
The thread placement can be either specified using an abstract name or by an
explicit list of the places.  The abstract names @@code{threads}, @@code{cores}
and @@code{sockets} can be optionally followed by a positive number in
parentheses, which denotes the how many places shall be created.  With
@@code{threads} each place corresponds to a single hardware thread; @@code{cores}
to a single core with the corresponding number of hardware threads; and with
@@code{sockets} the place corresponds to a single socket.  The resulting
placement can be shown by setting the @@env{OMP_DISPLAY_ENV} environment
variable.

Alternatively, the placement can be specified explicitly as comma-separated
list of places.  A place is specified by set of nonnegative numbers in curly
braces, denoting the denoting the hardware threads.  The hardware threads
belonging to a place can either be specified as comma-separated list of
nonnegative thread numbers or using an interval.  Multiple places can also be
either specified by a comma-separated list of places or by an interval.  To
specify an interval, a colon followed by the count is placed after after
the hardware thread number or the place.  Optionally, the length can be
followed by a colon and the stride number -- otherwise a unit stride is
assumed.  For instance, the following specifies the same places list:
@@code{"@@{0,1,2@@}, @@{3,4,6@@}, @@{7,8,9@@}, @@{10,11,12@@}"};
@@code{"@@{0:3@@}, @@{3:3@@}, @@{7:3@@}, @@{10:3@@}"}; and @@code{"@@{0:2@@}:4:3"}.

If @@env{OMP_PLACES} and @@env{GOMP_CPU_AFFINITY} are unset and
@@env{OMP_PROC_BIND} is either unset or @@code{false}, threads may be moved
between CPUs following no placement policy.

@@item @@emph{See also}:
@@ref{OMP_PROC_BIND}, @@ref{GOMP_CPU_AFFINITY}, @@ref{omp_get_proc_bind},
@@ref{OMP_DISPLAY_ENV}

@@item @@emph{Reference}:
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 4.5
d1214 2
a1215 2
or gigabytes.  This is different from @@code{pthread_attr_setstacksize}
which gets the number of bytes as an argument.  If the stack size cannot
d1217 1
a1217 1
stack size is left unchanged.  If undefined, the stack size is system
d1221 1
a1221 1
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 4.7
d1226 2
a1227 2
@@node OMP_SCHEDULE
@@section @@env{OMP_SCHEDULE} -- How threads are scheduled
a1228 1
@@cindex Implementation specific setting
d1231 3
a1233 5
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}, @@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.
d1236 2
a1237 1
@@ref{omp_set_schedule}
d1240 1
a1240 1
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Sections 2.7.1 and 4.1
d1245 2
a1246 2
@@node OMP_THREAD_LIMIT
@@section @@env{OMP_THREAD_LIMIT} -- Set the maximum number of threads
d1250 4
a1253 6
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}
d1256 1
a1256 1
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 4.10
d1261 2
a1262 2
@@node OMP_WAIT_POLICY
@@section @@env{OMP_WAIT_POLICY} -- How waiting threads are handled
d1266 3
a1268 5
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.  If undefined, threads wait actively for a short time
before waiting passively.
d1271 1
a1271 1
@@ref{GOMP_SPINCOUNT}
d1274 1
a1274 1
@@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 4.8
d1284 2
a1285 2
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 
d1287 1
a1287 1
or a range with some stride (M-N:S).  CPU numbers are zero based.  For example,
d1294 2
a1295 2
There is no libgomp library routine to determine whether a CPU affinity
specification is in effect.  As a workaround, language-specific library 
d1298 1
a1298 1
environment variable.  A defined CPU affinity on startup cannot be changed 
d1301 2
a1302 4
If both @@env{GOMP_CPU_AFFINITY} and @@env{OMP_PROC_BIND} are set,
@@env{OMP_PROC_BIND} has a higher precedence.  If neither has been set and
@@env{OMP_PROC_BIND} is unset, or when @@env{OMP_PROC_BIND} is set to
@@code{FALSE}, the host system will handle the assignment of threads to CPUs.
d1305 1
a1305 15
@@ref{OMP_PLACES}, @@ref{OMP_PROC_BIND}
@@end table



@@node GOMP_DEBUG
@@section @@env{GOMP_DEBUG} -- Enable debugging output
@@cindex Environment Variable
@@table @@asis
@@item @@emph{Description}:
Enable debugging output.  The variable should be set to @@code{0}
(disabled, also the default if not set), or @@code{1} (enabled).

If enabled, some debugging output will be printed during execution.
This is currently not specified in more detail, and subject to change.
d1316 1
a1316 1
Set the default thread stack size in kilobytes.  This is different from
d1318 2
a1319 2
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,
a1333 27
@@node GOMP_SPINCOUNT
@@section @@env{GOMP_SPINCOUNT} -- Set the busy-wait spin count
@@cindex Environment Variable
@@cindex Implementation specific setting
@@table @@asis
@@item @@emph{Description}:
Determines how long a threads waits actively with consuming CPU power
before waiting passively without consuming CPU power.  The value may be
either @@code{INFINITE}, @@code{INFINITY} to always wait actively or an
integer which gives the number of spins of the busy-wait loop.  The
integer may optionally be followed by the following suffixes acting
as multiplication factors: @@code{k} (kilo, thousand), @@code{M} (mega,
million), @@code{G} (giga, billion), or @@code{T} (tera, trillion).
If undefined, 0 is used when @@env{OMP_WAIT_POLICY} is @@code{PASSIVE},
300,000 is used when @@env{OMP_WAIT_POLICY} is undefined and
30 billion is used when @@env{OMP_WAIT_POLICY} is @@code{ACTIVE}.
If there are more OpenMP threads than available CPUs, 1000 and 100
spins are used for @@env{OMP_WAIT_POLICY} being @@code{ACTIVE} or
undefined, respectively; unless the @@env{GOMP_SPINCOUNT} is lower
or @@env{OMP_WAIT_POLICY} is @@code{PASSIVE}.

@@item @@emph{See also}:
@@ref{OMP_WAIT_POLICY}
@@end table



d1724 1
a1724 1
@@c Reporting Bugs
d1730 3
a1732 4
Bugs in the GNU Offloading and Multi Processing Runtime Library should
be reported via @@uref{http://gcc.gnu.org/bugzilla/, Bugzilla}.  Please add
"openacc", or "openmp", or both to the keywords field in the bug
report, as appropriate.
@


1.1.1.4
log
@import GCC 6.4.0.  see this url for details which are too large to
include here:

   http://gcc.gnu.org/gcc-6/changes.html

the main visible changes appear to be:

- The default mode for C++ is now -std=gnu++14 instead of -std=gnu++98.
- The C and C++ compilers now support attributes on enumerators.
- Diagnostics can now contain "fix-it hints"
- more warnings (some added to -Wall)
@
text
@d10 1
a10 1
Copyright @@copyright{} 2006-2016 Free Software Foundation, Inc.
a101 10
* Enabling OpenACC::           How to enable OpenACC for your
                               applications.
* OpenACC Runtime Library Routines:: The OpenACC runtime application
                               programming interface.
* OpenACC Environment Variables:: Influencing OpenACC runtime behavior with
                               environment variables.
* CUDA Streams Usage::         Notes on the implementation of
                               asynchronous operations.
* OpenACC Library Interoperability:: OpenACC library interoperability with the
                               NVIDIA CUBLAS library.
d133 1
a133 1
version 4.5.
d144 1
a144 1
specification in version 4.5.  The routines are structured in following
a157 1
* omp_get_max_task_priority::   Maximum task priority value that can be set
d222 1
a222 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.20.
d251 1
a251 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.18.
d279 1
a279 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.9.
d304 1
a304 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.30.
d336 1
a336 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.8.
d362 1
a362 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.17.
d387 1
a387 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.16.
a390 21
@@node omp_get_max_task_priority
@@section @@code{omp_get_max_task_priority} -- Maximum priority value
that can be set for tasks.
@@table @@asis
@@item @@emph{Description}:
This function obtains the maximum allowed priority number for tasks.

@@item @@emph{C/C++}
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{int omp_get_max_task_priority(void);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_max_task_priority()}
@@end multitable

@@item @@emph{Reference}:
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.29.
@@end table

d413 1
a413 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.3.
d445 1
a445 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.11.
d467 1
a467 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.31.
d489 1
a489 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.5.
d511 1
a511 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.32.
d544 1
a544 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.2.
d572 1
a572 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.22.
d584 1
a584 1
@@var{chunk_size}, is set to the chunk size.
d588 1
a588 1
@@item @@emph{Prototype}: @@tab @@code{void omp_get_schedule(omp_sched_t *kind, int *chunk_size);}
d593 1
a593 1
@@item @@emph{Interface}: @@tab @@code{subroutine omp_get_schedule(kind, chunk_size)}
d595 1
a595 1
@@item                   @@tab @@code{integer chunk_size}
d602 1
a602 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.13.
d624 1
a624 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.33.
d654 1
a654 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.19.
d679 1
a679 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.14.
d708 1
a708 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.4.
d732 1
a732 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.6.
d755 1
a755 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.21.
d779 1
a779 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.34.
d806 1
a806 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.29.
d835 1
a835 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.7.
d862 1
a862 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.15.
d891 1
a891 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.10.
d919 1
a919 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.1.
d932 2
a933 2
@@var{chunk_size} if positive, or to the default value if zero or negative.
For @@code{omp_sched_auto} the @@var{chunk_size} argument is ignored.
d937 1
a937 1
@@item @@emph{Prototype}: @@tab @@code{void omp_set_schedule(omp_sched_t kind, int chunk_size);}
d942 1
a942 1
@@item @@emph{Interface}: @@tab @@code{subroutine omp_set_schedule(kind, chunk_size)}
d944 1
a944 1
@@item                   @@tab @@code{integer chunk_size}
d952 1
a952 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.12.
d979 1
a979 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.3.1.
d1008 1
a1008 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.3.4.
d1038 1
a1038 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.3.6.
d1068 1
a1068 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.3.5.
d1095 1
a1095 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.3.3.
d1122 1
a1122 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.3.1.
d1150 1
a1150 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.3.4.
d1181 1
a1181 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.3.6.
d1211 1
a1211 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.3.5.
d1238 1
a1238 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.3.3.
d1264 1
a1264 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.4.2.
d1292 1
a1292 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.4.1.
d1305 1
a1305 1
section 4 of the OpenMP specification in version 4.5, while those
d1309 17
a1325 19
* OMP_CANCELLATION::        Set whether cancellation is activated
* OMP_DISPLAY_ENV::         Show OpenMP version and environment variables
* OMP_DEFAULT_DEVICE::      Set the device used in target regions
* OMP_DYNAMIC::             Dynamic adjustment of threads
* OMP_MAX_ACTIVE_LEVELS::   Set the maximum number of nested parallel regions
* OMP_MAX_TASK_PRIORITY::   Set the maximum task priority value
* OMP_NESTED::              Nested parallel regions
* OMP_NUM_THREADS::         Specifies the number of threads to use
* OMP_PROC_BIND::           Whether theads may be moved between CPUs
* OMP_PLACES::              Specifies on which CPUs the theads should be placed
* 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
* GOMP_CPU_AFFINITY::       Bind threads to specific CPUs
* GOMP_DEBUG::              Enable debugging output
* GOMP_STACKSIZE::          Set default thread stack size
* GOMP_SPINCOUNT::          Set the busy-wait spin count
* GOMP_RTEMS_THREAD_POOLS:: Set the RTEMS specific thread pools
d1341 1
a1341 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 4.11
d1359 1
a1359 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 4.12
d1380 1
a1380 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 4.13
d1399 1
a1399 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 4.3
d1417 1
a1417 21
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 4.9
@@end table



@@node OMP_MAX_TASK_PRIORITY
@@section @@env{OMP_MAX_TASK_PRIORITY} -- Set the maximum priority
number that can be set for a task.
@@cindex Environment Variable
@@table @@asis
@@item @@emph{Description}:
Specifies the initial value for the maximum priority value that can be
set for a task.  The value of this variable shall be a non-negative
integer, and zero is allowed.  If undefined, the default priority is
0.

@@item @@emph{See also}:
@@ref{omp_get_max_task_priority}

@@item @@emph{Reference}: 
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 4.14
d1437 1
a1437 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 4.6
d1457 1
a1457 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 4.2
d1484 1
a1484 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 4.4
d1526 1
a1526 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 4.5
d1546 1
a1546 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 4.7
d1567 1
a1567 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Sections 2.7.1.1 and 4.1
d1585 1
a1585 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 4.10
d1605 1
a1605 1
@@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 4.8
a1707 40
@@node GOMP_RTEMS_THREAD_POOLS
@@section @@env{GOMP_RTEMS_THREAD_POOLS} -- Set the RTEMS specific thread pools
@@cindex Environment Variable
@@cindex Implementation specific setting
@@table @@asis
@@item @@emph{Description}:
This environment variable is only used on the RTEMS real-time operating system.
It determines the scheduler instance specific thread pools.  The format for
@@env{GOMP_RTEMS_THREAD_POOLS} is a list of optional
@@code{<thread-pool-count>[$<priority>]@@@@<scheduler-name>} configurations
separated by @@code{:} where:
@@itemize @@bullet
@@item @@code{<thread-pool-count>} is the thread pool count for this scheduler
instance.
@@item @@code{$<priority>} is an optional priority for the worker threads of a
thread pool according to @@code{pthread_setschedparam}.  In case a priority
value is omitted, then a worker thread will inherit the priority of the OpenMP
master thread that created it.  The priority of the worker thread is not
changed after creation, even if a new OpenMP master thread using the worker has
a different priority.
@@item @@code{@@@@<scheduler-name>} is the scheduler instance name according to the
RTEMS application configuration.
@@end itemize
In case no thread pool configuration is specified for a scheduler instance,
then each OpenMP master thread of this scheduler instance will use its own
dynamically allocated thread pool.  To limit the worker thread count of the
thread pools, each OpenMP master thread must call @@code{omp_set_num_threads}.
@@item @@emph{Example}:
Lets suppose we have three scheduler instances @@code{IO}, @@code{WRK0}, and
@@code{WRK1} with @@env{GOMP_RTEMS_THREAD_POOLS} set to
@@code{"1@@@@WRK0:3$4@@@@WRK1"}.  Then there are no thread pool restrictions for
scheduler instance @@code{IO}.  In the scheduler instance @@code{WRK0} there is
one thread pool available.  Since no priority is specified for this scheduler
instance, the worker thread inherits the priority of the OpenMP master thread
that created it.  In the scheduler instance @@code{WRK1} there are three thread
pools available and their worker threads run at priority four.
@@end table



d1709 1
a1709 1
@@c Enabling OpenACC
d1712 2
a1713 2
@@node Enabling OpenACC
@@chapter Enabling OpenACC
d1715 2
a1716 8
To activate the OpenACC extensions for C/C++ and Fortran, the compile-time 
flag @@option{-fopenacc} must be specified.  This enables the OpenACC directive
@@code{#pragma acc} in C/C++ and @@code{!$accp} directives in free form,
@@code{c$acc}, @@code{*$acc} and @@code{!$acc} directives in fixed form,
@@code{!$} conditional compilation sentinels in free form and @@code{c$},
@@code{*$} and @@code{!$} sentinels in fixed form, for Fortran.  The flag also
arranges for automatic linking of the OpenACC runtime library 
(@@ref{OpenACC Runtime Library Routines}).
d1718 16
a1733 7
A complete description of all OpenACC directives accepted may be found in 
the @@uref{http://www.openacc.org/, OpenACC} Application Programming
Interface manual, version 2.0.

Note that this is an experimental feature and subject to
change in future versions of GCC.  See
@@uref{https://gcc.gnu.org/wiki/OpenACC} for more information.
d1736 2
d1739 4
a1742 3
@@c ---------------------------------------------------------------------
@@c OpenACC Runtime Library Routines
@@c ---------------------------------------------------------------------
d1744 3
a1746 2
@@node OpenACC Runtime Library Routines
@@chapter OpenACC Runtime Library Routines
a1747 6
The runtime routines described here are defined by section 3 of the OpenACC
specifications in version 2.0.
They have C linkage, and do not throw exceptions.
Generally, they are available only for the host, with the exception of
@@code{acc_on_device}, which is available for both the host and the
acceleration device.
a1748 57
@@menu
* acc_get_num_devices::         Get number of devices for the given device
                                type.
* acc_set_device_type::         Set type of device accelerator to use.
* acc_get_device_type::         Get type of device accelerator to be used.
* acc_set_device_num::          Set device number to use.
* acc_get_device_num::          Get device number to be used.
* acc_async_test::              Tests for completion of a specific asynchronous
                                operation.
* acc_async_test_all::          Tests for completion of all asychronous
                                operations.
* acc_wait::                    Wait for completion of a specific asynchronous
                                operation.
* acc_wait_all::                Waits for completion of all asyncrhonous
                                operations.
* acc_wait_all_async::          Wait for completion of all asynchronous
                                operations.
* acc_wait_async::              Wait for completion of asynchronous operations.
* acc_init::                    Initialize runtime for a specific device type.
* acc_shutdown::                Shuts down the runtime for a specific device
                                type.
* acc_on_device::               Whether executing on a particular device
* acc_malloc::                  Allocate device memory.
* acc_free::                    Free device memory.
* acc_copyin::                  Allocate device memory and copy host memory to
                                it.
* acc_present_or_copyin::       If the data is not present on the device,
                                allocate device memory and copy from host
                                memory.
* acc_create::                  Allocate device memory and map it to host
                                memory.
* acc_present_or_create::       If the data is not present on the device,
                                allocate device memory and map it to host
                                memory.
* acc_copyout::                 Copy device memory to host memory.
* acc_delete::                  Free device memory.
* acc_update_device::           Update device memory from mapped host memory.
* acc_update_self::             Update host memory from mapped device memory.
* acc_map_data::                Map previously allocated device memory to host
                                memory.
* acc_unmap_data::              Unmap device memory from host memory.
* acc_deviceptr::               Get device pointer associated with specific
                                host address.
* acc_hostptr::                 Get host pointer associated with specific
                                device address.
* acc_is_present::              Indiciate whether host variable / array is
                                present on device.
* acc_memcpy_to_device::        Copy host memory to device memory.
* acc_memcpy_from_device::      Copy device memory to host memory.

API routines for target platforms.

* acc_get_current_cuda_device:: Get CUDA device handle.
* acc_get_current_cuda_context::Get CUDA context handle.
* acc_get_cuda_stream::         Get CUDA stream handle.
* acc_set_cuda_stream::         Set CUDA stream handle.
@@end menu
d1750 2
d1753 1
d1755 4
a1758 6
@@node acc_get_num_devices
@@section @@code{acc_get_num_devices} -- Get number of devices for given device type
@@table @@asis
@@item @@emph{Description}
This function returns a value indicating the number of devices available
for the device type specified in @@var{devicetype}. 
d1760 2
a1761 4
@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{int acc_get_num_devices(acc_device_t devicetype);}
@@end multitable
d1763 2
a1764 5
@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{integer function acc_get_num_devices(devicetype)}
@@item                  @@tab @@code{integer(kind=acc_device_kind) devicetype}
@@end multitable
d1766 3
a1768 4
@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
3.2.1.
@@end table
d1770 3
a1774 6
@@node acc_set_device_type
@@section @@code{acc_set_device_type} -- Set type of device accelerator to use.
@@table @@asis
@@item @@emph{Description}
This function indicates to the runtime library which device typr, specified
in @@var{devicetype}, to use when executing a parallel or kernels region. 
d1776 2
a1777 4
@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{acc_set_device_type(acc_device_t devicetype);}
@@end multitable
d1779 1
a1779 5
@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{subroutine acc_set_device_type(devicetype)}
@@item                   @@tab @@code{integer(kind=acc_device_kind) devicetype}
@@end multitable
d1781 1
a1781 4
@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
3.2.2.
@@end table
d1783 4
d1788 2
a1790 6
@@node acc_get_device_type
@@section @@code{acc_get_device_type} -- Get type of device accelerator to be used.
@@table @@asis
@@item @@emph{Description}
This function returns what device type will be used when executing a
parallel or kernels region.
a1791 4
@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{acc_device_t acc_get_device_type(void);}
@@end multitable
d1793 2
a1794 5
@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{function acc_get_device_type(void)}
@@item                  @@tab @@code{integer(kind=acc_device_kind) acc_get_device_type}
@@end multitable
d1796 1
a1796 4
@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
3.2.3.
@@end table
d1800 2
a1801 7
@@node acc_set_device_num
@@section @@code{acc_set_device_num} -- Set device number to use.
@@table @@asis
@@item @@emph{Description}
This function will indicate to the runtime which device number,
specified by @@var{num}, associated with the specifed device
type @@var{devicetype}.
d1803 3
a1805 4
@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{acc_set_device_num(int num, acc_device_t devicetype);}
@@end multitable
a1806 6
@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{subroutine acc_set_device_num(devicenum, devicetype)}
@@item                   @@tab @@code{integer devicenum}
@@item                   @@tab @@code{integer(kind=acc_device_kind) devicetype}
@@end multitable
d1808 2
a1809 4
@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
3.2.4.
@@end table
d1811 4
d1816 3
a1819 7
@@node acc_get_device_num
@@section @@code{acc_get_device_num} -- Get device number to be used.
@@table @@asis
@@item @@emph{Description}
This function returns which device number associated with the specified device
type @@var{devicetype}, will be used when executing a parallel or kernels
region.
a1820 4
@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{int acc_get_device_num(acc_device_t devicetype);}
@@end multitable
d1822 2
a1823 6
@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{function acc_get_device_num(devicetype)}
@@item                   @@tab @@code{integer(kind=acc_device_kind) devicetype}
@@item                   @@tab @@code{integer acc_get_device_num}
@@end multitable
d1825 3
a1827 4
@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
3.2.5.
@@end table
d1829 3
a1833 9
@@node acc_async_test
@@section @@code{acc_async_test} -- Test for completion of a specific asynchronous operation.
@@table @@asis
@@item @@emph{Description}
This function tests for completion of the asynchrounous operation specified
in @@var{arg}. In C/C++, a non-zero value will be returned to indicate
the specified asynchronous operation has completed. While Fortran will return
a @@code{true}. If the asynchrounous operation has not completed, C/C++ returns
a zero and Fortran returns a @@code{false}.
d1835 2
a1836 4
@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{int acc_async_test(int arg);}
@@end multitable
d1838 5
a1842 6
@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{function acc_async_test(arg)}
@@item                   @@tab @@code{integer(kind=acc_handle_kind) arg}
@@item                   @@tab @@code{logical acc_async_test}
@@end multitable
d1844 2
a1845 4
@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
3.2.6.
@@end table
d1847 5
d1853 1
d1855 3
a1857 9
@@node acc_async_test_all
@@section @@code{acc_async_test_all} -- Tests for completion of all asynchronous operations.
@@table @@asis
@@item @@emph{Description}
This function tests for completion of all asynchrounous operations.
In C/C++, a non-zero value will be returned to indicate all asynchronous
operations have completed. While Fortran will return a @@code{true}. If
any asynchronous operation has not completed, C/C++ returns a zero and
Fortran returns a @@code{false}.
d1859 1
a1859 4
@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{int acc_async_test_all(void);}
@@end multitable
d1861 4
a1864 5
@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{function acc_async_test()}
@@item                   @@tab @@code{logical acc_get_device_num}
@@end multitable
d1866 4
a1869 4
@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
3.2.7.
@@end table
d1871 2
a1874 6
@@node acc_wait
@@section @@code{acc_wait} -- Wait for completion of a specific asynchronous operation.
@@table @@asis
@@item @@emph{Description}
This function waits for completion of the asynchronous operation
specified in @@var{arg}.
d1876 2
a1877 4
@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{acc_wait(arg);}
@@end multitable
d1879 5
a1883 5
@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{subroutine acc_wait(arg)}
@@item                   @@tab @@code{integer(acc_handle_kind) arg}
@@end multitable
a1884 4
@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
3.2.8.
@@end table
d1886 2
d1889 6
d1896 1
a1896 5
@@node acc_wait_all
@@section @@code{acc_wait_all} -- Waits for completion of all asynchronous operations.
@@table @@asis
@@item @@emph{Description}
This function waits for the completion of all asynchronous operations.
d1898 6
a1903 4
@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{acc_wait_all(void);}
@@end multitable
d1905 5
a1909 1147
@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{subroutine acc_wait_async()}
@@end multitable

@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
3.2.10.
@@end table



@@node acc_wait_all_async
@@section @@code{acc_wait_all_async} -- Wait for completion of all asynchronous operations.
@@table @@asis
@@item @@emph{Description}
This function enqueues a wait operation on the queue @@var{async} for any
and all asynchronous operations that have been previously enqueued on
any queue.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{acc_wait_all_async(int async);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{subroutine acc_wait_all_async(async)}
@@item                   @@tab @@code{integer(acc_handle_kind) async}
@@end multitable

@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
3.2.11.
@@end table



@@node acc_wait_async
@@section @@code{acc_wait_async} -- Wait for completion of asynchronous operations.
@@table @@asis
@@item @@emph{Description}
This function enqueues a wait operation on queue @@var{async} for any and all
asynchronous operations enqueued on queue @@var{arg}.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{acc_wait_async(int arg, int async);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{subroutine acc_wait_async(arg, async)}
@@item                   @@tab @@code{integer(acc_handle_kind) arg, async}
@@end multitable

@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
3.2.9.
@@end table



@@node acc_init
@@section @@code{acc_init} -- Initialize runtime for a specific device type.
@@table @@asis
@@item @@emph{Description}
This function initializes the runtime for the device type specified in
@@var{devicetype}.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{acc_init(acc_device_t devicetype);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{subroutine acc_init(devicetype)}
@@item                   @@tab @@code{integer(acc_device_kind) devicetype}
@@end multitable

@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
3.2.12.
@@end table



@@node acc_shutdown
@@section @@code{acc_shutdown} -- Shuts down the runtime for a specific device type.
@@table @@asis
@@item @@emph{Description}
This function shuts down the runtime for the device type specified in
@@var{devicetype}.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{acc_shutdown(acc_device_t devicetype);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{subroutine acc_shutdown(devicetype)}
@@item                   @@tab @@code{integer(acc_device_kind) devicetype}
@@end multitable

@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
3.2.13.
@@end table



@@node acc_on_device
@@section @@code{acc_on_device} -- Whether executing on a particular device
@@table @@asis
@@item @@emph{Description}:
This function returns whether the program is executing on a particular
device specified in @@var{devicetype}. In C/C++ a non-zero value is
returned to indicate the device is execiting on the specified device type.
In Fortran, @@code{true} will be returned. If the program is not executing
on the specified device type C/C++ will return a zero, while Fortran will
return @@code{false}.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{acc_on_device(acc_device_t devicetype);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{function acc_on_device(devicetype)}
@@item                   @@tab @@code{integer(acc_device_kind) devicetype}
@@item                   @@tab @@code{logical acc_on_device}
@@end multitable


@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
3.2.14.
@@end table



@@node acc_malloc
@@section @@code{acc_malloc} -- Allocate device memory.
@@table @@asis
@@item @@emph{Description}
This function allocates @@var{len} bytes of device memory. It returns
the device address of the allocated memory.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{d_void* acc_malloc(size_t len);}
@@end multitable

@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
3.2.15.
@@end table



@@node acc_free
@@section @@code{acc_free} -- Free device memory.
@@table @@asis
@@item @@emph{Description}
Free previously allocated device memory at the device address @@code{a}.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{acc_free(d_void *a);}
@@end multitable

@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
3.2.16.
@@end table



@@node acc_copyin
@@section @@code{acc_copyin} -- Allocate device memory and copy host memory to it.
@@table @@asis
@@item @@emph{Description}
In C/C++, this function allocates @@var{len} bytes of device memory
and maps it to the specified host address in @@var{a}. The device
address of the newly allocated device memory is returned.

In Fortran, two (2) forms are supported. In the first form, @@var{a} specifies
a contiguous array section. The second form @@var{a} specifies a
variable or array element and @@var{len} specifies the length in bytes.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{void *acc_copyin(h_void *a, size_t len);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{subroutine acc_copyin(a)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item @@emph{Interface}: @@tab @@code{subroutine acc_copyin(a, len)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item                   @@tab @@code{integer len}
@@end multitable

@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
3.2.17.
@@end table



@@node acc_present_or_copyin
@@section @@code{acc_present_or_copyin} -- If the data is not present on the device, allocate device memory and copy from host memory.
@@table @@asis
@@item @@emph{Description}
This function tests if the host data specifed by @@var{a} and of length
@@var{len} is present or not. If it is not present, then device memory
will be allocated and the host memory copied. The device address of
the newly allocated device memory is returned.

In Fortran, two (2) forms are supported. In the first form, @@var{a} specifies
a contiguous array section. The second form @@var{a} specifies a variable or
array element and @@var{len} specifies the length in bytes.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{void *acc_present_or_copyin(h_void *a, size_t len);}
@@item @@emph{Prototype}: @@tab @@code{void *acc_pcopyin(h_void *a, size_t len);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{subroutine acc_present_or_copyin(a)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item @@emph{Interface}: @@tab @@code{subroutine acc_present_or_copyin(a, len)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item                   @@tab @@code{integer len}
@@item @@emph{Interface}: @@tab @@code{subroutine acc_pcopyin(a)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item @@emph{Interface}: @@tab @@code{subroutine acc_pcopyin(a, len)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item                   @@tab @@code{integer len}
@@end multitable

@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
3.2.18.
@@end table



@@node acc_create
@@section @@code{acc_create} -- Allocate device memory and map it to host memory.
@@table @@asis
@@item @@emph{Description}
This function allocates device memory and maps it to host memory specified
by the host address @@var{a} with a length of @@var{len} bytes. In C/C++,
the function returns the device address of the allocated device memory.

In Fortran, two (2) forms are supported. In the first form, @@var{a} specifies
a contiguous array section. The second form @@var{a} specifies a variable or
array element and @@var{len} specifies the length in bytes.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{void *acc_create(h_void *a, size_t len);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{subroutine acc_create(a)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item @@emph{Interface}: @@tab @@code{subroutine acc_create(a, len)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item                   @@tab @@code{integer len}
@@end multitable

@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
3.2.19.
@@end table



@@node acc_present_or_create
@@section @@code{acc_present_or_create} -- If the data is not present on the device, allocate device memory and map it to host memory.
@@table @@asis
@@item @@emph{Description}
This function tests if the host data specifed by @@var{a} and of length
@@var{len} is present or not. If it is not present, then device memory
will be allocated and mapped to host memory. In C/C++, the device address
of the newly allocated device memory is returned.

In Fortran, two (2) forms are supported. In the first form, @@var{a} specifies
a contiguous array section. The second form @@var{a} specifies a variable or
array element and @@var{len} specifies the length in bytes.


@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{void *acc_present_or_create(h_void *a, size_t len)}
@@item @@emph{Prototype}: @@tab @@code{void *acc_pcreate(h_void *a, size_t len)}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{subroutine acc_present_or_create(a)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item @@emph{Interface}: @@tab @@code{subroutine acc_present_or_create(a, len)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item                   @@tab @@code{integer len}
@@item @@emph{Interface}: @@tab @@code{subroutine acc_pcreate(a)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item @@emph{Interface}: @@tab @@code{subroutine acc_pcreate(a, len)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item                   @@tab @@code{integer len}
@@end multitable

@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
3.2.20.
@@end table



@@node acc_copyout
@@section @@code{acc_copyout} -- Copy device memory to host memory.
@@table @@asis
@@item @@emph{Description}
This function copies mapped device memory to host memory which is specified
by host address @@var{a} for a length @@var{len} bytes in C/C++.

In Fortran, two (2) forms are supported. In the first form, @@var{a} specifies
a contiguous array section. The second form @@var{a} specifies a variable or
array element and @@var{len} specifies the length in bytes.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{acc_copyout(h_void *a, size_t len);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{subroutine acc_copyout(a)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item @@emph{Interface}: @@tab @@code{subroutine acc_copyout(a, len)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item                   @@tab @@code{integer len}
@@end multitable

@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
3.2.21.
@@end table



@@node acc_delete
@@section @@code{acc_delete} -- Free device memory.
@@table @@asis
@@item @@emph{Description}
This function frees previously allocated device memory specified by
the device address @@var{a} and the length of @@var{len} bytes.

In Fortran, two (2) forms are supported. In the first form, @@var{a} specifies
a contiguous array section. The second form @@var{a} specifies a variable or
array element and @@var{len} specifies the length in bytes.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{acc_delete(h_void *a, size_t len);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{subroutine acc_delete(a)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item @@emph{Interface}: @@tab @@code{subroutine acc_delete(a, len)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item                   @@tab @@code{integer len}
@@end multitable

@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
3.2.22.
@@end table



@@node acc_update_device
@@section @@code{acc_update_device} -- Update device memory from mapped host memory.
@@table @@asis
@@item @@emph{Description}
This function updates the device copy from the previously mapped host memory.
The host memory is specified with the host address @@var{a} and a length of
@@var{len} bytes.

In Fortran, two (2) forms are supported. In the first form, @@var{a} specifies
a contiguous array section. The second form @@var{a} specifies a variable or
array element and @@var{len} specifies the length in bytes.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{acc_update_device(h_void *a, size_t len);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{subroutine acc_update_device(a)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item @@emph{Interface}: @@tab @@code{subroutine acc_update_device(a, len)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item                   @@tab @@code{integer len}
@@end multitable

@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
3.2.23.
@@end table



@@node acc_update_self
@@section @@code{acc_update_self} -- Update host memory from mapped device memory.
@@table @@asis
@@item @@emph{Description}
This function updates the host copy from the previously mapped device memory.
The host memory is specified with the host address @@var{a} and a length of
@@var{len} bytes.

In Fortran, two (2) forms are supported. In the first form, @@var{a} specifies
a contiguous array section. The second form @@var{a} specifies a variable or
array element and @@var{len} specifies the length in bytes.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{acc_update_self(h_void *a, size_t len);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{subroutine acc_update_self(a)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item @@emph{Interface}: @@tab @@code{subroutine acc_update_self(a, len)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item                   @@tab @@code{integer len}
@@end multitable

@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
3.2.24.
@@end table



@@node acc_map_data
@@section @@code{acc_map_data} -- Map previously allocated device memory to host memory.
@@table @@asis
@@item @@emph{Description}
This function maps previously allocated device and host memory. The device
memory is specified with the device address @@var{d}. The host memory is
specified with the host address @@var{h} and a length of @@var{len}.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{acc_map_data(h_void *h, d_void *d, size_t len);}
@@end multitable

@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
3.2.25.
@@end table



@@node acc_unmap_data
@@section @@code{acc_unmap_data} -- Unmap device memory from host memory.
@@table @@asis
@@item @@emph{Description}
This function unmaps previously mapped device and host memory. The latter
specified by @@var{h}.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{acc_unmap_data(h_void *h);}
@@end multitable

@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
3.2.26.
@@end table



@@node acc_deviceptr
@@section @@code{acc_deviceptr} -- Get device pointer associated with specific host address.
@@table @@asis
@@item @@emph{Description}
This function returns the device address that has been mapped to the
host address specified by @@var{h}.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{void *acc_deviceptr(h_void *h);}
@@end multitable

@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
3.2.27.
@@end table



@@node acc_hostptr
@@section @@code{acc_hostptr} -- Get host pointer associated with specific device address.
@@table @@asis
@@item @@emph{Description}
This function returns the host address that has been mapped to the
device address specified by @@var{d}.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{void *acc_hostptr(d_void *d);}
@@end multitable

@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
3.2.28.
@@end table



@@node acc_is_present
@@section @@code{acc_is_present} -- Indicate whether host variable / array is present on device.
@@table @@asis
@@item @@emph{Description}
This function indicates whether the specified host address in @@var{a} and a
length of @@var{len} bytes is present on the device. In C/C++, a non-zero
value is returned to indicate the presence of the mapped memory on the
device. A zero is returned to indicate the memory is not mapped on the
device.

In Fortran, two (2) forms are supported. In the first form, @@var{a} specifies
a contiguous array section. The second form @@var{a} specifies a variable or
array element and @@var{len} specifies the length in bytes. If the host
memory is mapped to device memory, then a @@code{true} is returned. Otherwise,
a @@code{false} is return to indicate the mapped memory is not present.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{int acc_is_present(h_void *a, size_t len);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{function acc_is_present(a)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item                   @@tab @@code{logical acc_is_present}
@@item @@emph{Interface}: @@tab @@code{function acc_is_present(a, len)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item                   @@tab @@code{integer len}
@@item                   @@tab @@code{logical acc_is_present}
@@end multitable

@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
3.2.29.
@@end table



@@node acc_memcpy_to_device
@@section @@code{acc_memcpy_to_device} -- Copy host memory to device memory.
@@table @@asis
@@item @@emph{Description}
This function copies host memory specified by host address of @@var{src} to
device memory specified by the device address @@var{dest} for a length of
@@var{bytes} bytes.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{acc_memcpy_to_device(d_void *dest, h_void *src, size_t bytes);}
@@end multitable

@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
3.2.30.
@@end table



@@node acc_memcpy_from_device
@@section @@code{acc_memcpy_from_device} -- Copy device memory to host memory.
@@table @@asis
@@item @@emph{Description}
This function copies host memory specified by host address of @@var{src} from
device memory specified by the device address @@var{dest} for a length of
@@var{bytes} bytes.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{acc_memcpy_from_device(d_void *dest, h_void *src, size_t bytes);}
@@end multitable

@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
3.2.31.
@@end table



@@node acc_get_current_cuda_device
@@section @@code{acc_get_current_cuda_device} -- Get CUDA device handle.
@@table @@asis
@@item @@emph{Description}
This function returns the CUDA device handle. This handle is the same
as used by the CUDA Runtime or Driver API's.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{void *acc_get_current_cuda_device(void);}
@@end multitable

@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
A.2.1.1.
@@end table



@@node acc_get_current_cuda_context
@@section @@code{acc_get_current_cuda_context} -- Get CUDA context handle.
@@table @@asis
@@item @@emph{Description}
This function returns the CUDA context handle. This handle is the same
as used by the CUDA Runtime or Driver API's.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{acc_get_current_cuda_context(void);}
@@end multitable

@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
A.2.1.2.
@@end table



@@node acc_get_cuda_stream
@@section @@code{acc_get_cuda_stream} -- Get CUDA stream handle.
@@table @@asis
@@item @@emph{Description}
This function returns the CUDA stream handle. This handle is the same
as used by the CUDA Runtime or Driver API's.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{acc_get_cuda_stream(void);}
@@end multitable

@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
A.2.1.3.
@@end table



@@node acc_set_cuda_stream
@@section @@code{acc_set_cuda_stream} -- Set CUDA stream handle.
@@table @@asis
@@item @@emph{Description}
This function associates the stream handle specified by @@var{stream} with
the asynchronous value specified by @@var{async}.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{acc_set_cuda_stream(int async void *stream);}
@@end multitable

@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
A.2.1.4.
@@end table



@@c ---------------------------------------------------------------------
@@c OpenACC Environment Variables
@@c ---------------------------------------------------------------------

@@node OpenACC Environment Variables
@@chapter OpenACC Environment Variables

The variables @@env{ACC_DEVICE_TYPE} and @@env{ACC_DEVICE_NUM}
are defined by section 4 of the OpenACC specification in version 2.0.
The variable @@env{GCC_ACC_NOTIFY} is used for diagnostic purposes.

@@menu
* ACC_DEVICE_TYPE::
* ACC_DEVICE_NUM::
* GCC_ACC_NOTIFY::
@@end menu



@@node ACC_DEVICE_TYPE
@@section @@code{ACC_DEVICE_TYPE}
@@table @@asis
@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
4.1.
@@end table



@@node ACC_DEVICE_NUM
@@section @@code{ACC_DEVICE_NUM}
@@table @@asis
@@item @@emph{Reference}:
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
4.2.
@@end table



@@node GCC_ACC_NOTIFY
@@section @@code{GCC_ACC_NOTIFY}
@@table @@asis
@@item @@emph{Description}:
Print debug information pertaining to the accelerator.
@@end table



@@c ---------------------------------------------------------------------
@@c CUDA Streams Usage
@@c ---------------------------------------------------------------------

@@node CUDA Streams Usage
@@chapter CUDA Streams Usage

This applies to the @@code{nvptx} plugin only.

The library provides elements that perform asynchronous movement of
data and asynchronous operation of computing constructs.  This
asynchronous functionality is implemented by making use of CUDA
streams@@footnote{See "Stream Management" in "CUDA Driver API",
TRM-06703-001, Version 5.5, for additional information}.

The primary means by that the asychronous functionality is accessed
is through the use of those OpenACC directives which make use of the
@@code{async} and @@code{wait} clauses.  When the @@code{async} clause is
first used with a directive, it creates a CUDA stream.  If an
@@code{async-argument} is used with the @@code{async} clause, then the
stream is associated with the specified @@code{async-argument}.

Following the creation of an association between a CUDA stream and the
@@code{async-argument} of an @@code{async} clause, both the @@code{wait}
clause and the @@code{wait} directive can be used.  When either the
clause or directive is used after stream creation, it creates a
rendezvous point whereby execution waits until all operations
associated with the @@code{async-argument}, that is, stream, have
completed.

Normally, the management of the streams that are created as a result of
using the @@code{async} clause, is done without any intervention by the
caller.  This implies the association between the @@code{async-argument}
and the CUDA stream will be maintained for the lifetime of the program.
However, this association can be changed through the use of the library
function @@code{acc_set_cuda_stream}.  When the function
@@code{acc_set_cuda_stream} is called, the CUDA stream that was
originally associated with the @@code{async} clause will be destroyed.
Caution should be taken when changing the association as subsequent
references to the @@code{async-argument} refer to a different
CUDA stream.



@@c ---------------------------------------------------------------------
@@c OpenACC Library Interoperability
@@c ---------------------------------------------------------------------

@@node OpenACC Library Interoperability
@@chapter OpenACC Library Interoperability

@@section Introduction

The OpenACC library uses the CUDA Driver API, and may interact with
programs that use the Runtime library directly, or another library
based on the Runtime library, e.g., CUBLAS@@footnote{See section 2.26,
"Interactions with the CUDA Driver API" in
"CUDA Runtime API", Version 5.5, and section 2.27, "VDPAU
Interoperability", in "CUDA Driver API", TRM-06703-001, Version 5.5,
for additional information on library interoperability.}.
This chapter describes the use cases and what changes are
required in order to use both the OpenACC library and the CUBLAS and Runtime
libraries within a program.

@@section First invocation: NVIDIA CUBLAS library API

In this first use case (see below), a function in the CUBLAS library is called
prior to any of the functions in the OpenACC library. More specifically, the
function @@code{cublasCreate()}.

When invoked, the function initializes the library and allocates the
hardware resources on the host and the device on behalf of the caller. Once
the initialization and allocation has completed, a handle is returned to the
caller. The OpenACC library also requires initialization and allocation of
hardware resources. Since the CUBLAS library has already allocated the
hardware resources for the device, all that is left to do is to initialize
the OpenACC library and acquire the hardware resources on the host.

Prior to calling the OpenACC function that initializes the library and
allocate the host hardware resources, you need to acquire the device number
that was allocated during the call to @@code{cublasCreate()}. The invoking of the
runtime library function @@code{cudaGetDevice()} accomplishes this. Once
acquired, the device number is passed along with the device type as
parameters to the OpenACC library function @@code{acc_set_device_num()}.

Once the call to @@code{acc_set_device_num()} has completed, the OpenACC
library uses the  context that was created during the call to
@@code{cublasCreate()}. In other words, both libraries will be sharing the
same context.

@@smallexample
    /* Create the handle */
    s = cublasCreate(&h);
    if (s != CUBLAS_STATUS_SUCCESS)
    @@{
        fprintf(stderr, "cublasCreate failed %d\n", s);
        exit(EXIT_FAILURE);
    @@}

    /* Get the device number */
    e = cudaGetDevice(&dev);
    if (e != cudaSuccess)
    @@{
        fprintf(stderr, "cudaGetDevice failed %d\n", e);
        exit(EXIT_FAILURE);
    @@}

    /* Initialize OpenACC library and use device 'dev' */
    acc_set_device_num(dev, acc_device_nvidia);

@@end smallexample
@@center Use Case 1 

@@section First invocation: OpenACC library API

In this second use case (see below), a function in the OpenACC library is
called prior to any of the functions in the CUBLAS library. More specificially,
the function @@code{acc_set_device_num()}.

In the use case presented here, the function @@code{acc_set_device_num()}
is used to both initialize the OpenACC library and allocate the hardware
resources on the host and the device. In the call to the function, the
call parameters specify which device to use and what device
type to use, i.e., @@code{acc_device_nvidia}. It should be noted that this
is but one method to initialize the OpenACC library and allocate the
appropriate hardware resources. Other methods are available through the
use of environment variables and these will be discussed in the next section.

Once the call to @@code{acc_set_device_num()} has completed, other OpenACC
functions can be called as seen with multiple calls being made to
@@code{acc_copyin()}. In addition, calls can be made to functions in the
CUBLAS library. In the use case a call to @@code{cublasCreate()} is made
subsequent to the calls to @@code{acc_copyin()}.
As seen in the previous use case, a call to @@code{cublasCreate()}
initializes the CUBLAS library and allocates the hardware resources on the
host and the device.  However, since the device has already been allocated,
@@code{cublasCreate()} will only initialize the CUBLAS library and allocate
the appropriate hardware resources on the host. The context that was created
as part of the OpenACC initialization is shared with the CUBLAS library,
similarly to the first use case.

@@smallexample
    dev = 0;

    acc_set_device_num(dev, acc_device_nvidia);

    /* Copy the first set to the device */
    d_X = acc_copyin(&h_X[0], N * sizeof (float));
    if (d_X == NULL)
    @@{ 
        fprintf(stderr, "copyin error h_X\n");
        exit(EXIT_FAILURE);
    @@}

    /* Copy the second set to the device */
    d_Y = acc_copyin(&h_Y1[0], N * sizeof (float));
    if (d_Y == NULL)
    @@{ 
        fprintf(stderr, "copyin error h_Y1\n");
        exit(EXIT_FAILURE);
    @@}

    /* Create the handle */
    s = cublasCreate(&h);
    if (s != CUBLAS_STATUS_SUCCESS)
    @@{
        fprintf(stderr, "cublasCreate failed %d\n", s);
        exit(EXIT_FAILURE);
    @@}

    /* Perform saxpy using CUBLAS library function */
    s = cublasSaxpy(h, N, &alpha, d_X, 1, d_Y, 1);
    if (s != CUBLAS_STATUS_SUCCESS)
    @@{
        fprintf(stderr, "cublasSaxpy failed %d\n", s);
        exit(EXIT_FAILURE);
    @@}

    /* Copy the results from the device */
    acc_memcpy_from_device(&h_Y1[0], d_Y, N * sizeof (float));

@@end smallexample
@@center Use Case 2

@@section OpenACC library and environment variables

There are two environment variables associated with the OpenACC library
that may be used to control the device type and device number:
@@env{ACC_DEVICE_TYPE} and @@env{ACC_DEVICE_NUM}, respecively. These two
environement variables can be used as an alternative to calling
@@code{acc_set_device_num()}. As seen in the second use case, the device
type and device number were specified using @@code{acc_set_device_num()}.
If however, the aforementioned environment variables were set, then the
call to @@code{acc_set_device_num()} would not be required.


The use of the environment variables is only relevant when an OpenACC function
is called prior to a call to @@code{cudaCreate()}. If @@code{cudaCreate()}
is called prior to a call to an OpenACC function, then you must call
@@code{acc_set_device_num()}@@footnote{More complete information
about @@env{ACC_DEVICE_TYPE} and @@env{ACC_DEVICE_NUM} can be found in
sections 4.1 and 4.2 of the @@uref{http://www.openacc.org/, OpenACC}
Application Programming Interface”, Version 2.0.}



@@c ---------------------------------------------------------------------
@@c The libgomp ABI
@@c ---------------------------------------------------------------------

@@node The libgomp ABI
@@chapter The libgomp ABI

The following sections present notes on the external ABI as 
presented by libgomp.  Only maintainers should need them.

@@menu
* Implementing MASTER construct::
* Implementing CRITICAL construct::
* Implementing ATOMIC construct::
* Implementing FLUSH construct::
* Implementing BARRIER construct::
* Implementing THREADPRIVATE construct::
* Implementing PRIVATE clause::
* Implementing FIRSTPRIVATE LASTPRIVATE COPYIN and COPYPRIVATE clauses::
* Implementing REDUCTION clause::
* Implementing PARALLEL construct::
* Implementing FOR construct::
* Implementing ORDERED construct::
* Implementing SECTIONS construct::
* Implementing SINGLE construct::
* Implementing OpenACC's PARALLEL construct::
@@end menu


@@node Implementing MASTER construct
@@section Implementing MASTER construct

@@smallexample
if (omp_get_thread_num () == 0)
  block
@@end smallexample

Alternately, we generate two copies of the parallel subfunction
and only include this in the version run by the master thread.
Surely this is not worthwhile though...



@@node Implementing CRITICAL construct
@@section Implementing CRITICAL construct

Without a specified name,

@@smallexample
  void GOMP_critical_start (void);
  void GOMP_critical_end (void);
@@end smallexample

so that we don't get COPY relocations from libgomp to the main
application.

With a specified name, use omp_set_lock and omp_unset_lock with
name being transformed into a variable declared like

@@smallexample
  omp_lock_t gomp_critical_user_<name> __attribute__((common))
@@end smallexample

Ideally the ABI would specify that all zero is a valid unlocked
state, and so we wouldn't need to initialize this at
startup.



@@node Implementing ATOMIC construct
@@section Implementing ATOMIC construct

The target should implement the @@code{__sync} builtins.

Failing that we could add

@@smallexample
  void GOMP_atomic_enter (void)
  void GOMP_atomic_exit (void)
@@end smallexample

which reuses the regular lock code, but with yet another lock
object private to the library.



@@node Implementing FLUSH construct
@@section Implementing FLUSH construct

Expands to the @@code{__sync_synchronize} builtin.



@@node Implementing BARRIER construct
@@section Implementing BARRIER construct

@@smallexample
  void GOMP_barrier (void)
@@end smallexample


@@node Implementing THREADPRIVATE construct
@@section Implementing THREADPRIVATE construct

In _most_ cases we can map this directly to @@code{__thread}.  Except
that OMP allows constructors for C++ objects.  We can either
refuse to support this (how often is it used?) or we can 
implement something akin to .ctors.

Even more ideally, this ctor feature is handled by extensions
to the main pthreads library.  Failing that, we can have a set
of entry points to register ctor functions to be called.



@@node Implementing PRIVATE clause
@@section Implementing PRIVATE clause

In association with a PARALLEL, or within the lexical extent
of a PARALLEL block, the variable becomes a local variable in
the parallel subfunction.

In association with FOR or SECTIONS blocks, create a new
automatic variable within the current function.  This preserves
the semantic of new variable creation.



@@node Implementing FIRSTPRIVATE LASTPRIVATE COPYIN and COPYPRIVATE clauses
@@section Implementing FIRSTPRIVATE LASTPRIVATE COPYIN and COPYPRIVATE clauses

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.

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)
for (int i = 0; i < n; ++i)
  body;
@@end smallexample

which becomes

@@smallexample
@@{
  int x = x, y;

  // for stuff

  if (i == n)
    y = y;
@@}
@@end smallexample

where the "x=x" and "y=y" assignments actually have different
uids for the two variables, i.e. not something you could write
directly in C.  Presumably this only makes sense if the "outer"
x and y are global variables.

COPYPRIVATE would work the same way, except the structure 
broadcast would have to happen via SINGLE machinery instead.



@@node Implementing REDUCTION clause
@@section Implementing REDUCTION clause

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 to collect the values.


@@node Implementing PARALLEL construct
@@section Implementing PARALLEL construct

@@smallexample
  #pragma omp parallel
  @@{
    body;
  @@}
@@end smallexample

becomes

@@smallexample
  void subfunction (void *data)
  @@{
    use data;
    body;
  @@}

  setup data;
  GOMP_parallel_start (subfunction, &data, num_threads);
  subfunction (&data);
  GOMP_parallel_end ();
@@end smallexample
a2096 9
@@node Implementing OpenACC's PARALLEL construct
@@section Implementing OpenACC's PARALLEL construct

@@smallexample
  void GOACC_parallel ()
@@end smallexample



@


1.1.1.4.4.1
log
@Sync with HEAD
@
text
@d10 1
a10 1
Copyright @@copyright{} 2006-2017 Free Software Foundation, Inc.
@


1.1.1.4.4.2
log
@Mostly merge changes from HEAD upto 20200411
@
text
@d10 1
a10 1
Copyright @@copyright{} 2006-2018 Free Software Foundation, Inc.
d80 1
a80 1
@@uref{https://www.openacc.org, OpenACC} Application Programming
d1819 1
a1819 1
the @@uref{https://www.openacc.org, OpenACC} Application Programming
d1921 1
a1921 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d1946 1
a1946 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d1971 1
a1971 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d1998 1
a1998 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2025 1
a2025 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2054 1
a2054 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2082 1
a2082 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
a2097 1
@@item @@emph{Prototype (OpenACC 1.0 compatibility)}: @@tab @@code{acc_async_wait(arg);}
a2103 2
@@item @@emph{Interface (OpenACC 1.0 compatibility)}: @@tab @@code{subroutine acc_async_wait(arg)}
@@item                                               @@tab @@code{integer(acc_handle_kind) arg}
d2107 1
a2107 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
a2121 1
@@item @@emph{Prototype (OpenACC 1.0 compatibility)}: @@tab @@code{acc_async_wait_all(void);}
d2126 1
a2126 2
@@item @@emph{Interface}: @@tab @@code{subroutine acc_wait_all()}
@@item @@emph{Interface (OpenACC 1.0 compatibility)}: @@tab @@code{subroutine acc_async_wait_all()}
d2130 1
a2130 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2156 1
a2156 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2181 1
a2181 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2206 1
a2206 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2231 1
a2231 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2262 1
a2262 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2281 1
a2281 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2299 1
a2299 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2332 1
a2332 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2372 1
a2372 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2405 1
a2405 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2446 1
a2446 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2478 1
a2478 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2510 1
a2510 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2543 1
a2543 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2576 1
a2576 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2596 1
a2596 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2615 1
a2615 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2634 1
a2634 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2653 1
a2653 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2692 1
a2692 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2712 1
a2712 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2732 1
a2732 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2751 1
a2751 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2770 1
a2770 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2789 1
a2789 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2808 1
a2808 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2837 1
a2837 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2847 1
a2847 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d3063 1
a3063 1
sections 4.1 and 4.2 of the @@uref{https://www.openacc.org, OpenACC}
@


1.1.1.4.2.1
log
@Sync with HEAD
@
text
@d10 1
a10 1
Copyright @@copyright{} 2006-2017 Free Software Foundation, Inc.
@


1.1.1.5
log
@import GCC 7.4.0.  main changes include:

The non-standard C++0x type traits has_trivial_default_constructor,
has_trivial_copy_constructor and has_trivial_copy_assign have been
removed.

On ARM targets (arm*-*-*), a bug introduced in GCC 5 that affects
conformance to the procedure call standard (AAPCS) has been fixed.

Many optimiser improvements

DWARF-5 support.

Many new and enhanced warnings.

Warnings about format strings now underline the pertinent part of
the string, and can offer suggested fixes.

Several new warnings related to buffer overflows and buffer
truncation.

New __builtin_add_overflow_p, __builtin_sub_overflow_p,
__builtin_mul_overflow_p built-ins added that test for overflow.

The C++ front end has experimental support for all of the current
C++17 draft.

The -fverbose-asm option has been expanded to prints comments
showing the source lines that correspond to the assembly.

The gcc and g++ driver programs will now provide suggestions for
misspelled arguments to command-line options.


AArch64 specific:

GCC has been updated to the latest revision of the procedure call
standard (AAPCS64) to provide support for parameter passing when
data types have been over-aligned.

The ARMv8.2-A and ARMv8.3-A architecture are now supported.

ARM specific:

Support for the ARMv5 and ARMv5E architectures has been
deprecated (which have no known implementations).

A new command-line option -mpure-code has been added. It does not
allow constant data to be placed in code sections.

x86 specific:

Support for the AVX-512 4FMAPS, 4VNNIW, VPOPCNTDQ and Software
Guard Extensions (SGX) ISA extensions has been added.

PPC specific:

GCC now diagnoses inline assembly that clobbers register r2.

RISC-V specific:

Support for the RISC-V instruction set has been added.

SH specific:

Support for SH5/SH64 has been removed.

Support for SH2A has been enhanced.
@
text
@d10 1
a10 1
Copyright @@copyright{} 2006-2017 Free Software Foundation, Inc.
@


1.1.1.6
log
@import GCC 8.3.  it includes these new features:
- many optimisations improved: inter-procedural, profile-directed,
  LTO, loops including user-controllable unroll support, and more.
- columns numbers added to line numbers in dwarf
- gcov extended significantly
- many sanitizer updates
- many new warning messages
- many better hints and more useful error messages
- minor ABI changes on x86-64 libstdc++, and some c++17 modes
- draft c++2a features
- better c++17 experimental support
- Armv8.4-A supported, better 8.2-A and 8.3-A support, including
  32 bit arm port.  cortex a-55, a-75 and a-55.a-75 combo support.
- in the GCC bugzilla, 8.1 shows 1149 bugs fixed, 8.2 shows 100, and
  8.3 shows 158.
@
text
@d10 1
a10 1
Copyright @@copyright{} 2006-2018 Free Software Foundation, Inc.
d80 1
a80 1
@@uref{https://www.openacc.org, OpenACC} Application Programming
d1819 1
a1819 1
the @@uref{https://www.openacc.org, OpenACC} Application Programming
d1921 1
a1921 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d1946 1
a1946 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d1971 1
a1971 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d1998 1
a1998 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2025 1
a2025 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2054 1
a2054 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2082 1
a2082 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
a2097 1
@@item @@emph{Prototype (OpenACC 1.0 compatibility)}: @@tab @@code{acc_async_wait(arg);}
a2103 2
@@item @@emph{Interface (OpenACC 1.0 compatibility)}: @@tab @@code{subroutine acc_async_wait(arg)}
@@item                                               @@tab @@code{integer(acc_handle_kind) arg}
d2107 1
a2107 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
a2121 1
@@item @@emph{Prototype (OpenACC 1.0 compatibility)}: @@tab @@code{acc_async_wait_all(void);}
d2126 1
a2126 2
@@item @@emph{Interface}: @@tab @@code{subroutine acc_wait_all()}
@@item @@emph{Interface (OpenACC 1.0 compatibility)}: @@tab @@code{subroutine acc_async_wait_all()}
d2130 1
a2130 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2156 1
a2156 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2181 1
a2181 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2206 1
a2206 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2231 1
a2231 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2262 1
a2262 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2281 1
a2281 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2299 1
a2299 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2332 1
a2332 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2372 1
a2372 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2405 1
a2405 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2446 1
a2446 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2478 1
a2478 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2510 1
a2510 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2543 1
a2543 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2576 1
a2576 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2596 1
a2596 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2615 1
a2615 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2634 1
a2634 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2653 1
a2653 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2692 1
a2692 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2712 1
a2712 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2732 1
a2732 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2751 1
a2751 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2770 1
a2770 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2789 1
a2789 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2808 1
a2808 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2837 1
a2837 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2847 1
a2847 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d3063 1
a3063 1
sections 4.1 and 4.2 of the @@uref{https://www.openacc.org, OpenACC}
@


1.1.1.7
log
@import GCC 7.5.0.  doing this here so that the vendor branch has
the code we'll merge into gcc.old and the netbsd-9 tree gcc tree.
GCC 8.4.0 will be imported immediately on top of this again,
restoring the current status.

these PRs in the GCC bugzilla are fixed with this update:

89869 80693 89795 84272 85593 86669 87148 87647 87895 88103 88107 88563
88870 88976 89002 89187 89195 89234 89303 89314 89354 89361 89403 89412
89512 89520 89590 89621 89663 89679 89704 89734 89872 89933 90090 90208
87075 85870 89009 89242 88167 80864 81933 85890 86608 87145 88857 89024
89119 89214 89511 89612 89705 89400 81740 82186 84552 86554 87609 88105
88149 88415 88739 88903 89135 89223 89296 89505 89572 89677 89698 89710
90006 90020 90071 90328 90474 91126 91162 91812 91887 90075 88998 89945
87047 87506 88074 88656 88740 91137 89008 84010 89349 91136 91347 91995
89397 87030 60702 78884 85594 87649 87725 88181 88470 88553 88568 88588
88620 88644 88906 88949 89246 89587 89726 89768 89796 89998 90108 90756
90950 91704 88825 88983 86538 51333 89446 90220 91308 92143 89392 90213
90278 91131 91200 91510 89037 91481 87673 88418 88938 88948 90547 27221
58321 61250 67183 67958 77583 83531 86215 88648 88720 88726 89091 89466
89629 90105 90329 90585 90760 90924 91087 89222 81956 71861 35031 69455
81849 82993 85798 88138 88155 88169 88205 88206 88228 88249 88269 88376
77703 80260 82077 86248 88393 90786 57048 66089 66695 67679 68009 71723
72714 84394 85544 87734 88298 90937 91557 63891 64132 65342 68649 68717
71066 71860 71935 77746 78421 78645 78865 78983 79485 79540 85953 88326
89651 90744
@
text
@d10 1
a10 1
Copyright @@copyright{} 2006-2017 Free Software Foundation, Inc.
d80 1
a80 1
@@uref{http://www.openacc.org/, OpenACC} Application Programming
d1819 1
a1819 1
the @@uref{http://www.openacc.org/, OpenACC} Application Programming
d1921 1
a1921 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d1946 1
a1946 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d1971 1
a1971 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d1998 1
a1998 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d2025 1
a2025 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d2054 1
a2054 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d2082 1
a2082 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d2098 1
d2105 2
d2110 1
a2110 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d2125 1
d2130 2
a2131 1
@@item @@emph{Interface}: @@tab @@code{subroutine acc_wait_async()}
d2135 1
a2135 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d2161 1
a2161 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d2186 1
a2186 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d2211 1
a2211 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d2236 1
a2236 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d2267 1
a2267 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d2286 1
a2286 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d2304 1
a2304 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d2337 1
a2337 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d2377 1
a2377 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d2410 1
a2410 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d2451 1
a2451 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d2483 1
a2483 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d2515 1
a2515 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d2548 1
a2548 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d2581 1
a2581 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d2601 1
a2601 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d2620 1
a2620 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d2639 1
a2639 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d2658 1
a2658 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d2697 1
a2697 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d2717 1
a2717 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d2737 1
a2737 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d2756 1
a2756 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d2775 1
a2775 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d2794 1
a2794 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d2813 1
a2813 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d2842 1
a2842 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d2852 1
a2852 1
@@uref{http://www.openacc.org/, OpenACC specification v2.0}, section
d3068 1
a3068 1
sections 4.1 and 4.2 of the @@uref{http://www.openacc.org/, OpenACC}
@


1.1.1.8
log
@re-import GCC 8.4.0.
@
text
@d10 1
a10 1
Copyright @@copyright{} 2006-2018 Free Software Foundation, Inc.
d80 1
a80 1
@@uref{https://www.openacc.org, OpenACC} Application Programming
d1819 1
a1819 1
the @@uref{https://www.openacc.org, OpenACC} Application Programming
d1921 1
a1921 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d1946 1
a1946 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d1971 1
a1971 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d1998 1
a1998 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2025 1
a2025 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2054 1
a2054 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2082 1
a2082 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
a2097 1
@@item @@emph{Prototype (OpenACC 1.0 compatibility)}: @@tab @@code{acc_async_wait(arg);}
a2103 2
@@item @@emph{Interface (OpenACC 1.0 compatibility)}: @@tab @@code{subroutine acc_async_wait(arg)}
@@item                                               @@tab @@code{integer(acc_handle_kind) arg}
d2107 1
a2107 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
a2121 1
@@item @@emph{Prototype (OpenACC 1.0 compatibility)}: @@tab @@code{acc_async_wait_all(void);}
d2126 1
a2126 2
@@item @@emph{Interface}: @@tab @@code{subroutine acc_wait_all()}
@@item @@emph{Interface (OpenACC 1.0 compatibility)}: @@tab @@code{subroutine acc_async_wait_all()}
d2130 1
a2130 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2156 1
a2156 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2181 1
a2181 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2206 1
a2206 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2231 1
a2231 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2262 1
a2262 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2281 1
a2281 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2299 1
a2299 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2332 1
a2332 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2372 1
a2372 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2405 1
a2405 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2446 1
a2446 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2478 1
a2478 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2510 1
a2510 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2543 1
a2543 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2576 1
a2576 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2596 1
a2596 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2615 1
a2615 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2634 1
a2634 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2653 1
a2653 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2692 1
a2692 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2712 1
a2712 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2732 1
a2732 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2751 1
a2751 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2770 1
a2770 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2789 1
a2789 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2808 1
a2808 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2837 1
a2837 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d2847 1
a2847 1
@@uref{https://www.openacc.org, OpenACC specification v2.0}, section
d3063 1
a3063 1
sections 4.1 and 4.2 of the @@uref{https://www.openacc.org, OpenACC}
@


1.1.1.9
log
@initial import of GCC 9.3.0.  changes include:

- live patching support
- shell completion help
- generally better diagnostic output (less verbose/more useful)
- diagnostics and optimisation choices can be emitted in json
- asan memory usage reduction
- many general, and specific to switch, inter-procedure,
  profile and link-time optimisations.  from the release notes:
  "Overall compile time of Firefox 66 and LibreOffice 6.2.3 on
  an 8-core machine was reduced by about 5% compared to GCC 8.3"
- OpenMP 5.0 support
- better spell-guesser
- partial experimental support for c2x and c++2a
- c++17 is no longer experimental
- arm AAPCS GCC 6-8 structure passing bug fixed, may cause
  incompatibility (restored compat with GCC 5 and earlier.)
- openrisc support
@
text
@d10 1
a10 1
Copyright @@copyright{} 2006-2019 Free Software Foundation, Inc.
d77 1
a77 1
implementation of the @@uref{https://www.openmp.org, OpenMP} Application
d98 1
a98 2
* OpenMP Runtime Library Routines: Runtime Library Routines.
                               The OpenMP runtime application programming
d100 2
a101 3
* OpenMP Environment Variables: Environment Variables.
                               Influencing OpenMP runtime behavior with
                               environment variables.
d142 1
a142 1
the @@uref{https://www.openmp.org, OpenMP Application Program Interface} manual,
d147 1
a147 1
@@c OpenMP Runtime Library Routines
d151 1
a151 1
@@chapter OpenMP Runtime Library Routines
d233 1
a233 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.20.
d262 1
a262 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.18.
d290 1
a290 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.9.
d315 1
a315 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.30.
d347 1
a347 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.8.
d373 1
a373 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.17.
d398 1
a398 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.16.
d420 1
a420 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.29.
d445 1
a445 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.3.
d477 1
a477 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.11.
d499 1
a499 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.31.
d521 1
a521 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.5.
d543 1
a543 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.32.
d576 1
a576 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.2.
d604 1
a604 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.22.
d634 1
a634 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.13.
d656 1
a656 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.33.
d686 1
a686 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.19.
d711 1
a711 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.14.
d740 1
a740 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.4.
d764 1
a764 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.6.
d787 1
a787 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.21.
d811 1
a811 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.34.
d838 1
a838 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.29.
d867 1
a867 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.7.
d894 1
a894 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.15.
d923 1
a923 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.10.
d951 1
a951 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.1.
d984 1
a984 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.12.
d1011 1
a1011 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.1.
d1040 1
a1040 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.4.
d1070 1
a1070 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.6.
d1100 1
a1100 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.5.
d1127 1
a1127 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.3.
d1154 1
a1154 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.1.
d1182 1
a1182 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.4.
d1213 1
a1213 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.6.
d1243 1
a1243 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.5.
d1270 1
a1270 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.3.
d1296 1
a1296 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.4.2.
d1324 1
a1324 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.4.1.
d1330 1
a1330 1
@@c OpenMP Environment Variables
d1334 1
a1334 1
@@chapter OpenMP Environment Variables
d1375 1
a1375 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.11
d1393 1
a1393 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.12
d1414 1
a1414 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.13
d1433 1
a1433 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.3
d1451 1
a1451 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.9
d1471 1
a1471 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.14
d1491 1
a1491 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.6
d1511 1
a1511 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.2
d1538 1
a1538 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.4
d1580 1
a1580 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.5
d1600 1
a1600 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.7
d1621 1
a1621 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Sections 2.7.1.1 and 4.1
d1639 1
a1639 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.10
d1659 1
a1659 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 4.8
d2771 1
a2771 1
@@item @@emph{Prototype}: @@tab @@code{void *acc_get_current_cuda_context(void);}
d2785 2
a2786 2
This function returns the CUDA stream handle for the queue @@var{async}.
This handle is the same as used by the CUDA Runtime or Driver API's.
d2790 1
a2790 1
@@item @@emph{Prototype}: @@tab @@code{void *acc_get_cuda_stream(int async);}
d2805 1
a2805 6
the queue @@var{async}.

This cannot be used to change the stream handle associated with
@@code{acc_async_sync}.

The return value is not specified.
d2809 1
a2809 1
@@item @@emph{Prototype}: @@tab @@code{int acc_set_cuda_stream(int async, void *stream);}
@


1.1.1.10
log
@initial import of GCC 10.3.0.  main changes include:

caveats:
- ABI issue between c++14 and c++17 fixed
- profile mode is removed from libstdc++
- -fno-common is now the default

new features:
- new flags -fallocation-dce, -fprofile-partial-training,
  -fprofile-reproducible, -fprofile-prefix-path, and -fanalyzer
- many new compile and link time optimisations
- enhanced drive optimisations
- openacc 2.6 support
- openmp 5.0 features
- new warnings: -Wstring-compare and -Wzero-length-bounds
- extended warnings: -Warray-bounds, -Wformat-overflow,
  -Wrestrict, -Wreturn-local-addr, -Wstringop-overflow,
  -Warith-conversion, -Wmismatched-tags, and -Wredundant-tags
- some likely C2X features implemented
- more C++20 implemented
- many new arm & intel CPUs known

hundreds of reported bugs are fixed.  full list of changes
can be found at:

   https://gcc.gnu.org/gcc-10/changes.html
@
text
@d10 1
a10 1
Copyright @@copyright{} 2006-2020 Free Software Foundation, Inc.
a113 1
* OpenACC Profiling Interface::
d1729 1
a1729 1
@@uref{https://gcc.gnu.org/ml/gcc-patches/2006-06/msg00493.html,
d1731 1
a1731 1
@@uref{https://gcc.gnu.org/ml/gcc-patches/2006-06/msg00496.html,
d1813 1
a1813 1
@@code{#pragma acc} in C/C++ and @@code{!$acc} directives in free form,
a1819 2
See @@uref{https://gcc.gnu.org/wiki/OpenACC} for more information.

d1822 5
a1826 1
Interface manual, version 2.6.
d1838 1
a1838 1
specifications in version 2.6.
a1850 1
* acc_get_property::            Get device property.
d1853 1
a1853 1
* acc_async_test_all::          Tests for completion of all asynchronous
d1857 1
a1857 1
* acc_wait_all::                Waits for completion of all asynchronous
d1889 1
a1889 1
* acc_is_present::              Indicate whether host variable / array is
a1892 2
* acc_attach::                  Let device pointer point to device-pointer target.
* acc_detach::                  Let device pointer point to host-pointer target.
a1899 7

API routines for the OpenACC Profiling Interface.

* acc_prof_register::           Register callbacks.
* acc_prof_unregister::         Unregister callbacks.
* acc_prof_lookup::             Obtain inquiry functions.
* acc_register_library::        Library registration.
d1923 1
a1923 1
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
d1933 1
a1933 1
This function indicates to the runtime library which device type, specified
d1948 1
a1948 1
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
a1960 6
This function returns @@code{acc_device_none} if
@@code{acc_get_device_type} is called from
@@code{acc_ev_device_init_start}, @@code{acc_ev_device_init_end}
callbacks of the OpenACC Profiling Interface (@@ref{OpenACC Profiling
Interface}), that is, if the device is currently being initialized.

d1973 1
a1973 1
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
d1984 1
a1984 1
specified by @@var{devicenum}, associated with the specified device
d1989 1
a1989 1
@@item @@emph{Prototype}: @@tab @@code{acc_set_device_num(int devicenum, acc_device_t devicetype);}
d2000 1
a2000 1
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
d2027 1
a2027 1
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
a2032 47
@@node acc_get_property
@@section @@code{acc_get_property} -- Get device property.
@@cindex acc_get_property
@@cindex acc_get_property_string
@@table @@asis
@@item @@emph{Description}
These routines return the value of the specified @@var{property} for the
device being queried according to @@var{devicenum} and @@var{devicetype}.
Integer-valued and string-valued properties are returned by
@@code{acc_get_property} and @@code{acc_get_property_string} respectively.
The Fortran @@code{acc_get_property_string} subroutine returns the string
retrieved in its fourth argument while the remaining entry points are
functions, which pass the return value as their result.

Note for Fortran, only: the OpenACC technical committee corrected and, hence,
modified the interface introduced in OpenACC 2.6.  The kind-value parameter
@@code{acc_device_property} has been renamed to @@code{acc_device_property_kind}
for consistency and the return type of the @@code{acc_get_property} function is
now a @@code{c_size_t} integer instead of a @@code{acc_device_property} integer.
The parameter @@code{acc_device_property} will continue to be provided,
but might be removed in a future version of GCC.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{size_t acc_get_property(int devicenum, acc_device_t devicetype, acc_device_property_t property);}
@@item @@emph{Prototype}: @@tab @@code{const char *acc_get_property_string(int devicenum, acc_device_t devicetype, acc_device_property_t property);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{function acc_get_property(devicenum, devicetype, property)}
@@item @@emph{Interface}: @@tab @@code{subroutine acc_get_property_string(devicenum, devicetype, property, string)}
@@item                   @@tab @@code{use ISO_C_Binding, only: c_size_t}
@@item                   @@tab @@code{integer devicenum}
@@item                   @@tab @@code{integer(kind=acc_device_kind) devicetype}
@@item                   @@tab @@code{integer(kind=acc_device_property_kind) property}
@@item                   @@tab @@code{integer(kind=c_size_t) acc_get_property}
@@item                   @@tab @@code{character(*) string}
@@end multitable

@@item @@emph{Reference}:
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
3.2.6.
@@end table



d2037 1
a2037 1
This function tests for completion of the asynchronous operation specified
d2040 1
a2040 1
a @@code{true}. If the asynchronous operation has not completed, C/C++ returns
d2056 2
a2057 2
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
3.2.9.
d2066 1
a2066 1
This function tests for completion of all asynchronous operations.
d2084 2
a2085 2
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
3.2.10.
d2112 2
a2113 2
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
3.2.11.
d2137 2
a2138 2
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
3.2.13.
d2163 2
a2164 2
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
3.2.14.
d2188 2
a2189 2
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
3.2.12.
d2213 2
a2214 2
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
3.2.7.
d2238 2
a2239 2
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
3.2.8.
d2250 1
a2250 1
returned to indicate the device is executing on the specified device type.
d2269 2
a2270 2
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
3.2.17.
d2288 2
a2289 2
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
3.2.18.
d2306 2
a2307 2
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
3.2.19.
a2326 1
@@item @@emph{Prototype}: @@tab @@code{void *acc_copyin_async(h_void *a, size_t len, int async);}
a2335 7
@@item @@emph{Interface}: @@tab @@code{subroutine acc_copyin_async(a, async)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item                   @@tab @@code{integer(acc_handle_kind) :: async}
@@item @@emph{Interface}: @@tab @@code{subroutine acc_copyin_async(a, len, async)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item                   @@tab @@code{integer len}
@@item                   @@tab @@code{integer(acc_handle_kind) :: async}
d2339 2
a2340 2
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
3.2.20.
d2349 1
a2349 1
This function tests if the host data specified by @@var{a} and of length
a2357 3
Note that @@code{acc_present_or_copyin} and @@code{acc_pcopyin} exist for
backward compatibility with OpenACC 2.0; use @@ref{acc_copyin} instead.

d2379 2
a2380 2
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
3.2.20.
a2399 1
@@item @@emph{Prototype}: @@tab @@code{void *acc_create_async(h_void *a, size_t len, int async);}
a2408 7
@@item @@emph{Interface}: @@tab @@code{subroutine acc_create_async(a, async)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item                   @@tab @@code{integer(acc_handle_kind) :: async}
@@item @@emph{Interface}: @@tab @@code{subroutine acc_create_async(a, len, async)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item                   @@tab @@code{integer len}
@@item                   @@tab @@code{integer(acc_handle_kind) :: async}
d2412 2
a2413 2
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
3.2.21.
d2422 1
a2422 1
This function tests if the host data specified by @@var{a} and of length
a2430 2
Note that @@code{acc_present_or_create} and @@code{acc_pcreate} exist for
backward compatibility with OpenACC 2.0; use @@ref{acc_create} instead.
d2453 2
a2454 2
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
3.2.21.
a2472 3
@@item @@emph{Prototype}: @@tab @@code{acc_copyout_async(h_void *a, size_t len, int async);}
@@item @@emph{Prototype}: @@tab @@code{acc_copyout_finalize(h_void *a, size_t len);}
@@item @@emph{Prototype}: @@tab @@code{acc_copyout_finalize_async(h_void *a, size_t len, int async);}
a2481 19
@@item @@emph{Interface}: @@tab @@code{subroutine acc_copyout_async(a, async)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item                   @@tab @@code{integer(acc_handle_kind) :: async}
@@item @@emph{Interface}: @@tab @@code{subroutine acc_copyout_async(a, len, async)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item                   @@tab @@code{integer len}
@@item                   @@tab @@code{integer(acc_handle_kind) :: async}
@@item @@emph{Interface}: @@tab @@code{subroutine acc_copyout_finalize(a)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item @@emph{Interface}: @@tab @@code{subroutine acc_copyout_finalize(a, len)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item                   @@tab @@code{integer len}
@@item @@emph{Interface}: @@tab @@code{subroutine acc_copyout_finalize_async(a, async)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item                   @@tab @@code{integer(acc_handle_kind) :: async}
@@item @@emph{Interface}: @@tab @@code{subroutine acc_copyout_finalize_async(a, len, async)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item                   @@tab @@code{integer len}
@@item                   @@tab @@code{integer(acc_handle_kind) :: async}
d2485 2
a2486 2
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
3.2.22.
a2504 3
@@item @@emph{Prototype}: @@tab @@code{acc_delete_async(h_void *a, size_t len, int async);}
@@item @@emph{Prototype}: @@tab @@code{acc_delete_finalize(h_void *a, size_t len);}
@@item @@emph{Prototype}: @@tab @@code{acc_delete_finalize_async(h_void *a, size_t len, int async);}
a2513 19
@@item @@emph{Interface}: @@tab @@code{subroutine acc_delete_async(a, async)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item                   @@tab @@code{integer(acc_handle_kind) :: async}
@@item @@emph{Interface}: @@tab @@code{subroutine acc_delete_async(a, len, async)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item                   @@tab @@code{integer len}
@@item                   @@tab @@code{integer(acc_handle_kind) :: async}
@@item @@emph{Interface}: @@tab @@code{subroutine acc_delete_finalize(a)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item @@emph{Interface}: @@tab @@code{subroutine acc_delete_finalize(a, len)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item                   @@tab @@code{integer len}
@@item @@emph{Interface}: @@tab @@code{subroutine acc_delete_async_finalize(a, async)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item                   @@tab @@code{integer(acc_handle_kind) :: async}
@@item @@emph{Interface}: @@tab @@code{subroutine acc_delete_async_finalize(a, len, async)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item                   @@tab @@code{integer len}
@@item                   @@tab @@code{integer(acc_handle_kind) :: async}
d2517 2
a2518 2
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
3.2.23.
a2537 1
@@item @@emph{Prototype}: @@tab @@code{acc_update_device(h_void *a, size_t len, async);}
a2546 7
@@item @@emph{Interface}: @@tab @@code{subroutine acc_update_device_async(a, async)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item                   @@tab @@code{integer(acc_handle_kind) :: async}
@@item @@emph{Interface}: @@tab @@code{subroutine acc_update_device_async(a, len, async)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item                   @@tab @@code{integer len}
@@item                   @@tab @@code{integer(acc_handle_kind) :: async}
d2550 2
a2551 2
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
3.2.24.
a2570 1
@@item @@emph{Prototype}: @@tab @@code{acc_update_self_async(h_void *a, size_t len, int async);}
a2579 7
@@item @@emph{Interface}: @@tab @@code{subroutine acc_update_self_async(a, async)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item                   @@tab @@code{integer(acc_handle_kind) :: async}
@@item @@emph{Interface}: @@tab @@code{subroutine acc_update_self_async(a, len, async)}
@@item                   @@tab @@code{type, dimension(:[,:]...) :: a}
@@item                   @@tab @@code{integer len}
@@item                   @@tab @@code{integer(acc_handle_kind) :: async}
d2583 2
a2584 2
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
3.2.25.
d2603 2
a2604 2
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
3.2.26.
d2622 2
a2623 2
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
3.2.27.
d2641 2
a2642 2
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
3.2.28.
d2660 2
a2661 2
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
3.2.29.
d2699 2
a2700 2
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
3.2.30.
d2719 2
a2720 2
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
3.2.31.
d2739 2
a2740 44
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
3.2.32.
@@end table



@@node acc_attach
@@section @@code{acc_attach} -- Let device pointer point to device-pointer target.
@@table @@asis
@@item @@emph{Description}
This function updates a pointer on the device from pointing to a host-pointer
address to pointing to the corresponding device data.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{acc_attach(h_void **ptr);}
@@item @@emph{Prototype}: @@tab @@code{acc_attach_async(h_void **ptr, int async);}
@@end multitable

@@item @@emph{Reference}:
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
3.2.34.
@@end table



@@node acc_detach
@@section @@code{acc_detach} -- Let device pointer point to host-pointer target.
@@table @@asis
@@item @@emph{Description}
This function updates a pointer on the device from pointing to a device-pointer
address to pointing to the corresponding host data.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{acc_detach(h_void **ptr);}
@@item @@emph{Prototype}: @@tab @@code{acc_detach_async(h_void **ptr, int async);}
@@item @@emph{Prototype}: @@tab @@code{acc_detach_finalize(h_void **ptr);}
@@item @@emph{Prototype}: @@tab @@code{acc_detach_finalize_async(h_void **ptr, int async);}
@@end multitable

@@item @@emph{Reference}:
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
3.2.35.
d2758 1
a2758 1
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
d2777 1
a2777 1
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
d2796 1
a2796 1
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
d2820 1
a2820 1
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
a2825 84
@@node acc_prof_register
@@section @@code{acc_prof_register} -- Register callbacks.
@@table @@asis
@@item @@emph{Description}:
This function registers callbacks.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{void acc_prof_register (acc_event_t, acc_prof_callback, acc_register_t);}
@@end multitable

@@item @@emph{See also}:
@@ref{OpenACC Profiling Interface}

@@item @@emph{Reference}:
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
5.3.
@@end table



@@node acc_prof_unregister
@@section @@code{acc_prof_unregister} -- Unregister callbacks.
@@table @@asis
@@item @@emph{Description}:
This function unregisters callbacks.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{void acc_prof_unregister (acc_event_t, acc_prof_callback, acc_register_t);}
@@end multitable

@@item @@emph{See also}:
@@ref{OpenACC Profiling Interface}

@@item @@emph{Reference}:
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
5.3.
@@end table



@@node acc_prof_lookup
@@section @@code{acc_prof_lookup} -- Obtain inquiry functions.
@@table @@asis
@@item @@emph{Description}:
Function to obtain inquiry functions.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{acc_query_fn acc_prof_lookup (const char *);}
@@end multitable

@@item @@emph{See also}:
@@ref{OpenACC Profiling Interface}

@@item @@emph{Reference}:
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
5.3.
@@end table



@@node acc_register_library
@@section @@code{acc_register_library} -- Library registration.
@@table @@asis
@@item @@emph{Description}:
Function for library registration.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{void acc_register_library (acc_prof_reg, acc_prof_reg, acc_prof_lookup_func);}
@@end multitable

@@item @@emph{See also}:
@@ref{OpenACC Profiling Interface}, @@ref{ACC_PROFLIB}

@@item @@emph{Reference}:
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
5.3.
@@end table



a2834 2
The variable @@env{ACC_PROFLIB}
is defined by section 4 of the OpenACC specification in version 2.6.
a2839 1
* ACC_PROFLIB::
d2849 1
a2849 1
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
d2859 1
a2859 1
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
a2864 13
@@node ACC_PROFLIB
@@section @@code{ACC_PROFLIB}
@@table @@asis
@@item @@emph{See also}:
@@ref{acc_register_library}, @@ref{OpenACC Profiling Interface}

@@item @@emph{Reference}:
@@uref{https://www.openacc.org, OpenACC specification v2.6}, section
4.3.
@@end table



d2889 1
a2889 1
The primary means by that the asynchronous functionality is accessed
d3062 2
a3063 2
@@env{ACC_DEVICE_TYPE} and @@env{ACC_DEVICE_NUM}, respectively. These two
environment variables can be used as an alternative to calling
d3076 1
a3076 310
Application Programming Interface”, Version 2.6.}



@@c ---------------------------------------------------------------------
@@c OpenACC Profiling Interface
@@c ---------------------------------------------------------------------

@@node OpenACC Profiling Interface
@@chapter OpenACC Profiling Interface

@@section Implementation Status and Implementation-Defined Behavior

We're implementing the OpenACC Profiling Interface as defined by the
OpenACC 2.6 specification.  We're clarifying some aspects here as
@@emph{implementation-defined behavior}, while they're still under
discussion within the OpenACC Technical Committee.

This implementation is tuned to keep the performance impact as low as
possible for the (very common) case that the Profiling Interface is
not enabled.  This is relevant, as the Profiling Interface affects all
the @@emph{hot} code paths (in the target code, not in the offloaded
code).  Users of the OpenACC Profiling Interface can be expected to
understand that performance will be impacted to some degree once the
Profiling Interface has gotten enabled: for example, because of the
@@emph{runtime} (libgomp) calling into a third-party @@emph{library} for
every event that has been registered.

We're not yet accounting for the fact that @@cite{OpenACC events may
occur during event processing}.
We just handle one case specially, as required by CUDA 9.0
@@command{nvprof}, that @@code{acc_get_device_type}
(@@ref{acc_get_device_type})) may be called from
@@code{acc_ev_device_init_start}, @@code{acc_ev_device_init_end}
callbacks.

We're not yet implementing initialization via a
@@code{acc_register_library} function that is either statically linked
in, or dynamically via @@env{LD_PRELOAD}.
Initialization via @@code{acc_register_library} functions dynamically
loaded via the @@env{ACC_PROFLIB} environment variable does work, as
does directly calling @@code{acc_prof_register},
@@code{acc_prof_unregister}, @@code{acc_prof_lookup}.

As currently there are no inquiry functions defined, calls to
@@code{acc_prof_lookup} will always return @@code{NULL}.

There aren't separate @@emph{start}, @@emph{stop} events defined for the
event types @@code{acc_ev_create}, @@code{acc_ev_delete},
@@code{acc_ev_alloc}, @@code{acc_ev_free}.  It's not clear if these
should be triggered before or after the actual device-specific call is
made.  We trigger them after.

Remarks about data provided to callbacks:

@@table @@asis

@@item @@code{acc_prof_info.event_type}
It's not clear if for @@emph{nested} event callbacks (for example,
@@code{acc_ev_enqueue_launch_start} as part of a parent compute
construct), this should be set for the nested event
(@@code{acc_ev_enqueue_launch_start}), or if the value of the parent
construct should remain (@@code{acc_ev_compute_construct_start}).  In
this implementation, the value will generally correspond to the
innermost nested event type.

@@item @@code{acc_prof_info.device_type}
@@itemize

@@item
For @@code{acc_ev_compute_construct_start}, and in presence of an
@@code{if} clause with @@emph{false} argument, this will still refer to
the offloading device type.
It's not clear if that's the expected behavior.

@@item
Complementary to the item before, for
@@code{acc_ev_compute_construct_end}, this is set to
@@code{acc_device_host} in presence of an @@code{if} clause with
@@emph{false} argument.
It's not clear if that's the expected behavior.

@@end itemize

@@item @@code{acc_prof_info.thread_id}
Always @@code{-1}; not yet implemented.

@@item @@code{acc_prof_info.async}
@@itemize

@@item
Not yet implemented correctly for
@@code{acc_ev_compute_construct_start}.

@@item
In a compute construct, for host-fallback
execution/@@code{acc_device_host} it will always be
@@code{acc_async_sync}.
It's not clear if that's the expected behavior.

@@item
For @@code{acc_ev_device_init_start} and @@code{acc_ev_device_init_end},
it will always be @@code{acc_async_sync}.
It's not clear if that's the expected behavior.

@@end itemize

@@item @@code{acc_prof_info.async_queue}
There is no @@cite{limited number of asynchronous queues} in libgomp.
This will always have the same value as @@code{acc_prof_info.async}.

@@item @@code{acc_prof_info.src_file}
Always @@code{NULL}; not yet implemented.

@@item @@code{acc_prof_info.func_name}
Always @@code{NULL}; not yet implemented.

@@item @@code{acc_prof_info.line_no}
Always @@code{-1}; not yet implemented.

@@item @@code{acc_prof_info.end_line_no}
Always @@code{-1}; not yet implemented.

@@item @@code{acc_prof_info.func_line_no}
Always @@code{-1}; not yet implemented.

@@item @@code{acc_prof_info.func_end_line_no}
Always @@code{-1}; not yet implemented.

@@item @@code{acc_event_info.event_type}, @@code{acc_event_info.*.event_type}
Relating to @@code{acc_prof_info.event_type} discussed above, in this
implementation, this will always be the same value as
@@code{acc_prof_info.event_type}.

@@item @@code{acc_event_info.*.parent_construct}
@@itemize

@@item
Will be @@code{acc_construct_parallel} for all OpenACC compute
constructs as well as many OpenACC Runtime API calls; should be the
one matching the actual construct, or
@@code{acc_construct_runtime_api}, respectively.

@@item
Will be @@code{acc_construct_enter_data} or
@@code{acc_construct_exit_data} when processing variable mappings
specified in OpenACC @@emph{declare} directives; should be
@@code{acc_construct_declare}.

@@item
For implicit @@code{acc_ev_device_init_start},
@@code{acc_ev_device_init_end}, and explicit as well as implicit
@@code{acc_ev_alloc}, @@code{acc_ev_free},
@@code{acc_ev_enqueue_upload_start}, @@code{acc_ev_enqueue_upload_end},
@@code{acc_ev_enqueue_download_start}, and
@@code{acc_ev_enqueue_download_end}, will be
@@code{acc_construct_parallel}; should reflect the real parent
construct.

@@end itemize

@@item @@code{acc_event_info.*.implicit}
For @@code{acc_ev_alloc}, @@code{acc_ev_free},
@@code{acc_ev_enqueue_upload_start}, @@code{acc_ev_enqueue_upload_end},
@@code{acc_ev_enqueue_download_start}, and
@@code{acc_ev_enqueue_download_end}, this currently will be @@code{1}
also for explicit usage.

@@item @@code{acc_event_info.data_event.var_name}
Always @@code{NULL}; not yet implemented.

@@item @@code{acc_event_info.data_event.host_ptr}
For @@code{acc_ev_alloc}, and @@code{acc_ev_free}, this is always
@@code{NULL}.

@@item @@code{typedef union acc_api_info}
@@dots{} as printed in @@cite{5.2.3. Third Argument: API-Specific
Information}.  This should obviously be @@code{typedef @@emph{struct}
acc_api_info}.

@@item @@code{acc_api_info.device_api}
Possibly not yet implemented correctly for
@@code{acc_ev_compute_construct_start},
@@code{acc_ev_device_init_start}, @@code{acc_ev_device_init_end}:
will always be @@code{acc_device_api_none} for these event types.
For @@code{acc_ev_enter_data_start}, it will be
@@code{acc_device_api_none} in some cases.

@@item @@code{acc_api_info.device_type}
Always the same as @@code{acc_prof_info.device_type}.

@@item @@code{acc_api_info.vendor}
Always @@code{-1}; not yet implemented.

@@item @@code{acc_api_info.device_handle}
Always @@code{NULL}; not yet implemented.

@@item @@code{acc_api_info.context_handle}
Always @@code{NULL}; not yet implemented.

@@item @@code{acc_api_info.async_handle}
Always @@code{NULL}; not yet implemented.

@@end table

Remarks about certain event types:

@@table @@asis

@@item @@code{acc_ev_device_init_start}, @@code{acc_ev_device_init_end}
@@itemize

@@item
@@c See 'DEVICE_INIT_INSIDE_COMPUTE_CONSTRUCT' in
@@c 'libgomp.oacc-c-c++-common/acc_prof-kernels-1.c',
@@c 'libgomp.oacc-c-c++-common/acc_prof-parallel-1.c'.
Whan a compute construct triggers implicit
@@code{acc_ev_device_init_start} and @@code{acc_ev_device_init_end}
events, they currently aren't @@emph{nested within} the corresponding
@@code{acc_ev_compute_construct_start} and
@@code{acc_ev_compute_construct_end}, but they're currently observed
@@emph{before} @@code{acc_ev_compute_construct_start}.
It's not clear what to do: the standard asks us provide a lot of
details to the @@code{acc_ev_compute_construct_start} callback, without
(implicitly) initializing a device before?

@@item
Callbacks for these event types will not be invoked for calls to the
@@code{acc_set_device_type} and @@code{acc_set_device_num} functions.
It's not clear if they should be.

@@end itemize

@@item @@code{acc_ev_enter_data_start}, @@code{acc_ev_enter_data_end}, @@code{acc_ev_exit_data_start}, @@code{acc_ev_exit_data_end}
@@itemize

@@item
Callbacks for these event types will also be invoked for OpenACC
@@emph{host_data} constructs.
It's not clear if they should be.

@@item
Callbacks for these event types will also be invoked when processing
variable mappings specified in OpenACC @@emph{declare} directives.
It's not clear if they should be.

@@end itemize

@@end table

Callbacks for the following event types will be invoked, but dispatch
and information provided therein has not yet been thoroughly reviewed:

@@itemize
@@item @@code{acc_ev_alloc}
@@item @@code{acc_ev_free}
@@item @@code{acc_ev_update_start}, @@code{acc_ev_update_end}
@@item @@code{acc_ev_enqueue_upload_start}, @@code{acc_ev_enqueue_upload_end}
@@item @@code{acc_ev_enqueue_download_start}, @@code{acc_ev_enqueue_download_end}
@@end itemize

During device initialization, and finalization, respectively,
callbacks for the following event types will not yet be invoked:

@@itemize
@@item @@code{acc_ev_alloc}
@@item @@code{acc_ev_free}
@@end itemize

Callbacks for the following event types have not yet been implemented,
so currently won't be invoked:

@@itemize
@@item @@code{acc_ev_device_shutdown_start}, @@code{acc_ev_device_shutdown_end}
@@item @@code{acc_ev_runtime_shutdown}
@@item @@code{acc_ev_create}, @@code{acc_ev_delete}
@@item @@code{acc_ev_wait_start}, @@code{acc_ev_wait_end}
@@end itemize

For the following runtime library functions, not all expected
callbacks will be invoked (mostly concerning implicit device
initialization):

@@itemize
@@item @@code{acc_get_num_devices}
@@item @@code{acc_set_device_type}
@@item @@code{acc_get_device_type}
@@item @@code{acc_set_device_num}
@@item @@code{acc_get_device_num}
@@item @@code{acc_init}
@@item @@code{acc_shutdown}
@@end itemize

Aside from implicit device initialization, for the following runtime
library functions, no callbacks will be invoked for shared-memory
offloading devices (it's not clear if they should be):

@@itemize
@@item @@code{acc_malloc}
@@item @@code{acc_free}
@@item @@code{acc_copyin}, @@code{acc_present_or_copyin}, @@code{acc_copyin_async}
@@item @@code{acc_create}, @@code{acc_present_or_create}, @@code{acc_create_async}
@@item @@code{acc_copyout}, @@code{acc_copyout_async}, @@code{acc_copyout_finalize}, @@code{acc_copyout_finalize_async}
@@item @@code{acc_delete}, @@code{acc_delete_async}, @@code{acc_delete_finalize}, @@code{acc_delete_finalize_async}
@@item @@code{acc_update_device}, @@code{acc_update_device_async}
@@item @@code{acc_update_self}, @@code{acc_update_self_async}
@@item @@code{acc_map_data}, @@code{acc_unmap_data}
@@item @@code{acc_memcpy_to_device}, @@code{acc_memcpy_to_device_async}
@@item @@code{acc_memcpy_from_device}, @@code{acc_memcpy_from_device_async}
@@end itemize
d3487 1
a3487 1
be reported via @@uref{https://gcc.gnu.org/bugzilla/, Bugzilla}.  Please add
@


1.1.1.10.6.1
log
@Sync to head external/gpl3/gcc/dist, pulling up the following revisions
(requested by mrg in ticket #231):

	external/gpl3/gcc/dist/fixincludes/tests/base/objc/runtime.h up to 1.1.1.1
	external/gpl3/gcc/dist/gcc/opts-jobserver.h     up to 1.1.1.1
	external/gpl3/gcc/dist/libgcc/config/t-darwin-min-1 up to 1.1.1.1
	external/gpl3/gcc/dist/libgcc/config/t-darwin-min-5 up to 1.1.1.1
	external/gpl3/gcc/dist/libgcc/config/t-darwin-min-8 up to 1.1.1.1
	external/gpl3/gcc/dist/ChangeLog                up to 1.1.1.21
	external/gpl3/gcc/dist/LAST_UPDATED             up to 1.18
	external/gpl3/gcc/dist/MD5SUMS                  up to 1.18
	external/gpl3/gcc/dist/NEWS                     up to 1.16
	external/gpl3/gcc/dist/INSTALL/binaries.html    up to 1.13
	external/gpl3/gcc/dist/INSTALL/build.html       up to 1.15
	external/gpl3/gcc/dist/INSTALL/configure.html   up to 1.15
	external/gpl3/gcc/dist/INSTALL/download.html    up to 1.14
	external/gpl3/gcc/dist/INSTALL/finalinstall.html up to 1.13
	external/gpl3/gcc/dist/INSTALL/gfdl.html        up to 1.13
	external/gpl3/gcc/dist/INSTALL/index.html       up to 1.13
	external/gpl3/gcc/dist/INSTALL/old.html         up to 1.13
	external/gpl3/gcc/dist/INSTALL/prerequisites.html up to 1.15
	external/gpl3/gcc/dist/INSTALL/specific.html    up to 1.14
	external/gpl3/gcc/dist/INSTALL/test.html        up to 1.13
	external/gpl3/gcc/dist/config/ChangeLog         up to 1.1.1.21
	external/gpl3/gcc/dist/contrib/ChangeLog        up to 1.1.1.21
	external/gpl3/gcc/dist/contrib/header-tools/ChangeLog up to 1.1.1.11
	external/gpl3/gcc/dist/contrib/reghunt/ChangeLog up to 1.1.1.20
	external/gpl3/gcc/dist/contrib/regression/ChangeLog up to 1.1.1.20
	external/gpl3/gcc/dist/fixincludes/ChangeLog    up to 1.1.1.20
	external/gpl3/gcc/dist/fixincludes/fixincl.x    up to 1.1.1.16
	external/gpl3/gcc/dist/fixincludes/inclhack.def up to 1.1.1.15
	external/gpl3/gcc/dist/fixincludes/tests/base/stdio.h up to 1.1.1.6
	external/gpl3/gcc/dist/gcc/BASE-VER             up to 1.1.1.19
	external/gpl3/gcc/dist/gcc/ChangeLog            up to 1.24
	external/gpl3/gcc/dist/gcc/DATESTAMP            up to 1.1.1.22
	external/gpl3/gcc/dist/gcc/asan.c               up to 1.1.1.13
	external/gpl3/gcc/dist/gcc/bb-reorder.c         up to 1.1.1.15
	external/gpl3/gcc/dist/gcc/builtins.c           up to 1.20
	external/gpl3/gcc/dist/gcc/cfgbuild.c           up to 1.1.1.11
	external/gpl3/gcc/dist/gcc/cgraphclones.c       up to 1.1.1.13
	external/gpl3/gcc/dist/gcc/cgraphunit.c         up to 1.1.1.14
	external/gpl3/gcc/dist/gcc/config.gcc           up to 1.72
	external/gpl3/gcc/dist/gcc/cse.c                up to 1.1.1.13
	external/gpl3/gcc/dist/gcc/expr.c               up to 1.19
	external/gpl3/gcc/dist/gcc/function.c           up to 1.1.1.18
	external/gpl3/gcc/dist/gcc/function.h           up to 1.1.1.12
	external/gpl3/gcc/dist/gcc/gcc.c                up to 1.25
	external/gpl3/gcc/dist/gcc/generic-match-head.c up to 1.1.1.9
	external/gpl3/gcc/dist/gcc/gimple-ssa-store-merging.c up to 1.1.1.9
	external/gpl3/gcc/dist/gcc/ifcvt.c              up to 1.1.1.15
	external/gpl3/gcc/dist/gcc/ira-color.c          up to 1.10
	external/gpl3/gcc/dist/gcc/loop-invariant.c     up to 1.1.1.13
	external/gpl3/gcc/dist/gcc/lto-streamer-in.c    up to 1.1.1.13
	external/gpl3/gcc/dist/gcc/lto-wrapper.c        up to 1.1.1.12
	external/gpl3/gcc/dist/gcc/match.pd             up to 1.1.1.13
	external/gpl3/gcc/dist/gcc/omp-expand.c         up to 1.1.1.8
	external/gpl3/gcc/dist/gcc/omp-low.c            up to 1.1.1.19
	external/gpl3/gcc/dist/gcc/optabs.c             up to 1.1.1.15
	external/gpl3/gcc/dist/gcc/optc-save-gen.awk    up to 1.1.1.10
	external/gpl3/gcc/dist/gcc/opts-common.c        up to 1.1.1.13
	external/gpl3/gcc/dist/gcc/predict.c            up to 1.1.1.12
	external/gpl3/gcc/dist/gcc/ree.c                up to 1.1.1.12
	external/gpl3/gcc/dist/gcc/reg-stack.c          up to 1.1.1.11
	external/gpl3/gcc/dist/gcc/regrename.c          up to 1.1.1.11
	external/gpl3/gcc/dist/gcc/sanopt.c             up to 1.1.1.10
	external/gpl3/gcc/dist/gcc/selftest-diagnostic.c up to 1.1.1.4
	external/gpl3/gcc/dist/gcc/symbol-summary.h     up to 1.1.1.9
	external/gpl3/gcc/dist/gcc/tree-inline.c        up to 1.1.1.18
	external/gpl3/gcc/dist/gcc/tree-loop-distribution.c up to 1.1.1.13
	external/gpl3/gcc/dist/gcc/tree-nested.c        up to 1.1.1.13
	external/gpl3/gcc/dist/gcc/tree-sra.c           up to 1.1.1.17
	external/gpl3/gcc/dist/gcc/tree-ssa-ccp.c       up to 1.16
	external/gpl3/gcc/dist/gcc/tree-ssa-dom.c       up to 1.1.1.16
	external/gpl3/gcc/dist/gcc/tree-ssa-loop-ivopts.c up to 1.1.1.14
	external/gpl3/gcc/dist/gcc/tree-ssa-reassoc.c   up to 1.1.1.18
	external/gpl3/gcc/dist/gcc/tree-ssa-sccvn.c     up to 1.1.1.18
	external/gpl3/gcc/dist/gcc/tree-ssa-strlen.c    up to 1.1.1.13
	external/gpl3/gcc/dist/gcc/tree-ssa.c           up to 1.1.1.13
	external/gpl3/gcc/dist/gcc/tree.c               up to 1.5
	external/gpl3/gcc/dist/gcc/tree.h               up to 1.5
	external/gpl3/gcc/dist/gcc/varasm.c             up to 1.14
	external/gpl3/gcc/dist/gcc/wide-int.cc          up to 1.1.1.10
	external/gpl3/gcc/dist/gcc/wide-int.h           up to 1.1.1.10
	external/gpl3/gcc/dist/gcc/analyzer/ChangeLog   up to 1.1.1.3
	external/gpl3/gcc/dist/gcc/brig/ChangeLog       up to 1.1.1.9
	external/gpl3/gcc/dist/gcc/c/ChangeLog          up to 1.1.1.19
	external/gpl3/gcc/dist/gcc/c/c-parser.c         up to 1.1.1.16
	external/gpl3/gcc/dist/gcc/c/c-typeck.c         up to 1.1.1.17
	external/gpl3/gcc/dist/gcc/c-family/ChangeLog   up to 1.1.1.18
	external/gpl3/gcc/dist/gcc/c-family/c-common.c  up to 1.1.1.17
	external/gpl3/gcc/dist/gcc/c-family/c-ubsan.c   up to 1.1.1.10
	external/gpl3/gcc/dist/gcc/c-family/c-warn.c    up to 1.1.1.8
	external/gpl3/gcc/dist/gcc/common/config/i386/i386-cpuinfo.h up to 1.1.1.2
	external/gpl3/gcc/dist/gcc/config/darwin.c      up to 1.1.1.15
	external/gpl3/gcc/dist/gcc/config/darwin.h      up to 1.1.1.14
	external/gpl3/gcc/dist/gcc/config/aarch64/aarch64-c.c up to 1.1.1.9
	external/gpl3/gcc/dist/gcc/config/aarch64/aarch64-cores.def up to 1.1.1.12
	external/gpl3/gcc/dist/gcc/config/aarch64/aarch64-cost-tables.h up to 1.1.1.9
	external/gpl3/gcc/dist/gcc/config/aarch64/aarch64-fusion-pairs.def up to 1.1.1.8
	external/gpl3/gcc/dist/gcc/config/aarch64/aarch64-netbsd.h up to 1.7
	external/gpl3/gcc/dist/gcc/config/aarch64/aarch64-protos.h up to 1.1.1.13
	external/gpl3/gcc/dist/gcc/config/aarch64/aarch64-simd.md up to 1.1.1.13
	external/gpl3/gcc/dist/gcc/config/aarch64/aarch64-sve-builtins.cc up to 1.1.1.3
	external/gpl3/gcc/dist/gcc/config/aarch64/aarch64-sve.md up to 1.1.1.5
	external/gpl3/gcc/dist/gcc/config/aarch64/aarch64-tune.md up to 1.1.1.12
	external/gpl3/gcc/dist/gcc/config/aarch64/aarch64-tuning-flags.def up to 1.1.1.8
	external/gpl3/gcc/dist/gcc/config/aarch64/aarch64.c up to 1.1.1.19
	external/gpl3/gcc/dist/gcc/config/aarch64/aarch64.h up to 1.4
	external/gpl3/gcc/dist/gcc/config/aarch64/aarch64.md up to 1.1.1.17
	external/gpl3/gcc/dist/gcc/config/aarch64/driver-aarch64.c up to 1.14
	external/gpl3/gcc/dist/gcc/config/aarch64/iterators.md up to 1.1.1.14
	external/gpl3/gcc/dist/gcc/config/i386/i386-builtin.def up to 1.1.1.8
	external/gpl3/gcc/dist/gcc/config/i386/i386-expand.c up to 1.1.1.3
	external/gpl3/gcc/dist/gcc/config/i386/i386-features.c up to 1.1.1.2
	external/gpl3/gcc/dist/gcc/config/i386/i386-options.c up to 1.1.1.2
	external/gpl3/gcc/dist/gcc/config/i386/smmintrin.h up to 1.1.1.11
	external/gpl3/gcc/dist/gcc/config/i386/t-i386   up to 1.1.1.11
	external/gpl3/gcc/dist/gcc/config/nvptx/nvptx.c up to 1.1.1.12
	external/gpl3/gcc/dist/gcc/config/nvptx/nvptx.h up to 1.1.1.9
	external/gpl3/gcc/dist/gcc/config/nvptx/nvptx.md up to 1.1.1.9
	external/gpl3/gcc/dist/gcc/config/pa/pa.md      up to 1.1.1.17
	external/gpl3/gcc/dist/gcc/config/riscv/t-rtems up to 1.1.1.2
	external/gpl3/gcc/dist/gcc/config/rs6000/altivec.md up to 1.1.1.19
	external/gpl3/gcc/dist/gcc/config/rs6000/mma.md up to 1.1.1.3
	external/gpl3/gcc/dist/gcc/config/rs6000/rs6000-builtin.def up to 1.1.1.19
	external/gpl3/gcc/dist/gcc/config/rs6000/rs6000-call.c up to 1.1.1.3
	external/gpl3/gcc/dist/gcc/config/rs6000/rs6000-logue.c up to 1.4
	external/gpl3/gcc/dist/gcc/config/rs6000/rs6000-p8swap.c up to 1.1.1.6
	external/gpl3/gcc/dist/gcc/config/rs6000/rs6000-protos.h up to 1.1.1.15
	external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c up to 1.32
	external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.h up to 1.1.1.17
	external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.md up to 1.1.1.20
	external/gpl3/gcc/dist/gcc/config/rs6000/rtems.h up to 1.1.1.11
	external/gpl3/gcc/dist/gcc/config/rs6000/t-rtems up to 1.1.1.11
	external/gpl3/gcc/dist/gcc/config/rs6000/vector.md up to 1.1.1.15
	external/gpl3/gcc/dist/gcc/config/rs6000/vsx.md up to 1.1.1.20
	external/gpl3/gcc/dist/gcc/config/s390/s390.c   up to 1.1.1.18
	external/gpl3/gcc/dist/gcc/config/sparc/sparc.c up to 1.1.1.19
	external/gpl3/gcc/dist/gcc/cp/ChangeLog         up to 1.1.1.22
	external/gpl3/gcc/dist/gcc/cp/constexpr.c       up to 1.1.1.14
	external/gpl3/gcc/dist/gcc/cp/cp-gimplify.c     up to 1.1.1.15
	external/gpl3/gcc/dist/gcc/cp/cp-tree.h         up to 1.1.1.15
	external/gpl3/gcc/dist/gcc/cp/cvt.c             up to 1.1.1.15
	external/gpl3/gcc/dist/gcc/cp/decl.c            up to 1.10
	external/gpl3/gcc/dist/gcc/cp/decl2.c           up to 1.1.1.18
	external/gpl3/gcc/dist/gcc/cp/expr.c            up to 1.1.1.12
	external/gpl3/gcc/dist/gcc/cp/friend.c          up to 1.1.1.12
	external/gpl3/gcc/dist/gcc/cp/lambda.c          up to 1.1.1.12
	external/gpl3/gcc/dist/gcc/cp/parser.c          up to 1.1.1.21
	external/gpl3/gcc/dist/gcc/cp/pt.c              up to 1.1.1.19
	external/gpl3/gcc/dist/gcc/cp/semantics.c       up to 1.1.1.20
	external/gpl3/gcc/dist/gcc/cp/tree.c            up to 1.1.1.18
	external/gpl3/gcc/dist/gcc/cp/typeck.c          up to 1.1.1.19
	external/gpl3/gcc/dist/gcc/d/ChangeLog          up to 1.1.1.4
	external/gpl3/gcc/dist/gcc/d/d-convert.cc       up to 1.1.1.4
	external/gpl3/gcc/dist/gcc/d/decl.cc            up to 1.1.1.4
	external/gpl3/gcc/dist/gcc/d/expr.cc            up to 1.1.1.4
	external/gpl3/gcc/dist/gcc/d/gdc.texi           up to 1.1.1.3
	external/gpl3/gcc/dist/gcc/d/imports.cc         up to 1.1.1.3
	external/gpl3/gcc/dist/gcc/d/toir.cc            up to 1.1.1.3
	external/gpl3/gcc/dist/gcc/d/dmd/dinterpret.c   up to 1.1.1.4
	external/gpl3/gcc/dist/gcc/d/dmd/expressionsem.c up to 1.1.1.4
	external/gpl3/gcc/dist/gcc/doc/cpp.1            up to 1.17
	external/gpl3/gcc/dist/gcc/doc/cpp.info         up to 1.16
	external/gpl3/gcc/dist/gcc/doc/cppinternals.info up to 1.18
	external/gpl3/gcc/dist/gcc/doc/cppopts.texi     up to 1.10
	external/gpl3/gcc/dist/gcc/doc/extend.texi      up to 1.10
	external/gpl3/gcc/dist/gcc/doc/fsf-funding.7    up to 1.15
	external/gpl3/gcc/dist/gcc/doc/g++.1            up to 1.18
	external/gpl3/gcc/dist/gcc/doc/gcc.1            up to 1.18
	external/gpl3/gcc/dist/gcc/doc/gcc.info         up to 1.16
	external/gpl3/gcc/dist/gcc/doc/gccinstall.info  up to 1.18
	external/gpl3/gcc/dist/gcc/doc/gccint.info      up to 1.17
	external/gpl3/gcc/dist/gcc/doc/gcov-dump.1      up to 1.1.1.12
	external/gpl3/gcc/dist/gcc/doc/gcov-tool.1      up to 1.11
	external/gpl3/gcc/dist/gcc/doc/gcov.1           up to 1.17
	external/gpl3/gcc/dist/gcc/doc/gfdl.7           up to 1.15
	external/gpl3/gcc/dist/gcc/doc/gfortran.1       up to 1.14
	external/gpl3/gcc/dist/gcc/doc/gpl.7            up to 1.15
	external/gpl3/gcc/dist/gcc/doc/invoke.texi      up to 1.23
	external/gpl3/gcc/dist/gcc/doc/lto-dump.1       up to 1.1.1.3
	external/gpl3/gcc/dist/gcc/fortran/ChangeLog    up to 1.1.1.4
	external/gpl3/gcc/dist/gcc/fortran/array.c      up to 1.1.1.4
	external/gpl3/gcc/dist/gcc/fortran/check.c      up to 1.1.1.4
	external/gpl3/gcc/dist/gcc/fortran/decl.c       up to 1.1.1.4
	external/gpl3/gcc/dist/gcc/fortran/dependency.c up to 1.1.1.3
	external/gpl3/gcc/dist/gcc/fortran/expr.c       up to 1.1.1.4
	external/gpl3/gcc/dist/gcc/fortran/f95-lang.c   up to 1.1.1.3
	external/gpl3/gcc/dist/gcc/fortran/gfortran.info up to 1.1.1.4
	external/gpl3/gcc/dist/gcc/fortran/interface.c  up to 1.1.1.4
	external/gpl3/gcc/dist/gcc/fortran/iresolve.c   up to 1.1.1.3
	external/gpl3/gcc/dist/gcc/fortran/match.c      up to 1.1.1.4
	external/gpl3/gcc/dist/gcc/fortran/parse.c      up to 1.1.1.4
	external/gpl3/gcc/dist/gcc/fortran/primary.c    up to 1.1.1.4
	external/gpl3/gcc/dist/gcc/fortran/resolve.c    up to 1.1.1.4
	external/gpl3/gcc/dist/gcc/fortran/simplify.c   up to 1.1.1.4
	external/gpl3/gcc/dist/gcc/fortran/symbol.c     up to 1.1.1.3
	external/gpl3/gcc/dist/gcc/fortran/trans-decl.c up to 1.1.1.4
	external/gpl3/gcc/dist/gcc/fortran/trans-expr.c up to 1.1.1.4
	external/gpl3/gcc/dist/gcc/fortran/trans-intrinsic.c up to 1.1.1.4
	external/gpl3/gcc/dist/gcc/fortran/trans-types.c up to 1.1.1.4
	external/gpl3/gcc/dist/gcc/fortran/trans.h      up to 1.1.1.3
	external/gpl3/gcc/dist/gcc/jit/ChangeLog        up to 1.1.1.14
	external/gpl3/gcc/dist/gcc/lto/ChangeLog        up to 1.1.1.20
	external/gpl3/gcc/dist/gcc/objc/ChangeLog       up to 1.1.1.20
	external/gpl3/gcc/dist/gcc/objcp/ChangeLog      up to 1.1.1.20
	external/gpl3/gcc/dist/include/ChangeLog        up to 1.1.1.20
	external/gpl3/gcc/dist/intl/ChangeLog           up to 1.1.1.20
	external/gpl3/gcc/dist/libbacktrace/ChangeLog   up to 1.1.1.19
	external/gpl3/gcc/dist/libcc1/ChangeLog         up to 1.1.1.14
	external/gpl3/gcc/dist/libcpp/ChangeLog         up to 1.1.1.20
	external/gpl3/gcc/dist/libcpp/directives.c      up to 1.1.1.13
	external/gpl3/gcc/dist/libdecnumber/ChangeLog   up to 1.1.1.20
	external/gpl3/gcc/dist/libgcc/ChangeLog         up to 1.1.1.22
	external/gpl3/gcc/dist/libgcc/config.host       up to 1.33
	external/gpl3/gcc/dist/libgcc/config/darwin10-unwind-find-enc-func.c up to 1.1.1.2
	external/gpl3/gcc/dist/libgcc/config/t-darwin   up to 1.1.1.6
	external/gpl3/gcc/dist/libgcc/config/t-slibgcc-darwin up to 1.1.1.4
	external/gpl3/gcc/dist/libgcc/config/avr/libf7/ChangeLog up to 1.1.1.3
	external/gpl3/gcc/dist/libgcc/config/avr/libf7/libf7-asm.sx up to 1.1.1.2
	external/gpl3/gcc/dist/libgcc/config/i386/cpuinfo.c up to 1.1.1.11
	external/gpl3/gcc/dist/libgcc/config/libbid/ChangeLog up to 1.1.1.20
	external/gpl3/gcc/dist/libgcc/config/riscv/div.S up to 1.1.1.7
	external/gpl3/gcc/dist/libgcc/config/riscv/riscv-asm.h up to 1.1.1.4
	external/gpl3/gcc/dist/libgfortran/ChangeLog    up to 1.1.1.4
	external/gpl3/gcc/dist/libgomp/ChangeLog        up to 1.1.1.20
	external/gpl3/gcc/dist/libgomp/libgomp.info     up to 1.15
	external/gpl3/gcc/dist/libgomp/libgomp.texi     up to 1.1.1.11
	external/gpl3/gcc/dist/libgomp/target.c         up to 1.1.1.9
	external/gpl3/gcc/dist/libgomp/task.c           up to 1.1.1.12
	external/gpl3/gcc/dist/libhsail-rt/ChangeLog    up to 1.1.1.9
	external/gpl3/gcc/dist/libiberty/ChangeLog      up to 1.1.1.20
	external/gpl3/gcc/dist/libiberty/strstr.c       up to 1.1.1.2
	external/gpl3/gcc/dist/libobjc/ChangeLog        up to 1.1.1.21
	external/gpl3/gcc/dist/libphobos/ChangeLog      up to 1.1.1.4
	external/gpl3/gcc/dist/libphobos/src/std/path.d up to 1.1.1.2
	external/gpl3/gcc/dist/libquadmath/ChangeLog    up to 1.1.1.4
	external/gpl3/gcc/dist/libquadmath/libquadmath.info up to 1.1.1.4
	external/gpl3/gcc/dist/libquadmath/strtod/strtod_l.c up to 1.1.1.2
	external/gpl3/gcc/dist/libsanitizer/ChangeLog   up to 1.4
	external/gpl3/gcc/dist/libsanitizer/configure.tgt up to 1.10
	external/gpl3/gcc/dist/libssp/ChangeLog         up to 1.1.1.20
	external/gpl3/gcc/dist/libstdc++-v3/ChangeLog   up to 1.1.1.22
	external/gpl3/gcc/dist/libstdc++-v3/config/os/gnu-linux/os_defines.h up to 1.1.1.11
	external/gpl3/gcc/dist/libstdc++-v3/doc/doxygen/user.cfg.in up to 1.1.1.7
	external/gpl3/gcc/dist/libstdc++-v3/doc/html/bk02.html up to 1.1.1.4
	external/gpl3/gcc/dist/libstdc++-v3/doc/html/manual/api.html up to 1.1.1.11
	external/gpl3/gcc/dist/libstdc++-v3/doc/html/manual/ext_demangling.html up to 1.1.1.7
	external/gpl3/gcc/dist/libstdc++-v3/doc/html/manual/extensions.html up to 1.1.1.6
	external/gpl3/gcc/dist/libstdc++-v3/doc/html/manual/index.html up to 1.1.1.14
	external/gpl3/gcc/dist/libstdc++-v3/doc/xml/authors.xml up to 1.1.1.4
	external/gpl3/gcc/dist/libstdc++-v3/doc/xml/manual/evolution.xml up to 1.1.1.10
	external/gpl3/gcc/dist/libstdc++-v3/doc/xml/manual/extensions.xml up to 1.1.1.13
	external/gpl3/gcc/dist/libstdc++-v3/doc/xml/manual/spine.xml up to 1.1.1.11
	external/gpl3/gcc/dist/libstdc++-v3/include/Makefile.am up to 1.1.1.16
	external/gpl3/gcc/dist/libstdc++-v3/include/Makefile.in up to 1.1.1.16
	external/gpl3/gcc/dist/libstdc++-v3/include/bits/fs_path.h up to 1.1.1.6
	external/gpl3/gcc/dist/libstdc++-v3/include/bits/gslice_array.h up to 1.1.1.12
	external/gpl3/gcc/dist/libstdc++-v3/include/bits/indirect_array.h up to 1.1.1.12
	external/gpl3/gcc/dist/libstdc++-v3/include/bits/list.tcc up to 1.1.1.12
	external/gpl3/gcc/dist/libstdc++-v3/include/bits/mask_array.h up to 1.1.1.13
	external/gpl3/gcc/dist/libstdc++-v3/include/bits/range_access.h up to 1.1.1.11
	external/gpl3/gcc/dist/libstdc++-v3/include/bits/regex.h up to 1.1.1.13
	external/gpl3/gcc/dist/libstdc++-v3/include/bits/regex.tcc up to 1.1.1.10
	external/gpl3/gcc/dist/libstdc++-v3/include/bits/regex_automaton.h up to 1.1.1.11
	external/gpl3/gcc/dist/libstdc++-v3/include/bits/regex_compiler.h up to 1.1.1.12
	external/gpl3/gcc/dist/libstdc++-v3/include/bits/regex_compiler.tcc up to 1.1.1.10
	external/gpl3/gcc/dist/libstdc++-v3/include/bits/regex_error.h up to 1.1.1.11
	external/gpl3/gcc/dist/libstdc++-v3/include/bits/regex_executor.tcc up to 1.1.1.10
	external/gpl3/gcc/dist/libstdc++-v3/include/bits/regex_scanner.h up to 1.1.1.11
	external/gpl3/gcc/dist/libstdc++-v3/include/bits/regex_scanner.tcc up to 1.1.1.10
	external/gpl3/gcc/dist/libstdc++-v3/include/bits/shared_ptr_base.h up to 1.1.1.16
	external/gpl3/gcc/dist/libstdc++-v3/include/bits/slice_array.h up to 1.1.1.13
	external/gpl3/gcc/dist/libstdc++-v3/include/bits/stl_iterator.h up to 1.1.1.14
	external/gpl3/gcc/dist/libstdc++-v3/include/bits/stl_uninitialized.h up to 1.1.1.13
	external/gpl3/gcc/dist/libstdc++-v3/include/experimental/numeric up to 1.1.1.8
	external/gpl3/gcc/dist/libstdc++-v3/include/experimental/optional up to 1.1.1.12
	external/gpl3/gcc/dist/libstdc++-v3/include/std/any up to 1.1.1.9
	external/gpl3/gcc/dist/libstdc++-v3/include/std/memory up to 1.1.1.12
	external/gpl3/gcc/dist/libstdc++-v3/include/std/numeric up to 1.1.1.12
	external/gpl3/gcc/dist/libstdc++-v3/include/std/ranges up to 1.1.1.3
	external/gpl3/gcc/dist/libstdc++-v3/include/std/span up to 1.1.1.3
	external/gpl3/gcc/dist/libstdc++-v3/include/std/valarray up to 1.1.1.12
	external/gpl3/gcc/dist/libstdc++-v3/python/libstdcxx/v6/xmethods.py up to 1.1.1.12
	external/gpl3/gcc/dist/libstdc++-v3/src/c++11/thread.cc up to 1.1.1.12
	external/gpl3/gcc/dist/libstdc++-v3/src/c++17/fs_path.cc up to 1.1.1.4
	external/gpl3/gcc/dist/lto-plugin/ChangeLog     up to 1.1.1.20
	external/gpl3/gcc/dist/maintainer-scripts/ChangeLog up to 1.1.1.21

Import gcc 10.5.
@
text
@d178 1
a178 1
* omp_get_proc_bind::           Whether threads may be moved between CPUs
d585 1
a585 1
@@section @@code{omp_get_proc_bind} -- Whether threads may be moved between CPUs
d1352 2
a1353 2
* OMP_PROC_BIND::           Whether threads may be moved between CPUs
* OMP_PLACES::              Specifies on which CPUs the threads should be placed
d1520 1
a1520 1
@@section @@env{OMP_PROC_BIND} -- Whether threads may be moved between CPUs
d1525 1
a1525 1
@@code{TRUE}, OpenMP threads should not be moved; if set to @@code{FALSE}
d1547 1
a1547 1
@@section @@env{OMP_PLACES} -- Specifies on which CPUs the threads should be placed
@


1.1.1.11
log
@initial import of GCC 10.5.0.

(we plan to import 12.3 soon as well, this is mostly so it can be pulled up
to netbsd-10 branch more easily.)

the list of PR's fixed since 10.4.0 can be found here:

https://gcc.gnu.org/bugzilla/buglist.cgi?bug_status=RESOLVED&resolution=FIXED&target_milestone=10.5

which includes 3 C, 25 C++, 4 debug, 17 libstdc++, and many others for the
internals.
@
text
@d178 1
a178 1
* omp_get_proc_bind::           Whether threads may be moved between CPUs
d585 1
a585 1
@@section @@code{omp_get_proc_bind} -- Whether threads may be moved between CPUs
d1352 2
a1353 2
* OMP_PROC_BIND::           Whether threads may be moved between CPUs
* OMP_PLACES::              Specifies on which CPUs the threads should be placed
d1520 1
a1520 1
@@section @@env{OMP_PROC_BIND} -- Whether threads may be moved between CPUs
d1525 1
a1525 1
@@code{TRUE}, OpenMP threads should not be moved; if set to @@code{FALSE}
d1547 1
a1547 1
@@section @@env{OMP_PLACES} -- Specifies on which CPUs the threads should be placed
@


1.1.1.12
log
@initial import of GCC 12.3.0.

major changes in GCC 11 included:

- The default mode for C++ is now -std=gnu++17 instead of -std=gnu++14.
- When building GCC itself, the host compiler must now support C++11,
  rather than C++98.
- Some short options of the gcov tool have been renamed: -i to -j and
  -j to -H.
- ThreadSanitizer improvements.
- Introduce Hardware-assisted AddressSanitizer support.
- For targets that produce DWARF debugging information GCC now defaults
  to DWARF version 5. This can produce up to 25% more compact debug
  information compared to earlier versions.
- Many optimisations.
- The existing malloc attribute has been extended so that it can be
  used to identify allocator/deallocator API pairs. A pair of new
  -Wmismatched-dealloc and -Wmismatched-new-delete warnings are added.
- Other new warnings:
  -Wsizeof-array-div, enabled by -Wall, warns about divisions of two
    sizeof operators when the first one is applied to an array and the
    divisor does not equal the size of the array element.
  -Wstringop-overread, enabled by default, warns about calls to string
    functions reading past the end of the arrays passed to them as
    arguments.
  -Wtsan, enabled by default, warns about unsupported features in
    ThreadSanitizer (currently std::atomic_thread_fence).
- Enchanced warnings:
  -Wfree-nonheap-object detects many more instances of calls to
    deallocation functions with pointers not returned from a dynamic
    memory allocation function.
  -Wmaybe-uninitialized diagnoses passing pointers or references to
    uninitialized memory to functions taking const-qualified arguments.
  -Wuninitialized detects reads from uninitialized dynamically
    allocated memory.
  -Warray-parameter warns about functions with inconsistent array forms.
  -Wvla-parameter warns about functions with inconsistent VLA forms.
- Several new features from the upcoming C2X revision of the ISO C
  standard are supported with -std=c2x and -std=gnu2x.
- Several C++20 features have been implemented.
- The C++ front end has experimental support for some of the upcoming
  C++23 draft.
- Several new C++ warnings.
- Enhanced Arm, AArch64, x86, and RISC-V CPU support.
- The implementation of how program state is tracked within
  -fanalyzer has been completely rewritten with many enhancements.

see https://gcc.gnu.org/gcc-11/changes.html for a full list.

major changes in GCC 12 include:

- An ABI incompatibility between C and C++ when passing or returning
  by value certain aggregates containing zero width bit-fields has
  been discovered on various targets. x86-64, ARM and AArch64
  will always ignore them (so there is a C ABI incompatibility
  between GCC 11 and earlier with GCC 12 or later), PowerPC64 ELFv2
  always take them into account (so there is a C++ ABI
  incompatibility, GCC 4.4 and earlier compatible with GCC 12 or
  later, incompatible with GCC 4.5 through GCC 11). RISC-V has
  changed the handling of these already starting with GCC 10. As
  the ABI requires, MIPS takes them into account handling function
  return values so there is a C++ ABI incompatibility with GCC 4.5
  through 11.
- STABS: Support for emitting the STABS debugging format is
  deprecated and will be removed in the next release. All ports now
  default to emit DWARF (version 2 or later) debugging info or are
  obsoleted.
- Vectorization is enabled at -O2 which is now equivalent to the
  original -O2 -ftree-vectorize -fvect-cost-model=very-cheap.
- GCC now supports the ShadowCallStack sanitizer.
- Support for __builtin_shufflevector compatible with the clang
  language extension was added.
- Support for attribute unavailable was added.
- Support for __builtin_dynamic_object_size compatible with the
  clang language extension was added.
- New warnings:
  -Wbidi-chars warns about potentially misleading UTF-8
    bidirectional control characters.
  -Warray-compare warns about comparisons between two operands of
    array type.
- Some new features from the upcoming C2X revision of the ISO C
  standard are supported with -std=c2x and -std=gnu2x.
- Several C++23 features have been implemented.
- Many C++ enhancements across warnings and -f options.

see https://gcc.gnu.org/gcc-12/changes.html for a full list.
@
text
@d10 1
a10 1
Copyright @@copyright{} 2006-2022 Free Software Foundation, Inc.
d71 1
a71 1
@@node Top, Enabling OpenMP
a97 1
* OpenMP Implementation Status:: List of implemented features by OpenMP version
d144 3
a146 200
A complete description of all OpenMP directives may be found in the
@@uref{https://www.openmp.org, OpenMP Application Program Interface} manuals.
See also @@ref{OpenMP Implementation Status}.


@@c ---------------------------------------------------------------------
@@c OpenMP Implementation Status
@@c ---------------------------------------------------------------------

@@node OpenMP Implementation Status
@@chapter OpenMP Implementation Status

@@menu
* OpenMP 4.5:: Feature completion status to 4.5 specification
* OpenMP 5.0:: Feature completion status to 5.0 specification
* OpenMP 5.1:: Feature completion status to 5.1 specification
@@end menu

The @@code{_OPENMP} preprocessor macro and Fortran's @@code{openmp_version}
parameter, provided by @@code{omp_lib.h} and the @@code{omp_lib} module, have
the value @@code{201511} (i.e. OpenMP 4.5).

@@node OpenMP 4.5
@@section OpenMP 4.5

The OpenMP 4.5 specification is fully supported.

@@node OpenMP 5.0
@@section OpenMP 5.0

@@unnumberedsubsec New features listed in Appendix B of the OpenMP specification
@@c This list is sorted as in OpenMP 5.1's B.3 not as in OpenMP 5.0's B.2

@@multitable @@columnfractions .60 .10 .25
@@headitem Description @@tab Status @@tab Comments
@@item Array shaping @@tab N @@tab
@@item Array sections with non-unit strides in C and C++ @@tab N @@tab
@@item Iterators @@tab Y @@tab
@@item @@code{metadirective} directive @@tab N @@tab
@@item @@code{declare variant} directive
      @@tab P @@tab simd traits not handled correctly
@@item @@emph{target-offload-var} ICV and @@code{OMP_TARGET_OFFLOAD}
      env variable @@tab Y @@tab
@@item Nested-parallel changes to @@emph{max-active-levels-var} ICV @@tab Y @@tab
@@item @@code{requires} directive @@tab P
      @@tab Only fulfillable requirement are @@code{atomic_default_mem_order}
      and @@code{dynamic_allocators}
@@item @@code{teams} construct outside an enclosing target region @@tab Y @@tab
@@item Non-rectangular loop nests @@tab P @@tab Only C/C++
@@item @@code{!=} as relational-op in canonical loop form for C/C++ @@tab Y @@tab
@@item @@code{nonmonotonic} as default loop schedule modifier for worksharing-loop
      constructs @@tab Y @@tab
@@item Collapse of associated loops that are imperfectly nested loops @@tab N @@tab
@@item Clauses @@code{if}, @@code{nontemporal} and @@code{order(concurrent)} in
      @@code{simd} construct @@tab Y @@tab
@@item @@code{atomic} constructs in @@code{simd} @@tab Y @@tab
@@item @@code{loop} construct @@tab Y @@tab
@@item @@code{order(concurrent)} clause @@tab Y @@tab
@@item @@code{scan} directive and @@code{in_scan} modifier for the
      @@code{reduction} clause @@tab Y @@tab
@@item @@code{in_reduction} clause on @@code{task} constructs @@tab Y @@tab
@@item @@code{in_reduction} clause on @@code{target} constructs @@tab P
      @@tab @@code{nowait} only stub
@@item @@code{task_reduction} clause with @@code{taskgroup} @@tab Y @@tab
@@item @@code{task} modifier to @@code{reduction} clause @@tab Y @@tab
@@item @@code{affinity} clause to @@code{task} construct @@tab Y @@tab Stub only
@@item @@code{detach} clause to @@code{task} construct @@tab Y @@tab
@@item @@code{omp_fulfill_event} runtime routine @@tab Y @@tab
@@item @@code{reduction} and @@code{in_reduction} clauses on @@code{taskloop}
      and @@code{taskloop simd} constructs @@tab Y @@tab
@@item @@code{taskloop} construct cancelable by @@code{cancel} construct
      @@tab Y @@tab
@@item @@code{mutexinoutset} @@emph{dependence-type} for @@code{depend} clause
      @@tab Y @@tab
@@item Predefined memory spaces, memory allocators, allocator traits
      @@tab Y @@tab Some are only stubs
@@item Memory management routines @@tab Y @@tab
@@item @@code{allocate} directive @@tab N @@tab
@@item @@code{allocate} clause @@tab P @@tab initial support
@@item @@code{use_device_addr} clause on @@code{target data} @@tab Y @@tab
@@item @@code{ancestor} modifier on @@code{device} clause
      @@tab P @@tab Reverse offload unsupported
@@item Implicit declare target directive @@tab Y @@tab
@@item Discontiguous array section with @@code{target update} construct
      @@tab N @@tab
@@item C/C++'s lvalue expressions in @@code{to}, @@code{from}
      and @@code{map} clauses @@tab N @@tab
@@item C/C++'s lvalue expressions in @@code{depend} clauses @@tab Y @@tab
@@item Nested @@code{declare target} directive @@tab Y @@tab
@@item Combined @@code{master} constructs @@tab Y @@tab
@@item @@code{depend} clause on @@code{taskwait} @@tab Y @@tab
@@item Weak memory ordering clauses on @@code{atomic} and @@code{flush} construct
      @@tab Y @@tab
@@item @@code{hint} clause on the @@code{atomic} construct @@tab Y @@tab Stub only
@@item @@code{depobj} construct and depend objects  @@tab Y @@tab
@@item Lock hints were renamed to synchronization hints @@tab Y @@tab
@@item @@code{conditional} modifier to @@code{lastprivate} clause @@tab Y @@tab
@@item Map-order clarifications @@tab P @@tab
@@item @@code{close} @@emph{map-type-modifier} @@tab Y @@tab
@@item Mapping C/C++ pointer variables and to assign the address of
      device memory mapped by an array section @@tab P @@tab
@@item Mapping of Fortran pointer and allocatable variables, including pointer
      and allocatable components of variables
      @@tab P @@tab Mapping of vars with allocatable components unsupported
@@item @@code{defaultmap} extensions @@tab Y @@tab
@@item @@code{declare mapper} directive @@tab N @@tab
@@item @@code{omp_get_supported_active_levels} routine @@tab Y @@tab
@@item Runtime routines and environment variables to display runtime thread
      affinity information @@tab Y @@tab
@@item @@code{omp_pause_resource} and @@code{omp_pause_resource_all} runtime
      routines @@tab Y @@tab
@@item @@code{omp_get_device_num} runtime routine @@tab Y @@tab
@@item OMPT interface @@tab N @@tab
@@item OMPD interface @@tab N @@tab
@@end multitable

@@unnumberedsubsec Other new OpenMP 5.0 features

@@multitable @@columnfractions .60 .10 .25
@@headitem Description @@tab Status @@tab Comments
@@item Supporting C++'s range-based for loop @@tab Y @@tab
@@end multitable


@@node OpenMP 5.1
@@section OpenMP 5.1

@@unnumberedsubsec New features listed in Appendix B of the OpenMP specification

@@multitable @@columnfractions .60 .10 .25
@@headitem Description @@tab Status @@tab Comments
@@item OpenMP directive as C++ attribute specifiers @@tab Y @@tab
@@item @@code{omp_all_memory} reserved locator @@tab N @@tab
@@item @@emph{target_device trait} in OpenMP Context @@tab N @@tab
@@item @@code{target_device} selector set in context selectors @@tab N @@tab
@@item C/C++'s @@code{declare variant} directive: elision support of
      preprocessed code @@tab N @@tab
@@item @@code{declare variant}: new clauses @@code{adjust_args} and
      @@code{append_args} @@tab N @@tab
@@item @@code{dispatch} construct @@tab N @@tab
@@item device-specific ICV settings the environment variables @@tab N @@tab
@@item assume directive @@tab N @@tab
@@item @@code{nothing} directive @@tab Y @@tab
@@item @@code{error} directive @@tab Y @@tab
@@item @@code{masked} construct @@tab Y @@tab
@@item @@code{scope} directive @@tab Y @@tab
@@item Loop transformation constructs @@tab N @@tab
@@item @@code{strict} modifier in the @@code{grainsize} and @@code{num_tasks}
      clauses of the taskloop construct @@tab Y @@tab
@@item @@code{align} clause/modifier in @@code{allocate} directive/clause
      and @@code{allocator} directive @@tab P @@tab C/C++ on clause only
@@item @@code{thread_limit} clause to @@code{target} construct @@tab Y @@tab
@@item @@code{has_device_addr} clause to @@code{target} construct @@tab Y @@tab
@@item iterators in @@code{target update} motion clauses and @@code{map}
      clauses @@tab N @@tab
@@item indirect calls to the device version of a procedure or function in
      @@code{target} regions @@tab N @@tab
@@item @@code{interop} directive @@tab N @@tab
@@item @@code{omp_interop_t} object support in runtime routines @@tab N @@tab
@@item @@code{nowait} clause in @@code{taskwait} directive @@tab N @@tab
@@item Extensions to the @@code{atomic} directive @@tab Y @@tab
@@item @@code{seq_cst} clause on a @@code{flush} construct @@tab Y @@tab
@@item @@code{inoutset} argument to the @@code{depend} clause @@tab N @@tab
@@item @@code{private} and @@code{firstprivate} argument to @@code{default}
      clause in C and C++ @@tab Y @@tab
@@item @@code{present} argument to @@code{defaultmap} clause @@tab N @@tab
@@item @@code{omp_set_num_teams}, @@code{omp_set_teams_thread_limit},
      @@code{omp_get_max_teams}, @@code{omp_get_teams_thread_limit} runtime
      routines @@tab Y @@tab
@@item @@code{omp_target_is_accessible} runtime routine @@tab N @@tab
@@item @@code{omp_target_memcpy_async} and @@code{omp_target_memcpy_rect_async}
      runtime routines @@tab N @@tab
@@item @@code{omp_get_mapped_ptr} runtime routine @@tab N @@tab
@@item @@code{omp_calloc}, @@code{omp_realloc}, @@code{omp_aligned_alloc} and
      @@code{omp_aligned_calloc} runtime routines @@tab Y @@tab
@@item @@code{omp_alloctrait_key_t} enum: @@code{omp_atv_serialized} added,
      @@code{omp_atv_default} changed @@tab Y @@tab
@@item @@code{omp_display_env} runtime routine @@tab Y @@tab
@@item @@code{ompt_scope_endpoint_t} enum: @@code{ompt_scope_beginend} @@tab N @@tab
@@item @@code{ompt_sync_region_t} enum additions @@tab N @@tab
@@item @@code{ompt_state_t} enum: @@code{ompt_state_wait_barrier_implementation}
      and @@code{ompt_state_wait_barrier_teams} @@tab N @@tab
@@item @@code{ompt_callback_target_data_op_emi_t},
      @@code{ompt_callback_target_emi_t}, @@code{ompt_callback_target_map_emi_t}
      and @@code{ompt_callback_target_submit_emi_t} @@tab N @@tab
@@item @@code{ompt_callback_error_t} type @@tab N @@tab
@@item @@code{OMP_PLACES} syntax extensions @@tab Y @@tab
@@item @@code{OMP_NUM_TEAMS} and @@code{OMP_TEAMS_THREAD_LIMIT} environment
      variables @@tab Y @@tab
@@end multitable

@@unnumberedsubsec Other new OpenMP 5.1 features

@@multitable @@columnfractions .60 .10 .25
@@headitem Description @@tab Status @@tab Comments
@@item Support of strictly structured blocks in Fortran @@tab Y @@tab
@@item Support of structured block sequences in C/C++ @@tab Y @@tab
@@item @@code{unconstrained} and @@code{reproducible} modifiers on @@code{order}
      clause @@tab Y @@tab
@@end multitable
a167 1
* omp_get_device_num::          Get device that current thread is running on
a168 1
* omp_get_initial_device::      Device number of host device
d170 1
a170 1
* omp_get_max_active_levels::   Current maximum number of active regions
a171 1
* omp_get_max_teams::           Maximum number of teams for teams region
a179 1
* omp_get_supported_active_levels:: Maximum number of active regions supported
a181 1
* omp_get_teams_thread_limit::  Maximum number of threads imposed by teams
a190 1
* omp_set_num_teams::           Set upper teams limit for teams region
a192 1
* omp_set_teams_thread_limit::  Set upper thread limit for teams construct
a210 4

Support for event objects.

* omp_fulfill_event::        Fulfill and destroy an OpenMP event.
a322 28
@@node omp_get_device_num
@@section @@code{omp_get_device_num} -- Return device number of current device
@@table @@asis
@@item @@emph{Description}:
This function returns a device number that represents the device that the
current thread is executing on. For OpenMP 5.0, this must be equal to the
value returned by the @@code{omp_get_initial_device} function when called
from the host.

@@item @@emph{C/C++}
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{int omp_get_device_num(void);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_device_num()}
@@end multitable

@@item @@emph{See also}:
@@ref{omp_get_initial_device}

@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v5.0}, Section 3.2.37.
@@end table



a354 27
@@node omp_get_initial_device
@@section @@code{omp_get_initial_device} -- Return device number of initial device
@@table @@asis
@@item @@emph{Description}:
This function returns a device number that represents the host device.
For OpenMP 5.1, this must be equal to the value returned by the
@@code{omp_get_num_devices} function.

@@item @@emph{C/C++}
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{int omp_get_initial_device(void);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_initial_device()}
@@end multitable

@@item @@emph{See also}:
@@ref{omp_get_num_devices}

@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.35.
@@end table



d382 1
a382 1
@@section @@code{omp_get_max_active_levels} -- Current maximum number of active regions
a426 26
@@node omp_get_max_teams
@@section @@code{omp_get_max_teams} -- Maximum number of teams of teams region
@@table @@asis
@@item @@emph{Description}:
Return the maximum number of teams used for the teams region
that does not use the clause @@code{num_teams}.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{int omp_get_max_teams(void);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_max_teams()}
@@end multitable

@@item @@emph{See also}:
@@ref{omp_set_num_teams}, @@ref{omp_get_num_teams}

@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.4.4.
@@end table



d461 4
a464 14
The state of nested parallel regions at startup depends on several
environment variables.  If @@env{OMP_MAX_ACTIVE_LEVELS} is defined
and is set to greater than one, then nested parallel regions will be
enabled.  If not defined, then the value of the @@env{OMP_NESTED}
environment variable will be followed if defined.  If neither are
defined, then if either @@env{OMP_NUM_THREADS} or @@env{OMP_PROC_BIND}
are defined with a list of more than one value, then nested parallel
regions are enabled.  If none of these are defined, then nested parallel
regions are disabled by default.

Nested parallel regions can be enabled or disabled at runtime using
@@code{omp_set_nested}, or by setting the maximum number of nested
regions with @@code{omp_set_max_active_levels} to one to disable, or
above one to enable.
d477 1
a477 2
@@ref{omp_set_max_active_levels}, @@ref{omp_set_nested},
@@ref{OMP_MAX_ACTIVE_LEVELS}, @@ref{OMP_NESTED}
d590 2
a591 3
@@code{omp_proc_bind_true}, @@code{omp_proc_bind_primary},
@@code{omp_proc_bind_master}, @@code{omp_proc_bind_close} and @@code{omp_proc_bind_spread},
where @@code{omp_proc_bind_master} is an alias for @@code{omp_proc_bind_primary}.
a640 25
@@node omp_get_supported_active_levels
@@section @@code{omp_get_supported_active_levels} -- Maximum number of active regions supported
@@table @@asis
@@item @@emph{Description}:
This function returns the maximum number of nested, active parallel regions
supported by this implementation.

@@item @@emph{C/C++}
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{int omp_get_supported_active_levels(void);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_supported_active_levels()}
@@end multitable

@@item @@emph{See also}:
@@ref{omp_get_max_active_levels}, @@ref{omp_set_max_active_levels}

@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v5.0}, Section 3.2.15.
@@end table


a693 26
@@node omp_get_teams_thread_limit
@@section @@code{omp_get_teams_thread_limit} -- Maximum number of threads imposed by teams
@@table @@asis
@@item @@emph{Description}:
Return the maximum number of threads that will be able to participate in
each team created by a teams construct.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{int omp_get_teams_thread_limit(void);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_teams_thread_limit()}
@@end multitable

@@item @@emph{See also}:
@@ref{omp_set_teams_thread_limit}, @@ref{OMP_TEAMS_THREAD_LIMIT}

@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.4.6.
@@end table



d727 1
a727 1
value of the primary thread of a team is always 0.
d880 1
a880 2
parallel regions.  @@var{max_levels} must be less or equal to
the value returned by @@code{omp_get_supported_active_levels}.
d894 1
a894 2
@@ref{omp_get_max_active_levels}, @@ref{omp_get_active_level},
@@ref{omp_get_supported_active_levels}
a910 4
Enabling nested parallel regions will also set the maximum number of
active nested regions to the maximum supported.  Disabling nested parallel
regions will set the maximum number of active nested regions to one.

d923 1
a923 2
@@ref{omp_get_nested}, @@ref{omp_set_max_active_levels},
@@ref{OMP_MAX_ACTIVE_LEVELS}, @@ref{OMP_NESTED}
a930 28
@@node omp_set_num_teams
@@section @@code{omp_set_num_teams} -- Set upper teams limit for teams construct
@@table @@asis
@@item @@emph{Description}:
Specifies the upper bound for number of teams created by the teams construct
which does not specify a @@code{num_teams} clause.  The
argument of @@code{omp_set_num_teams} shall be a positive integer.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{void omp_set_num_teams(int num_teams);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{subroutine omp_set_num_teams(num_teams)}
@@item                   @@tab @@code{integer, intent(in) :: num_teams}
@@end multitable

@@item @@emph{See also}:
@@ref{OMP_NUM_TEAMS}, @@ref{omp_get_num_teams}, @@ref{omp_get_max_teams}

@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.4.3.
@@end table



a991 29
@@node omp_set_teams_thread_limit
@@section @@code{omp_set_teams_thread_limit} -- Set upper thread limit for teams construct
@@table @@asis
@@item @@emph{Description}:
Specifies the upper bound for number of threads that will be available
for each team created by the teams construct which does not specify a
@@code{thread_limit} clause.  The argument of
@@code{omp_set_teams_thread_limit} shall be a positive integer.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{void omp_set_teams_thread_limit(int thread_limit);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{subroutine omp_set_teams_thread_limit(thread_limit)}
@@item                   @@tab @@code{integer, intent(in) :: thread_limit}
@@end multitable

@@item @@emph{See also}:
@@ref{OMP_TEAMS_THREAD_LIMIT}, @@ref{omp_get_teams_thread_limit}, @@ref{omp_get_thread_limit}

@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.4.5.
@@end table



a1331 30
@@node omp_fulfill_event
@@section @@code{omp_fulfill_event} -- Fulfill and destroy an OpenMP event
@@table @@asis
@@item @@emph{Description}:
Fulfill the event associated with the event handle argument.  Currently, it
is only used to fulfill events generated by detach clauses on task
constructs - the effect of fulfilling the event is to allow the task to
complete.

The result of calling @@code{omp_fulfill_event} with an event handle other
than that generated by a detach clause is undefined.  Calling it with an
event handle that has already been fulfilled is also undefined.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{void omp_fulfill_event(omp_event_handle_t event);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{subroutine omp_fulfill_event(event)}
@@item                   @@tab @@code{integer (kind=omp_event_handle_kind) :: event}
@@end multitable

@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v5.0}, Section 3.5.1.
@@end table



a1350 1
* OMP_NUM_TEAMS::           Specifies the number of teams to use by teams region
a1355 2
* OMP_TARGET_OFFLOAD::      Controls offloading behaviour
* OMP_TEAMS_THREAD_LIMIT::  Set the maximum number of threads imposed by teams
d1448 1
a1448 5
If undefined, then if @@env{OMP_NESTED} is defined and set to true, or
if @@env{OMP_NUM_THREADS} or @@env{OMP_PROC_BIND} are defined and set to
a list with more than one item, the maximum number of nested parallel
regions will be initialized to the largest number supported, otherwise
it will be set to one.
d1451 1
a1451 1
@@ref{omp_set_max_active_levels}, @@ref{OMP_NESTED}
d1487 2
a1488 7
shall be @@code{TRUE} or @@code{FALSE}.  If set to @@code{TRUE}, the number
of maximum active nested regions supported will by default be set to the
maximum supported, otherwise it will be set to one.  If
@@env{OMP_MAX_ACTIVE_LEVELS} is defined, its setting will override this
setting.  If both are undefined, nested parallel regions are enabled if
@@env{OMP_NUM_THREADS} or @@env{OMP_PROC_BINDS} are defined to a list with
more than one item, otherwise they are disabled by default.
d1491 1
a1491 1
@@ref{omp_set_max_active_levels}, @@ref{omp_set_nested}
a1498 19
@@node OMP_NUM_TEAMS
@@section @@env{OMP_NUM_TEAMS} -- Specifies the number of teams to use by teams region
@@cindex Environment Variable
@@table @@asis
@@item @@emph{Description}:
Specifies the upper bound for number of teams to use in teams regions
without explicit @@code{num_teams} clause.  The value of this variable shall
be a positive integer.  If undefined it defaults to 0 which means
implementation defined upper bound.

@@item @@emph{See also}:
@@ref{omp_set_num_teams}

@@item @@emph{Reference}: 
@@uref{https://www.openmp.org, OpenMP specification v5.1}, Section 6.23
@@end table



d1507 2
a1508 3
the value specifies the number of threads to use for the corresponding nested
level.  Specifying more than one item in the list will automatically enable
nesting by default.  If undefined one thread per CPU is used.
d1511 1
a1511 1
@@ref{omp_set_num_threads}, @@ref{OMP_NESTED}
d1527 6
a1532 8
values @@code{PRIMARY}, @@code{MASTER}, @@code{CLOSE} and @@code{SPREAD} can
be used to specify the thread affinity policy for the corresponding nesting
level.  With @@code{PRIMARY} and @@code{MASTER} the worker threads are in the
same place partition as the primary thread.  With @@code{CLOSE} those are
kept close to the primary thread in contiguous place partitions.  And
with @@code{SPREAD} a sparse distribution
across the place partitions is used.  Specifying more than one item in the
list will automatically enable nesting by default.
d1538 1
a1538 2
@@ref{omp_get_proc_bind}, @@ref{GOMP_CPU_AFFINITY},
@@ref{OMP_NESTED}, @@ref{OMP_PLACES}
d1552 8
a1559 11
explicit list of the places.  The abstract names @@code{threads}, @@code{cores},
@@code{sockets}, @@code{ll_caches} and @@code{numa_domains} can be optionally
followed by a positive number in parentheses, which denotes the how many places
shall be created.  With @@code{threads} each place corresponds to a single
hardware thread; @@code{cores} to a single core with the corresponding number of
hardware threads; with @@code{sockets} the place corresponds to a single
socket; with @@code{ll_caches} to a set of cores that shares the last level
cache on the device; and @@code{numa_domains} to a set of cores for which their
closest memory on the device is the same memory and at a similar distance from
the cores.  The resulting placement can be shown by setting the
@@env{OMP_DISPLAY_ENV} environment variable.
d1563 1
a1563 2
braces, denoting the hardware threads.  The curly braces can be omitted
when only a single number has been specified.  The hardware threads
d1567 1
a1567 1
specify an interval, a colon followed by the count is placed after
d1570 1
a1570 5
assumed.  Placing an exclamation mark (@@code{!}) directly before a curly
brace or numbers inside the curly braces (excluding intervals) will
exclude those hardware threads.

For instance, the following specifies the same places list:
a1628 44
@@node OMP_TARGET_OFFLOAD
@@section @@env{OMP_TARGET_OFFLOAD} -- Controls offloading behaviour
@@cindex Environment Variable
@@cindex Implementation specific setting
@@table @@asis
@@item @@emph{Description}:
Specifies the behaviour with regard to offloading code to a device.  This
variable can be set to one of three values - @@code{MANDATORY}, @@code{DISABLED}
or @@code{DEFAULT}.

If set to @@code{MANDATORY}, the program will terminate with an error if
the offload device is not present or is not supported.  If set to
@@code{DISABLED}, then offloading is disabled and all code will run on the
host. If set to @@code{DEFAULT}, the program will try offloading to the
device first, then fall back to running code on the host if it cannot.

If undefined, then the program will behave as if @@code{DEFAULT} was set.

@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v5.0}, Section 6.17
@@end table



@@node OMP_TEAMS_THREAD_LIMIT
@@section @@env{OMP_TEAMS_THREAD_LIMIT} -- Set the maximum number of threads imposed by teams
@@cindex Environment Variable
@@table @@asis
@@item @@emph{Description}:
Specifies an upper bound for the number of threads to use by each contention
group created by a teams construct without explicit @@code{thread_limit}
clause.  The value of this variable shall be a positive integer.  If undefined,
the value of 0 is used which stands for an implementation defined upper
limit.

@@item @@emph{See also}:
@@ref{OMP_THREAD_LIMIT}, @@ref{omp_set_teams_thread_limit}

@@item @@emph{Reference}: 
@@uref{https://www.openmp.org, OpenMP specification v5.1}, Section 6.24
@@end table



d1782 2
a1783 2
primary thread that created it.  The priority of the worker thread is not
changed after creation, even if a new OpenMP primary thread using the worker has
d1789 1
a1789 1
then each OpenMP primary thread of this scheduler instance will use its own
d1791 1
a1791 1
thread pools, each OpenMP primary thread must call @@code{omp_set_num_threads}.
d1798 1
a1798 1
instance, the worker thread inherits the priority of the OpenMP primary thread
d3577 1
a3577 1
When a compute construct triggers implicit
d3712 1
a3712 1
and only include this in the version run by the primary thread.
d3849 1
a3849 1
array, and after the barrier, the primary thread iterates over the
@


1.1.1.13
log
@initial import of GCC 14.3.0.

major changes in GCC 13:
- improved sanitizer
- zstd debug info compression
- LTO improvements
- SARIF based diagnostic support
- new warnings: -Wxor-used-as-pow, -Wenum-int-mismatch, -Wself-move,
  -Wdangling-reference
- many new -Wanalyzer* specific warnings
- enhanced warnings: -Wpessimizing-move, -Wredundant-move
- new attributes to mark file descriptors, c++23 "assume"
- several C23 features added
- several C++23 features added
- many new features for Arm, x86, RISC-V

major changes in GCC 14:
- more strict C99 or newer support
- ia64* marked deprecated (but seemingly still in GCC 15.)
- several new hardening features
- support for "hardbool", which can have user supplied values of true/false
- explicit support for stack scrubbing upon function exit
- better auto-vectorisation support
- added clang-compatible __has_feature and __has_extension
- more C23, including -std=c23
- several C++26 features added
- better diagnostics in C++ templates
- new warnings: -Wnrvo, Welaborated-enum-base
- many new features for Arm, x86, RISC-V
- possible ABI breaking change for SPARC64 and small structures with arrays
  of floats.
@
text
@d10 1
a10 1
Copyright @@copyright{} 2006-2024 Free Software Foundation, Inc.
a115 3
* OpenMP-Implementation Specifics:: Notes specifics of this OpenMP
                               implementation
* Offload-Target Specifics::   Notes on offload-target specific internals
d136 7
a142 10
To activate the OpenMP extensions for C/C++ and Fortran, the compile-time
flag @@option{-fopenmp} must be specified.  For C and C++, this enables
the handling of the OpenMP directives using @@code{#pragma omp} and the
@@code{[[omp::directive(...)]]}, @@code{[[omp::sequence(...)]]} and
@@code{[[omp::decl(...)]]} attributes.  For Fortran, it enables for
free source form the @@code{!$omp} sentinel for directives and the
@@code{!$} conditional compilation sentinel and for fixed source form the
@@code{c$omp}, @@code{*$omp} and @@code{!$omp} sentinels for directives and
the @@code{c$}, @@code{*$} and @@code{!$} conditional compilation sentinels.
The flag also arranges for automatic linking of the OpenMP runtime library
a144 4
The @@option{-fopenmp-simd} flag can be used to enable a subset of
OpenMP directives that do not require the linking of either the
OpenMP runtime library or the POSIX threads library.

a160 2
* OpenMP 5.2:: Feature completion status to 5.2 specification
* OpenMP Technical Report 12:: Feature completion status to second 6.0 preview
d185 2
a186 2
      @@tab P @@tab @@emph{simd} traits not handled correctly
@@item @@var{target-offload-var} ICV and @@code{OMP_TARGET_OFFLOAD}
d188 1
a188 1
@@item Nested-parallel changes to @@var{max-active-levels-var} ICV @@tab Y @@tab
d190 2
a191 1
      @@tab complete but no non-host device provides @@code{unified_shared_memory}
d193 1
a193 3
@@item Non-rectangular loop nests @@tab P
      @@tab Full support for C/C++, partial for Fortran
           (@@uref{https://gcc.gnu.org/PR110735,PR110735})
d197 1
a197 1
@@item Collapse of associated loops that are imperfectly nested loops @@tab Y @@tab
d220 1
a220 1
      @@tab Y @@tab See also @@ref{Memory allocation}
d222 2
a223 4
@@item @@code{allocate} directive @@tab P
      @@tab Only C for stack/automatic and Fortran for stack/automatic
      and allocatable/pointer variables
@@item @@code{allocate} clause @@tab P @@tab Initial support
d225 2
a226 1
@@item @@code{ancestor} modifier on @@code{device} clause @@tab Y @@tab
d231 1
a231 1
      and @@code{map} clauses @@tab Y @@tab
d277 1
a277 1
@@item @@code{omp_all_memory} reserved locator @@tab Y @@tab
d285 2
a286 2
@@item device-specific ICV settings with environment variables @@tab Y @@tab
@@item @@code{assume} and @@code{assumes} directives @@tab Y @@tab
d293 3
a295 4
      clauses of the @@code{taskloop} construct @@tab Y @@tab
@@item @@code{align} clause in @@code{allocate} directive @@tab P
      @@tab Only C and Fortran (and not for static variables)
@@item @@code{align} modifier in @@code{allocate} clause @@tab Y @@tab
d298 1
a298 1
@@item Iterators in @@code{target update} motion clauses and @@code{map}
d300 2
a301 2
@@item Indirect calls to the device version of a procedure or function in
      @@code{target} regions @@tab Y @@tab
d304 1
a304 1
@@item @@code{nowait} clause in @@code{taskwait} directive @@tab Y @@tab
d307 1
a307 1
@@item @@code{inoutset} argument to the @@code{depend} clause @@tab Y @@tab
d310 1
a310 1
@@item @@code{present} argument to @@code{defaultmap} clause @@tab Y @@tab
d314 1
a314 1
@@item @@code{omp_target_is_accessible} runtime routine @@tab Y @@tab
d316 2
a317 2
      runtime routines @@tab Y @@tab
@@item @@code{omp_get_mapped_ptr} runtime routine @@tab Y @@tab
a343 189
@@item Support @@code{begin/end declare target} syntax in C/C++ @@tab Y @@tab
@@item Pointer predetermined firstprivate getting initialized
to address of matching mapped list item per 5.1, Sect. 2.21.7.2 @@tab N @@tab
@@item For Fortran, diagnose placing declarative before/between @@code{USE},
      @@code{IMPORT}, and @@code{IMPLICIT} as invalid @@tab N @@tab
@@item Optional comma between directive and clause in the @@code{#pragma} form @@tab Y @@tab
@@item @@code{indirect} clause in @@code{declare target} @@tab Y @@tab
@@item @@code{device_type(nohost)}/@@code{device_type(host)} for variables @@tab N @@tab
@@item @@code{present} modifier to the @@code{map}, @@code{to} and @@code{from}
      clauses @@tab Y @@tab
@@end multitable


@@node OpenMP 5.2
@@section OpenMP 5.2

@@unnumberedsubsec New features listed in Appendix B of the OpenMP specification

@@multitable @@columnfractions .60 .10 .25
@@headitem Description @@tab Status @@tab Comments
@@item @@code{omp_in_explicit_task} routine and @@var{explicit-task-var} ICV
      @@tab Y @@tab
@@item @@code{omp}/@@code{ompx}/@@code{omx} sentinels and @@code{omp_}/@@code{ompx_}
      namespaces @@tab N/A
      @@tab warning for @@code{ompx/omx} sentinels@@footnote{The @@code{ompx}
      sentinel as C/C++ pragma and C++ attributes are warned for with
      @@code{-Wunknown-pragmas} (implied by @@code{-Wall}) and @@code{-Wattributes}
      (enabled by default), respectively; for Fortran free-source code, there is
      a warning enabled by default and, for fixed-source code, the @@code{omx}
      sentinel is warned for with @@code{-Wsurprising} (enabled by
      @@code{-Wall}).  Unknown clauses are always rejected with an error.}
@@item Clauses on @@code{end} directive can be on directive @@tab Y @@tab
@@item @@code{destroy} clause with destroy-var argument on @@code{depobj}
      @@tab Y @@tab
@@item Deprecation of no-argument @@code{destroy} clause on @@code{depobj}
      @@tab N @@tab
@@item @@code{linear} clause syntax changes and @@code{step} modifier @@tab Y @@tab
@@item Deprecation of minus operator for reductions @@tab N @@tab
@@item Deprecation of separating @@code{map} modifiers without comma @@tab N @@tab
@@item @@code{declare mapper} with iterator and @@code{present} modifiers
      @@tab N @@tab
@@item If a matching mapped list item is not found in the data environment, the
      pointer retains its original value @@tab Y @@tab
@@item New @@code{enter} clause as alias for @@code{to} on declare target directive
      @@tab Y @@tab
@@item Deprecation of @@code{to} clause on declare target directive @@tab N @@tab
@@item Extended list of directives permitted in Fortran pure procedures
      @@tab Y @@tab
@@item New @@code{allocators} directive for Fortran @@tab Y @@tab
@@item Deprecation of @@code{allocate} directive for Fortran
      allocatables/pointers @@tab N @@tab
@@item Optional paired @@code{end} directive with @@code{dispatch} @@tab N @@tab
@@item New @@code{memspace} and @@code{traits} modifiers for @@code{uses_allocators}
      @@tab N @@tab
@@item Deprecation of traits array following the allocator_handle expression in
      @@code{uses_allocators} @@tab N @@tab
@@item New @@code{otherwise} clause as alias for @@code{default} on metadirectives
      @@tab N @@tab
@@item Deprecation of @@code{default} clause on metadirectives @@tab N @@tab
@@item Deprecation of delimited form of @@code{declare target} @@tab N @@tab
@@item Reproducible semantics changed for @@code{order(concurrent)} @@tab N @@tab
@@item @@code{allocate} and @@code{firstprivate} clauses on @@code{scope}
      @@tab Y @@tab
@@item @@code{ompt_callback_work} @@tab N @@tab
@@item Default map-type for the @@code{map} clause in @@code{target enter/exit data}
      @@tab Y @@tab
@@item New @@code{doacross} clause as alias for @@code{depend} with
      @@code{source}/@@code{sink} modifier @@tab Y @@tab
@@item Deprecation of @@code{depend} with @@code{source}/@@code{sink} modifier
      @@tab N @@tab
@@item @@code{omp_cur_iteration} keyword @@tab Y @@tab
@@end multitable

@@unnumberedsubsec Other new OpenMP 5.2 features

@@multitable @@columnfractions .60 .10 .25
@@headitem Description @@tab Status @@tab Comments
@@item For Fortran, optional comma between directive and clause @@tab N @@tab
@@item Conforming device numbers and @@code{omp_initial_device} and
      @@code{omp_invalid_device} enum/PARAMETER @@tab Y @@tab
@@item Initial value of @@var{default-device-var} ICV with
      @@code{OMP_TARGET_OFFLOAD=mandatory} @@tab Y @@tab
@@item @@code{all} as @@emph{implicit-behavior} for @@code{defaultmap} @@tab Y @@tab
@@item @@emph{interop_types} in any position of the modifier list for the @@code{init} clause
      of the @@code{interop} construct @@tab N @@tab
@@item Invoke virtual member functions of C++ objects created on the host device
      on other devices @@tab N @@tab
@@end multitable


@@node OpenMP Technical Report 12
@@section OpenMP Technical Report 12

Technical Report (TR) 12 is the second preview for OpenMP 6.0.

@@unnumberedsubsec New features listed in Appendix B of the OpenMP specification
@@multitable @@columnfractions .60 .10 .25
@@item Features deprecated in versions 5.2, 5.1 and 5.0 were removed
      @@tab N/A @@tab Backward compatibility
@@item Full support for C23 was added @@tab P @@tab
@@item Full support for C++23 was added @@tab P @@tab
@@item @@code{_ALL} suffix to the device-scope environment variables
      @@tab P @@tab Host device number wrongly accepted
@@item @@code{num_threads} now accepts a list @@tab N @@tab
@@item Supporting increments with abstract names in @@code{OMP_PLACES} @@tab N @@tab
@@item Extension of @@code{OMP_DEFAULT_DEVICE} and new
      @@code{OMP_AVAILABLE_DEVICES} environment vars @@tab N @@tab
@@item New @@code{OMP_THREADS_RESERVE} environment variable @@tab N @@tab
@@item The @@code{decl} attribute was added to the C++ attribute syntax
      @@tab Y @@tab
@@item The OpenMP directive syntax was extended to include C 23 attribute
      specifiers @@tab Y @@tab
@@item All inarguable clauses take now an optional Boolean argument @@tab N @@tab
@@item For Fortran, @@emph{locator list} can be also function reference with
      data pointer result @@tab N @@tab
@@item Concept of @@emph{assumed-size arrays} in C and C++
      @@tab N @@tab
@@item @@emph{directive-name-modifier} accepted in all clauses @@tab N @@tab
@@item For Fortran, atomic with BLOCK construct and, for C/C++, with
      unlimited curly braces supported @@tab N @@tab
@@item For Fortran, atomic compare with storing the comparison result
      @@tab N @@tab
@@item New @@code{looprange} clause @@tab N @@tab
@@item Ref-count change for @@code{use_device_ptr}/@@code{use_device_addr}
      @@tab N @@tab
@@item Support for inductions @@tab N @@tab
@@item Implicit reduction identifiers of C++ classes
      @@tab N @@tab
@@item Change of the @@emph{map-type} property from @@emph{ultimate} to
      @@emph{default} @@tab N @@tab
@@item @@code{self} modifier to @@code{map} and @@code{self} as
      @@code{defaultmap} argument @@tab N @@tab
@@item Mapping of @@emph{assumed-size arrays} in C, C++ and Fortran
      @@tab N @@tab
@@item @@code{groupprivate} directive @@tab N @@tab
@@item @@code{local} clause to @@code{declare target} directive @@tab N @@tab
@@item @@code{part_size} allocator trait @@tab N @@tab
@@item @@code{pin_device}, @@code{preferred_device} and @@code{target_access}
      allocator traits
      @@tab N @@tab
@@item @@code{access} allocator trait changes @@tab N @@tab
@@item Extension of @@code{interop} operation of @@code{append_args}, allowing all
      modifiers of the @@code{init} clause
      @@tab N @@tab
@@item @@code{interop} clause to @@code{dispatch} @@tab N @@tab
@@item @@code{message} and @@code{severity} clauses to @@code{parallel} directive
      @@tab N @@tab
@@item @@code{self} clause to @@code{requires} directive @@tab N @@tab
@@item @@code{no_openmp_constructs} assumptions clause @@tab N @@tab
@@item @@code{reverse} loop-transformation construct @@tab N @@tab
@@item @@code{interchange} loop-transformation construct @@tab N @@tab
@@item @@code{fuse} loop-transformation construct @@tab N @@tab
@@item @@code{apply} code to loop-transforming constructs @@tab N @@tab
@@item @@code{omp_curr_progress_width} identifier @@tab N @@tab
@@item @@code{safesync} clause to the @@code{parallel} construct @@tab N @@tab
@@item @@code{omp_get_max_progress_width} runtime routine @@tab N @@tab
@@item @@code{strict} modifier keyword to @@code{num_threads} @@tab N @@tab
@@item @@code{atomic} permitted in a construct with @@code{order(concurrent)}
      @@tab N @@tab
@@item @@code{workdistribute} directive for Fortran @@tab N
      @@tab Renamed just after TR12; added in TR12 as @@code{coexecute}
@@item Fortran DO CONCURRENT as associated loop in a @@code{loop} construct
      @@tab N @@tab
@@item @@code{threadset} clause in task-generating constructs @@tab N @@tab
@@item @@code{nowait} clause with reverse-offload @@code{target} directives
      @@tab N @@tab
@@item Boolean argument to @@code{nowait} and @@code{nogroup} may be non constant
      @@tab N @@tab
@@item @@code{memscope} clause to @@code{atomic} and @@code{flush} @@tab N @@tab
@@item @@code{omp_is_free_agent} and @@code{omp_ancestor_is_free_agent} routines
      @@tab N @@tab
@@item @@code{omp_target_memset} and @@code{omp_target_memset_rect_async} routines
      @@tab N @@tab
@@item Routines for obtaining memory spaces/allocators for shared/device memory
      @@tab N @@tab
@@item @@code{omp_get_memspace_num_resources} routine @@tab N @@tab
@@item @@code{omp_get_submemspace} routine @@tab N @@tab
@@item @@code{ompt_target_data_transfer} and @@code{ompt_target_data_transfer_async}
      values in @@code{ompt_target_data_op_t} enum @@tab N @@tab
@@item @@code{ompt_get_buffer_limits} OMPT routine @@tab N @@tab
@@end multitable

@@unnumberedsubsec Other new TR 12 features
@@multitable @@columnfractions .60 .10 .25
@@item Canonical loop nest enclosed in (multiple) curly braces (C/C++) or BLOCK constructs (Fortran)
      @@tab N @@tab
@@item Relaxed Fortran restrictions to the @@code{aligned} clause @@tab N @@tab
@@item Mapping lambda captures @@tab N @@tab
@@item New @@code{omp_pause_stop_tool} constant for omp_pause_resource @@tab N @@tab
a346 1

d354 3
a356 2
The runtime routines described here are defined by Section 18 of the OpenMP
specification in version 5.2.
d359 2
a360 15
* Thread Team Routines::
* Thread Affinity Routines::
* Teams Region Routines::
* Tasking Routines::
* Resource Relinquishing Routines::
* Device Information Routines::
* Device Memory Routines::
* Lock Routines::
* Timing Routines::
* Event Routine::
@@c * Interoperability Routines::
* Memory Management Routines::
@@c * Tool Control Routine::
* Environment Display Routine::
@@end menu
d362 16
a377 10


@@node Thread Team Routines
@@section Thread Team Routines

Routines controlling threads in the current contention group.
They have C linkage and do not throw exceptions.

@@menu
* omp_set_num_threads::         Set upper team size limit
d379 7
a385 1
* omp_get_max_threads::         Maximum number of threads of parallel region
d388 3
d392 1
a392 2
* omp_get_dynamic::             Dynamic teams setting
* omp_get_cancellation::        Whether cancellation support is enabled
d394 2
a395 1
* omp_get_nested::              Nested parallel regions
d397 1
a397 10
* omp_get_schedule::            Obtain the runtime scheduling method
* omp_get_teams_thread_limit::  Maximum number of threads imposed by teams
* omp_get_supported_active_levels:: Maximum number of active regions supported
* omp_set_max_active_levels::   Limits the number of active parallel regions
* omp_get_max_active_levels::   Current maximum number of active regions
* omp_get_level::               Number of parallel regions
* omp_get_ancestor_thread_num:: Ancestor thread ID
* omp_get_team_size::           Number of threads in a team
* omp_get_active_level::        Number of active parallel regions
@@end menu
d399 1
d401 10
d412 1
a412 7
@@node omp_set_num_threads
@@subsection @@code{omp_set_num_threads} -- Set upper team size limit
@@table @@asis
@@item @@emph{Description}:
Specifies the number of threads used by default in subsequent parallel
sections, if those do not specify a @@code{num_threads} clause.  The
argument of @@code{omp_set_num_threads} shall be a positive integer.
d414 2
a415 4
@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{void omp_set_num_threads(int num_threads);}
@@end multitable
d417 1
a417 5
@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{subroutine omp_set_num_threads(num_threads)}
@@item                   @@tab @@code{integer, intent(in) :: num_threads}
@@end multitable
d419 2
a420 6
@@item @@emph{See also}:
@@ref{OMP_NUM_THREADS}, @@ref{omp_get_num_threads}, @@ref{omp_get_max_threads}

@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.1.
@@end table
d424 2
a425 2
@@node omp_get_num_threads
@@subsection @@code{omp_get_num_threads} -- Size of the active team
d428 2
a429 2
Returns the number of threads in the current team.  In a sequential section of
the program @@code{omp_get_num_threads} returns 1.
d431 1
a431 8
The default team size may be initialized at startup by the
@@env{OMP_NUM_THREADS} environment variable.  At runtime, the size
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
used to define a specific value and @@env{OMP_DYNAMIC} is disabled,
one thread per CPU online is used.

@@item @@emph{C/C++}:
d433 1
a433 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_num_threads(void);}
d438 1
a438 1
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_num_threads()}
d442 1
a442 1
@@ref{omp_get_max_threads}, @@ref{omp_set_num_threads}, @@ref{OMP_NUM_THREADS}
d445 1
a445 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.2.
d450 2
a451 2
@@node omp_get_max_threads
@@subsection @@code{omp_get_max_threads} -- Maximum number of threads of parallel region
d454 4
a457 2
Return the maximum number of threads used for the current parallel region
that does not use the clause @@code{num_threads}.
d459 1
a459 1
@@item @@emph{C/C++}:
d461 1
a461 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_max_threads(void);}
d466 2
a467 1
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_max_threads()}
d471 1
a471 1
@@ref{omp_set_num_threads}, @@ref{omp_set_dynamic}, @@ref{omp_get_thread_limit}
d474 1
a474 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.3.
d479 2
a480 2
@@node omp_get_thread_num
@@subsection @@code{omp_get_thread_num} -- Current thread ID
d483 4
a486 5
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 primary thread of a team is always 0.
d490 1
a490 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_thread_num(void);}
d495 1
a495 1
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_thread_num()}
d499 1
a499 1
@@ref{omp_get_num_threads}, @@ref{omp_get_ancestor_thread_num}
d502 1
a502 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.4.
d507 2
a508 2
@@node omp_in_parallel
@@subsection @@code{omp_in_parallel} -- Whether a parallel region is active
d511 1
a511 3
This function returns @@code{true} if currently running in parallel,
@@code{false} otherwise.  Here, @@code{true} and @@code{false} represent
their language-specific counterparts.
d515 1
a515 1
@@item @@emph{Prototype}: @@tab @@code{int omp_in_parallel(void);}
d520 1
a520 1
@@item @@emph{Interface}: @@tab @@code{logical function omp_in_parallel()}
d523 3
d527 1
a527 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.6.
d531 3
a533 2
@@node omp_set_dynamic
@@subsection @@code{omp_set_dynamic} -- Enable/disable dynamic teams
d536 4
a539 4
Enable or disable the dynamic adjustment of the number of threads 
within a team.  The function takes the language-specific equivalent
of @@code{true} and @@code{false}, where @@code{true} enables dynamic 
adjustment of team sizes and @@code{false} disables it.
d541 1
a541 1
@@item @@emph{C/C++}:
d543 1
a543 1
@@item @@emph{Prototype}: @@tab @@code{void omp_set_dynamic(int dynamic_threads);}
d548 1
a548 2
@@item @@emph{Interface}: @@tab @@code{subroutine omp_set_dynamic(dynamic_threads)}
@@item                   @@tab @@code{logical, intent(in) :: dynamic_threads}
d552 1
a552 1
@@ref{OMP_DYNAMIC}, @@ref{omp_get_dynamic}
d555 1
a555 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.7.
d561 1
a561 1
@@subsection @@code{omp_get_dynamic} -- Dynamic teams setting
d592 2
a593 2
@@node omp_get_cancellation
@@subsection @@code{omp_get_cancellation} -- Whether cancellation support is enabled
d596 3
a598 4
This function returns @@code{true} if cancellation is activated, @@code{false}
otherwise.  Here, @@code{true} and @@code{false} represent their language-specific
counterparts.  Unless @@env{OMP_CANCELLATION} is set true, cancellations are
deactivated.
d600 1
a600 1
@@item @@emph{C/C++}:
d602 1
a602 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_cancellation(void);}
d607 1
a607 1
@@item @@emph{Interface}: @@tab @@code{logical function omp_get_cancellation()}
d611 1
a611 1
@@ref{OMP_CANCELLATION}
d614 1
a614 671
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.9.
@@end table



@@node omp_set_nested
@@subsection @@code{omp_set_nested} -- Enable/disable nested parallel regions
@@table @@asis
@@item @@emph{Description}:
Enable or disable nested parallel regions, i.e., whether team members
are allowed to create new teams.  The function takes the language-specific
equivalent of @@code{true} and @@code{false}, where @@code{true} enables 
dynamic adjustment of team sizes and @@code{false} disables it.

Enabling nested parallel regions also sets the maximum number of
active nested regions to the maximum supported.  Disabling nested parallel
regions sets the maximum number of active nested regions to one.

Note that the @@code{omp_set_nested} API routine was deprecated
in the OpenMP specification 5.2 in favor of @@code{omp_set_max_active_levels}.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{void omp_set_nested(int nested);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{subroutine omp_set_nested(nested)}
@@item                   @@tab @@code{logical, intent(in) :: nested}
@@end multitable

@@item @@emph{See also}:
@@ref{omp_get_nested}, @@ref{omp_set_max_active_levels},
@@ref{OMP_MAX_ACTIVE_LEVELS}, @@ref{OMP_NESTED}

@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.10.
@@end table



@@node omp_get_nested
@@subsection @@code{omp_get_nested} -- Nested parallel regions
@@table @@asis
@@item @@emph{Description}:
This function returns @@code{true} if nested parallel regions are
enabled, @@code{false} otherwise.  Here, @@code{true} and @@code{false}
represent their language-specific counterparts.

The state of nested parallel regions at startup depends on several
environment variables.  If @@env{OMP_MAX_ACTIVE_LEVELS} is defined
and is set to greater than one, then nested parallel regions will be
enabled.  If not defined, then the value of the @@env{OMP_NESTED}
environment variable will be followed if defined.  If neither are
defined, then if either @@env{OMP_NUM_THREADS} or @@env{OMP_PROC_BIND}
are defined with a list of more than one value, then nested parallel
regions are enabled.  If none of these are defined, then nested parallel
regions are disabled by default.

Nested parallel regions can be enabled or disabled at runtime using
@@code{omp_set_nested}, or by setting the maximum number of nested
regions with @@code{omp_set_max_active_levels} to one to disable, or
above one to enable.

Note that the @@code{omp_get_nested} API routine was deprecated
in the OpenMP specification 5.2 in favor of @@code{omp_get_max_active_levels}.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{int omp_get_nested(void);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{logical function omp_get_nested()}
@@end multitable

@@item @@emph{See also}:
@@ref{omp_get_max_active_levels}, @@ref{omp_set_nested},
@@ref{OMP_MAX_ACTIVE_LEVELS}, @@ref{OMP_NESTED}

@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.11.
@@end table



@@node omp_set_schedule
@@subsection @@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{chunk_size} if positive, or to the default value if zero or negative.
For @@code{omp_sched_auto} the @@var{chunk_size} 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 chunk_size);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{subroutine omp_set_schedule(kind, chunk_size)}
@@item                   @@tab @@code{integer(kind=omp_sched_kind) kind}
@@item                   @@tab @@code{integer chunk_size}
@@end multitable

@@item @@emph{See also}:
@@ref{omp_get_schedule}
@@ref{OMP_SCHEDULE}

@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.12.
@@end table



@@node omp_get_schedule
@@subsection @@code{omp_get_schedule} -- Obtain the runtime scheduling method
@@table @@asis
@@item @@emph{Description}:
Obtain the runtime scheduling method.  The @@var{kind} argument is set to
@@code{omp_sched_static}, @@code{omp_sched_dynamic},
@@code{omp_sched_guided} or @@code{omp_sched_auto}.  The second argument,
@@var{chunk_size}, is set to the chunk size.

@@item @@emph{C/C++}
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{void omp_get_schedule(omp_sched_t *kind, int *chunk_size);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{subroutine omp_get_schedule(kind, chunk_size)}
@@item                   @@tab @@code{integer(kind=omp_sched_kind) kind}
@@item                   @@tab @@code{integer chunk_size}
@@end multitable

@@item @@emph{See also}:
@@ref{omp_set_schedule}, @@ref{OMP_SCHEDULE}

@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.13.
@@end table


@@node omp_get_teams_thread_limit
@@subsection @@code{omp_get_teams_thread_limit} -- Maximum number of threads imposed by teams
@@table @@asis
@@item @@emph{Description}:
Return the maximum number of threads that are able to participate in
each team created by a teams construct.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{int omp_get_teams_thread_limit(void);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_teams_thread_limit()}
@@end multitable

@@item @@emph{See also}:
@@ref{omp_set_teams_thread_limit}, @@ref{OMP_TEAMS_THREAD_LIMIT}

@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.4.6.
@@end table



@@node omp_get_supported_active_levels
@@subsection @@code{omp_get_supported_active_levels} -- Maximum number of active regions supported
@@table @@asis
@@item @@emph{Description}:
This function returns the maximum number of nested, active parallel regions
supported by this implementation.

@@item @@emph{C/C++}
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{int omp_get_supported_active_levels(void);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_supported_active_levels()}
@@end multitable

@@item @@emph{See also}:
@@ref{omp_get_max_active_levels}, @@ref{omp_set_max_active_levels}

@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v5.0}, Section 3.2.15.
@@end table



@@node omp_set_max_active_levels
@@subsection @@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.  @@var{max_levels} must be less or equal to
the value returned by @@code{omp_get_supported_active_levels}.

@@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},
@@ref{omp_get_supported_active_levels}

@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.15.
@@end table



@@node omp_get_max_active_levels
@@subsection @@code{omp_get_max_active_levels} -- Current 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{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.16.
@@end table


@@node omp_get_level
@@subsection @@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{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.17.
@@end table



@@node omp_get_ancestor_thread_num
@@subsection @@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{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.18.
@@end table



@@node omp_get_team_size
@@subsection @@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{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.19.
@@end table



@@node omp_get_active_level
@@subsection @@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{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.20.
@@end table



@@node Thread Affinity Routines
@@section Thread Affinity Routines

Routines controlling and accessing thread-affinity policies.
They have C linkage and do not throw exceptions.

@@menu
* omp_get_proc_bind::           Whether threads may be moved between CPUs
@@c * omp_get_num_places:: <fixme>
@@c * omp_get_place_num_procs:: <fixme>
@@c * omp_get_place_proc_ids:: <fixme>
@@c * omp_get_place_num:: <fixme>
@@c * omp_get_partition_num_places:: <fixme>
@@c * omp_get_partition_place_nums:: <fixme>
@@c * omp_set_affinity_format:: <fixme>
@@c * omp_get_affinity_format:: <fixme>
@@c * omp_display_affinity:: <fixme>
@@c * omp_capture_affinity:: <fixme>
@@end menu



@@node omp_get_proc_bind
@@subsection @@code{omp_get_proc_bind} -- Whether threads may be moved between CPUs
@@table @@asis
@@item @@emph{Description}:
This functions returns the currently active thread affinity policy, which is
set via @@env{OMP_PROC_BIND}.  Possible values are @@code{omp_proc_bind_false},
@@code{omp_proc_bind_true}, @@code{omp_proc_bind_primary},
@@code{omp_proc_bind_master}, @@code{omp_proc_bind_close} and @@code{omp_proc_bind_spread},
where @@code{omp_proc_bind_master} is an alias for @@code{omp_proc_bind_primary}.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{omp_proc_bind_t omp_get_proc_bind(void);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{integer(kind=omp_proc_bind_kind) function omp_get_proc_bind()}
@@end multitable

@@item @@emph{See also}:
@@ref{OMP_PROC_BIND}, @@ref{OMP_PLACES}, @@ref{GOMP_CPU_AFFINITY},

@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.22.
@@end table



@@node Teams Region Routines
@@section Teams Region Routines

Routines controlling the league of teams that are executed in a @@code{teams}
region.  They have C linkage and do not throw exceptions.

@@menu
* omp_get_num_teams::           Number of teams
* omp_get_team_num::            Get team number
* omp_set_num_teams::           Set upper teams limit for teams region
* omp_get_max_teams::           Maximum number of teams for teams region
* omp_set_teams_thread_limit::  Set upper thread limit for teams construct
* omp_get_thread_limit::        Maximum number of threads
@@end menu



@@node omp_get_num_teams
@@subsection @@code{omp_get_num_teams} -- Number of teams
@@table @@asis
@@item @@emph{Description}:
Returns the number of teams in the current team region.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{int omp_get_num_teams(void);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_num_teams()}
@@end multitable

@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.32.
@@end table



@@node omp_get_team_num
@@subsection @@code{omp_get_team_num} -- Get team number
@@table @@asis
@@item @@emph{Description}:
Returns the team number of the calling thread.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{int omp_get_team_num(void);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_team_num()}
@@end multitable

@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.33.
@@end table



@@node omp_set_num_teams
@@subsection @@code{omp_set_num_teams} -- Set upper teams limit for teams construct
@@table @@asis
@@item @@emph{Description}:
Specifies the upper bound for number of teams created by the teams construct
which does not specify a @@code{num_teams} clause.  The
argument of @@code{omp_set_num_teams} shall be a positive integer.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{void omp_set_num_teams(int num_teams);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{subroutine omp_set_num_teams(num_teams)}
@@item                   @@tab @@code{integer, intent(in) :: num_teams}
@@end multitable

@@item @@emph{See also}:
@@ref{OMP_NUM_TEAMS}, @@ref{omp_get_num_teams}, @@ref{omp_get_max_teams}

@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.4.3.
@@end table



@@node omp_get_max_teams
@@subsection @@code{omp_get_max_teams} -- Maximum number of teams of teams region
@@table @@asis
@@item @@emph{Description}:
Return the maximum number of teams used for the teams region
that does not use the clause @@code{num_teams}.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{int omp_get_max_teams(void);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_max_teams()}
@@end multitable

@@item @@emph{See also}:
@@ref{omp_set_num_teams}, @@ref{omp_get_num_teams}

@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.4.4.
@@end table



@@node omp_set_teams_thread_limit
@@subsection @@code{omp_set_teams_thread_limit} -- Set upper thread limit for teams construct
@@table @@asis
@@item @@emph{Description}:
Specifies the upper bound for number of threads that are available
for each team created by the teams construct which does not specify a
@@code{thread_limit} clause.  The argument of
@@code{omp_set_teams_thread_limit} shall be a positive integer.

@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{void omp_set_teams_thread_limit(int thread_limit);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{subroutine omp_set_teams_thread_limit(thread_limit)}
@@item                   @@tab @@code{integer, intent(in) :: thread_limit}
@@end multitable

@@item @@emph{See also}:
@@ref{OMP_TEAMS_THREAD_LIMIT}, @@ref{omp_get_teams_thread_limit}, @@ref{omp_get_thread_limit}

@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.4.5.
@@end table



@@node omp_get_thread_limit
@@subsection @@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{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.14.
@@end table



@@node Tasking Routines
@@section Tasking Routines

Routines relating to explicit tasks.
They have C linkage and do not throw exceptions.

@@menu
* omp_get_max_task_priority::   Maximum task priority value that can be set
* omp_in_explicit_task::        Whether a given task is an explicit task
* omp_in_final::                Whether in final or included task region
@@c * omp_is_free_agent:: <fixme>/TR12
@@c * omp_ancestor_is_free_agent:: <fixme>/TR12
@@end menu



@@node omp_get_max_task_priority
@@subsection @@code{omp_get_max_task_priority} -- Maximum priority value
that can be set for tasks.
@@table @@asis
@@item @@emph{Description}:
This function obtains the maximum allowed priority number for tasks.

@@item @@emph{C/C++}
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{int omp_get_max_task_priority(void);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_max_task_priority()}
@@end multitable

@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.29.
@@end table



@@node omp_in_explicit_task
@@subsection @@code{omp_in_explicit_task} -- Whether a given task is an explicit task
@@table @@asis
@@item @@emph{Description}:
The function returns the @@var{explicit-task-var} ICV; it returns true when the
encountering task was generated by a task-generating construct such as
@@code{target}, @@code{task} or @@code{taskloop}.  Otherwise, the encountering task
is in an implicit task region such as generated by the implicit or explicit
@@code{parallel} region and @@code{omp_in_explicit_task} returns false.

@@item @@emph{C/C++}
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{int omp_in_explicit_task(void);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{logical function omp_in_explicit_task()}
@@end multitable

@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v5.2}, Section 18.5.2.
@@end table



@@node omp_in_final
@@subsection @@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{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.21.
d619 2
a620 15
@@node Resource Relinquishing Routines
@@section Resource Relinquishing Routines

Routines releasing resources used by the OpenMP runtime.
They have C linkage and do not throw exceptions.

@@menu
* omp_pause_resource:: Release OpenMP resources on a device
* omp_pause_resource_all:: Release OpenMP resources on all devices
@@end menu



@@node omp_pause_resource
@@subsection @@code{omp_pause_resource} -- Release OpenMP resources on a device
d623 2
a624 3
Free resources used by the OpenMP program and the runtime library on and for the
device specified by @@var{device_num}; on success, zero is returned and non-zero
otherwise.
d626 1
a626 5
The value of @@var{device_num} must be a conforming device number.  The routine
may not be called from within any explicit region and all explicit threads that
do not bind to the implicit parallel region have finalized execution.

@@item @@emph{C/C++}:
d628 1
a628 1
@@item @@emph{Prototype}: @@tab @@code{int omp_pause_resource(omp_pause_resource_t kind, int device_num);}
d633 1
a633 3
@@item @@emph{Interface}: @@tab @@code{integer function omp_pause_resource(kind, device_num)}
@@item                   @@tab @@code{integer (kind=omp_pause_resource_kind) kind}
@@item                   @@tab @@code{integer device_num}
d636 3
d640 1
a640 1
@@uref{https://www.openmp.org, OpenMP specification v5.0}, Section 3.2.43.
d645 2
a646 2
@@node omp_pause_resource_all
@@subsection @@code{omp_pause_resource_all} -- Release OpenMP resources on all devices
d649 1
a649 2
Free resources used by the OpenMP program and the runtime library on all devices,
including the host. On success, zero is returned and non-zero otherwise.
d651 1
a651 4
The routine may not be called from within any explicit region and all explicit
threads that do not bind to the implicit parallel region have finalized execution.

@@item @@emph{C/C++}:
d653 1
a653 1
@@item @@emph{Prototype}: @@tab @@code{int omp_pause_resource(omp_pause_resource_t kind);}
d658 1
a658 2
@@item @@emph{Interface}: @@tab @@code{integer function omp_pause_resource(kind)}
@@item                   @@tab @@code{integer (kind=omp_pause_resource_kind) kind}
d662 1
a662 1
@@ref{omp_pause_resource}
d665 1
a665 1
@@uref{https://www.openmp.org, OpenMP specification v5.0}, Section 3.2.44.
d669 3
a671 22

@@node Device Information Routines
@@section Device Information Routines

Routines related to devices available to an OpenMP program.
They have C linkage and do not throw exceptions.

@@menu
* omp_get_num_procs::           Number of processors online
@@c * omp_get_max_progress_width:: <fixme>/TR11
* omp_set_default_device::      Set the default device for target regions
* omp_get_default_device::      Get the default device for target regions
* omp_get_num_devices::         Number of target devices
* omp_get_device_num::          Get device that current thread is running on
* omp_is_initial_device::       Whether executing on the host device
* omp_get_initial_device::      Device number of host device
@@end menu



@@node omp_get_num_procs
@@subsection @@code{omp_get_num_procs} -- Number of processors online
d674 1
a674 1
Returns the number of processors online on that device.
d676 1
a676 1
@@item @@emph{C/C++}:
d678 1
a678 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_num_procs(void);}
d683 1
a683 1
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_num_procs()}
d687 1
a687 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.5.
d691 2
a692 3

@@node omp_set_default_device
@@subsection @@code{omp_set_default_device} -- Set the default device for target regions
d695 2
a696 2
Set the default device for target regions without device clause.  The argument
shall be a nonnegative device number.
d700 1
a700 1
@@item @@emph{Prototype}: @@tab @@code{void omp_set_default_device(int device_num);}
d705 1
a705 2
@@item @@emph{Interface}: @@tab @@code{subroutine omp_set_default_device(device_num)}
@@item                   @@tab @@code{integer device_num}
d709 1
a709 1
@@ref{OMP_DEFAULT_DEVICE}, @@ref{omp_get_default_device}
d712 1
a712 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.29.
d717 2
a718 2
@@node omp_get_default_device
@@subsection @@code{omp_get_default_device} -- Get the default device for target regions
d721 2
a722 1
Get the default device for target regions without device clause.
d726 1
a726 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_default_device(void);}
d731 1
a731 1
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_default_device()}
d735 1
a735 1
@@ref{OMP_DEFAULT_DEVICE}, @@ref{omp_set_default_device}
d738 1
a738 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.30.
d743 2
a744 2
@@node omp_get_num_devices
@@subsection @@code{omp_get_num_devices} -- Number of target devices
d747 3
a749 1
Returns the number of target devices.
d751 9
a759 4
@@item @@emph{C/C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{int omp_get_num_devices(void);}
@@end multitable
d761 4
a764 4
@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_num_devices()}
@@end multitable
d766 1
a766 16
@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.31.
@@end table



@@node omp_get_device_num
@@subsection @@code{omp_get_device_num} -- Return device number of current device
@@table @@asis
@@item @@emph{Description}:
This function returns a device number that represents the device that the
current thread is executing on. For OpenMP 5.0, this must be equal to the
value returned by the @@code{omp_get_initial_device} function when called
from the host.

@@item @@emph{C/C++}
d768 1
a768 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_device_num(void);}
d773 1
a773 1
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_device_num()}
d777 2
a778 1
@@ref{omp_get_initial_device}
d781 1
a781 1
@@uref{https://www.openmp.org, OpenMP specification v5.0}, Section 3.2.37.
d786 2
a787 2
@@node omp_is_initial_device
@@subsection @@code{omp_is_initial_device} -- Whether executing on the host device
d790 1
a790 3
This function returns @@code{true} if currently running on the host device,
@@code{false} otherwise.  Here, @@code{true} and @@code{false} represent
their language-specific counterparts.
d794 1
a794 1
@@item @@emph{Prototype}: @@tab @@code{int omp_is_initial_device(void);}
d799 1
a799 1
@@item @@emph{Interface}: @@tab @@code{logical function omp_is_initial_device()}
d803 1
a803 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.34.
d808 2
a809 2
@@node omp_get_initial_device
@@subsection @@code{omp_get_initial_device} -- Return device number of initial device
d812 1
a812 3
This function returns a device number that represents the host device.
For OpenMP 5.1, this must be equal to the value returned by the
@@code{omp_get_num_devices} function.
d814 1
a814 1
@@item @@emph{C/C++}
d816 1
a816 1
@@item @@emph{Prototype}: @@tab @@code{int omp_get_initial_device(void);}
d821 1
a821 1
@@item @@emph{Interface}: @@tab @@code{integer function omp_get_initial_device()}
a823 3
@@item @@emph{See also}:
@@ref{omp_get_num_devices}

d825 1
a825 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.35.
d830 2
a831 26
@@node Device Memory Routines
@@section Device Memory Routines

Routines related to memory allocation and managing corresponding
pointers on devices. They have C linkage and do not throw exceptions.

@@menu
* omp_target_alloc:: Allocate device memory
* omp_target_free:: Free device memory
* omp_target_is_present:: Check whether storage is mapped
* omp_target_is_accessible:: Check whether memory is device accessible
* omp_target_memcpy:: Copy data between devices
* omp_target_memcpy_async:: Copy data between devices asynchronously
* omp_target_memcpy_rect:: Copy a subvolume of data between devices
* omp_target_memcpy_rect_async:: Copy a subvolume of data between devices asynchronously
@@c * omp_target_memset:: <fixme>/TR12
@@c * omp_target_memset_async:: <fixme>/TR12
* omp_target_associate_ptr:: Associate a device pointer with a host pointer
* omp_target_disassociate_ptr:: Remove device--host pointer association
* omp_get_mapped_ptr:: Return device pointer to a host pointer
@@end menu



@@node omp_target_alloc
@@subsection @@code{omp_target_alloc} -- Allocate device memory
d834 1
a834 10
This routine allocates @@var{size} bytes of memory in the device environment
associated with the device number @@var{device_num}.  If successful, a device
pointer is returned, otherwise a null pointer.

In GCC, when the device is the host or the device shares memory with the host,
the memory is allocated on the host; in that case, when @@var{size} is zero,
either NULL or a unique pointer value that can later be successfully passed to
@@code{omp_target_free} is returned.  When the allocation is not performed on
the host, a null pointer is returned when @@var{size} is zero; in that case,
additionally a diagnostic might be printed to standard error (stderr).
d836 1
a836 4
Running this routine in a @@code{target} region except on the initial device
is not supported.

@@item @@emph{C/C++}
d838 1
a838 1
@@item @@emph{Prototype}: @@tab @@code{void *omp_target_alloc(size_t size, int device_num)}
d843 1
a843 4
@@item @@emph{Interface}: @@tab @@code{type(c_ptr) function omp_target_alloc(size, device_num) bind(C)}
@@item                   @@tab @@code{use, intrinsic :: iso_c_binding, only: c_ptr, c_int, c_size_t}
@@item                   @@tab @@code{integer(c_size_t), value :: size}
@@item                   @@tab @@code{integer(c_int), value :: device_num}
a845 3
@@item @@emph{See also}:
@@ref{omp_target_free}, @@ref{omp_target_associate_ptr}

d847 1
a847 1
@@uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.8.1
d852 2
a853 2
@@node omp_target_free
@@subsection @@code{omp_target_free} -- Free device memory
d856 2
a857 4
This routine frees memory allocated by the @@code{omp_target_alloc} routine.
The @@var{device_ptr} argument must be either a null pointer or a device pointer
returned by @@code{omp_target_alloc} for the specified @@code{device_num}.  The
device number @@var{device_num} must be a conforming device number.
d859 6
a864 2
Running this routine in a @@code{target} region except on the initial device
is not supported.
d866 1
a866 1
@@item @@emph{C/C++}
d868 1
a868 1
@@item @@emph{Prototype}: @@tab @@code{void omp_target_free(void *device_ptr, int device_num)}
d873 1
a873 4
@@item @@emph{Interface}: @@tab @@code{subroutine omp_target_free(device_ptr, device_num) bind(C)}
@@item                   @@tab @@code{use, intrinsic :: iso_c_binding, only: c_ptr, c_int}
@@item                   @@tab @@code{type(c_ptr), value :: device_ptr}
@@item                   @@tab @@code{integer(c_int), value :: device_num}
d877 1
a877 1
@@ref{omp_target_alloc}, @@ref{omp_target_disassociate_ptr}
d880 1
a880 1
@@uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.8.2
d885 2
a886 2
@@node omp_target_is_present
@@subsection @@code{omp_target_is_present} -- Check whether storage is mapped
d889 5
a893 3
This routine tests whether storage, identified by the host pointer @@var{ptr}
is mapped to the device specified by @@var{device_num}.  If so, it returns
a nonzero value and otherwise zero.
d895 1
a895 15
In GCC, this includes self mapping such that @@code{omp_target_is_present}
returns @@emph{true} when @@var{device_num} specifies the host or when the host
and the device share memory.  If @@var{ptr} is a null pointer, @@var{true} is
returned and if @@var{device_num} is an invalid device number, @@var{false} is
returned.

If those conditions do not apply, @@emph{true} is returned if the association has
been established by an explicit or implicit @@code{map} clause, the
@@code{declare target} directive or a call to the @@code{omp_target_associate_ptr}
routine.

Running this routine in a @@code{target} region except on the initial device
is not supported.

@@item @@emph{C/C++}
d897 1
a897 2
@@item @@emph{Prototype}: @@tab @@code{int omp_target_is_present(const void *ptr,}
@@item                   @@tab @@code{                          int device_num)}
d902 1
a902 5
@@item @@emph{Interface}: @@tab @@code{integer(c_int) function omp_target_is_present(ptr, &}
@@item                   @@tab @@code{    device_num) bind(C)}
@@item                   @@tab @@code{use, intrinsic :: iso_c_binding, only: c_ptr, c_int}
@@item                   @@tab @@code{type(c_ptr), value :: ptr}
@@item                   @@tab @@code{integer(c_int), value :: device_num}
d906 1
a906 1
@@ref{omp_target_associate_ptr}
d909 1
a909 1
@@uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.8.3
d914 2
a915 2
@@node omp_target_is_accessible
@@subsection @@code{omp_target_is_accessible} -- Check whether memory is device accessible
d918 4
a921 15
This routine tests whether memory, starting at the address given by @@var{ptr}
and extending @@var{size} bytes, is accessibly on the device specified by
@@var{device_num}.  If so, it returns a nonzero value and otherwise zero.

The address given by @@var{ptr} is interpreted to be in the address space of
the device and @@var{size} must be positive.

Note that GCC's current implementation assumes that @@var{ptr} is a valid host
pointer. Therefore, all addresses given by @@var{ptr} are assumed to be
accessible on the initial device. And, to err on the safe side, this memory
is only available on a non-host device that can access all host memory
([uniform] shared memory access).

Running this routine in a @@code{target} region except on the initial device
is not supported.
d925 1
a925 3
@@item @@emph{Prototype}: @@tab @@code{int omp_target_is_accessible(const void *ptr,}
@@item                   @@tab @@code{                             size_t size,}
@@item                   @@tab @@code{                             int device_num)}
d930 3
a932 6
@@item @@emph{Interface}: @@tab @@code{integer(c_int) function omp_target_is_accessible(ptr, &}
@@item                   @@tab @@code{    size, device_num) bind(C)}
@@item                   @@tab @@code{use, intrinsic :: iso_c_binding, only: c_ptr, c_size_t, c_int}
@@item                   @@tab @@code{type(c_ptr), value :: ptr}
@@item                   @@tab @@code{integer(c_size_t), value :: size}
@@item                   @@tab @@code{integer(c_int), value :: device_num}
d936 1
a936 1
@@ref{omp_target_associate_ptr}
d939 1
a939 1
@@uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.8.4
d943 2
a944 3

@@node omp_target_memcpy
@@subsection @@code{omp_target_memcpy} -- Copy data between devices
d947 2
a948 9
This routine copies @@var{length} of bytes of data from the device
identified by device number @@var{src_device_num} to device @@var{dst_device_num}.
The data is copied from the source device from the address provided by
@@var{src}, shifted by the offset of @@var{src_offset} bytes, to the destination
device's @@var{dst} address shifted by @@var{dst_offset}.  The routine returns
zero on success and non-zero otherwise.

Running this routine in a @@code{target} region except on the initial device
is not supported.
d952 1
a952 7
@@item @@emph{Prototype}: @@tab @@code{int omp_target_memcpy(void *dst,}
@@item                   @@tab @@code{                           const void *src,}
@@item                   @@tab @@code{                           size_t length,}
@@item                   @@tab @@code{                           size_t dst_offset,}
@@item                   @@tab @@code{                           size_t src_offset,}
@@item                   @@tab @@code{                           int dst_device_num,}
@@item                   @@tab @@code{                           int src_device_num)}
d957 1
a957 7
@@item @@emph{Interface}: @@tab @@code{integer(c_int) function omp_target_memcpy( &}
@@item                   @@tab @@code{    dst, src, length, dst_offset, src_offset, &}
@@item                   @@tab @@code{    dst_device_num, src_device_num) bind(C)}
@@item                   @@tab @@code{use, intrinsic :: iso_c_binding, only: c_ptr, c_size_t, c_int}
@@item                   @@tab @@code{type(c_ptr), value :: dst, src}
@@item                   @@tab @@code{integer(c_size_t), value :: length, dst_offset, src_offset}
@@item                   @@tab @@code{integer(c_int), value :: dst_device_num, src_device_num}
d961 1
a961 1
@@ref{omp_target_memcpy_async}, @@ref{omp_target_memcpy_rect}
d964 1
a964 54
@@uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.8.5
@@end table



@@node omp_target_memcpy_async
@@subsection @@code{omp_target_memcpy_async} -- Copy data between devices asynchronously
@@table @@asis
@@item @@emph{Description}:
This routine copies asynchronously @@var{length} of bytes of data from the
device identified by device number @@var{src_device_num} to device
@@var{dst_device_num}.  The data is copied from the source device from the
address provided by @@var{src}, shifted by the offset of @@var{src_offset} bytes,
to the destination device's @@var{dst} address shifted by @@var{dst_offset}.
Task dependence is expressed by passing an array of depend objects to
@@var{depobj_list}, where the number of array elements is passed as
@@var{depobj_count}; if the count is zero, the @@var{depobj_list} argument is
ignored.  The routine returns zero if the copying process has successfully
been started and non-zero otherwise.

Running this routine in a @@code{target} region except on the initial device
is not supported.

@@item @@emph{C/C++}
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{int omp_target_memcpy_async(void *dst,}
@@item                   @@tab @@code{                           const void *src,}
@@item                   @@tab @@code{                           size_t length,}
@@item                   @@tab @@code{                           size_t dst_offset,}
@@item                   @@tab @@code{                           size_t src_offset,}
@@item                   @@tab @@code{                           int dst_device_num,}
@@item                   @@tab @@code{                           int src_device_num,}
@@item                   @@tab @@code{                           int depobj_count,}
@@item                   @@tab @@code{                           omp_depend_t *depobj_list)}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{integer(c_int) function omp_target_memcpy_async( &}
@@item                   @@tab @@code{    dst, src, length, dst_offset, src_offset, &}
@@item                   @@tab @@code{    dst_device_num, src_device_num, &}
@@item                   @@tab @@code{    depobj_count, depobj_list) bind(C)}
@@item                   @@tab @@code{use, intrinsic :: iso_c_binding, only: c_ptr, c_size_t, c_int}
@@item                   @@tab @@code{type(c_ptr), value :: dst, src}
@@item                   @@tab @@code{integer(c_size_t), value :: length, dst_offset, src_offset}
@@item                   @@tab @@code{integer(c_int), value :: dst_device_num, src_device_num, depobj_count}
@@item                   @@tab @@code{integer(omp_depend_kind), optional :: depobj_list(*)}
@@end multitable

@@item @@emph{See also}:
@@ref{omp_target_memcpy}, @@ref{omp_target_memcpy_rect_async}

@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.8.7
d969 5
a973 28
@@node omp_target_memcpy_rect
@@subsection @@code{omp_target_memcpy_rect} -- Copy a subvolume of data between devices
@@table @@asis
@@item @@emph{Description}:
This routine copies a subvolume of data from the device identified by
device number @@var{src_device_num} to device @@var{dst_device_num}. 
The array has @@var{num_dims} dimensions and each array element has a size of
@@var{element_size} bytes.  The @@var{volume} array specifies how many elements
per dimension are copied.  The full sizes of the destination and source arrays
are given by the @@var{dst_dimensions} and @@var{src_dimensions} arguments,
respectively.  The offset per dimension to the first element to be copied is
given by the @@var{dst_offset} and @@var{src_offset} arguments.  The routine
returns zero on success and non-zero otherwise.

The OpenMP specification only requires that @@var{num_dims} up to three is
supported.  In order to find implementation-specific maximally supported number
of dimensions, the routine returns this value when invoked with a null pointer
to both the @@var{dst} and @@var{src} arguments.  As GCC supports arbitrary
dimensions, it returns @@code{INT_MAX}.

The device-number arguments must be conforming device numbers, the @@var{src} and
@@var{dst} must be either both null pointers or all of the following must be
fulfilled: @@var{element_size} and @@var{num_dims} must be positive and the
@@var{volume}, offset and dimension arrays must have at least @@var{num_dims}
dimensions.

Running this routine in a @@code{target} region is not supported except on
the initial device.
d975 1
a975 1
@@item @@emph{C/C++}
d977 1
a977 11
@@item @@emph{Prototype}: @@tab @@code{int omp_target_memcpy_rect(void *dst,}
@@item                   @@tab @@code{                           const void *src,}
@@item                   @@tab @@code{                           size_t element_size,}
@@item                   @@tab @@code{                           int num_dims,}
@@item                   @@tab @@code{                           const size_t *volume,}
@@item                   @@tab @@code{                           const size_t *dst_offset,}
@@item                   @@tab @@code{                           const size_t *src_offset,}
@@item                   @@tab @@code{                           const size_t *dst_dimensions,}
@@item                   @@tab @@code{                           const size_t *src_dimensions,}
@@item                   @@tab @@code{                           int dst_device_num,}
@@item                   @@tab @@code{                           int src_device_num)}
d982 1
a982 9
@@item @@emph{Interface}: @@tab @@code{integer(c_int) function omp_target_memcpy_rect( &}
@@item                   @@tab @@code{    dst, src, element_size, num_dims, volume, &}
@@item                   @@tab @@code{    dst_offset, src_offset, dst_dimensions, &}
@@item                   @@tab @@code{    src_dimensions, dst_device_num, src_device_num) bind(C)}
@@item                   @@tab @@code{use, intrinsic :: iso_c_binding, only: c_ptr, c_size_t, c_int}
@@item                   @@tab @@code{type(c_ptr), value :: dst, src}
@@item                   @@tab @@code{integer(c_size_t), value :: element_size, dst_offset, src_offset}
@@item                   @@tab @@code{integer(c_size_t), value :: volume, dst_dimensions, src_dimensions}
@@item                   @@tab @@code{integer(c_int), value :: num_dims, dst_device_num, src_device_num}
a984 3
@@item @@emph{See also}:
@@ref{omp_target_memcpy_rect_async}, @@ref{omp_target_memcpy}

d986 1
a986 1
@@uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.8.6
d991 2
a992 2
@@node omp_target_memcpy_rect_async
@@subsection @@code{omp_target_memcpy_rect_async} -- Copy a subvolume of data between devices asynchronously
d995 5
a999 12
This routine copies asynchronously a subvolume of data from the device
identified by device number @@var{src_device_num} to device @@var{dst_device_num}.
The array has @@var{num_dims} dimensions and each array element has a size of
@@var{element_size} bytes.  The @@var{volume} array specifies how many elements
per dimension are copied.  The full sizes of the destination and source arrays
are given by the @@var{dst_dimensions} and @@var{src_dimensions} arguments,
respectively.  The offset per dimension to the first element to be copied is
given by the @@var{dst_offset} and @@var{src_offset} arguments.  Task dependence
is expressed by passing an array of depend objects to @@var{depobj_list}, where
the number of array elements is passed as @@var{depobj_count}; if the count is
zero, the @@var{depobj_list} argument is ignored.  The routine
returns zero on success and non-zero otherwise.
d1001 1
a1001 16
The OpenMP specification only requires that @@var{num_dims} up to three is
supported.  In order to find implementation-specific maximally supported number
of dimensions, the routine returns this value when invoked with a null pointer
to both the @@var{dst} and @@var{src} arguments.  As GCC supports arbitrary
dimensions, it returns @@code{INT_MAX}.

The device-number arguments must be conforming device numbers, the @@var{src} and
@@var{dst} must be either both null pointers or all of the following must be
fulfilled: @@var{element_size} and @@var{num_dims} must be positive and the
@@var{volume}, offset and dimension arrays must have at least @@var{num_dims}
dimensions.

Running this routine in a @@code{target} region is not supported except on
the initial device.

@@item @@emph{C/C++}
d1003 1
a1003 13
@@item @@emph{Prototype}: @@tab @@code{int omp_target_memcpy_rect_async(void *dst,}
@@item                   @@tab @@code{                           const void *src,}
@@item                   @@tab @@code{                           size_t element_size,}
@@item                   @@tab @@code{                           int num_dims,}
@@item                   @@tab @@code{                           const size_t *volume,}
@@item                   @@tab @@code{                           const size_t *dst_offset,}
@@item                   @@tab @@code{                           const size_t *src_offset,}
@@item                   @@tab @@code{                           const size_t *dst_dimensions,}
@@item                   @@tab @@code{                           const size_t *src_dimensions,}
@@item                   @@tab @@code{                           int dst_device_num,}
@@item                   @@tab @@code{                           int src_device_num,}
@@item                   @@tab @@code{                           int depobj_count,}
@@item                   @@tab @@code{                           omp_depend_t *depobj_list)}
d1008 2
a1009 12
@@item @@emph{Interface}: @@tab @@code{integer(c_int) function omp_target_memcpy_rect_async( &}
@@item                   @@tab @@code{    dst, src, element_size, num_dims, volume, &}
@@item                   @@tab @@code{    dst_offset, src_offset, dst_dimensions, &}
@@item                   @@tab @@code{    src_dimensions, dst_device_num, src_device_num, &}
@@item                   @@tab @@code{    depobj_count, depobj_list) bind(C)}
@@item                   @@tab @@code{use, intrinsic :: iso_c_binding, only: c_ptr, c_size_t, c_int}
@@item                   @@tab @@code{type(c_ptr), value :: dst, src}
@@item                   @@tab @@code{integer(c_size_t), value :: element_size, dst_offset, src_offset}
@@item                   @@tab @@code{integer(c_size_t), value :: volume, dst_dimensions, src_dimensions}
@@item                   @@tab @@code{integer(c_int), value :: num_dims, dst_device_num, src_device_num}
@@item                   @@tab @@code{integer(c_int), value :: depobj_count}
@@item                   @@tab @@code{integer(omp_depend_kind), optional :: depobj_list(*)}
d1013 1
a1013 1
@@ref{omp_target_memcpy_rect}, @@ref{omp_target_memcpy_async}
d1016 1
a1016 1
@@uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.8.8
d1021 2
a1022 2
@@node omp_target_associate_ptr
@@subsection @@code{omp_target_associate_ptr} -- Associate a device pointer with a host pointer
d1025 2
a1026 5
This routine associates storage on the host with storage on a device identified
by @@var{device_num}.  The device pointer is usually obtained by calling
@@code{omp_target_alloc} or by other means (but not by using the @@code{map}
clauses or the @@code{declare target} directive).  The host pointer should point
to memory that has a storage size of at least @@var{size}.
d1028 1
a1028 25
The @@var{device_offset} parameter specifies the offset into @@var{device_ptr}
that is used as the base address for the device side of the mapping; the
storage size should be at least @@var{device_offset} plus @@var{size}.

After the association, the host pointer can be used in a @@code{map} clause and
in the @@code{to} and @@code{from} clauses of the @@code{target update} directive
to transfer data between the associated pointers. The reference count of such
associated storage is infinite.  The association can be removed by calling
@@code{omp_target_disassociate_ptr} which should be done before the lifetime
of either storage ends.

The routine returns nonzero (@@code{EINVAL}) when the @@var{device_num} invalid,
for when the initial device or the associated device shares memory with the
host.  @@code{omp_target_associate_ptr} returns zero if @@var{host_ptr} points
into already associated storage that is fully inside of a previously associated
memory.  Otherwise, if the association was successful zero is returned; if none
of the cases above apply, nonzero (@@code{EINVAL}) is returned.

The @@code{omp_target_is_present} routine can be used to test whether
associated storage for a device pointer exists.

Running this routine in a @@code{target} region except on the initial device
is not supported.

@@item @@emph{C/C++}
d1030 1
a1030 5
@@item @@emph{Prototype}: @@tab @@code{int omp_target_associate_ptr(const void *host_ptr,}
@@item                   @@tab @@code{                             const void *device_ptr,}
@@item                   @@tab @@code{                             size_t size,}
@@item                   @@tab @@code{                             size_t device_offset,}
@@item                   @@tab @@code{                             int device_num)}
d1035 1
a1035 6
@@item @@emph{Interface}: @@tab @@code{integer(c_int) function omp_target_associate_ptr(host_ptr, &}
@@item                   @@tab @@code{    device_ptr, size, device_offset, device_num) bind(C)}
@@item                   @@tab @@code{use, intrinsic :: iso_c_binding, only: c_ptr, c_int, c_size_t}
@@item                   @@tab @@code{type(c_ptr), value :: host_ptr, device_ptr}
@@item                   @@tab @@code{integer(c_size_t), value :: size, device_offset}
@@item                   @@tab @@code{integer(c_int), value :: device_num}
d1039 1
a1039 2
@@ref{omp_target_disassociate_ptr}, @@ref{omp_target_is_present},
@@ref{omp_target_alloc}
d1042 1
a1042 1
@@uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.8.9
d1047 2
a1048 2
@@node omp_target_disassociate_ptr
@@subsection @@code{omp_target_disassociate_ptr} -- Remove device--host pointer association
d1051 1
a1051 5
This routine removes the storage association established by calling
@@code{omp_target_associate_ptr} and sets the reference count to zero,
even if @@code{omp_target_associate_ptr} was invoked multiple times for
for host pointer @@code{ptr}.  If applicable, the device memory needs
to be freed by the user.
d1053 1
a1053 13
If an associated device storage location for the @@var{device_num} was
found and has infinite reference count, the association is removed and
zero is returned.  In all other cases, nonzero (@@code{EINVAL}) is returned
and no other action is taken.

Note that passing a host pointer where the association to the device pointer
was established with the @@code{declare target} directive yields undefined
behavior.

Running this routine in a @@code{target} region except on the initial device
is not supported.

@@item @@emph{C/C++}
d1055 1
a1055 2
@@item @@emph{Prototype}: @@tab @@code{int omp_target_disassociate_ptr(const void *ptr,}
@@item                   @@tab @@code{                                int device_num)}
d1060 1
a1060 5
@@item @@emph{Interface}: @@tab @@code{integer(c_int) function omp_target_disassociate_ptr(ptr, &}
@@item                   @@tab @@code{    device_num) bind(C)}
@@item                   @@tab @@code{use, intrinsic :: iso_c_binding, only: c_ptr, c_int}
@@item                   @@tab @@code{type(c_ptr), value :: ptr}
@@item                   @@tab @@code{integer(c_int), value :: device_num}
d1064 1
a1064 1
@@ref{omp_target_associate_ptr}
d1067 1
a1067 1
@@uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.8.10
d1072 2
a1073 2
@@node omp_get_mapped_ptr
@@subsection @@code{omp_get_mapped_ptr} -- Return device pointer to a host pointer
d1076 5
a1080 6
If the device number is refers to the initial device or to a device with
memory accessible from the host (shared memory), the @@code{omp_get_mapped_ptr}
routines returns the value of the passed @@var{ptr}.  Otherwise, if associated
storage to the passed host pointer @@var{ptr} exists on device associated with
@@var{device_num}, it returns that pointer. In all other cases and in cases of
an error, a null pointer is returned.
d1082 1
a1082 8
The association of storage location is established either via an explicit or
implicit @@code{map} clause, the @@code{declare target} directive or the
@@code{omp_target_associate_ptr} routine.

Running this routine in a @@code{target} region except on the initial device
is not supported.

@@item @@emph{C/C++}
d1084 1
a1084 1
@@item @@emph{Prototype}: @@tab @@code{void *omp_get_mapped_ptr(const void *ptr, int device_num);}
d1089 1
a1089 4
@@item @@emph{Interface}: @@tab @@code{type(c_ptr) function omp_get_mapped_ptr(ptr, device_num) bind(C)}
@@item                   @@tab @@code{use, intrinsic :: iso_c_binding, only: c_ptr, c_int}
@@item                   @@tab @@code{type(c_ptr), value :: ptr}
@@item                   @@tab @@code{integer(c_int), value :: device_num}
d1093 1
a1093 1
@@ref{omp_target_associate_ptr}
d1096 1
a1096 1
@@uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.8.11
d1101 2
a1102 25
@@node Lock Routines
@@section Lock Routines

Initialize, set, test, unset and destroy simple and nested locks.
The routines have C linkage and do not throw exceptions.

@@menu
* omp_init_lock::            Initialize simple lock
* omp_init_nest_lock::       Initialize nested lock
@@c * omp_init_lock_with_hint:: <fixme>
@@c * omp_init_nest_lock_with_hint:: <fixme>
* omp_destroy_lock::         Destroy simple lock
* omp_destroy_nest_lock::    Destroy nested lock
* omp_set_lock::             Wait for and set simple lock
* omp_set_nest_lock::        Wait for and set simple lock
* omp_unset_lock::           Unset simple lock
* omp_unset_nest_lock::      Unset nested lock
* omp_test_lock::            Test and set simple lock if available
* omp_test_nest_lock::       Test and set nested lock if available
@@end menu



@@node omp_init_lock
@@subsection @@code{omp_init_lock} -- Initialize simple lock
d1105 3
a1107 2
Initialize a simple lock.  After initialization, the lock is in
an unlocked state.
d1111 1
a1111 1
@@item @@emph{Prototype}: @@tab @@code{void omp_init_lock(omp_lock_t *lock);}
d1116 1
a1116 2
@@item @@emph{Interface}: @@tab @@code{subroutine omp_init_lock(svar)}
@@item                   @@tab @@code{integer(omp_lock_kind), intent(out) :: svar}
d1119 2
a1120 5
@@item @@emph{See also}:
@@ref{omp_destroy_lock}

@@item @@emph{Reference}: 
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.1.
d1124 2
a1125 3

@@node omp_init_nest_lock
@@subsection @@code{omp_init_nest_lock} -- Initialize nested lock
d1128 3
a1130 2
Initialize a nested lock.  After initialization, the lock is in
an unlocked state and the nesting count is set to zero.
d1134 1
a1134 1
@@item @@emph{Prototype}: @@tab @@code{void omp_init_nest_lock(omp_nest_lock_t *lock);}
d1139 1
a1139 2
@@item @@emph{Interface}: @@tab @@code{subroutine omp_init_nest_lock(nvar)}
@@item                   @@tab @@code{integer(omp_nest_lock_kind), intent(out) :: nvar}
a1141 3
@@item @@emph{See also}:
@@ref{omp_destroy_nest_lock}

d1143 1
a1143 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.1.
d1148 2
a1149 2
@@node omp_destroy_lock
@@subsection @@code{omp_destroy_lock} -- Destroy simple lock
d1152 3
a1154 2
Destroy a simple lock.  In order to be destroyed, a simple lock must be
in the unlocked state. 
d1158 1
a1158 1
@@item @@emph{Prototype}: @@tab @@code{void omp_destroy_lock(omp_lock_t *lock);}
d1163 1
a1163 2
@@item @@emph{Interface}: @@tab @@code{subroutine omp_destroy_lock(svar)}
@@item                   @@tab @@code{integer(omp_lock_kind), intent(inout) :: svar}
d1166 2
a1167 5
@@item @@emph{See also}:
@@ref{omp_init_lock}

@@item @@emph{Reference}: 
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.3.
d1172 2
a1173 2
@@node omp_destroy_nest_lock
@@subsection @@code{omp_destroy_nest_lock} -- Destroy nested lock
d1176 2
a1177 2
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.
d1181 1
a1181 1
@@item @@emph{Prototype}: @@tab @@code{void omp_destroy_nest_lock(omp_nest_lock_t *);}
d1186 2
a1187 2
@@item @@emph{Interface}: @@tab @@code{subroutine omp_destroy_nest_lock(nvar)}
@@item                   @@tab @@code{integer(omp_nest_lock_kind), intent(inout) :: nvar}
d1191 1
a1191 1
@@ref{omp_init_lock}
d1193 2
a1194 2
@@item @@emph{Reference}: 
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.3.
d1199 2
a1200 2
@@node omp_set_lock
@@subsection @@code{omp_set_lock} -- Wait for and set simple lock
d1203 4
a1206 4
Before setting a simple lock, the lock variable must be initialized by 
@@code{omp_init_lock}.  The calling thread is blocked until the lock 
is available.  If the lock is already held by the current thread, 
a deadlock occurs.
d1210 1
a1210 1
@@item @@emph{Prototype}: @@tab @@code{void omp_set_lock(omp_lock_t *lock);}
d1215 2
a1216 2
@@item @@emph{Interface}: @@tab @@code{subroutine omp_set_lock(svar)}
@@item                   @@tab @@code{integer(omp_lock_kind), intent(inout) :: svar}
d1220 1
a1220 1
@@ref{omp_init_lock}, @@ref{omp_test_lock}, @@ref{omp_unset_lock}
d1222 2
a1223 2
@@item @@emph{Reference}: 
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.4.
d1228 2
a1229 2
@@node omp_set_nest_lock
@@subsection @@code{omp_set_nest_lock} -- Wait for and set nested lock
d1232 3
a1234 4
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 is incremented.
d1236 1
a1236 1
@@item @@emph{C/C++}:
d1238 1
a1238 1
@@item @@emph{Prototype}: @@tab @@code{void omp_set_nest_lock(omp_nest_lock_t *lock);}
d1243 2
a1244 2
@@item @@emph{Interface}: @@tab @@code{subroutine omp_set_nest_lock(nvar)}
@@item                   @@tab @@code{integer(omp_nest_lock_kind), intent(inout) :: nvar}
d1248 2
a1249 1
@@ref{omp_init_nest_lock}, @@ref{omp_unset_nest_lock}
d1251 2
a1252 2
@@item @@emph{Reference}: 
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.4.
d1257 2
a1258 2
@@node omp_unset_lock
@@subsection @@code{omp_unset_lock} -- Unset simple lock
d1261 8
a1268 5
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
or more threads attempted to set the lock before, one of them is chosen to,
again, set the lock to itself.
d1272 1
a1272 1
@@item @@emph{Prototype}: @@tab @@code{void omp_unset_lock(omp_lock_t *lock);}
d1277 2
a1278 2
@@item @@emph{Interface}: @@tab @@code{subroutine omp_unset_lock(svar)}
@@item                   @@tab @@code{integer(omp_lock_kind), intent(inout) :: svar}
d1282 2
a1283 1
@@ref{omp_set_lock}, @@ref{omp_test_lock}
d1285 2
a1286 2
@@item @@emph{Reference}: 
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.5.
d1291 2
a1292 2
@@node omp_unset_nest_lock
@@subsection @@code{omp_unset_nest_lock} -- Unset nested lock
d1295 3
a1297 5
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
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 to itself.
d1301 1
a1301 1
@@item @@emph{Prototype}: @@tab @@code{void omp_unset_nest_lock(omp_nest_lock_t *lock);}
d1306 2
a1307 2
@@item @@emph{Interface}: @@tab @@code{subroutine omp_unset_nest_lock(nvar)}
@@item                   @@tab @@code{integer(omp_nest_lock_kind), intent(inout) :: nvar}
d1311 1
a1311 1
@@ref{omp_set_nest_lock}
d1313 2
a1314 2
@@item @@emph{Reference}: 
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.5.
d1319 2
a1320 2
@@node omp_test_lock
@@subsection @@code{omp_test_lock} -- Test and set simple lock if available
d1322 4
a1325 6
@@item @@emph{Description}:
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{false} represent their language-specific counterparts.
d1329 1
a1329 1
@@item @@emph{Prototype}: @@tab @@code{int omp_test_lock(omp_lock_t *lock);}
d1334 2
a1335 2
@@item @@emph{Interface}: @@tab @@code{logical function omp_test_lock(svar)}
@@item                   @@tab @@code{integer(omp_lock_kind), intent(inout) :: svar}
d1339 1
a1339 1
@@ref{omp_init_lock}, @@ref{omp_set_lock}, @@ref{omp_set_lock}
d1341 2
a1342 2
@@item @@emph{Reference}: 
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.6.
d1347 2
a1348 2
@@node omp_test_nest_lock
@@subsection @@code{omp_test_nest_lock} -- Test and set nested lock if available
d1351 6
a1356 5
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_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 
is returned.  Otherwise, the return value equals zero.
d1358 1
a1358 1
@@item @@emph{C/C++}:
d1360 1
a1360 1
@@item @@emph{Prototype}: @@tab @@code{int omp_test_nest_lock(omp_nest_lock_t *lock);}
d1365 3
a1367 2
@@item @@emph{Interface}: @@tab @@code{logical function omp_test_nest_lock(nvar)}
@@item                   @@tab @@code{integer(omp_nest_lock_kind), intent(inout) :: nvar}
a1369 1

d1371 2
a1372 1
@@ref{omp_init_lock}, @@ref{omp_set_lock}, @@ref{omp_set_lock}
d1374 2
a1375 2
@@item @@emph{Reference}: 
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.3.6.
d1380 2
a1381 15
@@node Timing Routines
@@section Timing Routines

Portable, thread-based, wall clock timer.
The routines have C linkage and do not throw exceptions.

@@menu
* omp_get_wtick::            Get timer precision.
* omp_get_wtime::            Elapsed wall clock time.
@@end menu



@@node omp_get_wtick
@@subsection @@code{omp_get_wtick} -- Get timer precision
d1384 4
a1387 2
Gets the timer precision, i.e., the number of seconds between two 
successive clock ticks.
d1391 1
a1391 1
@@item @@emph{Prototype}: @@tab @@code{double omp_get_wtick(void);}
d1396 2
a1397 1
@@item @@emph{Interface}: @@tab @@code{double precision function omp_get_wtick()}
d1401 1
a1401 1
@@ref{omp_get_wtime}
d1403 2
a1404 2
@@item @@emph{Reference}: 
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.4.2.
d1409 2
a1410 2
@@node omp_get_wtime
@@subsection @@code{omp_get_wtime} -- Elapsed wall clock time
d1413 2
a1414 4
Elapsed wall clock time in seconds.  The time is measured per thread, no
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.
d1418 1
a1418 1
@@item @@emph{Prototype}: @@tab @@code{double omp_get_wtime(void);}
d1423 2
a1424 1
@@item @@emph{Interface}: @@tab @@code{double precision function omp_get_wtime()}
d1428 1
a1428 1
@@ref{omp_get_wtick}
d1431 1
a1431 1
@@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.4.1.
d1436 2
a1437 14
@@node Event Routine
@@section Event Routine

Support for event objects.
The routine has C linkage and do not throw exceptions.

@@menu
* omp_fulfill_event::        Fulfill and destroy an OpenMP event.
@@end menu



@@node omp_fulfill_event
@@subsection @@code{omp_fulfill_event} -- Fulfill and destroy an OpenMP event
d1440 4
a1443 8
Fulfill the event associated with the event handle argument.  Currently, it
is only used to fulfill events generated by detach clauses on task
constructs - the effect of fulfilling the event is to allow the task to
complete.

The result of calling @@code{omp_fulfill_event} with an event handle other
than that generated by a detach clause is undefined.  Calling it with an
event handle that has already been fulfilled is also undefined.
d1447 1
a1447 1
@@item @@emph{Prototype}: @@tab @@code{void omp_fulfill_event(omp_event_handle_t event);}
d1452 2
a1453 2
@@item @@emph{Interface}: @@tab @@code{subroutine omp_fulfill_event(event)}
@@item                   @@tab @@code{integer (kind=omp_event_handle_kind) :: event}
d1456 5
a1460 2
@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v5.0}, Section 3.5.1.
d1465 2
a1466 41
@@c @@node Interoperability Routines
@@c @@section Interoperability Routines
@@c
@@c Routines to obtain properties from an @@code{omp_interop_t} object.
@@c They have C linkage and do not throw exceptions.
@@c
@@c @@menu
@@c * omp_get_num_interop_properties:: <fixme>
@@c * omp_get_interop_int:: <fixme>
@@c * omp_get_interop_ptr:: <fixme>
@@c * omp_get_interop_str:: <fixme>
@@c * omp_get_interop_name:: <fixme>
@@c * omp_get_interop_type_desc:: <fixme>
@@c * omp_get_interop_rc_desc:: <fixme>
@@c @@end menu

@@node Memory Management Routines
@@section Memory Management Routines

Routines to manage and allocate memory on the current device.
They have C linkage and do not throw exceptions.

@@menu
* omp_init_allocator:: Create an allocator
* omp_destroy_allocator:: Destroy an allocator
* omp_set_default_allocator:: Set the default allocator
* omp_get_default_allocator:: Get the default allocator
* omp_alloc:: Memory allocation with an allocator
* omp_aligned_alloc:: Memory allocation with an allocator and alignment
* omp_free:: Freeing memory allocated with OpenMP routines
* omp_calloc:: Allocate nullified memory with an allocator
* omp_aligned_calloc:: Allocate nullified aligned memory with an allocator
* omp_realloc:: Reallocate memory allocated with OpenMP routines
@@c * omp_get_memspace_num_resources:: <fixme>/TR11
@@c * omp_get_submemspace:: <fixme>/TR11
@@end menu



@@node omp_init_allocator
@@subsection @@code{omp_init_allocator} -- Create an allocator
d1469 5
a1473 9
Create an allocator that uses the specified memory space and has the specified
traits; if an allocator that fulfills the requirements cannot be created,
@@code{omp_null_allocator} is returned.

The predefined memory spaces and available traits can be found at
@@ref{OMP_ALLOCATOR}, where the trait names have to be prefixed by
@@code{omp_atk_} (e.g. @@code{omp_atk_pinned}) and the named trait values by
@@code{omp_atv_} (e.g. @@code{omp_atv_true}); additionally, @@code{omp_atv_default}
may be used as trait value to specify that the default value should be used.
d1477 1
a1477 4
@@item @@emph{Prototype}: @@tab @@code{omp_allocator_handle_t omp_init_allocator(}
@@item                   @@tab @@code{  omp_memspace_handle_t memspace,}
@@item                   @@tab @@code{  int ntraits,}
@@item                   @@tab @@code{  const omp_alloctrait_t traits[]);}
d1482 2
a1483 5
@@item @@emph{Interface}: @@tab @@code{function omp_init_allocator(memspace, ntraits, traits)}
@@item                   @@tab @@code{integer (omp_allocator_handle_kind) :: omp_init_allocator}
@@item                   @@tab @@code{integer (omp_memspace_handle_kind), intent(in) :: memspace}
@@item                   @@tab @@code{integer, intent(in) :: ntraits}
@@item                   @@tab @@code{type (omp_alloctrait), intent(in) :: traits(*)}
d1487 1
a1487 1
@@ref{OMP_ALLOCATOR}, @@ref{Memory allocation}, @@ref{omp_destroy_allocator}
d1489 2
a1490 2
@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v5.0}, Section 3.7.2
d1495 2
a1496 2
@@node omp_destroy_allocator
@@subsection @@code{omp_destroy_allocator} -- Destroy an allocator
d1499 5
a1503 5
Releases all resources used by a memory allocator, which must not represent
a predefined memory allocator.  Accessing memory after its allocator has been
destroyed has unspecified behavior.  Passing @@code{omp_null_allocator} to the
routine is permitted but has no effect.

d1507 1
a1507 1
@@item @@emph{Prototype}: @@tab @@code{void omp_destroy_allocator (omp_allocator_handle_t allocator);}
d1512 2
a1513 2
@@item @@emph{Interface}: @@tab @@code{subroutine omp_destroy_allocator(allocator)}
@@item                   @@tab @@code{integer (omp_allocator_handle_kind), intent(in) :: allocator}
d1517 1
a1517 1
@@ref{omp_init_allocator}
d1519 2
a1520 2
@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v5.0}, Section 3.7.3
d1525 2
a1526 2
@@node omp_set_default_allocator
@@subsection @@code{omp_set_default_allocator} -- Set the default allocator
d1529 2
a1530 3
Sets the default allocator that is used when no allocator has been specified
in the @@code{allocate} or @@code{allocator} clause or if an OpenMP memory
routine is invoked with the @@code{omp_null_allocator} allocator.
d1534 1
a1534 1
@@item @@emph{Prototype}: @@tab @@code{void omp_set_default_allocator(omp_allocator_handle_t allocator);}
d1539 2
a1540 2
@@item @@emph{Interface}: @@tab @@code{subroutine omp_set_default_allocator(allocator)}
@@item                   @@tab @@code{integer (omp_allocator_handle_kind), intent(in) :: allocator}
d1544 1
a1544 2
@@ref{omp_get_default_allocator}, @@ref{omp_init_allocator}, @@ref{OMP_ALLOCATOR},
@@ref{Memory allocation}
d1546 2
a1547 2
@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v5.0}, Section 3.7.4
d1552 2
a1553 2
@@node omp_get_default_allocator
@@subsection @@code{omp_get_default_allocator} -- Get the default allocator
d1556 2
a1557 3
The routine returns the default allocator that is used when no allocator has
been specified in the @@code{allocate} or @@code{allocator} clause or if an
OpenMP memory routine is invoked with the @@code{omp_null_allocator} allocator.
d1561 1
a1561 1
@@item @@emph{Prototype}: @@tab @@code{omp_allocator_handle_t omp_get_default_allocator();}
d1566 2
a1567 2
@@item @@emph{Interface}: @@tab @@code{function omp_get_default_allocator()}
@@item                   @@tab @@code{integer (omp_allocator_handle_kind) :: omp_get_default_allocator}
d1571 1
a1571 1
@@ref{omp_set_default_allocator}, @@ref{OMP_ALLOCATOR}
d1574 1
a1574 1
@@uref{https://www.openmp.org, OpenMP specification v5.0}, Section 3.7.5
d1578 2
a1579 3

@@node omp_alloc
@@subsection @@code{omp_alloc} -- Memory allocation with an allocator
d1582 4
a1585 9
Allocate memory with the specified allocator, which can either be a predefined
allocator, an allocator handle or @@code{omp_null_allocator}.  If the allocators
is @@code{omp_null_allocator}, the allocator specified by the
@@var{def-allocator-var} ICV is used.  @@var{size} must be a nonnegative number
denoting the number of bytes to be allocated; if @@var{size} is zero,
@@code{omp_alloc} will return a null pointer.  If successful, a pointer to the
allocated memory is returned, otherwise the @@code{fallback} trait of the
allocator determines the behavior.  The content of the allocated memory is
unspecified.
d1587 1
a1587 8
In @@code{target} regions, either the @@code{dynamic_allocators} clause must
appear on a @@code{requires} directive in the same compilation unit -- or the
@@var{allocator} argument may only be a constant expression with the value of
one of the predefined allocators and may not be @@code{omp_null_allocator}.

Memory allocated by @@code{omp_alloc} must be freed using @@code{omp_free}.

@@item @@emph{C}:
d1589 1
a1589 8
@@item @@emph{Prototype}: @@tab @@code{void* omp_alloc(size_t size,}
@@item                   @@tab @@code{  omp_allocator_handle_t allocator)}
@@end multitable

@@item @@emph{C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{void* omp_alloc(size_t size,}
@@item                   @@tab @@code{  omp_allocator_handle_t allocator=omp_null_allocator)}
d1594 2
a1595 4
@@item @@emph{Interface}: @@tab @@code{type(c_ptr) function omp_alloc(size, allocator) bind(C)}
@@item                   @@tab @@code{use, intrinsic :: iso_c_binding, only : c_ptr, c_size_t}
@@item                   @@tab @@code{integer (c_size_t), value :: size}
@@item                   @@tab @@code{integer (omp_allocator_handle_kind), value :: allocator}
d1599 1
a1599 2
@@ref{OMP_ALLOCATOR}, @@ref{Memory allocation}, @@ref{omp_set_default_allocator},
@@ref{omp_free}, @@ref{omp_init_allocator}
d1601 2
a1602 2
@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v5.0}, Section 3.7.6
d1607 2
a1608 2
@@node omp_aligned_alloc
@@subsection @@code{omp_aligned_alloc} -- Memory allocation with an allocator and alignment
d1611 5
a1615 12
Allocate memory with the specified allocator, which can either be a predefined
allocator, an allocator handle or @@code{omp_null_allocator}.  If the allocators
is @@code{omp_null_allocator}, the allocator specified by the
@@var{def-allocator-var} ICV is used.  @@var{alignment} must be a positive power
of two and @@var{size} must be a nonnegative number that is a multiple of the
alignment and denotes the number of bytes to be allocated; if @@var{size} is
zero, @@code{omp_aligned_alloc} will return a null pointer.  The alignment will
be at least the maximal value required by @@code{alignment} trait of the
allocator and the value of the  passed @@var{alignment} argument.  If successful,
a pointer to the allocated memory is returned, otherwise the @@code{fallback}
trait of the allocator determines the behavior.  The content of the allocated
memory is unspecified.
d1617 1
a1617 9
In @@code{target} regions, either the @@code{dynamic_allocators} clause must
appear on a @@code{requires} directive in the same compilation unit -- or the
@@var{allocator} argument may only be a constant expression with the value of
one of the predefined allocators and may not be @@code{omp_null_allocator}.

Memory allocated by @@code{omp_aligned_alloc} must be freed using
@@code{omp_free}.

@@item @@emph{C}:
d1619 1
a1619 3
@@item @@emph{Prototype}: @@tab @@code{void* omp_aligned_alloc(size_t alignment,}
@@item                   @@tab @@code{  size_t size,}
@@item                   @@tab @@code{  omp_allocator_handle_t allocator)}
d1622 1
a1622 1
@@item @@emph{C++}:
d1624 2
a1625 3
@@item @@emph{Prototype}: @@tab @@code{void* omp_aligned_alloc(size_t alignment,}
@@item                   @@tab @@code{  size_t size,}
@@item                   @@tab @@code{  omp_allocator_handle_t allocator=omp_null_allocator)}
a1627 7
@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{type(c_ptr) function omp_aligned_alloc(alignment, size, allocator) bind(C)}
@@item                   @@tab @@code{use, intrinsic :: iso_c_binding, only : c_ptr, c_size_t}
@@item                   @@tab @@code{integer (c_size_t), value :: alignment, size}
@@item                   @@tab @@code{integer (omp_allocator_handle_kind), value :: allocator}
@@end multitable
d1630 1
a1630 2
@@ref{OMP_ALLOCATOR}, @@ref{Memory allocation}, @@ref{omp_set_default_allocator},
@@ref{omp_free}, @@ref{omp_init_allocator}
d1632 2
a1633 2
@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.13.6
d1638 2
a1639 2
@@node omp_free
@@subsection @@code{omp_free} -- Freeing memory allocated with OpenMP routines
d1642 5
a1646 7
The @@code{omp_free} routine deallocates memory previously allocated by an
OpenMP memory-management routine. The @@var{ptr} argument must point to such
memory or be a null pointer; if it is a null pointer, no operation is
performed.  If specified, the @@var{allocator} argument must be either the
memory allocator that was used for the allocation or @@code{omp_null_allocator};
if it is @@code{omp_null_allocator}, the implementation will determine the value
automatically.
d1648 1
a1648 4
Calling @@code{omp_free} invokes undefined behavior if the memory
was already deallocated or when the used allocator has already been destroyed.

@@item @@emph{C}:
d1650 1
a1650 8
@@item @@emph{Prototype}: @@tab @@code{void omp_free(void *ptr,}
@@item                   @@tab @@code{  omp_allocator_handle_t allocator)}
@@end multitable

@@item @@emph{C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{void omp_free(void *ptr,}
@@item                   @@tab @@code{  omp_allocator_handle_t allocator=omp_null_allocator)}
d1655 2
a1656 4
@@item @@emph{Interface}: @@tab @@code{subroutine omp_free(ptr, allocator) bind(C)}
@@item                   @@tab @@code{use, intrinsic :: iso_c_binding, only : c_ptr}
@@item                   @@tab @@code{type (c_ptr), value :: ptr}
@@item                   @@tab @@code{integer (omp_allocator_handle_kind), value :: allocator}
d1660 1
a1660 2
@@ref{omp_alloc}, @@ref{omp_aligned_alloc}, @@ref{omp_calloc},
@@ref{omp_aligned_calloc}, @@ref{omp_realloc}
d1662 2
a1663 2
@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v5.0}, Section 3.7.7
d1668 2
a1669 2
@@node omp_calloc
@@subsection @@code{omp_calloc} -- Allocate nullified memory with an allocator
d1672 2
a1673 9
Allocate zero-initialized memory with the specified allocator, which can either
be a predefined allocator, an allocator handle or @@code{omp_null_allocator}.  If
the allocators is @@code{omp_null_allocator}, the allocator specified by the
@@var{def-allocator-var} ICV is used.  The to-be allocated memory is for an
array with @@var{nmemb} elements, each having a size of @@var{size} bytes.  Both
@@var{nmemb} and @@var{size} must be nonnegative numbers; if either of them is
zero, @@code{omp_calloc} will return a null pointer.  If successful, a pointer to
the zero-initialized allocated memory is returned, otherwise the @@code{fallback}
trait of the allocator determines the behavior.
d1675 1
a1675 8
In @@code{target} regions, either the @@code{dynamic_allocators} clause must
appear on a @@code{requires} directive in the same compilation unit -- or the
@@var{allocator} argument may only be a constant expression with the value of
one of the predefined allocators and may not be @@code{omp_null_allocator}.

Memory allocated by @@code{omp_calloc} must be freed using @@code{omp_free}.

@@item @@emph{C}:
d1677 1
a1677 8
@@item @@emph{Prototype}: @@tab @@code{void* omp_calloc(size_t nmemb, size_t size,}
@@item                   @@tab @@code{  omp_allocator_handle_t allocator)}
@@end multitable

@@item @@emph{C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{void* omp_calloc(size_t nmemb, size_t size,}
@@item                   @@tab @@code{  omp_allocator_handle_t allocator=omp_null_allocator)}
d1682 2
a1683 4
@@item @@emph{Interface}: @@tab @@code{type(c_ptr) function omp_calloc(nmemb, size, allocator) bind(C)}
@@item                   @@tab @@code{use, intrinsic :: iso_c_binding, only : c_ptr, c_size_t}
@@item                   @@tab @@code{integer (c_size_t), value :: nmemb, size}
@@item                   @@tab @@code{integer (omp_allocator_handle_kind), value :: allocator}
d1687 4
a1690 5
@@ref{OMP_ALLOCATOR}, @@ref{Memory allocation}, @@ref{omp_set_default_allocator},
@@ref{omp_free}, @@ref{omp_init_allocator}

@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.13.8
d1695 2
a1696 2
@@node omp_aligned_calloc
@@subsection @@code{omp_aligned_calloc} -- Allocate aligned nullified memory with an allocator
d1699 2
a1700 13
Allocate zero-initialized memory with the specified allocator, which can either
be a predefined allocator, an allocator handle or @@code{omp_null_allocator}.  If
the allocators is @@code{omp_null_allocator}, the allocator specified by the
@@var{def-allocator-var} ICV is used.  The to-be allocated memory is for an
array with @@var{nmemb} elements, each having a size of @@var{size} bytes.  Both
@@var{nmemb} and @@var{size} must be nonnegative numbers; if either of them is
zero, @@code{omp_aligned_calloc} will return a null pointer.  @@var{alignment}
must be a positive power of two and @@var{size} must be a multiple of the
alignment; the alignment will be at least the maximal value required by
@@code{alignment} trait of the allocator and the value of the  passed
@@var{alignment} argument.  If successful, a pointer to the zero-initialized
allocated memory is returned, otherwise the @@code{fallback} trait of the
allocator determines the behavior.
d1702 1
a1702 9
In @@code{target} regions, either the @@code{dynamic_allocators} clause must
appear on a @@code{requires} directive in the same compilation unit -- or the
@@var{allocator} argument may only be a constant expression with the value of
one of the predefined allocators and may not be @@code{omp_null_allocator}.

Memory allocated by @@code{omp_aligned_calloc} must be freed using
@@code{omp_free}.

@@item @@emph{C}:
d1704 1
a1704 8
@@item @@emph{Prototype}: @@tab @@code{void* omp_aligned_calloc(size_t nmemb, size_t size,}
@@item                   @@tab @@code{  omp_allocator_handle_t allocator)}
@@end multitable

@@item @@emph{C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{void* omp_aligned_calloc(size_t nmemb, size_t size,}
@@item                   @@tab @@code{  omp_allocator_handle_t allocator=omp_null_allocator)}
d1709 1
a1709 4
@@item @@emph{Interface}: @@tab @@code{type(c_ptr) function omp_aligned_calloc(nmemb, size, allocator) bind(C)}
@@item                   @@tab @@code{use, intrinsic :: iso_c_binding, only : c_ptr, c_size_t}
@@item                   @@tab @@code{integer (c_size_t), value :: nmemb, size}
@@item                   @@tab @@code{integer (omp_allocator_handle_kind), value :: allocator}
d1713 1
a1713 2
@@ref{OMP_ALLOCATOR}, @@ref{Memory allocation}, @@ref{omp_set_default_allocator},
@@ref{omp_free}, @@ref{omp_init_allocator}
d1715 2
a1716 2
@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.13.8
d1721 2
a1722 2
@@node omp_realloc
@@subsection @@code{omp_realloc} -- Reallocate memory allocated with OpenMP routines
d1725 4
a1728 8
The @@code{omp_realloc} routine deallocates memory to which @@var{ptr} points to
and allocates new memory with the specified @@var{allocator} argument; the
new memory will have the content of the old memory up to the minimum of the
old size and the new @@var{size}, otherwise the content of the returned memory
is unspecified.  If the new allocator is the same as the old one, the routine
tries to resize the existing memory allocation, returning the same address as
@@var{ptr} if successful.  @@var{ptr} must point to memory allocated by an OpenMP
memory-management routine.
d1730 1
a1730 26
The @@var{allocator} and @@var{free_allocator} arguments must be a predefined
allocator, an allocator handle or @@code{omp_null_allocator}.  If
@@var{free_allocator} is @@code{omp_null_allocator}, the implementation
automatically determines the allocator used for the allocation of @@var{ptr}.
If @@var{allocator} is @@code{omp_null_allocator} and @@var{ptr} is not a
null pointer, the same allocator as @@code{free_allocator} is used and
when @@var{ptr} is a null pointer the allocator specified by the
@@var{def-allocator-var} ICV is used.

The @@var{size} must be a nonnegative number denoting the number of bytes to be
allocated; if @@var{size} is zero, @@code{omp_realloc} will return free the
memory and return a null pointer.  When @@var{size} is nonzero: if successful,
a pointer to the allocated memory is returned, otherwise the @@code{fallback}
trait of the allocator determines the behavior.

In @@code{target} regions, either the @@code{dynamic_allocators} clause must
appear on a @@code{requires} directive in the same compilation unit -- or the
@@var{free_allocator} and @@var{allocator} arguments may only be a constant
expression with the value of one of the predefined allocators and may not be
@@code{omp_null_allocator}.

Memory allocated by @@code{omp_realloc} must be freed using @@code{omp_free}.
Calling @@code{omp_free} invokes undefined behavior if the memory
was already deallocated or when the used allocator has already been destroyed.

@@item @@emph{C}:
d1732 1
a1732 10
@@item @@emph{Prototype}: @@tab @@code{void* omp_realloc(void *ptr, size_t size,}
@@item                   @@tab @@code{  omp_allocator_handle_t allocator,}
@@item                   @@tab @@code{  omp_allocator_handle_t free_allocator)}
@@end multitable

@@item @@emph{C++}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Prototype}: @@tab @@code{void* omp_realloc(void *ptr, size_t size,}
@@item                   @@tab @@code{  omp_allocator_handle_t allocator=omp_null_allocator,}
@@item                   @@tab @@code{  omp_allocator_handle_t free_allocator=omp_null_allocator)}
d1737 1
a1737 5
@@item @@emph{Interface}: @@tab @@code{type(c_ptr) function omp_realloc(ptr, size, allocator, free_allocator) bind(C)}
@@item                   @@tab @@code{use, intrinsic :: iso_c_binding, only : c_ptr, c_size_t}
@@item                   @@tab @@code{type(C_ptr), value :: ptr}
@@item                   @@tab @@code{integer (c_size_t), value :: size}
@@item                   @@tab @@code{integer (omp_allocator_handle_kind), value :: allocator, free_allocator}
d1741 1
a1741 2
@@ref{OMP_ALLOCATOR}, @@ref{Memory allocation}, @@ref{omp_set_default_allocator},
@@ref{omp_free}, @@ref{omp_init_allocator}
d1743 2
a1744 2
@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v5.0}, Section 3.7.9
d1749 2
a1750 17
@@c @@node Tool Control Routine
@@c @@section Tool Control Routine
@@c
@@c FIXME

@@node Environment Display Routine
@@section Environment Display Routine

Routine to display the OpenMP version number and the initial value of ICVs.
It has C linkage and does not throw exceptions.

@@menu
* omp_display_env:: print the initial ICV values
@@end menu

@@node omp_display_env
@@subsection @@code{omp_display_env} -- print the initial ICV values
d1753 4
a1756 5
Each time this routine is invoked, the OpenMP version number and initial value
of internal control variables (ICVs) is printed on @@code{stderr}.  The displayed
values are those at startup after evaluating the environment variables; later
calls to API routines or clauses used in enclosing constructs do not affect
the output.
d1758 3
a1760 24
If the @@var{verbose} argument is @@code{false}, only the OpenMP version and
standard OpenMP ICVs are shown; if it is @@code{true}, additionally, the
GCC-specific ICVs are shown.

The output consists of multiple lines and starts with
@@samp{OPENMP DISPLAY ENVIRONMENT BEGIN} followed by the name-value lines and
ends with @@samp{OPENMP DISPLAY ENVIRONMENT END}.  The @@var{name} is followed by
an equal sign and the @@var{value} is enclosed in single quotes.

The first line has as @@var{name} either @@samp{_OPENMP} or @@samp{openmp_version}
and shows as value the supported OpenMP version number (4-digit year, 2-digit
month) of the implementation, matching the value of the @@code{_OPENMP} macro
and, in Fortran, the named constant @@code{openmp_version}.

In each of the succeeding lines, the @@var{name} matches the environment-variable
name of an ICV and shows its value.  Those line are might be prefixed by pair of
brackets and a space, where the brackets enclose a comma-separated list of
devices to which the ICV-value combination applies to; the value can either be a
numeric device number or an abstract name denoting all devices (@@code{all}), the
initial host device (@@code{host}) or all devices but the host (@@code{device}).
Note that the same ICV might be printed multiple times for multiple devices,
even if all have the same value.

The effect when invoked from within a @@code{target} region is unspecified.
d1764 1
a1764 1
@@item @@emph{Prototype}: @@tab @@code{void omp_display_env(int verbose)}
d1769 2
a1770 2
@@item @@emph{Interface}: @@tab @@code{subroutine omp_display_env(vebose)}
@@item                   @@tab @@code{logical, intent(in) :: verbose}
a1772 20
@@item @@emph{Example}:
Note that the GCC-specific ICVs, such as the shown @@code{GOMP_SPINCOUNT},
are only printed when @@var{varbose} set to @@code{true}.

@@smallexample
OPENMP DISPLAY ENVIRONMENT BEGIN
  _OPENMP = '201511'
  [host] OMP_DYNAMIC = 'FALSE'
  [host] OMP_NESTED = 'FALSE'
  [all] OMP_CANCELLATION = 'FALSE'
  ...
  [host] GOMP_SPINCOUNT = '300000'
OPENMP DISPLAY ENVIRONMENT END
@@end smallexample


@@item @@emph{See also}:
@@ref{OMP_DISPLAY_ENV}, @@ref{Environment Variables},
@@ref{Implementation-defined ICV Initialization}

d1774 1
a1774 1
@@uref{https://www.openmp.org, OpenMP specification v5.1}, Section 3.15
d1778 1
d1787 2
a1788 15
section 4 of the OpenMP specification in version 4.5 or in a later version
of the specification, while those beginning with @@env{GOMP_} are GNU extensions.
Most @@env{OMP_} environment variables have an associated internal control
variable (ICV).

For any OpenMP environment variable that sets an ICV and is neither
@@code{OMP_DEFAULT_DEVICE} nor has global ICV scope, associated
device-specific environment variables exist.  For them, the environment
variable without suffix affects the host.  The suffix @@code{_DEV_} followed
by a non-negative device number less that the number of available devices sets
the ICV for the corresponding device.  The suffix @@code{_DEV} sets the ICV
of all non-host devices for which a device-specific corresponding environment
variable has not been set while the @@code{_ALL} suffix sets the ICV of all
host and non-host devices for which a more specific corresponding environment
variable is not set.
a1790 2
* OMP_ALLOCATOR::           Set the default allocator
* OMP_AFFINITY_FORMAT::     Set the format string used for affinity display
a1791 1
* OMP_DISPLAY_AFFINITY::    Display thread affinity information
d1804 1
a1804 1
* OMP_TARGET_OFFLOAD::      Controls offloading behavior
a1815 149
@@node OMP_ALLOCATOR
@@section @@env{OMP_ALLOCATOR} -- Set the default allocator
@@cindex Environment Variable
@@table @@asis
@@item @@emph{ICV:} @@var{def-allocator-var}
@@item @@emph{Scope:} data environment
@@item @@emph{Description}:
Sets the default allocator that is used when no allocator has been specified
in the @@code{allocate} or @@code{allocator} clause or if an OpenMP memory
routine is invoked with the @@code{omp_null_allocator} allocator.
If unset, @@code{omp_default_mem_alloc} is used.

The value can either be a predefined allocator or a predefined memory space
or a predefined memory space followed by a colon and a comma-separated list
of memory trait and value pairs, separated by @@code{=}.

Note: The corresponding device environment variables are currently not
supported.  Therefore, the non-host @@var{def-allocator-var} ICVs are always
initialized to @@code{omp_default_mem_alloc}.  However, on all devices,
the @@code{omp_set_default_allocator} API routine can be used to change
value.

@@multitable @@columnfractions .45 .45
@@headitem Predefined allocators @@tab Associated predefined memory spaces
@@item omp_default_mem_alloc     @@tab omp_default_mem_space
@@item omp_large_cap_mem_alloc   @@tab omp_large_cap_mem_space
@@item omp_const_mem_alloc       @@tab omp_const_mem_space
@@item omp_high_bw_mem_alloc     @@tab omp_high_bw_mem_space
@@item omp_low_lat_mem_alloc     @@tab omp_low_lat_mem_space
@@item omp_cgroup_mem_alloc      @@tab omp_low_lat_mem_space (implementation defined)
@@item omp_pteam_mem_alloc       @@tab omp_low_lat_mem_space (implementation defined)
@@item omp_thread_mem_alloc      @@tab omp_low_lat_mem_space (implementation defined)
@@end multitable

The predefined allocators use the default values for the traits,
as listed below.  Except that the last three allocators have the
@@code{access} trait set to @@code{cgroup}, @@code{pteam}, and
@@code{thread}, respectively.

@@multitable @@columnfractions .25 .40 .25
@@headitem Trait @@tab Allowed values @@tab Default value
@@item @@code{sync_hint} @@tab @@code{contended}, @@code{uncontended},
                            @@code{serialized}, @@code{private}
                       @@tab @@code{contended}
@@item @@code{alignment} @@tab Positive integer being a power of two
                       @@tab 1 byte
@@item @@code{access}    @@tab @@code{all}, @@code{cgroup},
                            @@code{pteam}, @@code{thread}
                       @@tab @@code{all}
@@item @@code{pool_size} @@tab Positive integer
                       @@tab See @@ref{Memory allocation}
@@item @@code{fallback}  @@tab @@code{default_mem_fb}, @@code{null_fb},
                            @@code{abort_fb}, @@code{allocator_fb}
                       @@tab See below
@@item @@code{fb_data}   @@tab @@emph{unsupported as it needs an allocator handle}
                       @@tab (none)
@@item @@code{pinned}    @@tab @@code{true}, @@code{false}
                       @@tab @@code{false}
@@item @@code{partition} @@tab @@code{environment}, @@code{nearest},
                            @@code{blocked}, @@code{interleaved}
                       @@tab @@code{environment}
@@end multitable

For the @@code{fallback} trait, the default value is @@code{null_fb} for the
@@code{omp_default_mem_alloc} allocator and any allocator that is associated
with device memory; for all other allocators, it is @@code{default_mem_fb}
by default.

Examples:
@@smallexample
OMP_ALLOCATOR=omp_high_bw_mem_alloc
OMP_ALLOCATOR=omp_large_cap_mem_space
OMP_ALLOCATOR=omp_low_lat_mem_space:pinned=true,partition=nearest
@@end smallexample

@@item @@emph{See also}:
@@ref{Memory allocation}, @@ref{omp_get_default_allocator},
@@ref{omp_set_default_allocator}, @@ref{Offload-Target Specifics}

@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v5.0}, Section 6.21
@@end table



@@node OMP_AFFINITY_FORMAT
@@section @@env{OMP_AFFINITY_FORMAT} -- Set the format string used for affinity display
@@cindex Environment Variable
@@table @@asis
@@item @@emph{ICV:} @@var{affinity-format-var}
@@item @@emph{Scope:} device
@@item @@emph{Description}:
Sets the format string used when displaying OpenMP thread affinity information.
Special values are output using @@code{%} followed by an optional size
specification and then either the single-character field type or its long
name enclosed in curly braces; using @@code{%%} displays a literal percent.
The size specification consists of an optional @@code{0.} or @@code{.} followed
by a positive integer, specifying the minimal width of the output.  With
@@code{0.} and numerical values, the output is padded with zeros on the left;
with @@code{.}, the output is padded by spaces on the left; otherwise, the
output is padded by spaces on the right.  If unset, the value is
``@@code{level %L thread %i affinity %A}''.

Supported field types are:

@@multitable @@columnfractions .10 .25 .60
@@item t @@tab team_num @@tab value returned by @@code{omp_get_team_num}
@@item T @@tab num_teams @@tab value returned by @@code{omp_get_num_teams}
@@item L @@tab nesting_level @@tab value returned by @@code{omp_get_level}
@@item n @@tab thread_num @@tab value returned by @@code{omp_get_thread_num}
@@item N @@tab num_threads @@tab value returned by @@code{omp_get_num_threads}
@@item a @@tab ancestor_tnum
      @@tab value returned by
           @@code{omp_get_ancestor_thread_num(omp_get_level()-1)}
@@item H @@tab host @@tab name of the host that executes the thread
@@item P @@tab process_id @@tab process identifier
@@item i @@tab native_thread_id @@tab native thread identifier
@@item A @@tab thread_affinity
      @@tab comma separated list of integer values or ranges, representing the
           processors on which a process might execute, subject to affinity
           mechanisms
@@end multitable

For instance, after setting

@@smallexample
OMP_AFFINITY_FORMAT="%0.2a!%n!%.4L!%N;%.2t;%0.2T;%@@{team_num@@};%@@{num_teams@@};%A"
@@end smallexample

with either @@code{OMP_DISPLAY_AFFINITY} being set or when calling
@@code{omp_display_affinity} with @@code{NULL} or an empty string, the program
might display the following:

@@smallexample
00!0!   1!4; 0;01;0;1;0-11
00!3!   1!4; 0;01;0;1;0-11
00!2!   1!4; 0;01;0;1;0-11
00!1!   1!4; 0;01;0;1;0-11
@@end smallexample

@@item @@emph{See also}:
@@ref{OMP_DISPLAY_AFFINITY}

@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v5.0}, Section 6.14
@@end table



a1819 2
@@item @@emph{ICV:} @@var{cancel-var}
@@item @@emph{Scope:} global
a1832 22
@@node OMP_DISPLAY_AFFINITY
@@section @@env{OMP_DISPLAY_AFFINITY} -- Display thread affinity information
@@cindex Environment Variable
@@table @@asis
@@item @@emph{ICV:} @@var{display-affinity-var}
@@item @@emph{Scope:} global
@@item @@emph{Description}:
If set to @@code{FALSE} or if unset, affinity displaying is disabled.
If set to @@code{TRUE}, the runtime displays affinity information about
OpenMP threads in a parallel region upon entering the region and every time
any change occurs.

@@item @@emph{See also}:
@@ref{OMP_AFFINITY_FORMAT}

@@item @@emph{Reference}:
@@uref{https://www.openmp.org, OpenMP specification v5.0}, Section 6.13
@@end table




a1836 2
@@item @@emph{ICV:} none
@@item @@emph{Scope:} not applicable
d1838 5
a1842 6
If set to @@code{TRUE}, the runtime displays the same information to
@@code{stderr} as shown by the @@code{omp_display_env} routine invoked with
@@var{verbose} argument set to @@code{false}.  If set to @@code{VERBOSE}, the same
information is shown as invoking the routine with @@var{verbose} set to
@@code{true}. If unset or set to @@code{FALSE}, this information is not shown.
The result for any other value is unspecified.
a1843 2
@@item @@emph{See also}:
@@ref{omp_display_env}
a1854 2
@@item @@emph{ICV:} @@var{default-device-var}
@@item @@emph{Scope:} data environment
d1860 1
a1860 3
@@env{OMP_TARGET_OFFLOAD} is @@code{mandatory} and no non-host devices are
available, it is set to @@code{omp_invalid_device}.  Otherwise, if unset,
device number 0 is used.
a1864 1
@@ref{OMP_TARGET_OFFLOAD}
d1867 1
a1867 1
@@uref{https://www.openmp.org, OpenMP specification v5.2}, Section 21.2.7
a1875 2
@@item @@emph{ICV:} @@var{dyn-var}
@@item @@emph{Scope:} global
a1894 2
@@item @@emph{ICV:} @@var{max-active-levels-var}
@@item @@emph{Scope:} data environment
d1901 2
a1902 2
regions is initialized to the largest number supported, otherwise
it is set to one.
d1905 1
a1905 3
@@ref{omp_set_max_active_levels}, @@ref{OMP_NESTED}, @@ref{OMP_PROC_BIND},
@@ref{OMP_NUM_THREADS}

a1917 2
@@item @@emph{ICV:} @@var{max-task-priority-var}
@@item @@emph{Scope:} global
a1937 2
@@item @@emph{ICV:} @@var{max-active-levels-var}
@@item @@emph{Scope:} data environment
d1942 3
a1944 3
of maximum active nested regions supported is by default set to the
maximum supported, otherwise it is set to one.  If
@@env{OMP_MAX_ACTIVE_LEVELS} is defined, its setting overrides this
a1948 3
Note that the @@code{OMP_NESTED} environment variable was deprecated in
the OpenMP specification 5.2 in favor of @@code{OMP_MAX_ACTIVE_LEVELS}.

d1950 1
a1950 2
@@ref{omp_set_max_active_levels}, @@ref{omp_set_nested},
@@ref{OMP_MAX_ACTIVE_LEVELS}
a1961 2
@@item @@emph{ICV:} @@var{nteams-var}
@@item @@emph{Scope:} device
a1981 2
@@item @@emph{ICV:} @@var{nthreads-var}
@@item @@emph{Scope:} data environment
d1986 1
a1986 1
level.  Specifying more than one item in the list automatically enables
a1988 3
When a list with more than value is specified, it also affects the
@@var{max-active-levels-var} ICV as described in @@ref{OMP_MAX_ACTIVE_LEVELS}.

d1990 1
a1990 1
@@ref{omp_set_num_threads}, @@ref{OMP_MAX_ACTIVE_LEVELS}
a2001 2
@@item @@emph{ICV:} @@var{bind-var}
@@item @@emph{Scope:} data environment
d2013 1
a2013 4
list automatically enables nesting by default.

When a list is specified, it also affects the @@var{max-active-levels-var} ICV
as described in @@ref{OMP_MAX_ACTIVE_LEVELS}.
d2019 2
a2020 2
@@ref{omp_get_proc_bind}, @@ref{GOMP_CPU_AFFINITY}, @@ref{OMP_PLACES},
@@ref{OMP_MAX_ACTIVE_LEVELS}
a2031 2
@@item @@emph{ICV:} @@var{place-partition-var}
@@item @@emph{Scope:} implicit tasks
d2057 2
a2058 2
brace or numbers inside the curly braces (excluding intervals)
excludes those hardware threads.
a2081 2
@@item @@emph{ICV:} @@var{stacksize-var}
@@item @@emph{Scope:} device
a2091 3
@@item @@emph{See also}:
@@ref{GOMP_STACKSIZE}

a2102 2
@@item @@emph{ICV:} @@var{run-sched-var}
@@item @@emph{Scope:} data environment
d2120 1
a2120 1
@@section @@env{OMP_TARGET_OFFLOAD} -- Controls offloading behavior
a2123 2
@@item @@emph{ICV:} @@var{target-offload-var}
@@item @@emph{Scope:} global
d2125 1
a2125 1
Specifies the behavior with regard to offloading code to a device.  This
d2129 5
a2133 8
If set to @@code{MANDATORY}, the program terminates with an error if
any device construct or device memory routine uses a device that is unavailable
or not supported by the implementation, or uses a non-conforming device number.
If set to @@code{DISABLED}, then offloading is disabled and all code runs on
the host. If set to @@code{DEFAULT}, the program tries offloading to the
device first, then falls back to running code on the host if it cannot.

If undefined, then the program behaves as if @@code{DEFAULT} was set.
d2135 1
a2135 8
Note: Even with @@code{MANDATORY}, no run-time termination is performed when
the device number in a @@code{device} clause or argument to a device memory
routine is for host, which includes using the device number in the
@@var{default-device-var} ICV.  However, the initial value of
the @@var{default-device-var} ICV is affected by @@code{MANDATORY}.

@@item @@emph{See also}:
@@ref{OMP_DEFAULT_DEVICE}
d2138 1
a2138 1
@@uref{https://www.openmp.org, OpenMP specification v5.2}, Section 21.2.8
a2146 2
@@item @@emph{ICV:} @@var{teams-thread-limit-var}
@@item @@emph{Scope:} device
a2166 2
@@item @@emph{ICV:} @@var{thread-limit-var}
@@item @@emph{Scope:} data environment
d2210 1
a2210 1
@@code{GOMP_CPU_AFFINITY="0 3 1-2 4-15:2"} binds the initial thread
d2213 1
a2213 1
and 14 respectively and then starts assigning back from the beginning of
d2226 1
a2226 1
@@code{FALSE}, the host system handles the assignment of threads to CPUs.
d2242 1
a2242 1
If enabled, some debugging output is printed during execution.
d2315 1
a2315 1
value is omitted, then a worker thread inherits the priority of the OpenMP
d2323 1
a2323 1
then each OpenMP primary thread of this scheduler instance uses its own
d2348 6
a2353 4
@@samp{#pragma acc} in C/C++ and, in Fortran, the @@samp{!$acc} sentinel in free
source form and the @@samp{c$acc}, @@samp{*$acc} and @@samp{!$acc} sentinels in
fixed source form.  The flag also arranges for automatic linking of the OpenACC
runtime library (@@ref{OpenACC Runtime Library Routines}).
d2601 1
a2601 1
The parameter @@code{acc_device_property} is still provided,
d2634 4
a2637 4
in @@var{arg}. In C/C++, a non-zero value is returned to indicate
the specified asynchronous operation has completed while Fortran returns
@@code{true}. If the asynchronous operation has not completed, C/C++ returns
zero and Fortran returns @@code{false}.
d2663 4
a2666 4
In C/C++, a non-zero value is returned to indicate all asynchronous
operations have completed while Fortran returns @@code{true}. If
any asynchronous operation has not completed, C/C++ returns zero and
Fortran returns @@code{false}.
d2847 3
a2849 3
In Fortran, @@code{true} is returned. If the program is not executing
on the specified device type C/C++ returns zero, while Fortran
returns @@code{false}.
d2863 1
d2875 1
a2875 1
This function allocates @@var{bytes} bytes of device memory. It returns
d2880 1
a2880 7
@@item @@emph{Prototype}: @@tab @@code{d_void* acc_malloc(size_t bytes);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{type(c_ptr) function acc_malloc(bytes)}
@@item                   @@tab @@code{integer(c_size_t), value :: bytes}
d2885 1
a2885 2
3.2.18.  @@uref{https://www.openacc.org, openacc specification v3.3}, section
3.2.16.
d2894 1
a2894 1
Free previously allocated device memory at the device address @@code{data_dev}.
d2898 1
a2898 7
@@item @@emph{Prototype}: @@tab @@code{void acc_free(d_void *data_dev);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{subroutine acc_free(data_dev)}
@@item                   @@tab @@code{type(c_ptr), value :: data_dev}
d2903 1
a2903 2
3.2.19.  @@uref{https://www.openacc.org, openacc specification v3.3}, section
3.2.17.
d2954 2
a2955 2
@@var{len} is present or not. If it is not present, device memory
is allocated and the host memory copied. The device address of
d3038 2
a3039 2
@@var{len} is present or not. If it is not present, device memory
is allocated and mapped to host memory. In C/C++, the device address
d3271 2
a3272 2
memory is specified with the device address @@var{data_dev}. The host memory is
specified with the host address @@var{data_arg} and a length of @@var{bytes}.
d3276 1
a3276 9
@@item @@emph{Prototype}: @@tab @@code{void acc_map_data(h_void *data_arg, d_void *data_dev, size_t bytes);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{subroutine acc_map_data(data_arg, data_dev, bytes)}
@@item                   @@tab @@code{type(*), dimension(*) :: data_arg}
@@item                   @@tab @@code{type(c_ptr), value :: data_dev}
@@item                   @@tab @@code{integer(c_size_t), value :: bytes}
d3281 1
a3281 2
3.2.26.  @@uref{https://www.openacc.org, OpenACC specification v3.3}, section
3.2.21.
d3291 1
a3291 1
specified by @@var{data_arg}.
d3295 1
a3295 7
@@item @@emph{Prototype}: @@tab @@code{void acc_unmap_data(h_void *data_arg);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{subroutine acc_unmap_data(data_arg)}
@@item                   @@tab @@code{type(*), dimension(*) :: data_arg}
d3300 1
a3300 2
3.2.27. @@uref{https://www.openacc.org, OpenACC specification v3.3}, section
3.2.22.
d3310 1
a3310 1
host address specified by @@var{data_arg}.
d3314 1
a3314 7
@@item @@emph{Prototype}: @@tab @@code{void *acc_deviceptr(h_void *data_arg);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{type(c_ptr) function acc_deviceptr(data_arg)}
@@item                   @@tab @@code{type(*), dimension(*) :: data_arg}
d3319 1
a3319 2
3.2.28.  @@uref{https://www.openacc.org, OpenACC specification v3.3}, section
3.2.23.
d3329 1
a3329 1
device address specified by @@var{data_dev}.
d3333 1
a3333 7
@@item @@emph{Prototype}: @@tab @@code{void *acc_hostptr(d_void *data_dev);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{type(c_ptr) function acc_hostptr(data_dev)}
@@item                   @@tab @@code{type(c_ptr), value :: data_dev}
d3338 1
a3338 2
3.2.29.  @@uref{https://www.openacc.org, OpenACC specification v3.3}, section
3.2.24.
d3386 3
a3388 3
This function copies host memory specified by host address of
@@var{data_host_src} to device memory specified by the device address
@@var{data_dev_dest} for a length of @@var{bytes} bytes.
d3392 1
a3392 16
@@item @@emph{Prototype}: @@tab @@code{void acc_memcpy_to_device(d_void* data_dev_dest,}
@@item                   @@tab @@code{h_void* data_host_src, size_t bytes);}
@@item @@emph{Prototype}: @@tab @@code{void acc_memcpy_to_device_async(d_void* data_dev_dest,}
@@item                   @@tab @@code{h_void* data_host_src, size_t bytes, int async_arg);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{subroutine acc_memcpy_to_device(data_dev_dest, &}
@@item                   @@tab @@code{data_host_src, bytes)}
@@item @@emph{Interface}: @@tab @@code{subroutine acc_memcpy_to_device_async(data_dev_dest, &}
@@item                   @@tab @@code{data_host_src, bytes, async_arg)}
@@item                   @@tab @@code{type(c_ptr), value :: data_dev_dest}
@@item                   @@tab @@code{type(*), dimension(*) :: data_host_src}
@@item                   @@tab @@code{integer(c_size_t), value :: bytes}
@@item                   @@tab @@code{integer(acc_handle_kind), value :: async_arg}
d3397 1
a3397 2
3.2.31  @@uref{https://www.openacc.org, OpenACC specification v3.3}, section
3.2.26.
d3406 3
a3408 3
This function copies device memory specified by device address of
@@var{data_dev_src} to host memory specified by the host address
@@var{data_host_dest} for a length of @@var{bytes} bytes.
d3412 1
a3412 16
@@item @@emph{Prototype}: @@tab @@code{void acc_memcpy_from_device(h_void* data_host_dest,}
@@item                   @@tab @@code{d_void* data_dev_src, size_t bytes);}
@@item @@emph{Prototype}: @@tab @@code{void acc_memcpy_from_device_async(h_void* data_host_dest,}
@@item                   @@tab @@code{d_void* data_dev_src, size_t bytes, int async_arg);}
@@end multitable

@@item @@emph{Fortran}:
@@multitable @@columnfractions .20 .80
@@item @@emph{Interface}: @@tab @@code{subroutine acc_memcpy_from_device(data_host_dest, &}
@@item                   @@tab @@code{data_dev_src, bytes)}
@@item @@emph{Interface}: @@tab @@code{subroutine acc_memcpy_from_device_async(data_host_dest, &}
@@item                   @@tab @@code{data_dev_src, bytes, async_arg)}
@@item                   @@tab @@code{type(*), dimension(*) :: data_host_dest}
@@item                   @@tab @@code{type(c_ptr), value :: data_dev_src}
@@item                   @@tab @@code{integer(c_size_t), value :: bytes}
@@item                   @@tab @@code{integer(acc_handle_kind), value :: async_arg}
d3417 1
a3417 2
3.2.32.  @@uref{https://www.openacc.org, OpenACC specification v3.3}, section
3.2.27.
d3431 2
a3432 2
@@item @@emph{Prototype}: @@tab @@code{void acc_attach(h_void **ptr_addr);}
@@item @@emph{Prototype}: @@tab @@code{void acc_attach_async(h_void **ptr_addr, int async);}
a3434 8
@@c @@item @@emph{Fortran}:
@@c @@multitable @@columnfractions .20 .80
@@c @@item @@emph{Interface}: @@tab @@code{subroutine acc_attach(ptr_addr)}
@@c @@item @@emph{Interface}: @@tab @@code{subroutine acc_attach_async(ptr_addr, async_arg)}
@@c @@item                   @@tab @@code{type(*), dimension(..) :: ptr_addr}
@@c @@item                   @@tab @@code{integer(acc_handle_kind), value :: async_arg}
@@c @@end multitable

a3437 2
@@c  @@uref{https://www.openacc.org, OpenACC specification v3.3}, section
@@c 3.2.29.
d3451 4
a3454 4
@@item @@emph{Prototype}: @@tab @@code{void acc_detach(h_void **ptr_addr);}
@@item @@emph{Prototype}: @@tab @@code{void acc_detach_async(h_void **ptr_addr, int async);}
@@item @@emph{Prototype}: @@tab @@code{void acc_detach_finalize(h_void **ptr_addr);}
@@item @@emph{Prototype}: @@tab @@code{void acc_detach_finalize_async(h_void **ptr_addr, int async);}
a3456 10
@@c @@item @@emph{Fortran}:
@@c @@multitable @@columnfractions .20 .80
@@c @@item @@emph{Interface}: @@tab @@code{subroutine acc_detach(ptr_addr)}
@@c @@item @@emph{Interface}: @@tab @@code{subroutine acc_detach_async(ptr_addr, async_arg)}
@@c @@item @@emph{Interface}: @@tab @@code{subroutine acc_detach_finalize(ptr_addr)}
@@c @@item @@emph{Interface}: @@tab @@code{subroutine acc_detach_finalize_async(ptr_addr, async_arg)}
@@c @@item                   @@tab @@code{type(*), dimension(..) :: ptr_addr}
@@c @@item                   @@tab @@code{integer(acc_handle_kind), value :: async_arg}
@@c @@end multitable

a3459 2
@@c  @@uref{https://www.openacc.org, OpenACC specification v3.3}, section
@@c 3.2.29.
d3640 1
d3646 1
a3653 11
@@item @@emph{Description}:
Control the default device type to use when executing compute regions.
If unset, the code can be run on any device type, favoring a non-host
device type.

Supported values in GCC (if compiled in) are
@@itemize
@@item @@code{host}
@@item @@code{nvidia}
@@item @@code{radeon}
@@end itemize
a3663 4
@@item @@emph{Description}:
Control which device, identified by device number, is the default device.
The value must be a nonnegative integer less than the number of devices.
If unset, device number zero is used.
a3673 5
@@item @@emph{Description}:
Semicolon-separated list of dynamic libraries that are loaded as profiling
libraries.  Each library must provide at least the @@code{acc_register_library}
routine.  Each library file is found as described by the documentation of
@@code{dlopen} of your operating system.
d3684 9
d3726 1
a3726 1
and the CUDA stream is maintained for the lifetime of the program.
d3730 1
a3730 1
originally associated with the @@code{async} clause is destroyed.
d3780 1
a3780 1
@@code{cublasCreate()}. In other words, both libraries share the
d3809 1
a3809 1
called prior to any of the functions in the CUBLAS library. More specifically,
d3819 1
a3819 1
use of environment variables and these is discussed in the next section.
d3829 1
a3829 1
@@code{cublasCreate()} only initializes the CUBLAS library and allocates
d3918 2
a3919 2
understand that performance is impacted to some degree once the
Profiling Interface is enabled: for example, because of the
d3940 1
a3940 1
@@code{acc_prof_lookup} always returns @@code{NULL}.
d3958 1
a3958 1
this implementation, the value generally corresponds to the
d3966 1
a3966 1
@@code{if} clause with @@emph{false} argument, this still refers to
d3991 1
a3991 1
execution/@@code{acc_device_host} it always is
d3993 1
a3993 1
It is unclear if that is the expected behavior.
d3998 1
a3998 1
It is unclear if that is the expected behavior.
d4004 1
a4004 1
This always has the same value as @@code{acc_prof_info.async}.
a4205 326
@@c ---------------------------------------------------------------------
@@c OpenMP-Implementation Specifics
@@c ---------------------------------------------------------------------

@@node OpenMP-Implementation Specifics
@@chapter OpenMP-Implementation Specifics

@@menu
* Implementation-defined ICV Initialization::
* OpenMP Context Selectors::
* Memory allocation::
@@end menu

@@node Implementation-defined ICV Initialization
@@section Implementation-defined ICV Initialization
@@cindex Implementation specific setting

@@multitable @@columnfractions .30 .70
@@item @@var{affinity-format-var} @@tab See @@ref{OMP_AFFINITY_FORMAT}.
@@item @@var{def-allocator-var} @@tab See @@ref{OMP_ALLOCATOR}.
@@item @@var{max-active-levels-var} @@tab See @@ref{OMP_MAX_ACTIVE_LEVELS}.
@@item @@var{dyn-var} @@tab See @@ref{OMP_DYNAMIC}.
@@item @@var{nthreads-var} @@tab See @@ref{OMP_NUM_THREADS}.
@@item @@var{num-devices-var} @@tab Number of non-host devices found
by GCC's run-time library
@@item @@var{num-procs-var} @@tab The number of CPU cores on the
initial device, except that affinity settings might lead to a
smaller number.  On non-host devices, the value of the
@@var{nthreads-var} ICV.
@@item @@var{place-partition-var} @@tab See @@ref{OMP_PLACES}.
@@item @@var{run-sched-var} @@tab See @@ref{OMP_SCHEDULE}.
@@item @@var{stacksize-var} @@tab See @@ref{OMP_STACKSIZE}.
@@item @@var{thread-limit-var} @@tab See @@ref{OMP_TEAMS_THREAD_LIMIT}
@@item @@var{wait-policy-var} @@tab See @@ref{OMP_WAIT_POLICY} and
@@ref{GOMP_SPINCOUNT}
@@end multitable

@@node OpenMP Context Selectors
@@section OpenMP Context Selectors

@@code{vendor} is always @@code{gnu}. References are to the GCC manual.

@@c NOTE: Only the following selectors have been implemented. To add
@@c additional traits for target architecture, TARGET_OMP_DEVICE_KIND_ARCH_ISA
@@c has to be implemented; cf. also PR target/105640.
@@c For offload devices, add *additionally* gcc/config/*/t-omp-device.

For the host compiler, @@code{kind} always matches @@code{host}; for the
offloading architectures AMD GCN and Nvidia PTX, @@code{kind} always matches
@@code{gpu}.  For the x86 family of computers, AMD GCN and Nvidia PTX
the following traits are supported in addition; while OpenMP is supported
on more architectures, GCC currently does not match any @@code{arch} or
@@code{isa} traits for those.

@@multitable @@columnfractions .65 .30
@@headitem @@code{arch} @@tab @@code{isa}
@@item @@code{x86}, @@code{x86_64}, @@code{i386}, @@code{i486},
      @@code{i586}, @@code{i686}, @@code{ia32}
      @@tab See @@code{-m...} flags in ``x86 Options'' (without @@code{-m})
@@item @@code{amdgcn}, @@code{gcn}
      @@tab See @@code{-march=} in ``AMD GCN Options''@@footnote{Additionally,
      @@code{gfx803} is supported as an alias for @@code{fiji}.}
@@item @@code{nvptx}, @@code{nvptx64}
      @@tab See @@code{-march=} in ``Nvidia PTX Options''
@@end multitable

@@node Memory allocation
@@section Memory allocation

The description below applies to:

@@itemize
@@item Explicit use of the OpenMP API routines, see
      @@ref{Memory Management Routines}.
@@item The @@code{allocate} clause, except when the @@code{allocator} modifier is a
      constant expression with value @@code{omp_default_mem_alloc} and no
      @@code{align} modifier has been specified. (In that case, the normal
      @@code{malloc} allocation is used.)
@@item Using the @@code{allocate} directive for automatic/stack variables, except
      when the @@code{allocator} clause is a constant expression with value
      @@code{omp_default_mem_alloc} and no @@code{align} clause has been
      specified. (In that case, the normal allocation is used: stack allocation
      and, sometimes for Fortran, also @@code{malloc} [depending on flags such as
      @@option{-fstack-arrays}].)
@@item Using the @@code{allocate} directive for variable in static memory is
      currently not supported (compile time error).
@@item In Fortran, the @@code{allocators} directive and the executable
      @@code{allocate} directive for Fortran pointers and allocatables is
      supported, but requires that files containing those directives has to be
      compiled with @@option{-fopenmp-allocators}.  Additionally, all files that
      might explicitly or implicitly deallocate memory allocated that way must
      also be compiled with that option.
@@end itemize

For the available predefined allocators and, as applicable, their associated
predefined memory spaces and for the available traits and their default values,
see @@ref{OMP_ALLOCATOR}.  Predefined allocators without an associated memory
space use the @@code{omp_default_mem_space} memory space.

For the memory spaces, the following applies:
@@itemize
@@item @@code{omp_default_mem_space} is supported
@@item @@code{omp_const_mem_space} maps to @@code{omp_default_mem_space}
@@item @@code{omp_low_lat_mem_space} is only available on supported devices,
      and maps to @@code{omp_default_mem_space} otherwise.
@@item @@code{omp_large_cap_mem_space} maps to @@code{omp_default_mem_space},
      unless the memkind library is available
@@item @@code{omp_high_bw_mem_space} maps to @@code{omp_default_mem_space},
      unless the memkind library is available
@@end itemize

On Linux systems, where the @@uref{https://github.com/memkind/memkind, memkind
library} (@@code{libmemkind.so.0}) is available at runtime, it is used when
creating memory allocators requesting

@@itemize
@@item the memory space @@code{omp_high_bw_mem_space}
@@item the memory space @@code{omp_large_cap_mem_space}
@@item the @@code{partition} trait @@code{interleaved}; note that for
      @@code{omp_large_cap_mem_space} the allocation will not be interleaved
@@end itemize

On Linux systems, where the @@uref{https://github.com/numactl/numactl, numa
library} (@@code{libnuma.so.1}) is available at runtime, it used when creating
memory allocators requesting

@@itemize
@@item the @@code{partition} trait @@code{nearest}, except when both the
libmemkind library is available and the memory space is either
@@code{omp_large_cap_mem_space} or @@code{omp_high_bw_mem_space}
@@end itemize

Note that the numa library will round up the allocation size to a multiple of
the system page size; therefore, consider using it only with large data or
by sharing allocations via the @@code{pool_size} trait.  Furthermore, the Linux
kernel does not guarantee that an allocation will always be on the nearest NUMA
node nor that after reallocation the same node will be used.  Note additionally
that, on Linux, the default setting of the memory placement policy is to use the
current node; therefore, unless the memory placement policy has been overridden,
the @@code{partition} trait @@code{environment} (the default) will be effectively
a @@code{nearest} allocation.

Additional notes regarding the traits:
@@itemize
@@item The @@code{pinned} trait is supported on Linux hosts, but is subject to
      the OS @@code{ulimit}/@@code{rlimit} locked memory settings.
@@item The default for the @@code{pool_size} trait is no pool and for every
      (re)allocation the associated library routine is called, which might
      internally use a memory pool.
@@item For the @@code{partition} trait, the partition part size will be the same
      as the requested size (i.e. @@code{interleaved} or @@code{blocked} has no
      effect), except for @@code{interleaved} when the memkind library is
      available.  Furthermore, for @@code{nearest} and unless the numa library
      is available, the memory might not be on the same NUMA node as thread
      that allocated the memory; on Linux, this is in particular the case when
      the memory placement policy is set to preferred.
@@item The @@code{access} trait has no effect such that memory is always
      accessible by all threads.
@@item The @@code{sync_hint} trait has no effect.
@@end itemize

See also:
@@ref{Offload-Target Specifics}

@@c ---------------------------------------------------------------------
@@c Offload-Target Specifics
@@c ---------------------------------------------------------------------

@@node Offload-Target Specifics
@@chapter Offload-Target Specifics

The following sections present notes on the offload-target specifics

@@menu
* AMD Radeon::
* nvptx::
@@end menu

@@node AMD Radeon
@@section AMD Radeon (GCN)

On the hardware side, there is the hierarchy (fine to coarse):
@@itemize
@@item work item (thread)
@@item wavefront
@@item work group
@@item compute unit (CU)
@@end itemize

All OpenMP and OpenACC levels are used, i.e.
@@itemize
@@item OpenMP's simd and OpenACC's vector map to work items (thread)
@@item OpenMP's threads (``parallel'') and OpenACC's workers map
      to wavefronts
@@item OpenMP's teams and OpenACC's gang use a threadpool with the
      size of the number of teams or gangs, respectively.
@@end itemize

The used sizes are
@@itemize
@@item Number of teams is the specified @@code{num_teams} (OpenMP) or
      @@code{num_gangs} (OpenACC) or otherwise the number of CU. It is limited
      by two times the number of CU.
@@item Number of wavefronts is 4 for gfx900 and 16 otherwise;
      @@code{num_threads} (OpenMP) and @@code{num_workers} (OpenACC)
      overrides this if smaller.
@@item The wavefront has 102 scalars and 64 vectors
@@item Number of workitems is always 64
@@item The hardware permits maximally 40 workgroups/CU and
      16 wavefronts/workgroup up to a limit of 40 wavefronts in total per CU.
@@item 80 scalars registers and 24 vector registers in non-kernel functions
      (the chosen procedure-calling API).
@@item For the kernel itself: as many as register pressure demands (number of
      teams and number of threads, scaled down if registers are exhausted)
@@end itemize

The implementation remark:
@@itemize
@@item I/O within OpenMP target regions and OpenACC parallel/kernels is supported
      using the C library @@code{printf} functions and the Fortran
      @@code{print}/@@code{write} statements.
@@item Reverse offload regions (i.e. @@code{target} regions with
      @@code{device(ancestor:1)}) are processed serially per @@code{target} region
      such that the next reverse offload region is only executed after the previous
      one returned.
@@item OpenMP code that has a @@code{requires} directive with
      @@code{unified_shared_memory} will remove any GCN device from the list of
      available devices (``host fallback'').
@@item The available stack size can be changed using the @@code{GCN_STACK_SIZE}
      environment variable; the default is 32 kiB per thread.
@@item Low-latency memory (@@code{omp_low_lat_mem_space}) is supported when the
      the @@code{access} trait is set to @@code{cgroup}.  The default pool size
      is automatically scaled to share the 64 kiB LDS memory between the number
      of teams configured to run on each compute-unit, but may be adjusted at
      runtime by setting environment variable
      @@code{GOMP_GCN_LOWLAT_POOL=@@var{bytes}}.
@@item @@code{omp_low_lat_mem_alloc} cannot be used with true low-latency memory
      because the definition implies the @@code{omp_atv_all} trait; main
      graphics memory is used instead.
@@item @@code{omp_cgroup_mem_alloc}, @@code{omp_pteam_mem_alloc}, and
      @@code{omp_thread_mem_alloc}, all use low-latency memory as first
      preference, and fall back to main graphics memory when the low-latency
      pool is exhausted.
@@end itemize



@@node nvptx
@@section nvptx

On the hardware side, there is the hierarchy (fine to coarse):
@@itemize
@@item thread
@@item warp
@@item thread block
@@item streaming multiprocessor
@@end itemize

All OpenMP and OpenACC levels are used, i.e.
@@itemize
@@item OpenMP's simd and OpenACC's vector map to threads
@@item OpenMP's threads (``parallel'') and OpenACC's workers map to warps
@@item OpenMP's teams and OpenACC's gang use a threadpool with the
      size of the number of teams or gangs, respectively.
@@end itemize

The used sizes are
@@itemize
@@item The @@code{warp_size} is always 32
@@item CUDA kernel launched: @@code{dim=@@{#teams,1,1@@}, blocks=@@{#threads,warp_size,1@@}}.
@@item The number of teams is limited by the number of blocks the device can
      host simultaneously.
@@end itemize

Additional information can be obtained by setting the environment variable to
@@code{GOMP_DEBUG=1} (very verbose; grep for @@code{kernel.*launch} for launch
parameters).

GCC generates generic PTX ISA code, which is just-in-time compiled by CUDA,
which caches the JIT in the user's directory (see CUDA documentation; can be
tuned by the environment variables @@code{CUDA_CACHE_@@{DISABLE,MAXSIZE,PATH@@}}.

Note: While PTX ISA is generic, the @@code{-mptx=} and @@code{-march=} commandline
options still affect the used PTX ISA code and, thus, the requirements on
CUDA version and hardware.

The implementation remark:
@@itemize
@@item I/O within OpenMP target regions and OpenACC parallel/kernels is supported
      using the C library @@code{printf} functions. Note that the Fortran
      @@code{print}/@@code{write} statements are not supported, yet.
@@item Compilation OpenMP code that contains @@code{requires reverse_offload}
      requires at least @@code{-march=sm_35}, compiling for @@code{-march=sm_30}
      is not supported.
@@item For code containing reverse offload (i.e. @@code{target} regions with
      @@code{device(ancestor:1)}), there is a slight performance penalty
      for @@emph{all} target regions, consisting mostly of shutdown delay
      Per device, reverse offload regions are processed serially such that
      the next reverse offload region is only executed after the previous
      one returned.
@@item OpenMP code that has a @@code{requires} directive with
      @@code{unified_shared_memory} will remove any nvptx device from the
      list of available devices (``host fallback'').
@@item The default per-warp stack size is 128 kiB; see also @@code{-msoft-stack}
      in the GCC manual.
@@item The OpenMP routines @@code{omp_target_memcpy_rect} and
      @@code{omp_target_memcpy_rect_async} and the @@code{target update}
      directive for non-contiguous list items will use the 2D and 3D
      memory-copy functions of the CUDA library.  Higher dimensions will
      call those functions in a loop and are therefore supported.
@@item Low-latency memory (@@code{omp_low_lat_mem_space}) is supported when the
      the @@code{access} trait is set to @@code{cgroup}, the ISA is at least
      @@code{sm_53}, and the PTX version is at least 4.1.  The default pool size
      is 8 kiB per team, but may be adjusted at runtime by setting environment
      variable @@code{GOMP_NVPTX_LOWLAT_POOL=@@var{bytes}}.  The maximum value is
      limited by the available hardware, and care should be taken that the
      selected pool size does not unduly limit the number of teams that can
      run simultaneously.
@@item @@code{omp_low_lat_mem_alloc} cannot be used with true low-latency memory
      because the definition implies the @@code{omp_atv_all} trait; main
      graphics memory is used instead.
@@item @@code{omp_cgroup_mem_alloc}, @@code{omp_pteam_mem_alloc}, and
      @@code{omp_thread_mem_alloc}, all use low-latency memory as first
      preference, and fall back to main graphics memory when the low-latency
      pool is exhausted.
@@end itemize
@


