Intel® C++ Compiler 16.0 User and Reference Guide
There are some notable differences between the Intel® C++ Compiler (with CLANG front-end) and the LLVM CLANG compiler. Consider the following as you begin compiling your source code with the Intel® C++ Compiler with the CLANG front-end. For the rest of this topic, Intel® C++ Compiler/Intel compiler indicates the Intel® C++ CLANG front-end compiler, and CLANG compiler indicates the LLVM CLANG compiler.
The Intel compiler relies on environment variables for the location of compiler binaries, libraries, man pages, and license files. In some cases these are different from the environment variables that the CLANG compiler uses. Another difference is that these variables are not set by default after installing the Intel® C++ Compiler. The following environment variables need to be set prior to running the Intel® C++ Compiler:
PATH – add the location of the compiler binaries to PATH
DYLD_LIBRARY_PATH (OS X*) – sets the location of the compiler libraries as well as the resulting binary generated by the compiler
MANPATH – add the location of the compiler manual pages (icc.1 and icpc.1) to MANPATH
INTEL_LICENSE_FILE – sets the location of the Intel® C++ Compiler license file
To set these environment variables, run the compilervars.sh script.
Setting these environment variables with compilervars.sh does not impose a conflict with the CLANG compiler. You should be able to use both compilers in the same shell.
The Intel® C++ Compiler is an optimizing compiler that begins with the assumption that you want improved performance from your application when it is executed on Intel architecture. Consequently, certain optimizations, such as option -O2, are part of the default invocation of the Intel® C++ Compiler. By default, Clang turns off optimization - the equivalent of compiling with -O or -O0. Other forms of the -O<n> option compare as follows:
Option |
ICL Intel® C++ Compiler |
Clang Compiler |
---|---|---|
-O0 |
Turns off optimization. |
Default. Turns off optimization. Same as O. |
-O1 |
Decreases code size with some increase in speed. |
Decreases code size with some increase in speed. |
-O2 |
Default. Favors speed optimization with some increase in code size. Same as option O. Intrinsics, loop unrolling, and inlining are performed. |
Optimizes for speed as long as there is not an increase in code size. Loop unrolling and function inlining, for example, are not performed. |
-O3 |
Enables option O2 optimizations plus more aggressive optimizations, such as prefetching, scalar replacement, and loop and memory access transformations. |
Optimizes for speed while generating larger code size. Includes option O2 optimizations plus loop unrolling and inlining. Similar to option O2 -ip on the Intel® C++ Compiler. |
While many of the same options that target specific processors are supported with both compilers, Intel includes options that utilize processor-specific instruction scheduling to target the latest Intel® processors. If you compile your CLANG application with the -march or -mtune option, consider using Intel's -x or -ax options for applications that run on IA-32 architecture or Intel® 64 architecture.
The Intel compiler lets you maintain configuration and response files that are part of compilation. Options stored in the configuration file apply to every compilation, while options stored in response files apply only where they are added on the command line. If you have several options in your makefile that apply to every build, you may find it easier to move these options to the configuration file (../bin/intel64/icl.cfg and ../bin/intel64/iclpp.cfg).
In a multi-user, networked environment, options listed in the icl.cfg and iclpp.cfg files are generally intended for everyone who uses the compiler. If you need a separate configuration, you can use the ICLCFG or ICLPPCFG environment variable to specify the name and location of your own .cfg file, such as /my_code/my_config.cfg. Anytime you instruct the compiler to use a different configuration file, the system configuration files (icl.cfg and iclpp.cfg) are ignored.
The Intel® C++ Compiler supplies additional libraries that contain optimized implementations of many commonly used functions. Some of these functions are implemented using CPU dispatch. This means that different code may be executed when run on different processors.
Supplied libraries include the Intel® Math Library (libimf), the Short Vector Math Library (libsvml), libirc, as well as others. These libraries are linked in by default when the compiler sees that references to them have been generated. Some library functions, such as sin or memset, may not require a call to the library, since the compiler may inline the code for the function.
Intel® Math Library
With the Intel® C++ Compiler, the Intel® Math Library, libimf, is linked by default when calling math functions that require the library. Some functions, such as sin, may not require a call to the library, since the compiler already knows how to compute the sin function. The Intel® Math Library also includes some functions not found in the standard math library.
You cannot make calls to the Intel® Math Library with the CLANG compiler.
Many routines in this library are more highly optimized for Intel® microprocessors than for non-Intel microprocessors.
Short Vector Math Library (libsvml)
When vectorization is being done, the compiler may translate some calls to the libm math library functions into calls to libsvml functions. These functions implement the same basic operations as the Intel® Math Library, but operate on short vectors of operands. This results in greater efficiency. In some cases, the libsvml functions are slightly less precise than the equivalent libimf functions.
Many routines in this library are more highly optimized for Intel® microprocessors than for non-Intel microprocessors.
libirc
libirc contains optimized implementations of some commonly used string and memory functions. For example, it contains functions that are optimized versions of memcpy and memset. The compiler will automatically generate calls to these functions when it sees calls to memcpy and memset. The compiler may also transform loops that are equivalent to memcpy or memset into calls to these functions.
Many routines in this library are more highly optimized for Intel® microprocessors than for non-Intel microprocessors.