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

Default

Description and Syntax

OMP_NUM_THREADS

Number of processors visible to the operating system.

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

Example syntax:

export OMP_NUM_THREADS=value

OMP_SCHEDULE

STATIC, no chunk size specified

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

Example syntax:

export OMP_SCHEDULE="kind[,chunk_size]"

OMP_DYNAMIC

0

Enables (1) or disables (0) the dynamic adjustment of the number of threads.

Example syntax:

export OMP_DYNAMIC=value

OMP_NESTED

0

Enables (1) or disables (0)nested parallelism.

Example syntax:

export OMP_NESTED=value

OMP_STACKSIZE

IA-32 architecture: 2M
Intel® 64 and IA-32 Architecures: 4M

Sets the number of bytes 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 env variables: KMP_STACKSIZE. KMP_STACKSIZE overrides OMP_STACKSIZE.

Example syntax:

export OMP_STACKSIZE=value

OMP_MAX_ACTIVE_LEVELS

No enforced 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 env variable: KMP_ALL_THREADS. OMP_THREAD_LIMIT overrides KMP_ALL_THREADS.

Example syntax:

export OMP_THREAD_LIMIT=value

OMP_THREAD_LIMIT

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

Example syntax:

export OMP_THREAD_LIMIT=value

Intel Environment Variables Extensions

Variable Name

Default

Description

KMP_ALL_THREADS

No enforced 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 (Linux and Mac OS X) and /Qopenmp or /Qopenmp-profile (Windows).

KMP_BLOCKTIME

200 milliseconds

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.

KMP_LIBRARY

throughput

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

KMP_SETTINGS

0

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.

KMP_STACKSIZE

IA-32 architecture: 2m

Intel® 64 and IA-64 architectures: 4m

Sets the number of bytes 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.

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_MONITOR_STACKSIZE

max (32k, system minimum thread stack size)

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.

KMP_VERSION

0

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

KMP_AFFINITY

noverbose,
respect,
granularity=core

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.

KMP_CPUINFO_FILE

none

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

GNU Environment Variables Extensions

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

Variable Name

Default

Description

GOMP_STACKSIZE

See OMP_STACKSIZE description

OMP_STACKSIZE overrides GOMP_STACKSIZE. KMP_STACKSIZE overrides OMP_STACKSIZE and GOMP_STACKSIZE

GOMP_CPU_AFFINITY

TBD