Development/Intel Compiler: Difference between revisions

From bwHPC Wiki
Jump to navigation Jump to search
No edit summary
(Update Intel Compiler for LLVM-based / OneAPI)
 
(3 intermediate revisions by one other user not shown)
Line 6: Line 6:
|-
|-
| module load
| module load
| compiler/intel
| compiler/intel/VERSION and compiler/intel/VERSION_llvm
|-
|-
| License
| License
Line 25: Line 25:
<br>
<br>
= Introduction =
= Introduction =
The '''Intel Compiler''' consists of tools to compile and debug C, C++ and Fortran programs, and currently is in a transition phase: the so-called legacy compiler (based on an Intel in-house development with many optimization hints) and the newer LLVM-based compiler (where many of these optimizations and hints are ported to). To smoothly handle this transition we offer the standard legacy compiler plus the new LLVM-based compiler with the ''_llvm'' prefix.
The '''Intel Compiler''' of the '''Intel Composer XE Suite''' consists of tools to compile and debug C, C++ and Fortran programs:
The following table shows the preferred names:
{| width=500px class="wikitable"
{| width=600px class="wikitable"
|-
|style="padding:3px"| '''Tool'''
|style="padding:3px"| '''Legacy name'''
|style="padding:3px"| '''LLVM-based name'''
|-
|-
|-
|style="padding:3px"| icc
|style="padding:3px"| Intel C compiler
|style="padding:3px"| Intel C compiler
|style="padding:3px"| icc
|style="padding:3px"| icx
|-
|-
|style="padding:3px"| Intel C++ compiler
|style="padding:3px"| icpc
|style="padding:3px"| icpc
|style="padding:3px"| Intel C++ compiler
|style="padding:3px"| icpx
|-
|-
|style="padding:3px"| ifort
|style="padding:3px"| [https://software.intel.com/en-us/fortran-compilers Intel Fortran compiler]
|style="padding:3px"| [https://software.intel.com/en-us/fortran-compilers Intel Fortran compiler]
|style="padding:3px"| ifort
|style="padding:3px"| ifx
|-
|-
|style="padding:3px"| Intel debugger in GUI mode (until version 14 only)
|style="padding:3px"| [[#GUI|idb]]
|style="padding:3px"| [[#GUI|idb]]
|style="padding:3px"| Intel debugger in GUI mode (until version 14 only)
|style="padding:3px"| N/A
|-
|-
|style="padding:3px"| Intel GNU debugger in console mode (from version 15)
|style="padding:3px"| [[#Console Mode|gdb-ia]]
|style="padding:3px"| [[#Console Mode|gdb-ia]]
|style="padding:3px"| Intel version of GNU debugger in console mode (from version 15)
|style="padding:3px"| gdb-oneapi
|-
|-
|style="padding:3px"| Intel debugger in console mode (until version 14 only)
|style="padding:3px"| [[#Console Mode|idbc]]
|style="padding:3px"| [[#Console Mode|idbc]]
|style="padding:3px"| Intel debugger in console mode (until version 14 only)
|style="padding:3px"| N/A
|}
|}
The intel compiler suite also includes the TBB (Threading Building Blocks) and IPP (Integrated Performance Primitives) libraries.
The intel compiler suite also includes the TBB (Threading Building Blocks), IPP (Integrated Performance Primitives) and oneAPI libraries.
<br>
<br>
<br>
<br>
More information about the MPI versions of the Intel Compiler is available here:
More information about the MPI versions of the Intel Compiler is available here:
* [[BwHPC_BPG_for_Parallel_Programming|Best Practices Guide for Parallel Programming]].
* [[Development/Parallel_Programming|Best Practices Guide for Parallel Programming]].
<br>
<br>


Line 57: Line 69:
* [https://software.intel.com/en-us/articles/intel-c-composer-xe-documentation Intel® C-Compiler Documentation]
* [https://software.intel.com/en-us/articles/intel-c-composer-xe-documentation Intel® C-Compiler Documentation]
* [https://software.intel.com/en-us/intel-software-technical-documentation Intel® Software Documentation Library]
* [https://software.intel.com/en-us/intel-software-technical-documentation Intel® Software Documentation Library]

= Debugger =
Please use DDT. It is a parallel debugger with graphical user interface and can also be used for debugging serial programs. The description of the debugger can be found on the website
<br>
http://www.bwhpc-c5.de/wiki/index.php/DDT
<br><br>


= Optimizations =
= Optimizations =
You can turn on various optimization options to enhance the performance of your program. Which options are the best depends on the specific program and can be determined by benchmarking your code. A command which gives good performance and a decent file size is
You can turn on various optimization options to enhance the performance of your program. Which options are the best depends on the specific program and can be determined by benchmarking your code. A command which gives good performance and a decent file size is
'''icc -xHost -O2 ex.c'''.
'''icx -xHost -O2 ex.c'''.
With the option '''-xHost''' instructions for the highest instruction set available on the compilation host processor are generated. If you want to generate optimal code on bwUniCluster for both nodes with Sandy Bridge architecture and nodes with Broadwell architecture, you must compile your code with the options '''-xAVX -axCORE-AVX2''' (instead of '''-xHost''').
With the option '''-xHost''' instructions for the highest instruction set available on the compilation host processor are generated. If you want to generate optimal code on bwUniCluster for both nodes with Sandy Bridge architecture and nodes with Broadwell architecture, you must compile your code with the options '''-xAVX -axCORE-AVX2''' (instead of '''-xHost''').
<br>
<br>
There are more aggressive optimization flags and levels (e.g. -O3 or -fast and implied options) but the compiled programs can get quite large due to inlining. Additionally the compilation process will probably take longer. Moreover it may happen that the compiled program is even slower -- or may require installation of additional statically-linked libraries. Such a command would be for example:
There are more aggressive optimization flags and levels (e.g. -O3 or -fast and implied options) but the compiled programs can get quite large due to inlining. Additionally the compilation process will probably take longer. Moreover it may happen that the compiled program is even slower -- or may require installation of additional statically-linked libraries. Such a command would be for example:
'''icc -fast ex.c'''
'''icx -fast ex.c'''
<br>
<br>
<br>
<br>
Line 76: Line 82:
= Profiling =
= Profiling =
Profiling an application means augmenting the compiled binary with information on execution counts per source-line (and basic blocks) -- e.g. one may see how many times an if-statement has been evaluated to true. To do so, compile your code with the profile flag:
Profiling an application means augmenting the compiled binary with information on execution counts per source-line (and basic blocks) -- e.g. one may see how many times an if-statement has been evaluated to true. To do so, compile your code with the profile flag:
'''icc -p ex.c -o ex'''.
'''icx -p ex.c -o ex'''.
<br>
<br>
Using the gprof tool, one may manually inspect execution count of each executed line of source code.
Using the gprof tool, one may manually inspect execution count of each executed line of source code.
<br>
<br>
For compiler optimization, recompile your source using
For compiler optimization, recompile your source using
'''icc -prof-gen ex.c -o ex'''
'''icx -prof-gen ex.c -o ex'''
then execute the most co]]mmon and typical use-case of your application, and then recompile using the generated profile count (and using optimization):
then execute the most co]]mmon and typical use-case of your application, and then recompile using the generated profile count (and using optimization):
'''icc -prof-use -O2 ex.c -o ex'''.
'''icx -prof-use -O2 ex.c -o ex'''.
<br>
<br>
== Further literature ==
== Further literature ==
A tutorial on optimization can be found at [https://software.intel.com/sites/default/files/managed/c1/61/compiler-essentials.1.pdf Compiler-Essentials.pdf]
A tutorial on optimization can be found at [https://www.intel.com/content/www/us/en/developer/articles/technical/vectorization-essential.html Vectorization Essentials]
and to get the different optimization options execute
and to get the different optimization options execute
'''icc -help opt'''
'''icx -help opt'''
or
'''icc -help advanced'''
'''icx -help advanced'''
<br>
<br>
or the previously described catch-all option '''''-v --help'''''.
or the previously described catch-all option '''''-v --help'''''.

[[Category:Compiler_software]][[Category:bwUniCluster]][[Category:bwForCluster_Chemistry]]

Latest revision as of 15:17, 9 October 2024

The main documentation is available via module help compiler/intel on the cluster. Most software modules for applications provide working example batch scripts.


Description Content
module load compiler/intel/VERSION and compiler/intel/VERSION_llvm
License Commercial. See $INTEL_HOME/install-doc/EULA.txt. | Intel Product Licensing FAQ
Citing n/a
Links Intel C-Compiler Homepage
Graphical Interface Yes (Intel Debugger GUI-Verison)
Included modules icc | icpc | ifort | idb | gdb-ia


Introduction

The Intel Compiler consists of tools to compile and debug C, C++ and Fortran programs, and currently is in a transition phase: the so-called legacy compiler (based on an Intel in-house development with many optimization hints) and the newer LLVM-based compiler (where many of these optimizations and hints are ported to). To smoothly handle this transition we offer the standard legacy compiler plus the new LLVM-based compiler with the _llvm prefix. The following table shows the preferred names:

Tool Legacy name LLVM-based name
Intel C compiler icc icx
Intel C++ compiler icpc icpx
Intel Fortran compiler ifort ifx
Intel debugger in GUI mode (until version 14 only) idb N/A
Intel GNU debugger in console mode (from version 15) gdb-ia gdb-oneapi
Intel debugger in console mode (until version 14 only) idbc N/A

The intel compiler suite also includes the TBB (Threading Building Blocks), IPP (Integrated Performance Primitives) and oneAPI libraries.

More information about the MPI versions of the Intel Compiler is available here:


Documentation

Online documentation

Optimizations

You can turn on various optimization options to enhance the performance of your program. Which options are the best depends on the specific program and can be determined by benchmarking your code. A command which gives good performance and a decent file size is icx -xHost -O2 ex.c. With the option -xHost instructions for the highest instruction set available on the compilation host processor are generated. If you want to generate optimal code on bwUniCluster for both nodes with Sandy Bridge architecture and nodes with Broadwell architecture, you must compile your code with the options -xAVX -axCORE-AVX2 (instead of -xHost).
There are more aggressive optimization flags and levels (e.g. -O3 or -fast and implied options) but the compiled programs can get quite large due to inlining. Additionally the compilation process will probably take longer. Moreover it may happen that the compiled program is even slower -- or may require installation of additional statically-linked libraries. Such a command would be for example: icx -fast ex.c

Profiling

Profiling an application means augmenting the compiled binary with information on execution counts per source-line (and basic blocks) -- e.g. one may see how many times an if-statement has been evaluated to true. To do so, compile your code with the profile flag: icx -p ex.c -o ex.
Using the gprof tool, one may manually inspect execution count of each executed line of source code.
For compiler optimization, recompile your source using icx -prof-gen ex.c -o ex then execute the most co]]mmon and typical use-case of your application, and then recompile using the generated profile count (and using optimization): icx -prof-use -O2 ex.c -o ex.

Further literature

A tutorial on optimization can be found at Vectorization Essentials and to get the different optimization options execute icx -help opt or icx -help advanced
or the previously described catch-all option -v --help.