The Intel Compilers consist of both C/C++ and Fortran compilers that create highly optimized executables for the Intel architecture. It supports multithreading and highly optimized performance libraries.
Using Intel Compilers
The Intel compilers and debugger are available in the cluster systems. Users should use the following command to set up the required environment variables:
System | Compiler version | Module command |
---|---|---|
HPC2021 | Intel Parallel Studio 2019 Update 4 | module load intel/2019u4 |
Intel Parallel Studio 2020 Update 4 | module load intel/2020u4 | |
Intel OneAPI 2021.4 | module load intel/2021.4 | |
Intel OneAPI 2022.1 | module load intel/2022.1 |
Compilation Commands
C programs :
icc [options] program.c -o program.exe
C++ programs :
icpc [options] program.cpp -o program.exe
Fortran programs :
ifort [options] program.f -o program.exe
Using Compiler Options
Compiler option is case-sensitive. Command line expression used to change the compilers’ default operation. Compiler options are not required to compile your program, but they are useful in helping you control the code generation, optimization, linking properties, speed of executable, etc.
Option Flag | Comment | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
-O3 | Default setting is ‘-O2‘ with maximize speed. The ‘-O3‘ option enables ‘-O2‘ optimizations plus more aggressive loop and memory-access optimizations. It is particularly recommended for applications that have loops that do many floating-point calculations or process large data sets. It may result in slow down compared to ‘-O2‘ option. | |||||||||
-qopenmp | Cause multi-threaded code to be generated when OpenMP directives are present. May require an increased stack size. | |||||||||
-parallel | The auto-parallelizer detects simply structured loops that may be safely executed in parallel, including loops implied by Intel® Cilk™ Plus array notation, and automatically generates multi-threaded code for these loops. | |||||||||
-xtarget or -xHost | Generate specialized codes that are optimized for various instruction sets(target) used in specific processors.
The instruction set is upward compatible. Therefore, applications compiled with -xCORE-AVX2 can run on Haswell or Broadwell processors, but not on Ivy Bridge. |
|||||||||
-ip or -ipo | ‘-ip‘ enables additional interprocedural(IP) optimizations for single-file compilation. ‘-ipo‘ permits inlining and other interprocedural optimizations among multiple source files. | |||||||||
-g | Generates debug information for use with any of the common platform debuggers | |||||||||
-fast | Optimize for speed across the entire program to evaluate performance with a set of best optimization switches. |
For information about Intel MKL,please visit Intel Math Kernel Library(MKL).
Further Information
There are User Guides, language Reference Manuals, and Quick-Reference Guides available at Intel compilers Home page
Man pages are available via command man ifort (for Fortran) or man icc (for C/C++).
Performance Optimization with Intel C Compiler:https://software.intel.com/en-us/articles/step-by-step-optimizing-with-intel-c-compiler