Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Making MKL-DNN default on MXNet master #13681

Merged
merged 116 commits into from
Jan 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
1e17a51
mkldnn is default makefile and explicitly turn off for buidls
azai91 Sep 18, 2018
abbc3ad
add endif
azai91 Sep 18, 2018
92b91f8
retrigger
azai91 Oct 30, 2018
335748b
Merge branch 'master' into feature/mklnn-default-make
azai91 Oct 30, 2018
ce5336c
retrigger
azai91 Oct 31, 2018
d12d2cd
Merge branch 'master' into feature/mklnn-default-make
azai91 Nov 9, 2018
b8a0203
build mkldnn as static lib
azai91 Nov 9, 2018
bc6c482
update makefile to statically build mkldnn
azai91 Nov 9, 2018
15a41fc
build static mkldnn
azai91 Nov 9, 2018
42b3353
fix static name
azai91 Nov 9, 2018
5af258a
fix static name
azai91 Nov 9, 2018
32ab9ce
update static for mac
azai91 Nov 9, 2018
e2422d6
rename mkldnn dep in ci
azai91 Nov 12, 2018
372f697
remove moving mkldnn dynamic lib
azai91 Nov 12, 2018
67e4dff
retrigger
azai91 Nov 13, 2018
150b324
remove commented code
azai91 Nov 13, 2018
890cf1d
merge master
azai91 Nov 13, 2018
89b11c6
retrigger
azai91 Nov 13, 2018
da8f62c
Merge branch 'master' into feature/mklnn-default-make
azai91 Nov 13, 2018
f29c254
Merge branch 'master' into feature/mkldnn-static
azai91 Nov 14, 2018
40fd0ac
remove mkldnn dnaymic for unitest
azai91 Nov 14, 2018
78c6093
Merge branch 'master' into feature/mklnn-default-make
azai91 Nov 21, 2018
cb095c6
retrigger
azai91 Nov 21, 2018
c08f6fa
retrigger
azai91 Nov 22, 2018
0302290
force static for mkldnn lib
azai91 Nov 22, 2018
bf78666
turn of mkldnn on arm builds
azai91 Nov 22, 2018
23fd7d9
Merge branch 'master' into feature/mkldnn-static
azai91 Nov 27, 2018
d103ec8
remove dynamic mkldnn bind
azai91 Nov 28, 2018
46da874
Merge branch 'master' into feature/mklnn-default-make
azai91 Nov 29, 2018
9b60119
Merge branch 'feature/mklnn-default-make' of github.com:azai91/incuba…
azai91 Nov 29, 2018
4b07dcf
update jenkins to use only mkldnn
azai91 Nov 29, 2018
6536cda
remove last flag
azai91 Nov 29, 2018
de4ff31
turn mkldnn by default on mac
azai91 Nov 29, 2018
0e5a362
move mkldnn files for GPU MKLDNN build
azai91 Nov 29, 2018
6eadfae
copy lib mxnet in gpu build
azai91 Nov 30, 2018
c9e8bd2
Merge branch 'master' into feature/mkldnn-static
azai91 Nov 30, 2018
0d0f407
only link windows
azai91 Nov 30, 2018
b300b88
add mkldnn.mk
azai91 Nov 30, 2018
b336ef0
try force linking
azai91 Nov 30, 2018
9827a5b
Merge branch 'master' into feature/mklnn-default-make-2
azai91 Nov 30, 2018
b9be823
retrigger
azai91 Nov 30, 2018
fdcee0d
retrigger
azai91 Nov 30, 2018
46ee0bd
remove mkldnn dynanmic check
azai91 Nov 30, 2018
7772cdd
use ifndef
azai91 Nov 30, 2018
45e8cd8
remove test mkldnn install
azai91 Nov 30, 2018
ed31e12
fix spacing
azai91 Nov 30, 2018
746596c
Merge branch 'master' into feature/mklnn-default-make-2
azai91 Nov 30, 2018
ab2ec74
Merge branch 'feature/mkldnn-static' into feature/mklnn-default-make-2
azai91 Nov 30, 2018
6a02949
fix index
azai91 Nov 30, 2018
9ba1181
Merge branch 'feature/mkldnn-static' into feature/mklnn-default-make-2
azai91 Nov 30, 2018
3cc21f3
remove cp of mkldnn since statically linked
azai91 Nov 30, 2018
0b894a0
add libmkldnn.a to list of files to pack
azai91 Nov 30, 2018
6b4db54
include mkl_ml
azai91 Nov 30, 2018
a754793
merge from master
azai91 Dec 3, 2018
4ad0b29
Merge branch 'master' into feature/mklnn-default-make-2
azai91 Dec 10, 2018
ccf9855
add mkldnn to pack
azai91 Dec 10, 2018
225b446
add libiomp to ci pack
azai91 Dec 11, 2018
54231a9
move static libs
azai91 Dec 11, 2018
2d2a0f9
fix typo
azai91 Dec 11, 2018
884d955
pack mkldnn
azai91 Dec 11, 2018
7dfa87e
retrigger
azai91 Dec 11, 2018
409acd0
add linux artifacts
azai91 Dec 11, 2018
8422287
move libmkldnn in gpu cmake build
azai91 Dec 11, 2018
346a602
move libmkldnn and libiomp5 on gpu workspace
azai91 Dec 11, 2018
20741c4
move linked files
azai91 Dec 11, 2018
4e6b2ca
fix typo
azai91 Dec 11, 2018
992a2a0
fix typo
azai91 Dec 11, 2018
45fd008
add artifacts for tensorrt
azai91 Dec 11, 2018
7934cf1
move mkldnn lib in scala build
azai91 Dec 11, 2018
b40e996
move mkldnn lib on cpu scala
azai91 Dec 11, 2018
74e86e6
create dir for binding
azai91 Dec 11, 2018
5a18a8f
rename libmkldnn in scala
azai91 Dec 11, 2018
c0bd964
move mklml dep in scala builds
azai91 Dec 11, 2018
2dc1683
move mkl to another linked folder
azai91 Dec 11, 2018
4eb65df
move libmkl to another dir
azai91 Dec 12, 2018
ec5421d
add libmklml
azai91 Dec 12, 2018
75dd532
move mkldnn
azai91 Dec 12, 2018
2af09a8
move mkldnn on centos
azai91 Dec 12, 2018
76d842f
specify new dynamic path
azai91 Dec 12, 2018
103c9d1
retrigger
azai91 Dec 13, 2018
edc3bd1
merge from master
azai91 Dec 13, 2018
d510436
remove mkldnn dynamic lib
azai91 Dec 13, 2018
16cca19
remove moving mkldnn artifact
azai91 Dec 13, 2018
ab75373
add ld path
azai91 Dec 14, 2018
63821d4
retrigger
azai91 Dec 14, 2018
13bf7ae
Revert "remove moving mkldnn artifact"
azai91 Dec 14, 2018
935b1dc
Revert "remove mkldnn dynamic lib"
azai91 Dec 14, 2018
96482f7
merge from master
azai91 Dec 14, 2018
59bae57
update makefile
azai91 Dec 14, 2018
6d583df
Revert RPATH change and trigger CI
anirudh2290 Dec 18, 2018
37701b0
Merge branch 'master' of https://github.com/dmlc/mxnet into feature/m…
anirudh2290 Dec 19, 2018
83c36d5
correcting use-mkldnn flags for two tests
Dec 19, 2018
c94129a
mkldnn default on linux for starters
Dec 19, 2018
0220572
reverting naming rules of pack_lib
Dec 19, 2018
2384a90
adding mkldnn=0 flags to centos non mkldnn builds
Dec 19, 2018
377db81
adding mkldnn=0 flags to ubuntu gpu non mkldnn builds
Dec 19, 2018
365838d
removing mkldnn binary operation for ubuntu gpu cmake non mkldnn build
Dec 19, 2018
dfaef51
removing mkldnn binary operation for centos non-mkldnn unittest
Dec 19, 2018
9f7e869
adding explicit USE_MKLDNN=0 flags for clang builds
Dec 19, 2018
c1a5d2c
adding explicit USE_MKLDNN=0 flags for cpu ubuntu builds
Dec 19, 2018
3ec81a1
removing mkldnn binaries from non mkldnn builds scala gpu
Dec 19, 2018
2a3d362
adding explicit flag mkldnn=0 for tensorrt gpu build
Dec 19, 2018
bd9e55b
adding explicit flag mkldnn=0 for ubuntu cmake asan
Dec 19, 2018
bd55a1c
adding centos cpu mkldnn tests to CI
Dec 20, 2018
c68ccd0
adding CentOS GPU MKLDNN build and unittest
Dec 20, 2018
8c82763
not keeping mkldnn default for mac os
Dec 20, 2018
670c3ae
setting mkldnn default for x86_64 only
Dec 21, 2018
130ec16
running docs with mkldnn=0 flag
Dec 21, 2018
b7330cc
removing CentOS CPU Scala MKLDNN test
Dec 21, 2018
fe4b20e
setting mkldnn default for x86_64 only
Dec 22, 2018
38b3d66
not making mkldn default on windows
Dec 22, 2018
b554519
removing Centos MKLDNN tests from CI
Dec 26, 2018
f770f8a
retrigger
azai91 Dec 29, 2018
8da6078
Merge branch 'master' into mkldnn-default
azai91 Dec 29, 2018
28ba12c
retrigger
azai91 Dec 29, 2018
10e40a8
retrigger
azai91 Dec 30, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ mxnet_option(USE_F16C "Build with x86 F16C instruction support" ON)
mxnet_option(USE_LAPACK "Build with lapack support" ON)
mxnet_option(USE_MKL_IF_AVAILABLE "Use MKL if found" ON)
mxnet_option(USE_MKLML_MKL "Use MKLDNN variant of MKL (if MKL found)" ON IF USE_MKL_IF_AVAILABLE AND (NOT APPLE))
mxnet_option(USE_MKLDNN "Use MKLDNN variant of MKL (if MKL found)" ON IF USE_MKL_IF_AVAILABLE AND (NOT APPLE))
mxnet_option(USE_MKLDNN "Use MKLDNN variant of MKL (if MKL found)" ON IF USE_MKL_IF_AVAILABLE AND (NOT APPLE) AND (NOT MSVC) AND (CMAKE_SYSTEM_PROCESSOR MATCHES x86_64))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually CMAKE_SYSTEM_PROCESSOR will not work for cross compilation. You could reuse a variable CMAKE_CROSSCOMPILING for this as shown here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you suggest we check for
SYSTEM_ARCHITECTURE STREQUAL "x86_64" AND NOT CMAKE_CROSSCOMPILING
instead of
CMAKE_SYSTEM_PROCESSOR MATCHES x86_64?

Also, will CMAKE_HOST_SYSTEM_PROCESSOR MATCHES x86_64 help in case of cross compilation?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think SYSTEM_ARCHITECTURE STREQUAL "x86_64" AND NOT CMAKE_CROSSCOMPILING should work. But you need to add the trick for CMAKE_CROSSCOMPILING from here as well:

# workaround to store CMAKE_CROSSCOMPILING because is getting reset by the project command
if(CMAKE_CROSSCOMPILING)
  set(__CMAKE_CROSSCOMPILING ${CMAKE_CROSSCOMPILING})
  set(__CMAKE_CROSSCOMPILING_OVERRIDE ON)
endif()

project(mxnet C CXX)

 if(__CMAKE_CROSSCOMPILING_OVERRIDE)
  set(CMAKE_CROSSCOMPILING ${__CMAKE_CROSSCOMPILING})
endif()

Copy link
Contributor Author

@mseth10 mseth10 Jan 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lebeg I checked, CMAKE_SYSTEM_PROCESSOR works for cross compilation. CMAKE_CROSSCOMPILING is TRUE only for ARM v6, v7, v8, and for all these cases CMAKE_SYSTEM_PROCESSOR exists and CMAKE_SYSTEM_PROCESSOR MATCHES x86_64 returns FALSE. Hence, I don't think any change is needed. Please correct me if I am missing anything.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note the semantics of mxnet_option. If the condition is not satisfied, this option will be turned off ,not setting the default value off.

mxnet_option(USE_OPERATOR_TUNING "Enable auto-tuning of operators" ON IF NOT MSVC)
mxnet_option(USE_GPERFTOOLS "Build with GPerfTools support (if found)" ON)
mxnet_option(USE_JEMALLOC "Build with Jemalloc support" ON)
Expand Down Expand Up @@ -215,7 +215,7 @@ if(ENABLE_TESTCOVERAGE)
if(NOT GCOV_PATH)
message(FATAL_ERROR "gcov not found! Aborting...")
endif() # NOT GCOV_PATH

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} --coverage")
Expand Down
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ ifeq ($(OS),Windows_NT)
UNAME_S := Windows
else
UNAME_S := $(shell uname -s)
UNAME_P := $(shell uname -p)
endif

ifndef config
Expand Down Expand Up @@ -60,6 +61,16 @@ endif
# use customized config file
include $(config)

ifndef $(USE_MKLDNN)
mseth10 marked this conversation as resolved.
Show resolved Hide resolved
ifneq ($(UNAME_S), Darwin)
ifneq ($(UNAME_S), Windows)
ifeq ($(UNAME_P), x86_64)
USE_MKLDNN=1
endif
endif
endif
endif

ifeq ($(USE_MKL2017), 1)
$(warning "USE_MKL2017 is deprecated. We will switch to USE_MKLDNN.")
USE_MKLDNN=1
Expand Down
20 changes: 12 additions & 8 deletions ci/docker/runtime_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ build_centos7_cpu() {
ENABLE_TESTCOVERAGE=1 \
USE_LAPACK_PATH=/usr/lib64/liblapack.so \
USE_BLAS=openblas \
USE_MKLDNN=0 \
USE_DIST_KVSTORE=1 \
-j$(nproc)
}
Expand Down Expand Up @@ -320,7 +321,6 @@ build_centos7_mkldnn() {
ENABLE_TESTCOVERAGE=1 \
USE_LAPACK=1 \
USE_LAPACK_PATH=/usr/lib64/liblapack.so \
USE_MKLDNN=1 \
USE_BLAS=openblas \
-j$(nproc)
}
Expand All @@ -336,6 +336,7 @@ build_centos7_gpu() {
USE_LAPACK=1 \
USE_LAPACK_PATH=/usr/lib64/liblapack.so \
USE_BLAS=openblas \
USE_MKLDNN=0 \
USE_CUDA=1 \
USE_CUDA_PATH=/usr/local/cuda \
USE_CUDNN=1 \
Expand All @@ -358,6 +359,7 @@ build_ubuntu_cpu_openblas() {
ENABLE_TESTCOVERAGE=1 \
USE_CPP_PACKAGE=1 \
USE_BLAS=openblas \
USE_MKLDNN=0 \
USE_DIST_KVSTORE=1 \
-j$(nproc)
}
Expand All @@ -371,6 +373,7 @@ build_ubuntu_cpu_mkl() {
ENABLE_TESTCOVERAGE=1 \
USE_CPP_PACKAGE=1 \
USE_BLAS=mkl \
USE_MKLDNN=0 \
USE_INTEL_PATH=/opt/intel \
USE_DIST_KVSTORE=1 \
-j$(nproc)
Expand Down Expand Up @@ -410,6 +413,7 @@ build_ubuntu_cpu_cmake_asan() {
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DUSE_CUDA=OFF \
-DUSE_MKL_IF_AVAILABLE=OFF \
-DUSE_MKLDNN=OFF \
-DUSE_OPENMP=OFF \
-DUSE_OPENCV=OFF \
-DCMAKE_BUILD_TYPE=Debug \
Expand All @@ -436,6 +440,7 @@ build_ubuntu_cpu_clang39() {
ENABLE_TESTCOVERAGE=1 \
USE_CPP_PACKAGE=1 \
USE_BLAS=openblas \
USE_MKLDNN=0 \
USE_OPENMP=0 \
USE_DIST_KVSTORE=1 \
-j$(nproc)
Expand All @@ -453,6 +458,7 @@ build_ubuntu_cpu_clang60() {
ENABLE_TESTCOVERAGE=1 \
USE_CPP_PACKAGE=1 \
USE_BLAS=openblas \
USE_MKLDNN=0 \
USE_OPENMP=1 \
USE_DIST_KVSTORE=1 \
-j$(nproc)
Expand All @@ -472,6 +478,7 @@ build_ubuntu_cpu_clang_tidy() {
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DUSE_CUDA=OFF \
-DUSE_MKLDNN=OFF \
-DUSE_MKL_IF_AVAILABLE=OFF \
-DUSE_OPENCV=ON \
-DCMAKE_BUILD_TYPE=Debug \
Expand All @@ -497,7 +504,6 @@ build_ubuntu_cpu_clang39_mkldnn() {
ENABLE_TESTCOVERAGE=1 \
USE_CPP_PACKAGE=1 \
USE_BLAS=openblas \
USE_MKLDNN=1 \
USE_OPENMP=0 \
-j$(nproc)
}
Expand All @@ -514,7 +520,6 @@ build_ubuntu_cpu_clang60_mkldnn() {
ENABLE_TESTCOVERAGE=1 \
USE_CPP_PACKAGE=1 \
USE_BLAS=openblas \
USE_MKLDNN=1 \
USE_OPENMP=1 \
-j$(nproc)
}
Expand All @@ -529,7 +534,6 @@ build_ubuntu_cpu_mkldnn() {
ENABLE_TESTCOVERAGE=1 \
USE_CPP_PACKAGE=1 \
USE_BLAS=openblas \
USE_MKLDNN=1 \
-j$(nproc)
}

Expand All @@ -543,7 +547,6 @@ build_ubuntu_cpu_mkldnn_mkl() {
ENABLE_TESTCOVERAGE=1 \
USE_CPP_PACKAGE=1 \
USE_BLAS=mkl \
USE_MKLDNN=1 \
-j$(nproc)
}

Expand Down Expand Up @@ -603,6 +606,7 @@ build_ubuntu_gpu_tensorrt() {
USE_CUDA_PATH=/usr/local/cuda \
USE_CUDNN=1 \
USE_OPENCV=0 \
USE_MKLDNN=0 \
USE_DIST_KVSTORE=0 \
USE_TENSORRT=1 \
USE_JEMALLOC=0 \
Expand All @@ -622,7 +626,6 @@ build_ubuntu_gpu_mkldnn() {
ENABLE_TESTCOVERAGE=1 \
USE_CPP_PACKAGE=1 \
USE_BLAS=openblas \
USE_MKLDNN=1 \
USE_CUDA=1 \
USE_CUDA_PATH=/usr/local/cuda \
USE_CUDNN=1 \
Expand All @@ -639,7 +642,6 @@ build_ubuntu_gpu_mkldnn_nocudnn() {
DEV=1 \
ENABLE_TESTCOVERAGE=1 \
USE_BLAS=openblas \
USE_MKLDNN=1 \
USE_CUDA=1 \
USE_CUDA_PATH=/usr/local/cuda \
USE_CUDNN=0 \
Expand All @@ -655,6 +657,7 @@ build_ubuntu_gpu_cuda91_cudnn7() {
DEV=1 \
ENABLE_TESTCOVERAGE=1 \
USE_BLAS=openblas \
USE_MKLDNN=0 \
USE_CUDA=1 \
USE_CUDA_PATH=/usr/local/cuda \
USE_CUDNN=1 \
Expand Down Expand Up @@ -697,7 +700,6 @@ build_ubuntu_gpu_cmake_mkldnn() {
-DUSE_CUDA=1 \
-DUSE_CUDNN=1 \
-DUSE_MKLML_MKL=1 \
-DUSE_MKLDNN=1 \
-DCMAKE_BUILD_TYPE=Release \
-DCUDA_ARCH_NAME=Manual \
-DCUDA_ARCH_BIN=$CI_CMAKE_CUDA_ARCH_BIN \
Expand Down Expand Up @@ -911,6 +913,7 @@ unittest_ubuntu_cpu_julia06() {

# FIXME
export LD_PRELOAD='/usr/lib/x86_64-linux-gnu/libjemalloc.so'
export LD_LIBRARY_PATH=/work/mxnet/lib:$LD_LIBRARY_PATH

# use the prebuilt binary from $MXNET_HOME/lib
julia -e 'Pkg.build("MXNet")'
Expand Down Expand Up @@ -1236,6 +1239,7 @@ deploy_jl_docs() {

# FIXME
export LD_PRELOAD='/usr/lib/x86_64-linux-gnu/libjemalloc.so'
export LD_LIBRARY_PATH=/work/mxnet/lib:$LD_LIBRARY_PATH

# use the prebuilt binary from $MXNET_HOME/lib
julia -e 'Pkg.build("MXNet")'
Expand Down
2 changes: 1 addition & 1 deletion ci/jenkins/Jenkins_steps.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def compile_centos7_cpu_mkldnn() {
timeout(time: max_time, unit: 'MINUTES') {
utils.init_git()
utils.docker_run('centos7_cpu', 'build_centos7_mkldnn', false)
utils.pack_lib('centos7_mkldnn', mx_lib, true)
utils.pack_lib('centos7_mkldnn', mx_mkldnn_lib, true)
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions docs/mxdoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ def generate_doxygen(app):
def build_mxnet(app):
"""Build mxnet .so lib"""
if not os.path.exists(os.path.join(app.builder.srcdir, '..', 'config.mk')):
_run_cmd("cd %s/.. && cp make/config.mk config.mk && make -j$(nproc) DEBUG=1" %
_run_cmd("cd %s/.. && cp make/config.mk config.mk && make -j$(nproc) DEBUG=1 USE_MKLDNN=0" %
app.builder.srcdir)
else:
_run_cmd("cd %s/.. && make -j$(nproc) DEBUG=1" %
_run_cmd("cd %s/.. && make -j$(nproc) DEBUG=1 USE_MKLDNN=0" %
app.builder.srcdir)

def build_r_docs(app):
Expand Down