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

Commit 3c14534

Browse files
committed
Merge Release_1.1.2
2 parents a3d5b02 + 8d7fb23 commit 3c14534

File tree

194 files changed

+281373
-57135
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

194 files changed

+281373
-57135
lines changed

CMakeLists.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ endif()
1010
project(Caffe C CXX)
1111

1212
# ---[ Caffe version
13-
set(CAFFE_TARGET_VERSION "1.1.0" CACHE STRING "Caffe logical version")
14-
set(CAFFE_TARGET_SOVERSION "1.1.0" CACHE STRING "Caffe soname version")
13+
set(CAFFE_TARGET_VERSION "1.1.2" CACHE STRING "Caffe logical version")
14+
set(CAFFE_TARGET_SOVERSION "1.1.2" CACHE STRING "Caffe soname version")
1515
add_definitions(-DCAFFE_VERSION=${CAFFE_TARGET_VERSION})
1616

1717
# ---[ Using cmake scripts and modules
@@ -47,6 +47,7 @@ caffe_option(PERFORMANCE_MONITORING "Build Caffe with PERFORMANCE_MONITORING " O
4747
caffe_option(CODE_COVERAGE "Build with code coverage instrumentation" OFF)
4848
caffe_option(CO_SIM "Build readonly cpu blob data/diff pycaffe interface" OFF)
4949
caffe_option(USE_MLSL "Build Caffe with Intel(r) Machine Learning Scaling Library for multinode training" ON)
50+
caffe_option(ICC_STATIC_BUILD "Build Intel Caffe static link with Intel compiler" OFF)
5051

5152
# ---[ Dependencies
5253
include(cmake/MKLDNN.cmake)
@@ -93,7 +94,11 @@ if(UNIX OR APPLE)
9394
# shows that it generates correct PIE anyway if only -pie is provided.
9495
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector -wd2196")
9596
# Auto enable SGD Fusion if use intel compiler
96-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_SGD_FUSION")
97+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_SGD_FUSION -DENABLE_NMS_OPTIMIZATION")
98+
# ICC static build
99+
if(ICC_STATIC_BUILD)
100+
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel")
101+
endif()
97102
endif()
98103

99104
# Generic flags.

Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ LIB_BUILD_DIR := $(BUILD_DIR)/lib
102102
STATIC_NAME := $(LIB_BUILD_DIR)/lib$(LIBRARY_NAME).a
103103
DYNAMIC_VERSION_MAJOR := 1
104104
DYNAMIC_VERSION_MINOR := 1
105-
DYNAMIC_VERSION_REVISION := 0
105+
DYNAMIC_VERSION_REVISION := 2
106106
DYNAMIC_NAME_SHORT := lib$(LIBRARY_NAME).so
107107
#DYNAMIC_SONAME_SHORT := $(DYNAMIC_NAME_SHORT).$(DYNAMIC_VERSION_MAJOR)
108108
DYNAMIC_VERSIONED_NAME_SHORT := $(DYNAMIC_NAME_SHORT).$(DYNAMIC_VERSION_MAJOR).$(DYNAMIC_VERSION_MINOR).$(DYNAMIC_VERSION_REVISION)
@@ -389,7 +389,11 @@ endif
389389
ifneq (,$(findstring icpc,$(CXX)))
390390
CXX_HARDENING_FLAGS += -fstack-protector -wd2196
391391
#Enable SGD FUSION if use intel compiler
392-
COMMON_FLAGS += -DENABLE_SGD_FUSION
392+
COMMON_FLAGS += -DENABLE_SGD_FUSION -DENABLE_NMS_OPTIMIZATION
393+
#Intel compiler static build flag
394+
ifeq ($(ICC_STATIC_BUILD), 1)
395+
LDFLAGS += -static-intel
396+
endif
393397

394398
else ifneq (,$(findstring clang++,$(CXX)))
395399
CXX_HARDENING_FLAGS += -fPIE -fstack-protector
@@ -447,7 +451,7 @@ ifeq ($(DEBUG), 1)
447451
COMMON_FLAGS += -DDEBUG -g -O0
448452
NVCCFLAGS += -G
449453
else ifneq (,$(findstring icpc,$(CXX)))
450-
COMMON_FLAGS += -DNDEBUG -O3 -xCORE-AVX2 -no-prec-div -fp-model fast=2
454+
COMMON_FLAGS += -DNDEBUG -O3 -xHost -no-prec-div -fp-model fast=2
451455
else
452456
COMMON_FLAGS += -DNDEBUG -O3
453457
endif

Makefile.config.example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ USE_MKLDNN_AS_DEFAULT_ENGINE := 1
7171
# To customize your choice of compiler, uncomment and set the following.
7272
# N.B. the default for Linux is g++ and the default for OSX is clang++
7373
# CUSTOM_CXX := g++
74+
# If you use Intel compiler, you can choose uncomment following to enable static build
75+
# ICC_STATIC_BUILD := 1
7476

7577
# If you use Intel compiler define a path to newer boost if not used
7678
# already.
@@ -85,6 +87,9 @@ DISABLE_CONV_RELU_FUSION:= 0
8587
# Use Bn + ReLU fusion to boost inference
8688
DISABLE_BN_RELU_FUSION := 0
8789

90+
# Use Conv + Concat fusion to boost inference.
91+
ENABLE_CONCAT_FUSION := 0
92+
8893
# Use Conv + Eltwise + Relu layer fusion to boost inference.
8994
DISABLE_CONV_SUM_FUSION := 0
9095

Makefile.dlcp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CAFFE_ROOTDIR := $(shell pwd)
22
DLCP_IDEEPDIR := $(CAFFE_ROOTDIR)/external/ideep
3-
DLCP_ROOTDIR := $(DLCP_IDEEPDIR)/ideep/dlcp
3+
DLCP_ROOTDIR := $(DLCP_IDEEPDIR)/dlcp
44
DLCP_INCLDIR := $(DLCP_ROOTDIR)/include
55
DLCP_LIBDIR := $(DLCP_ROOTDIR)/lib
66
IDEEP_GITHUB := https://github.com/intel/ideep.git
@@ -9,7 +9,7 @@ DLCP_CXX := $(CXX)
99
ifeq ("$(wildcard $(DLCP_INCLDIR)/dl_compression.h)", "")
1010
dlcp_download:
1111
rm -rf $(DLCP_IDEEPDIR)
12-
git clone $(IDEEP_GITHUB) -b dlcp $(DLCP_IDEEPDIR)
12+
git clone $(IDEEP_GITHUB) -b ideep4py $(DLCP_IDEEPDIR)
1313

1414
dlcp_build: dlcp_download
1515
make -C $(DLCP_ROOTDIR) -j$(shell cat /proc/cpuinfo |grep 'processor'|wc -l)

Makefile.mkldnn

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ ifneq (,$(findstring ccache,$(CC)))
2222
endif
2323

2424
MKLDNN_GITHUB := https://github.com/01org/mkl-dnn.git
25+
# Enable MKLDNN intel compiler static build
26+
ifneq (,$(findstring icpc,$(MKLDNN_CXX)))
27+
ifeq ($(ICC_STATIC_BUILD), 1)
28+
MKLDNN_CMAKE_FLAGS += $(MKLDNN_SRCDIR) -DCMAKE_INSTALL_PREFIX=$(MKLDNN_INSTALLDIR) -DMKLROOT=${MKL_ROOTDIR} -B$(MKLDNN_BUILDDIR) -DCMAKE_CXX_COMPILER="$(MKLDNN_CXX)" -DCMAKE_C_COMPILER="$(MKLDNN_CC)" -DCMAKE_SHARED_LINKER_FLAGS="$(CMAKE_SHARED_LINKER_FLAGS) -static-intel"
29+
endif
30+
endif
2531
MKLDNN_CMAKE_FLAGS += $(MKLDNN_SRCDIR) -DCMAKE_INSTALL_PREFIX=$(MKLDNN_INSTALLDIR) -DMKLROOT=${MKL_ROOTDIR} -B$(MKLDNN_BUILDDIR) -DCMAKE_CXX_COMPILER="$(MKLDNN_CXX)" -DCMAKE_C_COMPILER="$(MKLDNN_CC)"
2632

2733
# Disable MKLDNN download by customized setting

cmake/DLCP.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ function(Download_DLCP)
55
elseif(HAS_ICPC)
66
set(DLCP_CXX "icpc" PARENT_SCOPE)
77
else()
8-
message(WARNING "weight grad compression is disabled because intel compiler is not found")
8+
message("weight grad compression is disabled because intel compiler is not found")
99
return()
1010
endif()
1111

1212
set(EXTERNAL_DIR ${CMAKE_SOURCE_DIR}/external)
1313
set(DLCP_IDEEPDIR ${EXTERNAL_DIR}/ideep)
14-
set(DLCP_ROOTDIR ${DLCP_IDEEPDIR}/ideep/dlcp)
14+
set(DLCP_ROOTDIR ${DLCP_IDEEPDIR}/dlcp)
1515
set(DLCP_INCLDIR "${DLCP_ROOTDIR}/include" PARENT_SCOPE)
1616
set(DLCP_LIBDIR ${DLCP_ROOTDIR}/lib PARENT_SCOPE)
1717

1818
# Download dl compression lib source code if it doesn't exist
1919
if (NOT EXISTS ${DLCP_INCLDIR}/dl_compression.h)
2020
execute_process(COMMAND rm -rf ${DLCP_IDEEPDIR})
21-
execute_process(COMMAND git clone https://github.com/intel/ideep.git -b dlcp ${DLCP_IDEEPDIR})
21+
execute_process(COMMAND git clone https://github.com/intel/ideep.git -b ideep4py ${DLCP_IDEEPDIR})
2222
endif()
2323

2424
add_custom_target(DLCP_Build ALL

cmake/Dependencies.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ if(USE_MLSL)
128128
add_definitions("-DFOUNDED_MLSL_ROOT=${MLSL_ROOT}")
129129
include_directories(SYSTEM "${MLSL_ROOT}/intel64/include")
130130
link_directories(SYSTEM "${MLSL_ROOT}/intel64/lib")
131+
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH}:${MLSL_ROOT}/intel64/lib/)
131132
list(APPEND Caffe_LINKER_LIBS mlsl)
132133

133134
if(CAFFE_MLSL_SHUFFLE)
@@ -151,6 +152,7 @@ if(USE_MLSL)
151152
message(STATUS "Found DLCP: ${DLCPROOT_DIR}")
152153
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_WEIGHT_GRAD_COMPRESSION")
153154
list(APPEND Caffe_LINKER_LIBS "${DLCPROOT_LIB_DIR}/libdlcomp.so")
155+
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH}:${DLCP_LIBDIR})
154156
include_directories(SYSTEM ${DLCP_INCLUDE_DIR})
155157
else()
156158
message(STATUS "DLCP not found. DLCP_INCLUDE_DIR = ${DLCPROOT_INCLUDE_DIR} DLCP_LIB_DIR = ${DLCPROOT_LIB_DIR}")
@@ -162,6 +164,7 @@ if(USE_MLSL)
162164
if(DLCP_CXX)
163165
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_WEIGHT_GRAD_COMPRESSION")
164166
list(APPEND Caffe_LINKER_LIBS "${DLCP_LIBDIR}/libdlcomp.so")
167+
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH}:${DLCP_LIBDIR})
165168
include_directories(SYSTEM ${DLCP_INCLDIR})
166169
endif()
167170
endif()

cmake/MKLDNN.cmake

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ function(Download_MKLDNN)
55
set(MKLDNN_SOURCE_DIR ${MKLDNN_DIR}/src)
66
set(MKLDNN_BUILD_DIR ${MKLDNN_DIR}/build)
77
set(MKLDNN_INSTALL_DIR ${MKLDNN_DIR}/install CACHE PATH "Installation path of MKLDNN")
8+
# Enable MKLDNN intel compiler static build
9+
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel" )
10+
if(ICC_STATIC_BUILD)
11+
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel")
12+
endif()
13+
endif()
814
execute_process(COMMAND cat mkldnn.commit
915
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
1016
OUTPUT_VARIABLE MKLDNN_COMMIT)
@@ -18,13 +24,13 @@ function(Download_MKLDNN)
1824

1925
ExternalProject_add(MKLDNN_Build
2026
SOURCE_DIR ${MKLDNN_SOURCE_DIR}
21-
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${MKLDNN_INSTALL_DIR} -DMKLROOT=${MKL_ROOT_DIR}
27+
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${MKLDNN_INSTALL_DIR} -DMKLROOT=${MKL_ROOT_DIR} -DCMAKE_SHARED_LINKER_FLAGS=${CMAKE_SHARED_LINKER_FLAGS}
2228
#--Download step
2329
GIT_REPOSITORY https://github.com/01org/mkl-dnn.git
24-
GIT_TAG ${MKLDNN_COMMIT}
30+
GIT_TAG ${MKLDNN_COMMIT}
2531
#--Build step
2632
BINARY_DIR ${MKLDNN_BUILD_DIR}
27-
BUILD_COMMAND cmake ${MKLDNN_SOURCE_DIR}
33+
BUILD_COMMAND cmake ${MKLDNN_SOURCE_DIR}
2834
#--Install step
2935
INSTALL_DIR ${MKLDNN_INSTALL_DIR}
3036
INSTALL_COMMAND make install -j${NCORE}

cmake/Misc.cmake

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ if(DISABLE_BN_RELU_FUSION)
2121
add_definitions("-DDISABLE_BN_RELU_FUSION")
2222
endif()
2323

24+
if(ENABLE_CONCAT_FUSION)
25+
message(STATUS "conv/concat fusion is enabled!")
26+
add_definitions("-DENABLE_CONCAT_FUSION")
27+
endif()
28+
2429
if(DISABLE_CONV_SUM_FUSION)
2530
message(STATUS "conv/eltwise/relu fusion is disabled!")
2631
add_definitions("-DDISABLE_CONV_SUM_FUSION")
@@ -71,10 +76,3 @@ if(UNIX OR APPLE)
7176
COMMENT "Adding symlink: <caffe_root>/build -> ${PROJECT_BINARY_DIR}" )
7277
endif()
7378

74-
# ---[ Set debug postfix
75-
set(Caffe_DEBUG_POSTFIX "-d")
76-
77-
set(Caffe_POSTFIX "")
78-
if(CMAKE_BUILD_TYPE MATCHES "Debug")
79-
set(Caffe_POSTFIX ${Caffe_DEBUG_POSTFIX})
80-
endif()

cmake/Summary.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ function(caffe_print_configuration_summary)
105105
caffe_status(" Git : ${Caffe_GIT_VERSION}")
106106
caffe_status(" System : ${CMAKE_SYSTEM_NAME}")
107107
caffe_status(" C++ compiler : ${CMAKE_CXX_COMPILER}")
108+
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
109+
caffe_status(" ICC_STATIC_BUILD : ${ICC_STATIC_BUILD}")
110+
endif()
108111
caffe_status(" Release CXX flags : ${__flags_rel}")
109112
caffe_status(" Debug CXX flags : ${__flags_deb}")
110113
caffe_status(" Build type : ${CMAKE_BUILD_TYPE}")

0 commit comments

Comments
 (0)