Intel® oneAPI DPC++/C++ Compiler Developer Guide and Reference

ID 767253
Date 3/22/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Supported Environment Variables

You can customize your system environment by specifying paths where the compiler searches for certain files such as libraries, include files, configuration files, and certain settings.

Compiler Compile-Time Environment Variables

The following table shows the compile-time environment variables that affect the compiler:

Compile-Time Environment Variable

Description

CL (Windows)

_CL_ (Windows)

Define the files and options you use most often with the CL variable. Note: You cannot set the CL environment variable to a string that contains an equal sign. You can use the pound sign instead. In the following example, the pound sign (#) is used as a substitute for an equal sign in the assigned string: SET CL=/Dtest#100

ICXCFG

Specifies the configuration file for customizing compilations when invoking the compiler using icx. Used instead of the default configuration file.

ICPXCFG

Specifies the configuration file for customizing compilations when invoking the compiler using icpx. Used instead of the default configuration file.

__INTEL_PRE_CFLAGS

__INTEL_POST_CFLAGS

Specifies a set of compiler options to add to the compile line.

This is an extension to the facility already provided in the compiler configuration file icx.cfg.

You can insert command line options in the prefix position using __INTEL_PRE_CFLAGS , or in the suffix position using __INTEL_POST_CFLAGS. The command line is built as follows:

Syntax:icx <PRE flags> <flags from configuration file> <flags from the compiler invocation> <POST flags>

NOTE:
By default, a configuration file named icx.cfg (Windows, Linux), or icpx.cfg (Linux) is used. This file is in the same directory as the compiler executable. To use another configuration file in another location, you can use the ICXCFG (Windows, Linux), ICPXCFG (Linux) environment variable to assign the directory and file name for the configuration file.
NOTE:
The driver issues a warning that the compiler is overriding an option because of an environment variable, but only when you include the option /W5 (Windows) or -w3 (Linux).

PATH

Specifies the directories the system searches for binary executable files.

NOTE:
On Windows, this also affects the search for Dynamic Link Libraries (DLLs).

Compiler Runtime Environment Variables

The following table summarizes compiler environment variables that are recognized at runtime.

Runtime Environment Variable

Description

GNU extensions (recognized by the Intel OpenMP* compatibility library)

GOMP_CPU_AFFINITY (Linux)

GNU extension recognized by the Intel OpenMP compatibility library. Specifies a list of OS processor IDs.

You must set this environment variable before the first parallel region or before certain API calls including omp_get_max_threads(), omp_get_num_procs() and any affinity API calls. For detailed information on this environment variable, see Thread Affinity Interface.

Default: Affinity is disabled

GOMP_STACKSIZE (Linux)

GNU extension recognized by the Intel OpenMP compatibility library. Same as OMP_STACKSIZE.KMP_STACKSIZE overrides GOMP_STACKSIZE, which overrides OMP_STACKSIZE.

Default: See the description for OMP_STACKSIZE.

OpenMP Environment Variables (OMP_) and Extensions (KMP_)

OMP_CANCELLATION

Activates cancellation of the innermost enclosing region of the type specified. If set to TRUE, the effects of the cancel construct and of cancellation points are enabled and cancellation is activated. If set to FALSE, cancellation is disabled and the cancel construct and cancellation points are effectively ignored.

NOTE:

Internal barrier code will work differently depending on whether the cancellation is enabled. Barrier code should repeatedly check the global flag to figure out if the cancellation had been triggered. If a thread observes the cancellation it should leave the barrier prematurely with the return value 1 (may wake up other threads). Otherwise, it should leave the barrier with the return value 0.

Enables (TRUE) or disables (FALSE) cancellation of the innermost enclosing region of the type specified.

Default: FALSE

Example: OMP_CANCELLATION=TRUE

The following table summarizes CPU environment variables that are recognized at runtime.

Runtime Configuration

Default Value

Description

CL_CONFIG_CPU_FORCE_PRIVATE_MEM_SIZE

32KB

Forces CL_DEVICE_PRIVATE_MEM_SIZE for the CPU device to be the given value. The value must include the unit; for example: 8MB, 8192KB, 8388608B.

NOTE:
You must compile your host application with sufficient stack size.

CL_CONFIG_CPU_FORCE_LOCAL_MEM_SIZE

32KB

Forces CL_DEVICE_LOCAL_MEM_SIZE for CPU device to be the given value. The value needs to be set with size including units, examples: 8MB, 8192KB, 8388608B.

NOTE:
You must compile your host application with sufficient stack size. Our recommendation is to set the stack size equal to twice the local memory size to cover possible application and OpenCL Runtime overheads.

CL_CONFIG_CPU_EXPENSIVE_MEM_OPT

0

A bitmap indicating enabled expensive memory optimizations. These optimizations may lead to more JIT compilation time, but give some performance benefit.

NOTE:
Currently, only the least significant bit is available.

Available bits:

  • 0: OpenCL address space alias analysis

CL_CONFIG_CPU_STREAMING_ALWAYS

False

Controls whether non-temporal instructions are used.

Controlling DPC++ Runtime

Environment Variable

Default Value

Description

ONEAPI_DEVICE_SELECTOR

See ONEAPI_DEVICE_SELECTOR

This device selection environment variable can be used to limit the choice of devices available when the SYCL-using application is run. Useful for limiting devices to a certain type (like GPUs or accelerators) or backends (like Level Zero or OpenCL). This device selection mechanism is replacing SYCL_DEVICE_FILTER. The ONEAPI_DEVICE_SELECTOR syntax is shared with OpenMP and also allows sub-devices to be chosen.

SYCL_DEVICE_FILTER

(deprecated)

backend:device_type:device_num

Use the ONEAPI_DEVICE_SELECTOR environment variable instead.

SYCL_DEVICE_ALLOWLIST

See SYCL_DEVICE_ALLOWLIST

Filter out devices that do not match the pattern specified. BackendName accepts host, opencl, level_zero, or cuda. DeviceType accepts host, cpu, gpu, or acc. DeviceVendorId accepts uint32_t in hex form (0xXYZW). DriverVersion, PlatformVersion, DeviceName, and PlatformName accept regular expression. Special characters, such as parenthesis, must be escaped. DPC++ runtime will select only those devices which satisfy provided values above and RegEx. More than one device can be specified using the piping symbol "|".

SYCL_DISABLE_PARALLEL_FOR_RANGE_ROUNDING

Any(*)

Disables automatic rounding-up of parallel_for invocation ranges.

SYCL_CACHE_DIR

Path

Path to persistent cache root directory. Default values are %AppData%\libsycl_cache for Windows and $XDG_CACHE_HOME/libsycl_cache on Linux, if XDG_CACHE_HOME is not set then $HOME/.cache/libsycl_cache. When none of the environment variables are set, a SYCL persistent cache is disabled.

NOTE:
Any(*) indicates that this environment variable is effective when set to any non-null value.

Controlling DPC++ Level Zero Plugin

Environment Variable

Default Value

Description

SYCL_ENABLE_PCI

Integer

When set to 1, enables obtaining the GPU PCI address when using the Level Zero backend. The default is 1. This option is kept for compatibility reasons and is immediately deprecated.

SYCL_PI_LEVEL_ZERO_DISABLE_USM_ALLOCATOR

Any(*)

Disable USM allocator in Level Zero plugin (each memory request will go directly to Level Zero runtime).

SYCL_PI_LEVEL_ZERO_TRACK_INDIRECT_ACCESS_MEMORY

Any(*)

Enable support of the kernels with indirect access and corresponding deferred release of memory allocations in the Level Zero plugin.

NOTE:
Any(*) indicates that this environment variable is effective when set to any non-null value.


NOTE:

Some environment variables are available for both Intel® microprocessors and non-Intel microprocessors, but may perform additional optimizations for Intel® microprocessors than for non-Intel microprocessors.