Skip to main content

4.5) Intel: Compiler Optimisation


The Intel compiler has three optimisation levels:

-O0 : No optimisation
-O1 : Basic optimisation
-O2 ( or –O) : Optimises for speed, may increase code size, but still retains accuracy.
-O3 : Aggressive optimisation, begins to loose accuracy. If accuracy important avoid using this level of optimisation.

-O2 is the default optimisation level and is the generally recommended optimisation level.
In addition, the compiler provides the flag –xAVX that makes use of architecture specific instruction set and hardware specific optimisations. To use these include them in the compilation line, e.g.:

$ ifort –O2 –xAVX –o mycode mycode.f90

For more information about optimisation and available compiler flags, please look at the man pages, e.g. man icc or man ifort, or online support guides at http://www.intel.com/software/products/support/. For instance what does –fast flag to icc/ifort do? Look at man pages for description.