Difference between revisions of "Development/Intel Compiler"

From bwHPC Wiki
Jump to: navigation, search
(Created page with "{| style="border-style: solid; border-width: 1px" ! Navigation: bwHPC BPR |} = Intel = bwUniCluster currently provides Intel compiler suit…")
 
 
(83 intermediate revisions by 10 users not shown)
Line 1: Line 1:
  +
{{Softwarepage|compiler/intel}}
{| style="border-style: solid; border-width: 1px"
 
  +
! Navigation: [[BwHPC_Best_Practices_Repository|bwHPC BPR]]
 
  +
{| width=600px class="wikitable"
  +
|-
  +
! Description !! Content
  +
|-
  +
| module load
  +
| compiler/intel
  +
|-
  +
| License
  +
| Commercial. See $INTEL_HOME/install-doc/EULA.txt. | [https://software.intel.com/en-us/faq/licensing Intel Product Licensing FAQ]
  +
|-
  +
|Citing
  +
| n/a
  +
|-
  +
| Links
  +
| [https://software.intel.com/en-us/c-compilers Intel C-Compiler Homepage]
  +
|-
  +
| Graphical Interface
  +
| [[#Debugger|Yes (Intel Debugger GUI-Verison)]]
  +
|-
  +
| Included modules
  +
| icc | icpc | ifort | idb | gdb-ia
 
|}
 
|}
 
 
= Intel =
 
 
bwUniCluster currently provides Intel compiler suite versions:
 
* 13.1 (default)
 
* 12.1
 
 
<br>
 
<br>
  +
= Introduction =
To load the default compiler suite execute in your terminal session:
 
  +
The '''Intel Compiler''' of the '''Intel Composer XE Suite''' consists of tools to compile and debug C, C++ and Fortran programs:
<pre>
 
  +
{| width=500px class="wikitable"
$ module load compiler/intel
 
  +
|-
</pre>
 
  +
|style="padding:3px"| icc
To load your prefered version, e.g. 12.1, enter:
 
  +
|style="padding:3px"| Intel C compiler
<pre>
 
  +
|-
$ module load compiler/intel/12.1
 
  +
|style="padding:3px"| icpc
</pre>
 
  +
|style="padding:3px"| Intel C++ compiler
For details about unloading or switching compiler suites, please see chapter [[BwUniCluster_Environment_Modules| environment modules]].
 
  +
|-
 
  +
|style="padding:3px"| ifort
 
  +
|style="padding:3px"| [https://software.intel.com/en-us/fortran-compilers Intel Fortran compiler]
== Default Intel compiler suite - version 13.1 ==
 
  +
|-
 
  +
|style="padding:3px"| [[#GUI|idb]]
This module provides the Intel® compiler suite version 13.1.3 via
 
  +
|style="padding:3px"| Intel debugger in GUI mode (until version 14 only)
commands 'icc', 'icpc' and 'ifort', the debugger 'idb' as well as the Intel®
 
  +
|-
Threading Building Blocks TBB and the Integrated Performance Primitives IPP
 
  +
|style="padding:3px"| [[#Console Mode|gdb-ia]]
libraries (for details see also http://software.intel.com/en-us/intel-compilers/).
 
  +
|style="padding:3px"| Intel version of GNU debugger in console mode (from version 15)
 
  +
|-
The related Math Kernel Library MKL module is 'numlib/mkl/11.0.5'.
 
  +
|style="padding:3px"| [[#Console Mode|idbc]]
The related Intel MPI module is 'mpi/impi/4.1.1-intel-13.1'.
 
  +
|style="padding:3px"| Intel debugger in console mode (until version 14 only)
The Intel icpc should work well with GNU compiler 4.7.
 
  +
|}
 
  +
The intel compiler suite also includes the TBB (Threading Building Blocks) and IPP (Integrated Performance Primitives) libraries.
The compiler suite contains:
 
<pre>
 
icc # Intel® C compiler
 
icpc # Intel® C++ compiler
 
ifort # Intel® Fortran compiler
 
idb # Intel® debugger in GUI mode
 
idbc # Intel® debugger in console mode
 
</pre>
 
 
For local documentation consult the module help:
 
<pre>
 
$ module help compiler/intel/13.1
 
</pre>
 
or the '''man pages''' of each compiler:
 
<pre>
 
$ man icc
 
$ man icpc
 
$ man ifort
 
 
</pre>
 
For further online documentation visit:
 
* [http://software.intel.com/sites/products/search/search.php?q=&x=27&y=4&product=composerxef&version=2013&docos=lin Intel® Fortran Composer XE Version 2013]
 
* [http://software.intel.com/sites/products/search/search.php?q=&x=25&y=6&product=composerxec&version=2013&docos=lin Intel® C++ Composer XE Version 2013]
 
 
<br>
 
<br>
For some Intel® compiler option examples, hints on how to compile 32bit code
 
and solutions for less common problems see the tips and troubleshooting doc under:
 
<pre>
 
$INTEL_DOC_DIR/intel-compiler-tips-and-troubleshooting.txt
 
</pre>
 
 
<br>
 
<br>
  +
More information about the MPI versions of the Intel Compiler is available here:
For details on library and include directories of this compiler suite please enter:
 
  +
* [[Development/Parallel_Programming|Best Practices Guide for Parallel Programming]].
<pre>
 
$ module show compiler/intel/13.1
 
</pre>
 
 
<br>
 
<br>
Note that, the environment variables and commands are '''only''' available after loading this module.
 
   
  +
= Documentation =
  +
== Online 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]
   
  +
= 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
= GCC =
 
 
bwUniCluster currently provides GNU compiler suite versions:
 
* 4.5
 
* 4.7 (default)
 
* 4.8
 
 
<br>
 
<br>
  +
http://www.bwhpc-c5.de/wiki/index.php/DDT
To load the default compiler suite execute in your terminal session:
 
<pre>
+
<br><br>
$ module load compiler/gnu
 
</pre>
 
To load your prefered version, e.g. 4.5, enter:
 
<pre>
 
$ module load compiler/gnu/4.5
 
</pre>
 
For details about unload or switching compiler suites, please see chapter [[BwUniCluster_Environment_Modules| environment modules]].
 
   
  +
= 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
== Default GNU compiler suite - version 4.7 ==
 
  +
'''icc -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''').
This module provides the GNU compiler suite version 4.7.3
 
via commands 'gcc', 'g++' and 'gfortran' (see also 'http://gcc.gnu.org/').
 
The GNU compiler has been build with gmp-4.3.2, mpfr-2.4.2 and mpc-0.8.1.
 
 
The compiler suite contains:
 
<pre>
 
cpp # GNU pre processor
 
gcc # GNU C compiler
 
g++ # GNU C++ compiler
 
gfortran # GNU Fortran compiler (Fortran 77, 90 and 95)
 
</pre>
 
 
<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:
Libraries can be found under:
 
  +
'''icc -fast ex.c'''
<pre>
 
$GNU_LIB_DIR = /opt/bwhpc/common/compiler/gnu/4.7.3/x86_64/lib64
 
</pre>
 
 
<br>
 
<br>
For local documentation consult the module help:
 
<pre>
 
$ module help compiler/gnu/4.7
 
</pre>
 
or the '''man pages''' of each compiler:
 
<pre>
 
$ man cpp
 
$ man gcc
 
$ man g++
 
$ man gfortran
 
</pre>
 
 
<br>
 
<br>
  +
For further online documentation visit:
 
  +
= Profiling =
* [http://gcc.gnu.org/onlinedocs/ http://gcc.gnu.org/onlinedocs/]
 
  +
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'''.
  +
<br>
  +
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 details on library and include directories of this compiler suite please enter:
 
  +
'''icc -prof-gen ex.c -o ex'''
<pre>
 
  +
then execute the most co]]mmon and typical use-case of your application, and then recompile using the generated profile count (and using optimization):
$ module show compiler/gnu/4.7
 
  +
'''icc -prof-use -O2 ex.c -o ex'''.
</pre>
 
 
<br>
 
<br>
  +
== Further literature ==
Please do not add the gnu compiler module to any automatic environment setup
 
  +
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]
procedure (neither to ~/.profile nor to ~/.bashrc).
 
  +
and to get the different optimization options execute
  +
'''icc -help opt'''
  +
'''icc -help advanced'''
 
<br>
 
<br>
  +
or the previously described catch-all option '''''-v --help'''''.
Please note, that the environment variables and commands are '''only''' available after loading this module.
 

Latest revision as of 23:57, 8 December 2022

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
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


1 Introduction

The Intel Compiler of the Intel Composer XE Suite consists of tools to compile and debug C, C++ and Fortran programs:

icc Intel C compiler
icpc Intel C++ compiler
ifort Intel Fortran compiler
idb Intel debugger in GUI mode (until version 14 only)
gdb-ia Intel version of GNU debugger in console mode (from version 15)
idbc Intel debugger in console mode (until version 14 only)

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

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


2 Documentation

2.1 Online documentation

3 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
http://www.bwhpc-c5.de/wiki/index.php/DDT

4 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 icc -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: icc -fast ex.c

5 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: icc -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 icc -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): icc -prof-use -O2 ex.c -o ex.

5.1 Further literature

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