Development/Intel Compiler: Difference between revisions
K Siegmund (talk | contribs) (→General compiler usage: moved to General compiler usage) |
K Siegmund (talk | contribs) |
||
Line 60: | Line 60: | ||
'''Profiling:''' If you want to profile your program using gprof you have to compile your code with the profile flag: |
'''Profiling:''' If you want to profile your program using gprof you have to compile your code with the profile flag: |
||
<pre>$ icc -p ex.c -o ex</pre> |
<pre>$ icc -p ex.c -o ex</pre> |
||
= GCC = |
|||
The '''GNU Compiler Collection (GCC)''' consists of tools to compile C, C++ and Fortran programs: |
|||
{| border="1" style="margin:5px;border-collapse:collapse" |
|||
|- |
|||
|style="padding:3px"| gcc |
|||
|style="padding:3px"| GNU C compiler |
|||
|- |
|||
|style="padding:3px"| g++ |
|||
|style="padding:3px"| GNU C++ compiler |
|||
|- |
|||
|style="padding:3px"| gfortran |
|||
|style="padding:3px"| GNU Fortran compiler |
|||
|} |
|||
'''Loading:''' There is a version of GCC available on the system without loading a module but it may be outdated and it is recommended to load the GNU compiler module. To get a list of all the different versions installed on the system execute the following command: |
|||
<pre>$ module avail compiler/gnu</pre> |
|||
There is a default version which will be loaded when no version is explicitly specified, so the command |
|||
<pre>$ module load compiler/gnu</pre> |
|||
will load the default version. |
|||
'''Online documentation:''' http://gcc.gnu.org/onlinedocs/ |
|||
'''Local documentation:''' For version specific documentation see the help page of the module. For example |
|||
<pre>$ module help compiler/gnu</pre> |
|||
will show the information for the default version. |
|||
For detailed lists of the different program options consult the particular man page: |
|||
<pre> |
|||
$ man gcc |
|||
$ man g++ |
|||
$ man gfortran |
|||
</pre> |
|||
'''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 |
|||
<pre>$ gcc -march=native -O2 ex.c -o ex</pre> |
|||
There are more aggressive optimization flags but the compiled programs can get quite large and the compilation process will probably take much longer. Moreover it can happen that the so compiled program is even slower. Such a command would be for example |
|||
<pre>$ gcc -march=native -O3 ex.c -o ex</pre> |
|||
For a complete list of all the optimization options execute |
|||
<pre>$ gcc --help=optimizers</pre> |
|||
'''Profiling:''' If you want to profile your program using gprof you have to compile your code with the profile flag: |
|||
<pre>$ gcc -pg ex.c -o ex</pre> |
Revision as of 15:00, 24 March 2014
Navigation: bwHPC BPR |
---|
Intel Suite
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 but the compiled programs can get quite large and the compilation process will probably take much longer. Moreover it can happen that the so compiled program is even slower. Such a command would be for example
$ icc -fast ex.c
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
Profiling: If you want to profile your program using gprof you have to compile your code with the profile flag:
$ icc -p ex.c -o ex