Building the Boost library to run natively on Intel(R) Xeon Phi(tm) Coprocessor

This article provides instructions to custom build the Boost library to run in native mode on Intel(R) Xeon Phi(tm) Coprocessor, as well as verify the build is working properly.   The instructions are written assuming you have a copy of the Intel(R) C++ Compiler installed on your system.

The Boost library version used here is 1.49 (and has also been verified for version 1.48). The instructions are based on the “Getting Started on UNIX Variants” guide.Please refer to this guide for help on additional configuration options. provides free peer-reviewed portable C++ source libraries.

Steps to build Boost library for Intel(R) Xeon Phi(tm) Coprocessor:

  1. Download boost_1_49_0.tar.gz from
  2. In the directory where you want to put the Boost installation, uncompress the downloaded Boost distribution:  tar zxvf boost_1_49_0.tar.gz
  3. Change your current directory to the Boost root directory (created by the above command):  cd boost_1_49_0
  4. Setup the Intel compiler build environment to prepare for cross-compiling targeting Intel Xeon Phi Coprocessor:  source /opt/intel/composerxe_mic/bin/ intel64 
  5. Run the Boost bootstrap script :./
  6. Run bjam with Intel toolset selected: ./bjam toolset=intel --disable-icu --without-iostreams cflags="-mmic" cxxflags="-mmic" linkflags="-mmic"


Please refer to the  Intel compiler reference manual for additional relevant compiler/linker flags that may be used.

The above steps will build static and shared non-debug multi-threaded variants of the libraries. To build all variants, pass the additional option, “--build-type=complete”.


Steps to verify the Boost build and run it on the MIC platform:

 To verify the build process and demonstrate linking with the Boost library, the Boost.Regex based example from step #6 of the “Getting Started on UNIX Variants” guide is used. Note that this example does not provide comprehensive coverage on Boost usage but it is used here for sanity check only

  1. Copy the aforementioned example into a file called "boot_test.cpp"
  2. Build the test-program to run in native-mode on Intel Xeon Phi Coprocessor: icpc -mmic -vec-report2 -I . boost_test.cpp ./stage/lib/libboost_regex.a -o boost_test 
  3. Copy the test program’s binary to the coprocesor:  sudo scp boost_test 
  4. Log onto the coprocessor and change directory to /tmp: sudo ssh root@
  5. cd /tmp
  6. Create an input file to be processed by the test program:  (example): cat test.txt

To: George Shmidlap

From: Rita Marlowe

Subject: Will Success Spoil Rock Hunter?


See subject.

Lastly, run the test program with the aforementioned input file: ./boost_test < test.txt

If this runs successfully, it should return:   "Will Success Spoil Rock Hunter?"

Para obtener información más completa sobre las optimizaciones del compilador, consulte nuestro Aviso de optimización.