This repository has been archived by the owner on Aug 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 491
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.
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.
- Download the boost from offical page and unzip it.
- Execute the following commands step by step.
- Run
source <compiler root>/bin/compilervars.sh {ia32 OR intel64}
orsource <compiler root>/bin/compilervars.csh {ia32 OR intel64}
cd <boost root>
./bootstrap.sh
./b2 install --prefix=<Boost.Build install dir>
- For 32-bit:
./b2 --build-dir=<Boost object directory> toolset=intel stage
- For 64-bit:
./b2 --build-dir=<Boost object directory> address-model=64 toolset=intel stage
- Run
- 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.
- 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