Generate Faster Binary by Using Compile Option

By specifying options to the compiler, you can generate a high-speed binary. Here, I will introduce options of intel compiler, icc(for C Language) and icpc (for C ++).

      
-xHOST
It generates instructions for the highest instruction set and processor available on the compilation host machine.
      
-O3
It optimizes for maximum speed and enable more aggressive optimizations that may not improve performance on some programs. It is the most high optimization level "-O3" in the Intel compiler. The higher level optimization you do, the longer time it takes to compile . The default is "-O2" . "-O0" Does not optimize.
      
-ipo
It enables multi-file IP optimization between files. "-ipo" will perform further optimization of between procedures (objects or functions unit). Because it is further optimization after building the object, it takes a very long time to compile.
      
-no-prec-div
It improves precision of FP divides (some speed impact). "-no-Prec-div" is an option to increase the calculation speed by making the calculation accuracy of the division lower. The computer will take a very long time to division compared to the multiplication. Usually, this option will improve the calculation speed. However, because it casts the accuracy, you may have result with some errors.
      
-static
It prevents linking with shared libraries. Create an executable module by linking a static library. Default intel compiler will use the shared library. In the case of execution module that links the dynamic library, in order to go to read the object of the library of run time, generally calculated speed is slow. Libraries Intel compiler links are not just those that comes with the Intel compiler, it uses a lot of OS standard library. However, when programs uses more than 2GB of memory, you must specify the dynamic library. So "-fast" will cause a link error because it contains "-static". As a workaround, you will need to compile with removing the "-static" in the following manner "-xHOST -O3 -ipo -no-prec-div". If you want to use only a static link library that is bundled with the Intel compiler, use the "-static-intel" option.
      
-fast
It enables -xHOST -O3 -ipo -no-prec-div -static.