Intel oneAPI

Supported versions

Warning

As of version 2024.0, Intel has discontinued the traditional compilers icc, icpc, and ifort. We know that such a decision may affect many code projects that use those compilers and struggle switching to the new LLMV-based compilers icx, icpx, and ifx. To make the transition from classic to LLVM-based compilers easier, we still host some older versions of Intel oneAPI compilers that include the classic compilers. 2023.2.1 is the latest such version. Check the document Porting Guide for ICC Users to DPCPP or ICX for more details about how to move from classic to LLVM-based compilers.

Warning

Do not use Intel MPI on Discoverer compute nodes. That MPI library cannot scale to more than two nodes, and we do not have a clear explanation for that phenomena.

To check which Intel oneAPI versions are currently supported on Discoverer, execute on the login node:

module load intel
module avail

and check the output in the section below /opt/software/intel/oneapi/modulefiles label.

Accessing the compilers

To obtain access to the latest Intel compilers, load the following environment modules:

LLVM-based compilers

The access to the Intel LLVM-based compilers icx, icpx, ifx can be gained by loading the following sequence of environment modules:

module load intel
module load tbb/latest
module load compiler-rt/latest
module load oclfpga/latest
module load compiler/latest

You may also specify the particular version of the modules instead of relying on their “latest” versions.

LLVM base compilers (for experts)

The Intel CPU and Intel GPU optimizing LLVM compilers and tools clang, clang++, clang-cl, and clang-cpp are also available (though no flang is provided). To gain access to those compilers and tools load the following environment modules:

module load intel
module load tbb/latest
module load compiler-rt/latest
module load oclfpga/latest
module load compiler-intel-llvm/latest

You may also specify the particular version of the modules instead of relying on their “latest” versions.

Warning

USE WITH CAUTION! Load the access to those compilers only if there is not way to specify the use of icx and icpx! Be aware that clang, clang++, clang-cl, and clang-cpp binaries are not made accessible during environment setup (see “LLVM-based compilers” above) in order to reduce collisions with other toolchains.

Classic compilers

Warning

Intel has already discontinued and retired those compilers. This implies that the Intel classic compilers will not receive any new or revised versions in the future. Therefore, if you require these compilers to compile outdated code, you have to adhere to the most recent version made available before their retirement. Consider switching to Intel’s LLVM-based compilers as soon as possible (that may require to redesign your automake or CMake setups).

The access to the classic Intel LLVM-based compilers icc, icpc, ifort can be gained by loading the following sequence of environment modules:

module load intel
module load compiler/2023.2.1

Note

Version 2023.2.1 is the last version of Intel compilers that comes with icc, icpc, and ifort. We will keep that version in our software repository until the second half of 2026.

DPC++ compiler

Note

Intel oneAPI Data Parallel C++ compiler employs LLVM compiler drivers.

To get access to the latest DPC++ compiler, load the LLVM-based compilers as mentioned above. Then instead or invoking the old dpcpp compiler (it is deprecated and will be removed in a future release), use:

icpx -fsycl

Interoperability with GCC

Note

For advanced users!

You may need to load the latest GCC version to provide more recent C++ support to the Intel compilers:

module load gcc/latest
module load intel
...

Compiler flags for matching AMD Zen2 CPU microarchitecture

Note

The compute nodes of Discoverer HPC are equipped with AMD EPYC 7H12 64-Core processors, which implies AMD Zen2 CPU microarchitecture. Refer to Resource Overview for more details.

The following compiler flags can be useful during the compile-time optimization of your binary code on AMD Zen2:

-march=znver2 -mtune=znver2

For example:

icx -march=znver2 -mtune=znver2 ...
icpx -march=znver2 -mtune=znver2 ...
ifx -march=znver2 -mtune=znver2 ...

Note

The use of znver2 CPU microarchitecture specifier implies the use of FMA!

To pass the flags for the microarchitecture to the compilers one may add to the values of CFLAGS, CXXFLAGS, or FCFLAGS environmental variables the following:

CFLAGS+=" --march=znver2 -mtune=znver2"
CXXFLAGS+=" --march=znver2 -mtune=znver2"
FCFLAGS+=" --march=znver2 -mtune=znver2"

You should be able to tune your code for using specific AVX2 SIMD instructions (i.e. the highest SIMD supported by AMD Zen2 kernel) by following the instructions given in AMD EPYC™ 7xx2-series Processors Compiler Options Quick Reference Guide

See also: Best Practice Guide - AMD EPYC.

Interaction with CMake

It is recommended to specify the compiler executables when invoking cmake tool:

-DCMAKE_C_COMPILER=icx
-DCMAKE_CXX_COMPILER=icpx
-DCMAKE_Fortran_COMPILER=ifx

The corresponding optimization compiler flags can be passed to cmake as well:

-DCMAKE_C_FLAGS="-march=znver2 -mtune=znver2 ${CFLAGS}"
-DCMAKE_CXX_FLAGS="-march=znver2 -mtune=znver2 ${CXXFLAGS}"
-DCMAKE_Fortran_FLAGS="-march=znver2 -mtune=znver2 ${FCFLAGS}"

Getting help

See Getting help