Skip to content
This repository has been archived by the owner on Aug 5, 2022. It is now read-only.

Build Caffe with Intel Compiler

guomingz edited this page Jan 26, 2018 · 5 revisions

Builing the caffe with Intel C++ Compiler allows you to take full advantage of the Intel(R) processor. This is a step-by-step tutorial for building Intel caffe with MKLDNN library.

0.Prerequisite

The Intel C++ compiler produce optimized code that can run significantly faster by taking advantage of the ever-increasing core count and vector register width in Intel® Xeon® processors and compatible processors. Please install it from this link before executing the following steps.

1.Building Boost library.

  • Download the boost from offical page and unzip it.
  • Execute the following commands step by step.
    1. Run source <compiler root>/bin/compilervars.sh {ia32 OR intel64} or source <compiler root>/bin/compilervars.csh {ia32 OR intel64}
    2. cd <boost root>
    3. ./bootstrap.sh
    4. ./b2 install --prefix=<Boost.Build install dir>
    5. For 32-bit: ./b2 --build-dir=<Boost object directory> toolset=intel stage
    6. For 64-bit: ./b2 --build-dir=<Boost object directory> address-model=64 toolset=intel stage

2.Build caffe with Makefile

  • cd to /path/to/caffe and create the Makefile.config from the Makefile.config.example.
  • Set the variable CUSTOM_CXX and CUSTOM_CC to /path/to/icpc and /path/to/icc. e.g:CUSTOM_CXX := /opt/intel/compilers_and_libraries/linux/bin/intel64/icpc CUSTOM_CC := /opt/intel/compilers_and_libraries/linux/bin/intel64/icc
  • Set the variable BOOST_ROOT to /path/to/unzipped_boost_root. e.g:BOOST_ROOT := /home/user/boost_1_64_0
  • Run `make all -j$(nproc)' to build the caffe.

3.Build caffe with CMake

  • Create folder under caffe. e.g:mkdir build
  • cd build
  • Run CC=icc CXX=icpc cmake .. -DCPU_ONLY=1 -DBOOST_ROOT=<boost path> to generate makefile
  • Run CC=icc CXX=icpc CPATH="" make all -j$(nproc) to build caffe
Clone this wiki locally