Install and manage Intel oneAPI compiler and component tools using environment modules

Just like HPC clusters, manage intel components using module load commands.

Intel has recently changed their business model. Their suite of compilers, debuggers, toolkits, and libraries are given free of cost for personal or academic use. In an earlier post, I explained how to install them on Ubuntu linux and activate all the softwares using a single source command.

In this post, I will show you how to manage these compilers, libraries, and debuggers using the environment modules. So just using “module load icc” you could activate a single “icc” compoment. All the dependent modules will also be loaded automatically, if you follow the these steps.

Pre-requisites

Make sure that you have the following packages already installed on your ubuntu machine.

  1. environment modules (i.e. the module command)
  2. Intel oneapi basekit and/or hpckit (I am repeating the steps below)

Intel Repository Public Key

Get the Intel Repository public key and add it to your apt sources keyring so the packages will be trusted by ubuntu.

# use wget to fetch the Intel repository public key
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
# add to your apt sources keyring so that archives signed with this key will be trusted.
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
# remove the public key
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB

Configure apt client to use Intel repository

echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list

or

sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"

Install all the packages or selected packages.

All basic compilers (Fortran, C, C++, and Python)

sudo apt install intel-basekit

HPC toolkits

sudo apt install intel-hpckit

IoT (internet of things) toolkits

sudo apt install intel-iotkit

AI (Artificial Intelligence) analytics toolkits

sudo apt install intel-aikit

Rendering toolkit

sudo apt install intel-renderkit

After Installation

After you have installed the oneAPI kits, they can be activated using the following command written in the ~/.bashrc file.

Option 1: Activate all the components at once for all users (root access)

. /opt/intel/oneapi/setvars.sh

Option 2: Activate individual components using the environment modules

  1. cd /opt/intel/oneapi/
  2. You will see a modulefiles-setup.sh file. If we execute this file using bash it will create a folder named modulefiles in the same /opt/intel/oneapi/ folder.
  3. Put the following line into your $HOME/.bashrc file
    1. export MODULEPATH=${MODULEPATH}:/opt/intel/oneapi/modulefiles
    2. . $HOME/.bashrc or close and reopen the terminal
  4. If you type module avail, you will see all the components of Intel oneapi available for use.
  5. You can load or unload individual components using module load icc or module load compiler etc.
  6. You can create your own module file and put it in the modulefiles folder. Let us create a modulefile for intel python.
  7. Copy the following content into a file /opt/intel/oneapi/modulefiles/python/latest
    #%Module1.0###################################################################
    set min_tcl_ver 8.4
    if { $tcl_version < $min_tcl_ver } {
        puts stderr " "
        puts stderr "ERROR: This modulefile requires tcl $min_tcl_ver or greater."
        puts stderr "Your system reports that tclsh version $tcl_version is installed."
        exit 1
    }

    proc ModulesHelp { } {
            puts stderr "\tAdds Intel Python 3 to your PATH environment variable\n"
    }

    module-whatis   "adds Intel Python 3 to your PATH environment variable"

    prepend-path    PATH    /opt/intel/oneapi/intelpython/latest/bin

Check the installed packages using module avail, check the loaded packages using module list, unload packages using module unload packagename

Ravindra Shinde
Ravindra Shinde
Research Scientist

I am a theoretical and computational condensed matter physicist and quantum chemist. I am currently working as a researcher at the University of Twente, the Netherlands. I am also the founder of The Science Dev.



Next
Previous