aboutsummaryrefslogtreecommitdiff
path: root/libgomp/libgomp.texi
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2023-06-15 12:55:58 +0200
committerTobias Burnus <tobias@codesourcery.com>2023-06-15 12:55:58 +0200
commit73a0d3bf895b5c322676178a51ac0d68cf603953 (patch)
tree89ddc5fbb2ae3d1bfed659a3dd580de7e65fc8b6 /libgomp/libgomp.texi
parenta4df0ce78d6f1beee5d2ef53e2a1a9f3fc377100 (diff)
downloadgcc-73a0d3bf895b5c322676178a51ac0d68cf603953.zip
gcc-73a0d3bf895b5c322676178a51ac0d68cf603953.tar.gz
gcc-73a0d3bf895b5c322676178a51ac0d68cf603953.tar.bz2
libgomp: Extend OMP_ALLOCATOR, add affinity env var doc
Support OpenMP 5.1's syntax for OMP_ALLOCATOR as well, which permits besides predefined allocators also predefined memspaces optionally followed by traits. Additionally, this commit adds the previously lacking documentation for OMP_ALLOCATOR, OMP_AFFINITY_FORMAT and OMP_DISPLAY_AFFINITY. libgomp/ChangeLog: * env.c (gomp_def_allocator_envvar): New var. (parse_allocator): Handle OpenMP 5.1 syntax. (cleanup_env): New. (omp_display_env): Output gomp_def_allocator_envvar for an allocator with traits. * libgomp.texi (OMP_ALLOCATOR, OMP_AFFINITY_FORMAT, OMP_DISPLAY_AFFINITY): New. * testsuite/libgomp.c/allocator-1.c: New test. * testsuite/libgomp.c/allocator-2.c: New test. * testsuite/libgomp.c/allocator-3.c: New test. * testsuite/libgomp.c/allocator-4.c: New test. * testsuite/libgomp.c/allocator-5.c: New test. * testsuite/libgomp.c/allocator-6.c: New test.
Diffstat (limited to 'libgomp/libgomp.texi')
-rw-r--r--libgomp/libgomp.texi142
1 files changed, 142 insertions, 0 deletions
diff --git a/libgomp/libgomp.texi b/libgomp/libgomp.texi
index 21d3582..1c57f5a 100644
--- a/libgomp/libgomp.texi
+++ b/libgomp/libgomp.texi
@@ -1937,7 +1937,10 @@ section 4 of the OpenMP specification in version 4.5, while those
beginning with @env{GOMP_} are GNU extensions.
@menu
+* OMP_ALLOCATOR:: Set the default allocator
+* OMP_AFFINITY_FORMAT:: Set the format string used for affinity display
* OMP_CANCELLATION:: Set whether cancellation is activated
+* OMP_DISPLAY_AFFINITY:: Display thread affinity information
* 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
@@ -1962,6 +1965,125 @@ beginning with @env{GOMP_} are GNU extensions.
@end menu
+@node OMP_ALLOCATOR
+@section @env{OMP_ALLOCATOR} -- Set the default allocator
+@cindex Environment Variable
+@table @asis
+@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{=}.
+
+@multitable @columnfractions .45 .45
+@headitem Predefined allocators @tab 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 --
+@item omp_pteam_mem_alloc @tab --
+@item omp_thread_mem_alloc @tab --
+@end multitable
+
+@multitable @columnfractions .30 .60
+@headitem Trait @tab Allowed values
+@item @code{sync_hint} @tab @code{contended}, @code{uncontended},
+ @code{serialized}, @code{private}
+@item @code{alignment} @tab Positive integer being a power of two
+@item @code{access} @tab @code{all}, @code{cgroup},
+ @code{pteam}, @code{thread}
+@item @code{pool_size} @tab Positive integer
+@item @code{fallback} @tab @code{default_mem_fb}, @code{null_fb},
+ @code{abort_fb}, @code{allocator_fb}
+@item @code{fb_data} @tab @emph{unsupported as it needs an allocator handle}
+@item @code{pinned} @tab @code{true}, @code{false}
+@item @code{partition} @tab @code{environment}, @code{nearest},
+ @code{blocked}, @code{interleaved}
+@end multitable
+
+Examples:
+@smallexample
+OMP_ALLOCATOR=omp_high_bw_mem_alloc
+OMP_ALLOCATOR=omp_large_cap_mem_space
+OMP_ALLOCATR=omp_low_lat_mem_space:pinned=true,partition=nearest
+@end smallexample
+
+@c @item @emph{See also}:
+
+@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{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{%%} will display a literal percent.
+The size specification consists of an optional @code{0.} or @code{.} followed
+by a positive integer, specifing 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
+
+
+
@node OMP_CANCELLATION
@section @env{OMP_CANCELLATION} -- Set whether cancellation is activated
@cindex Environment Variable
@@ -1979,6 +2101,26 @@ if unset, cancellation is disabled and the @code{cancel} construct is ignored.
+@node OMP_DISPLAY_AFFINITY
+@section @env{OMP_DISPLAY_AFFINITY} -- Display thread affinity information
+@cindex Environment Variable
+@table @asis
+@item @emph{Description}:
+If set to @code{FALSE} or if unset, affinity displaying is disabled.
+If set to @code{TRUE}, the runtime will display 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
+
+
+
+
@node OMP_DISPLAY_ENV
@section @env{OMP_DISPLAY_ENV} -- Show OpenMP version and environment variables
@cindex Environment Variable