Programming Guide


Use the setvars Script with Linux* or MacOS*

Most of the component tool folders contain an environment script named
that configures the environment variables needed by that component to support oneAPI development work. For example, in a default installation, the Intel® Integrated Performance Primitives (Intel® IPP) vars script on Linux or macOS is located at:
. This pattern is shared by all oneAPI components that include an environment
setup script.
These component tool
scripts can be called directly or collectively. To call them collectively, a script named
is provided in the oneAPI installation folder. For example, in a default installation on a Linux or macOS machine:
Sourcing the
script without any arguments causes it to locate and source all
scripts in the installation. Changes made to the environment by these scripts can be seen by running the
command after running the environment setup scripts.
Changes to your environment made by sourcing the
script (or the individual
scripts) are not permanent. Those changes only apply to the terminal session in which the
environment script was sourced.

Command Line Arguments

script supports several command-line arguments, which are displayed using the
option. For example:
source /opt/intel/oneapi/ --help
argument and the ability to include arguments that will be passed to the
scripts that are called by the
script can be used to customize the environment setup.
argument provides the ability to limit environment initialization to a specific set of oneAPI components. It also provides a way to initialize the environment for specific component versions. For example, to limit environment setup to just the Intel® IPP library and the Intel® oneAPI Math Kernel Library (Intel® oneMKL), pass a config file that tells the
script to only call the
environment scripts for those two oneAPI components. More details and examples are provided in Use a Config file for on Linux or macOS.
Any extra arguments passed on the
command line that are not described in the
help message will be passed to every called
script. That is, if the
script does not recognize an argument, it assumes the argument is meant for use by one or more component scripts and passes those extra arguments to every component
script that it calls. The most common extra arguments are
, which are used by the Intel compilers and the IPP, MKL, and TBB libraries to specify the application target architecture.
Inspect the individual
scripts to determine which, if any, command line arguments they accept.

How to Run

source <install-dir>/
If you are using a non-POSIX shell, such as csh, use the following command:
$ bash -c 'source <install-dir>/ ; exec csh'
Alternatively, use the modulefiles scripts to set up your development environment. The modulefiles scripts work with all Linux shells.
If you wish to fine tune the list of components and the version of those components, use a setvars config file to set up your development environment.

How to Verify

After sourcing the
script, verify success by searching for the
environment variables. If
was successful, then the
environment variable will have a value of 1:
Return value
If the return value is anything other than
, then the test failed and
did not complete properly.

Multiple Runs

Because many of the individual
scripts make significant changes to PATH, CPATH, and other environment variables, the top-level
script will not allow multiple invocations of itself in the same session. This is done to ensure that your environment variables do not become too long due to redundant path references, especially the
environment variable.
This behavior can be overridden by passing
flag. In this example, the user tries to run
twice. The second instance is stopped because
has already been run.
> source <install-dir>/ .. code-block:: initializing environment ... (SNIP: lot of output) .. code-block:: oneAPI environment initialized ::
> source <install-dir>/ .. code-block:: WARNING: has already been run. Skipping re-execution. To force a re-execution of, use the '--force' option. Using '--force' can result in excessive use of your environment variables
In the third instance, the user runs --force
and the initialization is successful.
> source <install-dir>/ --force .. code-block:: initializing environment ... (SNIP: lot of output) .. code-block:: oneAPI environment initialized ::

ONEAPI_ROOT Environment Variable

variable is set by the top-level
script when that script is sourced. If there is already a
environment variable defined,
temporarily overwrites it in the terminal session in which you sourced the
script. This variable is primarily used by the
sample browser and the Eclipse* and Visual Studio Code* sample browsers to help them locate oneAPI tools and components, especially for in locating the
script if the
feature has been enabled. For more information about the
feature, see Automate the Script with Eclipse*.
On Linux and macOS systems, the installer does not add the
variable to the environment. To add it to the default environment, define the variable in your local shell initialization file(s) or in the system’s

Product and Performance Information


Performance varies by use, configuration and other factors. Learn more at