Use a Config file for setvars.sh
on Linux
Note
Starting with the 2024.0 release, macOS is no longer supported in Intel® oneAPI Toolkits and components. Several Intel-led open source developer tool projects will continue supporting macOS on Apple Silicon including oneAPI Threading Building Blocks (oneTBB) and Intel® Implicit SPMD Program Compiler. We welcome the opportunity to work with contributors to expand support to additional tools in the future.
There are two methods for customizing your environment in Linux*:
Use a setvars.sh configuration file, as described on this page
Use modulefiles
Note
Configuration files can only be used with setvars.sh
in the Component
Directory Layout. The Unified Directory Layout utilizes
oneapi-vars.sh
, which does not support configuration files. To learn
more about the layouts, see
:ref: Use the setvars and oneapi-vars Scripts with Linux <use-the-setvars-script-with-linux-or-macos>
The setvars.sh
script sets environment variables for use with the
oneAPI toolkits by sourcing each of the
<install-dir>/latest/env/vars.sh
scripts found in the respective
oneAPI folders. Unless you configure your Linux system to source the
setvars.sh
script automatically, it must be sourced every time a new
terminal window is opened for command line development, or prior to
launching Eclipse* or any other C/C++ IDE or editor you use for C/C++
development. For more information, see Configure Your
System.
The procedure below describes how to use a configuration file to manage environment variables.
Versions and Configurations
Some oneAPI tools support installation of multiple versions. For those tools that do support multiple versions, the directory is organized like this:
intel/oneapi/compiler/
|-- 2021.1.1
|-- 2021.2.0
`-- latest -> 2021.2.0
For example:

Fig. 3 Multiple versions and environmental variables
For all tools, there is a symlink named latest
that points to the
latest installed version of that component; and the vars.sh
script
located in the latest/env/
folder is what the setvars.sh
sources
by default.
If required, setvars.sh
can be customized to point to a specific
directory by using a configuration file.
–config Parameter
The top level setvars.sh
script accepts a --config
parameter
that identifies your custom config.txt file.
> source <install-dir>/setvars.sh --config="full/path/to/your/config.txt"
The name of your configuration file can have any name you choose. You can create many config files to setup a variety of development or test environments. For example, you might want to test the latest version of a library with an older version of a compiler; use a setvars config file to manage such a setup.
Config File Sample
The examples below show a simple example of the config file:
Load Latest of Everything but…
mkl=1.1
dldt=exclude
Exclude Everything but…
default=exclude
mkl=1.0
ipp=latest
The configuration text file must follow these requirements:
a newline delimited text file
each line consists of a single
"key=value"
pair"key"
names a component folder in the top-level set of oneAPI directories (the folders found in the$ONEAPI_ROOT
directory). If a"key"
appears more than once in a config file, the last"key"
wins and any prior keys with the same name are ignored.“
value
” names a version directory that is found at the top-level of the component directory. This includes any symlinks (such aslatest
) that might be present at that level in the component directory.OR
"value"
can be"exclude"
, which means the named key will NOT have itsenv/vars.sh
script sourced by thesetvars.sh
script.
The "key=value"
pair "default=exclude"
is a special case. When
included, it will exclude sourcing ALL env/vars.sh
scripts, except
those that are listed in the config file. See the examples below.
Further Customization of Config Files
The config file can be used to exclude specific components, include
specific component versions or only include specific component versions
that are named after a "default=exclude"
statement.
By default, setvars.sh
will process the latest
version of each
env/vars.sh
script.
The sample below shows two versions of Intel oneMKL installed: 2021.1.1
and 2021.2.0. The latest
symlink points to the 2021.2.0 folder because
it is the latest version. By default setvars.sh
will source the
2021.2.0 vars.sh
script in the mkl
folder because that is the
folder that latest
points to.

Fig. 4 Two versions of Intel oneMKL installed
Specify a Specific Version
To direct setvars.sh
to source the
<install-dir>/mkl/2021.1.1/env/vars.sh
script, add mkl=2021.1.1
to your config file.
This instructs setvars.sh
to source on the env/vars.sh
script
located in the 2021.1.1
version folder inside the mkl
directory.
For other installed components, setvars.sh
will source the
env/vars.sh
script located in the latest version folder.
Exclude Specific Components
To exclude a component, use the following syntax:
<key>=exclude
For example, to exclude Intel IPP, but include the 2021.1.1 version of Intel oneMKL:
mkl=2021.1.1
ipp=exclude
In this example:
setvars.sh
WILL source the Intel oneMKL 2021.1.1env/vars.sh
scriptsetvars.sh
WILL NOT source any Intel IPPenv/vars.sh
script filessetvars.sh
WILL source the latest version of the remainingenv/vars.sh
script files
Include Specific Components
To source a specific list of component env/vars.sh
scripts, you must
first exclude all env/vars.sh
scripts. Then add back the list of
components to be sourced by setvars.sh
. Use the following syntax to
exclude all component env/vars.sh
scripts from being sourced:
default=exclude
For example, to have setvars.sh
source only the Intel oneMKL and
Intel IPP component env/vars.sh
scripts, use this config file:
default=exclude
mkl=2021.1.1
ipp=latest
In this example:
setvars.sh
WILL source the Intel oneMKL 2021.1.1env/vars.sh
scriptsetvars.sh
WILL source the latest version of the Intel IPPenv/vars.sh
scriptsetvars.sh
WILL NOT source theenv/vars.sh
script for any other components