Intel's compilers are installed in
/software/intel (older versions) and
/software/apps/intel. We do not recommend that you source the normal compiler initialization scripts named
compilervars.sh or similar. Instead, just load the corresponding compiler module, and everything gets set up correctly.
module load intel/188.8.131.52
The compilers for different programming languages are named as follows:
|Fortran90+||ifort (.f90 files)|
|Fortran77||ifort (.f files)|
Suppose you have a file
myprogram.f90 that you want to compile. Do like this:
ifort -o myprogram.exe myprogram.f90
That will produce the executable
myprogram.exe with optimization level
-O2 (see more below). If your program uses BLAS, LAPACK, or FFTW, we recommend using the subroutines included in Intel's Math Kernel Library:
ifort -o myprogram.exe -Nmkl -mkl=sequential myprogram.f90
-Nmkl flag is specific to NSC and links your program permanently against the currently loaded Intel MKL module, the other flag
-mkl=sequential is specific to Intel's compilers and assembles the right combination of libraries necessary for single-threaded MKL linking. More information about using MKL and the other math libraries at NSC is available in the math libraries page.
Intel's compiler have many options and compiler flags for optimization. Some of them are very aggressive and can lead instability and/or crashes when applied on fragile code. We have often seen that high optimization can uncover silent bugs in the code, often as a result of the program relying on undefined Fortran or C behavior. We recommend trying these compiler flags as a start:
|Bi/Frost||-O2 -ip -xCORE-AVX2|
|Triolith||-O2 -ip -xavx|
|Gamma||-O2 -ip -xavx|
If you experience crashes, it is always worth trying to recompile with lower optimization (
-O1) or no optimization at all (
-O0). That will tell you whether you hit a bug related to aggressive compiler optimization. Please note that the default optimization level is
-O2, unlike other compilers such as GCC, so you have to explicitly state that you want lower optimization.
Intel's C/C++ compilers supports most of the C++11 standard and a limited number of C++14 features. The level of support naturally improves by compiler version. We recommend using at least compiler version 14 for good C++11 support. C++14 features are only present in version 15 and higher.
Please check the following documents for the current status for different compiler versions:
C++ standard library support: Intel C/C++ relies on GCC's
libstdc++, which is provided by the Linux system software. On most of our systems, that is
libstdc++ corresponding to GCC 4.4, which is rather old. It is possible, however, to instruct the compiler to use a more recent version of
libstd++. For example, to use the version supplied with GCC 4.9.0, you can call the compiler like this:
icpc -o myprogram -std=c++11 -cxxlib=/software/apps/gcc/4.9.0/build01/ -gxx-name=g++.orig myprogram.cpp
This will link the C++ program with the standard library from GCC 4.9.0.
It is strongly recommended for people who are heavy users of the compilers to check the release notes regularly. There are also a lists of bug fixes and issues for each version: