OpenMP-Environment
view release on metacpan or search on metacpan
lib/OpenMP/Environment.pm view on Meta::CPAN
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.
This variable is validated via setter.
=item C<OMP_WAIT_POLICY>
Specifies whether waiting threads should be active or passive. If
the value is PASSIVE, waiting threads should not consume CPU power
while waiting; while the value is ACTIVE specifies that they should.
If undefined, threads wait actively for a short time before waiting
passively.
This variable is validated via setter.
=item C<GOMP_CPU_AFFINITY>
Binds threads to specific CPUs. The variable should contain a
space-separated or comma-separated list of CPUs. This list may
contain different kinds of entries: either single CPU numbers in
any order, a range of CPUs (M-N) or a range with some stride (M-N:S).
CPU numbers are zero based. For example, 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.
GOMP_CPU_AFFINITY=0 binds all threads to CPU 0.
There is no libgomp library routine to determine whether a CPU
affinity specification is in effect. As a workaround,
language-specific library functions, e.g., getenv in C or
GET_ENVIRONMENT_VARIABLE in Fortran, may be used to query the
setting of the GOMP_CPU_AFFINITY environment variable. A defined
CPU affinity on startup cannot be changed or disabled during the
run time of the application.
If both GOMP_CPU_AFFINITY and OMP_PROC_BIND are set, OMP_PROC_BIND
has a higher precedence. If neither has been set and OMP_PROC_BIND
is unset, or when OMP_PROC_BIND is set to FALSE, the host system
will handle the assignment of threads to CPUs.
This module provides access to, but does NOT validate this variable.
=item C<GOMP_DEBUG>
Enable debugging output. The variable should be set to 0 (disabled,
also the default if not set), or 1 (enabled).
If enabled, some debugging output will be printed during execution.
This is currently not specified in more detail, and subject to
change.
This variable is validated via setter.
=item C<GOMP_STACKSIZE>
Determines how long a threads waits actively with consuming CPU
power before waiting passively without consuming CPU power. The
value may be either INFINITE, 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: k (kilo, thousand), M (mega,
million), G (giga, billion), or T (tera, trillion). If undefined,
0 is used when OMP_WAIT_POLICY is PASSIVE, 300,000 is used when
OMP_WAIT_POLICY is undefined and 30 billion is used when
OMP_WAIT_POLICY is ACTIVE. If there are more OpenMP threads than
available CPUs, 1000 and 100 spins are used for OMP_WAIT_POLICY
being ACTIVE or undefined, respectively; unless the GOMP_SPINCOUNT
is lower or OMP_WAIT_POLICY is PASSIVE.
This module provides access to, but does NOT validate this variable.
=item C<GOMP_SPINCOUNT>
Set the default thread stack size in kilobytes. This is different
from pthread_attr_get_set_assertstacksize which gets the number of
bytes as an argument. If the stack size cannot be set due to system
constraints, an error is reported and the initial stack size is
left unchanged. If undefined, the stack size is system dependent.
This module provides access to, but does NOT validate this variable.
=item C<GOMP_RTEMS_THREAD_POOLS>
This environment variable is only used on the RTEMS real-time
operating system. It determines the scheduler instance specific
thread pools. The format for GOMP_RTEMS_THREAD_POOLS is a list of
optional <thread-pool-count>[$<priority>]@<scheduler-name>
configurations separated by : where:
1. C<thread-pool-count> is the thread pool count for this scheduler
instance.
2. $<priority> is an optional priority for the worker threads of
a thread pool according to pthread_get_set_assertschedparam. 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.
3. @<scheduler-name> is the scheduler instance name according to
the RTEMS application configuration.
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 C<set_num_threads>.
This module provides access to, but does NOT validate this variable.
=back
=head1 SEE ALSO
L<OpenMP::Simple> is a module that aims at making it easier to bootstrap
Perl+OpenMP programs. It is designed to work together with this module.
This module heavily favors the C<GOMP> implementation of the OpenMP
( run in 0.715 second using v1.01-cache-2.11-cpan-39bf76dae61 )