Setting up Intel OneAPI compilers in Linux
Offline installation of Intel oneAPI Compilers
Download the Intel oneAPI Base Toolkit for Linux install:
The Base Toolkit contains the core tool set including the C/C++ compilers, Python interpreter, MKL, profilers etc. On ther hand, Intel oneAPI HPC Toolkit need to be installed as an add-on to the Base Toolkit in order to use things like Fortran compilers, MPI etc.
Download the Intel oneAPI HPC Toolkit for Linux and install:
Online installation of Intel oneAPI Compilers
Run the following commands
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
sudo apt-get update
sudo apt-get install intel-oneapi-compiler-fortran intel-oneapi-mkl
Note: The compilers will auto update each time apt
updates softwares.
Set up the compilers
By default oneAPI is installed in the default directory (/opt/intel/oneapi
or ~/intel/oneapi
). A setvars.sh
file should be available in that folder (or whatever directory you have specified during the installation). Source that file in order to use the compilers. Assuming the default directory, one can add the following line in the ~/.bashrc
source /opt/intel/oneapi/setvars.sh &> /dev/null
The /dev/null
suppresses the source messages. This will make all the installed toolkits available for you. Otherwise, you can selectively switch on the tools you need. For example, assuming a file configfile.txt
with the following content
default=exclude
compiler=latest
mkl=latest
mpi=latest
sourcing the setvars.sh
like this
source /opt/intel/oneapi/setvars.sh --config=/opt/intel/oneapi/configFile.txt &> /dev/null
will only enable the compilers, mkl and MPI.
Intel compilers moving to llvm
Since 2021, Intel has started to adopt llvm for their compiler suit, getting rid of their own architecture. Read this blog to learn more:
Intel C/C++ compilers complete adoption of LLVM. This means, Intel’s famous icc
/ifort
will be deprecated in future, with icc
being deprecated in 2024. Therefore, for any future project, it is highly recommended to use the llvm based icx
and ifx
as C/C++ and Fortran compiler, respectively.