Visible to Intel only — GUID: GUID-4C2276BF-D8F5-4B1B-B7AE-E315FC7193FE
Visible to Intel only — GUID: GUID-4C2276BF-D8F5-4B1B-B7AE-E315FC7193FE
Use a Config file for setvars.sh on Linux or macOS
There are two methods for configuring your environment in Linux*:
Use a setvars.sh configuration file, as described on this page
Use modulefiles
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:
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 as latest) that might be present at that level in the component directory.
OR "value" can be "exclude", which means the named key will NOT have its env/vars.sh script sourced by the setvars.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.
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.1 env/vars.sh script
setvars.sh WILL NOT source any Intel IPP env/vars.sh script files
setvars.sh WILL source the latest version of the remaining env/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.1 env/vars.sh script
setvars.sh WILL source the latest version of the Intel IPP env/vars.sh script
setvars.sh WILL NOT source the env/vars.sh script for any other components