Monday, March 1, 2010

Compile Boost and VXL with Intel Linux C++ compiler 11.0

Recently I started to evaluate the performance of a few compilers. Among them, Intel C++ compiler is certainly one of interests as it was often reported to result in 2x or greater performance gain.

After installation of the evaluation copy, first thing was to compile VXL, which was reasonable experience but not completely smooth. I found out that in addition to providing the C and C++ compiler commands, I also need to specify the Intel version of ar command before cmake is run for the first time. I tried to make this modification by editing CMakeCache.txt, but the Make files seem to be stuck with the original ar command. Here is a simple cache file I supply:

//Path to a program.
CMAKE_AR:FILEPATH=/software/intel/Compiler/11.1/069/bin/intel64/xiar

//CXX compiler.
CMAKE_CXX_COMPILER:FILEPATH=/software/intel/Compiler/11.1/069/bin/intel64/icpc

//Flags used by the compiler during all build types.
CMAKE_CXX_FLAGS:STRING=-xhost -ipo

//C compiler.
CMAKE_C_COMPILER:FILEPATH=/software/intel/Compiler/11.1/069/bin/intel64/icc

//Flags used by the compiler during all build types.
CMAKE_C_FLAGS:STRING=-xhost -ipo

//Path to a program.
CMAKE_LINKER:FILEPATH=/software/intel/Compiler/11.1/069/bin/intel64/xild

//Flags used by the linker.
CMAKE_EXE_LINKER_FLAGS:STRING=-ipo
Boost is the second software to compile. I did a bit research online about how to tell bjam to find the necessary tools. These are the information I found:
This is the content of tools/build/v2/user-config.jam:
using intel-linux : 11.1 : /software/intel/Compiler/11.1/069/bin/intel64/icpc : -xhost
With this bjam command line:
bjam --build-dir=/tmp/build-boost-64 variant=release threading=multi link=static cxxflags="-xhost -fPIC" cflags="-xhost -fPIC" --prefix=/software/boost-1_42_0-intel --libdir=/software/boost-1_42_0-intel/lib64 install