In order to use Intel C compiler and Intel Fortran compiler for numerical computation, Intel oneAPI Base Toolkit and HPC Toolkit (Intel Fortran) on Ubuntu 20.04 LTS of WSL2 of Windows 10 Pro were installed. This site (in Japanese) was referred.
The Intel compilers are now available free of charge, and can be installed using apt, which is very convenient.
Install the required drivers
Install the required drivers by referring to here.
# Add package repository sudo apt-get install -y gpg-agent wget wget -qO - https://repositories.intel.com/graphics/intel-graphics.key | sudo apt-key add - sudo apt-add-repository 'deb [arch=amd64] https://repositories.intel.com/graphics/ubuntu focal main' # Install run-time packages sudo apt-get update sudo apt-get install intel-opencl-icd intel-level-zero-gpu level-zero intel-media-va-driver-non-free libmfx1 # OPTIONAL: Install developer packages sudo apt-get install libigc-dev intel-igc-cm libigdfcl-dev libigfxcmrt-dev level-zero-dev
After this, the following GPU-related settings were written; but I ignored them because I don't have a GPU.
stat -c "%G" /dev/dri/render* ... # for GPU
Install Intel oneAPI
Work in the directory
/tmp, which is accessible to both user and root.
cd /tmp wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list sudo apt update
Specify the packages to install. Here Base Toolkit and HPC Toolkit were installed. Installation of Base Toolkit took a long time.
sudo apt install intel-basekit sudo apt install intel-hpckit
The installation directory is
Configuration for Intel compilers
To use the Intel compilers, execute the following. Appending this to
~/.bashrc will save you the trouble of running it every time.
Check the version of the compiler.
ifort --version icc --version icpc --version