Skip to content

Commit

Permalink
Making MKL-DNN default on MXNet master (apache#13681)
Browse files Browse the repository at this point in the history
* mkldnn is default makefile and explicitly turn off for buidls

* add endif

* retrigger

* retrigger

* build mkldnn as static lib

* update makefile to statically build mkldnn

* build static mkldnn

* fix static name

* fix static name

* update static for mac

* rename mkldnn dep in ci

* remove moving mkldnn dynamic lib

* retrigger

* remove commented code

* retrigger

* remove mkldnn dnaymic for unitest

* retrigger

* retrigger

* force static for mkldnn lib

* turn of mkldnn on arm builds

* remove dynamic mkldnn bind

* update jenkins to use only mkldnn

* remove last flag

* turn mkldnn by default on mac

* move mkldnn files for GPU MKLDNN build

* copy lib mxnet in gpu build

* only link windows

* add mkldnn.mk

* try force linking

* retrigger

* retrigger

* remove mkldnn dynanmic check

* use ifndef

* remove test mkldnn install

* fix spacing

* fix index

* remove cp of mkldnn since statically linked

* add libmkldnn.a to list of files to pack

* include mkl_ml

* add mkldnn to pack

* add libiomp to ci pack

* move static libs

* fix typo

* pack mkldnn

* retrigger

* add linux artifacts

* move libmkldnn in gpu cmake build

* move libmkldnn and libiomp5 on gpu workspace

* move linked files

* fix typo

* fix typo

* add artifacts for tensorrt

* move mkldnn lib in scala build

* move mkldnn lib on cpu scala

* create dir for binding

* rename libmkldnn in scala

* move mklml dep in scala builds

* move mkl to another linked folder

* move libmkl to another dir

* add libmklml

* move mkldnn

* move mkldnn on centos

* specify new dynamic path

* retrigger

* remove mkldnn dynamic lib

* remove moving mkldnn artifact

* add ld path

* retrigger

* Revert "remove moving mkldnn artifact"

This reverts commit 16cca19.

* Revert "remove mkldnn dynamic lib"

This reverts commit d510436.

* update makefile

* Revert RPATH change and trigger CI

* correcting use-mkldnn flags for two tests

* mkldnn default on linux for starters

* reverting naming rules of pack_lib

* adding mkldnn=0 flags to centos non mkldnn builds

* adding mkldnn=0 flags to ubuntu gpu non mkldnn builds

* removing mkldnn binary operation for ubuntu gpu cmake non mkldnn build

* removing mkldnn binary operation for centos non-mkldnn unittest

* adding explicit USE_MKLDNN=0 flags for clang builds

* adding explicit USE_MKLDNN=0 flags for cpu ubuntu builds

* removing mkldnn binaries from non mkldnn builds scala gpu

* adding explicit flag mkldnn=0 for tensorrt gpu build

* adding explicit flag mkldnn=0 for ubuntu cmake asan

* adding centos cpu mkldnn tests to CI

* adding CentOS GPU MKLDNN build and unittest

* not keeping mkldnn default for mac os

* setting mkldnn default for x86_64 only

* running docs with mkldnn=0 flag

* removing CentOS CPU Scala MKLDNN test

* setting mkldnn default for x86_64 only

* not making mkldn default on windows

* removing Centos MKLDNN tests from CI

* retrigger

* retrigger

* retrigger
  • Loading branch information
mseth10 authored and rondogency committed Jan 9, 2019
1 parent 0d2948f commit b268cfc
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 13 deletions.
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))
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)
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

0 comments on commit b268cfc

Please sign in to comment.