Installing Intel oneAPI (ifort) on Ubuntu 22.04 LTS

Table of Contents

This is translation of this article by ChatGPT.
I installed Intel oneAPI Base Toolkit and HPC Toolkit (ifort) on Ubuntu 22.04 LTS of WSL2 of Windows 11 Pro for the purpose of numerical computation using Intel C compiler and Intel Fortran compiler. I referred to this. Intel compiler can be used free of charge. Also, it is very convenient because you can install it with apt.

Installation of Intel oneAPI

The official guide is here.

Set up Intel's repository here. If it stops halfway, try pressing Enter. Enter your password when asked and press Enter.

wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
sudo apt update

Install Intel oneAPI Base Toolkit and Intel oneAPI HPC Toolkit. If you use GPU, you need preliminary settings separately.

sudo apt install intel-basekit
sudo apt install intel-hpckit

The installation destination is /opt/intel/oneapi.

Setting up Intel compiler

To use Intel compiler, run the following. If you add this to ~/.bashrc, you can save the trouble of running it every time. It is standard to add it to _\.profile, but this method may not have any particular harm and may be convenient to consolidate user settings into one. Intel Python sets the environment variable PYTHONPATH, so disable it assuming the use of Miniconda.

source /opt/intel/oneapi/setvars.sh
unset PYTHONPATH

Let's check the version of the compiler.

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

icc and icpc seem to have become icx.

Upgrading Intel oneAPI

Check if there are any upgradable packages.

sudo apt update
sudo apt list --upgradable

Specify the package name and upgrade. It is a big job to rebuild libraries, so it may be safer not to upgrade unless there is a problem.

sudo apt upgrade intel-basekit
sudo apt upgrade intel-hpckit

References

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.