From 2cf7219c56603a7d1bd0a4587ee60891fab21a73 Mon Sep 17 00:00:00 2001 From: Tao Lv Date: Wed, 15 Apr 2020 14:13:50 +0800 Subject: [PATCH] [v1.x] Update 3rdparty/mkldnn remote URL and pin to v1.3 (#17972) (#18033) * Update 3rdparty/mkldnn remote URL and pin to v1.3 (#17972) * update onednn remote url * checkout onednn v1.3 release * fix format test * make test Conflicts: .gitmodules 3rdparty/mkldnn tests/cpp/operator/mkldnn_test.cc * build flag * upgrade cmake --- .gitmodules | 3 +-- 3rdparty/mkldnn | 2 +- CMakeLists.txt | 1 + ci/docker/install/centos7_core.sh | 15 ++++++++++++++- mkldnn.mk | 1 + tests/cpp/operator/mkldnn_test.cc | 2 +- tests/cpp/unittest.mk | 7 ++++++- 7 files changed, 25 insertions(+), 6 deletions(-) diff --git a/.gitmodules b/.gitmodules index 1900820d4c86..b215ed430d14 100644 --- a/.gitmodules +++ b/.gitmodules @@ -15,8 +15,7 @@ url = https://github.com/google/googletest.git [submodule "3rdparty/mkldnn"] path = 3rdparty/mkldnn - url = https://github.com/intel/mkl-dnn.git - branch = master + url = https://github.com/oneapi-src/oneDNN.git [submodule "3rdparty/tvm"] path = 3rdparty/tvm url = https://github.com/apache/incubator-tvm.git diff --git a/3rdparty/mkldnn b/3rdparty/mkldnn index cb2cc7ac17ff..07579e6c0c68 160000 --- a/3rdparty/mkldnn +++ b/3rdparty/mkldnn @@ -1 +1 @@ -Subproject commit cb2cc7ac17ff4e2ef50805c7048d33256d82be4d +Subproject commit 07579e6c0c6839a390a6f3040e05a2b2c71e628a diff --git a/CMakeLists.txt b/CMakeLists.txt index 4731663281d4..77a7e0e88db6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -284,6 +284,7 @@ if(USE_MKLDNN) set(MKLDNN_ARCH_OPT_FLAGS "" CACHE INTERNAL "" FORCE) set(MKLDNN_ENABLE_JIT_PROFILING OFF CACHE INTERNAL "" FORCE) set(MKLDNN_LIBRARY_TYPE STATIC CACHE INTERNAL "" FORCE) + set(DNNL_ENABLE_CONCURRENT_EXEC ON CACHE INTERNAL "" FORCE) if(NOT USE_OPENMP) set(MKLDNN_CPU_RUNTIME SEQ CACHE INTERNAL "" FORCE) diff --git a/ci/docker/install/centos7_core.sh b/ci/docker/install/centos7_core.sh index 577f9dba7439..fbdb239cf0c2 100755 --- a/ci/docker/install/centos7_core.sh +++ b/ci/docker/install/centos7_core.sh @@ -30,10 +30,23 @@ yum -y install atlas-devel # Provide clbas headerfiles yum -y install openblas-devel yum -y install lapack-devel yum -y install opencv-devel +yum -y install protobuf-compiler +yum -y install protobuf-devel +yum -y install zeromq-devel yum -y install openssl-devel yum -y install gcc-c++-4.8.* yum -y install make -yum -y install cmake yum -y install wget yum -y install unzip yum -y install ninja-build + +# Centos 7 only provides ninja-build +ln -s /usr/bin/ninja-build /usr/bin/ninja + +# CMake 3.13.2+ is required +mkdir /opt/cmake && cd /opt/cmake +wget -nv https://cmake.org/files/v3.13/cmake-3.13.5-Linux-x86_64.sh +sh cmake-3.13.5-Linux-x86_64.sh --prefix=/opt/cmake --skip-license +ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake +rm cmake-3.13.5-Linux-x86_64.sh +cmake --version diff --git a/mkldnn.mk b/mkldnn.mk index 056cb4e51051..a22a64a018a8 100644 --- a/mkldnn.mk +++ b/mkldnn.mk @@ -31,6 +31,7 @@ mkldnn_FLAGS += -DMKLDNN_BUILD_TESTS=OFF mkldnn_FLAGS += -DMKLDNN_BUILD_EXAMPLES=OFF mkldnn_FLAGS += -DMKLDNN_ENABLE_JIT_PROFILING=OFF mkldnn_FLAGS += -DMKLDNN_LIBRARY_TYPE=STATIC +mkldnn_FLAGS += -DDNNL_ENABLE_CONCURRENT_EXEC=ON ifneq ($(USE_OPENMP), 1) mkldnn_FLAGS += -DMKLDNN_CPU_RUNTIME=SEQ diff --git a/tests/cpp/operator/mkldnn_test.cc b/tests/cpp/operator/mkldnn_test.cc index bcdb38ac4aa8..973c398026a7 100644 --- a/tests/cpp/operator/mkldnn_test.cc +++ b/tests/cpp/operator/mkldnn_test.cc @@ -100,7 +100,7 @@ static void VerifyDefMem(const mkldnn::memory &mem) { TEST(MKLDNN_UTIL_FUNC, MemFormat) { // Check whether the number of format is correct. - CHECK_EQ(mkldnn_format_tag_last, 131); + CHECK_EQ(mkldnn_format_tag_last, 154); CHECK_EQ(mkldnn_nchw, 5); CHECK_EQ(mkldnn_oihw, 5); } diff --git a/tests/cpp/unittest.mk b/tests/cpp/unittest.mk index 56d13850472a..2c674b9ec9d7 100644 --- a/tests/cpp/unittest.mk +++ b/tests/cpp/unittest.mk @@ -34,6 +34,11 @@ TEST_CFLAGS += -I/usr/local/include/breakpad TEST_LDFLAGS += -lbreakpad_client -lbreakpad endif +TEST_LIB_DEP = gtest.a +ifeq ($(USE_MKLDNN), 1) + TEST_LIB_DEP += $(MKLDNNROOT)/lib/libdnnl.a +endif + .PHONY: runtest testclean gtest-all.o : $(GTEST_SRCS_) @@ -67,7 +72,7 @@ build/tests/cpp/thread_safety/%.o : tests/cpp/thread_safety/%.cc | mkldnn $(CXX) -std=c++11 $(TEST_CFLAGS) $(TEST_CPPFLAGS) -I$(GTEST_INC) -MM -MT tests/cpp/thread_safety/$* $< > build/tests/cpp/thread_safety/$*.d $(CXX) -c -std=c++11 $(TEST_CFLAGS) $(TEST_CPPFLAGS) -I$(GTEST_INC) -o build/tests/cpp/thread_safety/$*.o $(filter %.cc %.a, $^) -$(TEST): $(TEST_OBJ) lib/libmxnet.so gtest.a +$(TEST): $(TEST_OBJ) lib/libmxnet.so $(TEST_LIB_DEP) $(CXX) -std=c++11 $(TEST_CFLAGS) -I$(GTEST_INC) -o $@ $^ $(TEST_LDFLAGS) runtest: $(TEST)