Development/Intel Compiler

From bwHPC Wiki
Jump to: navigation, search
Intel Compiler
module load compiler/intel/xxx
License GPL
Citing
Links Homepage
Graphical Interface No
Included in module icc, icpc, ifort, idb

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
idbc Intel debugger in console mode

Aside from that the suite also includes the TBB (Threading Building Blocks) and IPP (Integrated Performance Primitives) libraries.

Loading: There are different versions of the Intel compilers installed. To get a list of these installations execute the following command:

$ module avail compiler/intel

There is a default version which will be loaded when no version is explicitly specified, so the command

$ module load compiler/intel

will load the default version.

Online documentation: http://software.intel.com/en-us/articles/intel-c-composer-xe-documentation

Local documentation: For version specific documentation see the help page of the module. For example

$ module help compiler/intel

will show the information for the default version. For detailed lists of the different program options consult the particular man page:

$ man icc
$ man icpc
$ man ifort
$ man idb

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

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

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

Further literature: A tutorial on optimization can be found at http://download-software.intel.com/sites/default/files/article/301481/compiler-essentials.1.pdf and to get the different optimization options execute

$ icc -help opt
$ icc -help advanced

or the previously described catch-all option -v --help.