OpenMP* Environment Variables

The Intel® Compiler supports OpenMP* environment variables (with the OMP_ prefix) and extensions in the form of Intel-specific environment variables (with the KMP_ prefix).

OpenMP Environment Variables

The syntax examples assume bash on Linux* and Mac OS* X. Use the set command for Windows*.

Variable Name

Description, Default, and Syntax

OMP_NUM_THREADS

Sets the maximum number of threads to use for OpenMP* parallel regions if no other value is specified in the application.

This environment variable applies to both -openmp and -parallel (Linux and Mac OS X) or /Qopenmp and /Qparallel (Windows).

Default: Number of processors visible to the operating system.

Syntax:

export OMP_NUM_THREADS=value

OMP_SCHEDULE

Sets the run-time schedule type and an optional chunk size.

This environment variable is available for both Intel® and non-Intel microprocessors but it may perform additional optimizations for Intel® microprocessors than it performs for non-Intel microprocessors.

Default: STATIC, no chunk size specified

Syntax:

export OMP_SCHEDULE="kind[,chunk_size]"

OMP_DYNAMIC

Enables (.TRUE.) or disables (.FALSE.) the dynamic adjustment of the number of threads.

Default: .FALSE.

Syntax:

export OMP_DYNAMIC=value

OMP_NESTED

Enables (.TRUE.) or disables (.FALSE.) nested parallelism.

Default: .FALSE.

Syntax:

export OMP_NESTED=value

OMP_STACKSIZE

Sets the number of kilobytes to allocate for each OpenMP thread to use as the private stack for the thread.

Recommended size is 16M.

Use the optional suffixes: B (bytes), K (Kilobytes), M (Megabytes), G (Gigabytes), or T (Terabytes) to specify the units. If only value is specified and B, K, M, G, or T is not specified, then size is assumed to be K (Kilobytes).

This variable does not affect the native operating system threads created by the user program nor the thread executing the sequential part of an OpenMP program or parallel programs created using -parallel (Linux and Mac OS X) or /Qparallel (Windows).

kmp_{set,get}_stacksize_s() routines set/retrieve the value. kmp_set_stacksize_s() routine must be called from sequential part, before first parallel region is created. Otherwise, calling kmp_set_stacksize_s() has no effect.

Related environment variables: KMP_STACKSIZE and GOMP_STACKSIZE. Both KMP_STACKSIZE and GOMP_STACKSIZE override OMP_STACKSIZE.

Default: IA-32 architecture: 2M
Intel® 64 architecure: 4M

Syntax:

export OMP_STACKSIZE=value

OMP_MAX_ACTIVE_LEVELS

Controls the maximum number of nested active parallel regions. Any parallel regions encountered at a deeper nesting level than the specified value will be serialized.

Default: No enforced limit

Syntax:

export OMP_MAX_ACTIVE_LEVELS=value

OMP_WAIT_POLICY Decides whether threads spin (active) or sleep (passive) while they are waiting.

Default: Passive

Syntax:

export OMP_WAIT_POLICY=value

OMP_THREAD_LIMIT

Limits the number of simultaneously executing threads in an OpenMP* program.

If this limit is reached and another native operating system thread encounters OpenMP* API calls or constructs, the program can abort with an error message. If this limit is reached when an OpenMP parallel region begins, a one-time warning message might be generated indicating that the number of threads in the team was reduced, but the program will continue.

This environment variable is only used for programs compiled with the following options: -openmp or

-openmp-profile or -parallel (Linux and Mac OS X) and /Qopenmp or /Qopenmp-profile or /Qparallel (Windows).

omp_get_thread_limit() routine returns the value of the limit.

Related environment variable: KMP_ALL_THREADS. Its value overrides OMP_THREAD_LIMIT.

Default: No enforced limit

Syntax:

export OMP_THREAD_LIMIT=value

Intel Environment Variables Extensions

Variable Name

Description and Default

KMP_ALL_THREADS

Limits the number of simultaneously executing threads in an OpenMP* program.

If this limit is reached and another native operating system thread encounters OpenMP* API calls or constructs, the program can abort with an error message. If this limit is reached when an OpenMP parallel region begins, a one-time warning message might be generated indicating that the number of threads in the team was reduced, but the program will continue.

This environment variable is only used for programs compiled with the following options: -openmp or -openmp-profile (Linux and Mac OS X) and /Qopenmp or /Qopenmp-profile (Windows).

Default: No enforced limit

KMP_BLOCKTIME

Sets the time, in milliseconds, that a thread should wait, after completing the execution of a parallel region, before sleeping.

Use the optional character suffixes: s (seconds), m (minutes), h (hours), or d (days) to specify the units.

Specify infinite for an unlimited wait time.

See also the throughput execution mode and the KMP_LIBRARY environment variable.

Default: 200 milliseconds

KMP_DYNAMIC_MODE

Selects the method used to determine the number of threads to use for a parallel region when OMP_DYNAMIC=true. Possible values: (asat | load_balance | thread_limit), where,

  • asat: estimates number of threads based on parallel start time;

  • load_balance: tries to avoid using more threads than available execution units on the machine;

  • thread_limit: tries to avoid using more threads than total execution units on the machine.

Default: load_balance (only on Linux* OS, if support is available); thread_limit (elsewhere)

KMP_LIBRARY

Selects the OpenMP run-time library execution mode. The options for the variable value are throughput, turnaround, and serial.

Note iconNote

KMP_LIBRARY over-rides OMP_WAIT_POLICY.

Default:throughput

KMP_SETTINGS

Enables (1) or disables (0) the printing OpenMP run-time library environment variables during program execution. Two lists of variables are printed: user-defined environment variables settings and effective values of variables used by OpenMP run-time library.

Default: 0

KMP_STACKSIZE

Sets the number of bytes to allocate for each OpenMP* thread to use as the private stack for the thread.

Note iconNote

The format is the same as OMP_STACKSIZE except that default units are in bytes instead of kilobytes.

Recommended size is 16M.

Use the optional suffixes: B (bytes), K (kilobytes), M (megabytes), G (gigabytes), or T (terabytes) to specify the units.

This variable does not affect the native operating system threads created by the user program nor the thread executing the sequential part of an OpenMP* program or parallel programs created using -parallel (Linux and Mac OS X) or /Qparallel (Windows).

Related env variables: OMP_STACKSIZE and GOMP_STACKIZE. KMP_STACKSIZE overrides both OMP_STACKSIZE and GOMP_STACKSIZE.

Default: IA-32 architecture: 2M; Intel® 64 architecture: 4M

KMP_MONITOR_STACKSIZE

Sets the number of bytes to allocate for the monitor thread, which is used for book-keeping during program execution.

Use the optional suffixes: B (bytes), K (kilobytes), M (megabytes), G (gigabytes), or T (terabytes) to specify the units.

Default: max (32K, system minimum thread stack size)

KMP_VERSION

Enables (.TRUE.) or disables (.FALSE.) the printing of OpenMP run-time library version information during program execution.

Default: .FALSE.

KMP_AFFINITY

Enables run-time library to bind threads to physical processing units.

See Thread Affinity Interface for more information on the default and the affect this environment variable has on the parallel environment.

This environment variable is available for both Intel® and non-Intel microprocessors but it may perform additional optimizations for Intel® microprocessors than it performs for non-Intel microprocessors.

Default: noverbose,
respect,
granularity=core

KMP_CPUINFO_FILE

Specifies an alternate file name for file containing machine topology description. The file must be in the same format as /proc/cpuinfo.

This environment variable is available for both Intel® and non-Intel microprocessors but it may perform additional optimizations for Intel® microprocessors than it performs for non-Intel microprocessors.

Default: none

KMP_INHERIT_FP_CONTROL

Enables (1) or disables (0) the copying of the floating point control settings of the master thread to the floating point control settings of the OpenMP* worker threads at the start of each parallel region.

Default: 1

GNU Environment Variables Extensions

These environment variables are GNU extensions. They are recognized by the Intel OpenMP compatibility library.

Variable Name

Description

GOMP_STACKSIZE

Same as OMP_STACKSIZE. KMP_STACKSIZE overrides GOMP_STACKSIZE, which overrides OMP_STACKSIZE.

Default: See OMP_STACKSIZE description

GOMP_CPU_AFFINITY

Specifies a list of OS processor IDs. See Thread Affinity Interface for more information on explicitly specifying OS processor IDs using this variable.

Default: Affinity is disabled

See Also


Submit feedback on this help topic

Copyright © 1996-2010, Intel Corporation. All rights reserved.