Install Intel Compilers for C, C++ and Fortran

Related: Use Intel compilers with cmake, make and load libraries


The Intel Parallel Studio XE 2020 suite includes compliers named:

  • Windows: icl (C, C++) and ifort (Fortran)
  • Linux / MacOS: icc ( C ) icpc (C++) ifort (Fortran)

Parallel Studio also includes Intel MPI compiler wrappers (on Windows and Linux):

  • mpiicc ( C )
  • mpicxx (C++)
  • mpiifort (Fortran)

OS-specific considerations include:

  • MacOS: MPICH is available instead of Intel MPI or OpenMPI with Intel compilers
  • Windows: Intel compilers on Windows require Microsoft Visual Studio of appropriate version installed with C++ extensions as well.
  • Windows: MPI has special considerations particular to Windows only.

Install

For all OS, sudo / administrator is not needed or desired to install Intel compilers. Just install under your home directory or common directory.

  1. Download the Parallel Studio XE Cluster Edition Composer Suite (online/custom installer, not the entire 4 GB file). Get the CLUSTER / “all tools” version, NOT just the Fortran version or you will NOT have MPI!
  2. Extract and run the installer.

    • Linux / MacOS: install to a permissions-aware drive (e.g. Ext4), NOT a non-permissions filesystem like ExFAT, or the compiler will silently fail to install.
    • Windows: can install to non-permissions-aware drive (ExFAT is OK if desired)
  3. Select options similar to as below, adding PGI compiler if you use it (can add later if needed):

    • architecture: Intel64 (IA-32 not used)
    • Intel C++ Compiler
    • Intel Fortran Compiler
    • Intel MKL for C/C++
    • Intel MKL for Fortran
    • LAPACK 95
    • Intel MPI Library
    • GNU GDB

Load environment

  • Linux: create a file ~/intel.sh with contents like:

    . ~/intel/bin/compilervars.sh intel64
    . ~/intel/mkl/bin/mklvars.sh intel64

Enable the Intel compilers each time you want to use them with:

. ~/intel.sh
  • Windows: create a file %userprofile%\intel.bat containing like (modify slightly to match your install path):

    D:\IntelSWTools\compilers_and_libraries_2019.3.203\windows\bin\compilervars.bat intel64
    
    set FC=ifort
    set CC=icl
    set CXX=icl

Intel MKL

If you installed MKL prior to the Intel Compiler, be sure to select Intel MKL or it will uninstall your preexisting MKL! The Intel MKL options you may want for a desktop PC include

  • Intel MKL core libraries for C/C++
  • Intel TBB threading support
  • GNU C/C++ compiler support

  • Intel MKL core libraries for Fortran

  • GNU Fortran compiler support

  • Fortran 95 interfaces for BLAS and LAPACK

CMake Intel compilers

FC=ifort CC=icc CXX=icpc cmake ..

To switch back to GNU or other compiler, you have to remove the CMake cached files. Using Intel compilers and libraries with CMake is quite straightforward and easy to switch between compilers.

Why use Intel compilers

To understand what Intel compilers can do for scaling your program from the desktop to HPC–or merely improve performance on your laptop, see Intel Compiler new user guide