Install Intel oneAPI on Ubuntu 20.04 LTS

Table of Content

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 - | sudo apt-key add -
sudo apt-add-repository 'deb [arch=amd64] 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

echo "deb 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 /opt/intel/oneapi.

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.

source /opt/intel/oneapi/

Check the version of the compiler.

ifort --version
icc --version
icpc --version


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.