From 759c1d79368b8422955c06f339ff1f26cfb3d779 Mon Sep 17 00:00:00 2001 From: Alexander Zai Date: Tue, 2 Oct 2018 12:00:52 -0700 Subject: [PATCH 1/8] remove guard that prevent omp flag in mac --- MKLDNN_README.md | 14 -------------- Makefile | 4 +--- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/MKLDNN_README.md b/MKLDNN_README.md index 43cced49ed0d..ec545ba8ad37 100644 --- a/MKLDNN_README.md +++ b/MKLDNN_README.md @@ -70,20 +70,6 @@ git clone --recursive https://github.com/apache/incubator-mxnet.git cd incubator-mxnet ``` -### Enable OpenMP for MacOS - -If you want to enable OpenMP for better performance, you should modify the Makefile in MXNet root dictionary: - -Add CFLAGS '-fopenmp' for Darwin. - -``` -ifeq ($(USE_OPENMP), 1) -# ifneq ($(UNAME_S), Darwin) - CFLAGS += -fopenmp -# endif -endif -``` - ### Build MXNet with MKL-DNN ``` diff --git a/Makefile b/Makefile index 69b25daa9d1c..52f70822eb7d 100644 --- a/Makefile +++ b/Makefile @@ -145,9 +145,7 @@ else endif ifeq ($(USE_OPENMP), 1) - ifneq ($(UNAME_S), Darwin) - CFLAGS += -fopenmp - endif + CFLAGS += -fopenmp endif ifeq ($(USE_NNPACK), 1) From 7d2be0a21737d12ea6880b9ce1816925e7551e0a Mon Sep 17 00:00:00 2001 From: Alexander Zai Date: Wed, 3 Oct 2018 11:52:58 -0700 Subject: [PATCH 2/8] udpate doc for mac make build --- make/osx.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/make/osx.mk b/make/osx.mk index 47f395bccf97..00acdd6458a2 100644 --- a/make/osx.mk +++ b/make/osx.mk @@ -77,6 +77,7 @@ USE_CUDNN = 0 USE_OPENCV = 1 # use openmp for parallelization +# apple-clang by default does not have openmp built-in USE_OPENMP = 0 # choose the version of blas you want to use From e7319cfd1f1dbfec30295fc2784efda8c07e102a Mon Sep 17 00:00:00 2001 From: Alexander Zai Date: Thu, 11 Oct 2018 13:16:29 -0700 Subject: [PATCH 3/8] update docs --- MKLDNN_README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/MKLDNN_README.md b/MKLDNN_README.md index ec545ba8ad37..015d6f7074d3 100644 --- a/MKLDNN_README.md +++ b/MKLDNN_README.md @@ -45,7 +45,7 @@ If you don't have full [MKL](https://software.intel.com/en-us/intel-mkl) library Install the dependencies, required for MXNet, with the following commands: - [Homebrew](https://brew.sh/) -- gcc (clang in macOS does not support OpenMP) +- llvm (clang in macOS does not support OpenMP) - OpenCV (for computer vision operations) ``` @@ -59,8 +59,7 @@ brew install graphviz brew tap homebrew/core brew install opencv brew tap homebrew/versions -brew install gcc49 -brew link gcc49 #gcc-5 and gcc-7 also work +brew install llvm ``` ### Clone MXNet sources @@ -73,7 +72,7 @@ cd incubator-mxnet ### Build MXNet with MKL-DNN ``` -make -j $(sysctl -n hw.ncpu) CC=gcc-4.9 CXX=g++-4.9 USE_OPENCV=0 USE_OPENMP=1 USE_MKLDNN=1 USE_BLAS=apple USE_PROFILER=1 +make -j $(sysctl -n hw.ncpu) CC=$(brew --prefix llvm)/bin/clang++ CXX=$(brew --prefix llvm)/bin/clang++ USE_OPENCV=0 USE_OPENMP=1 USE_MKLDNN=1 USE_BLAS=apple USE_PROFILER=1 ``` *Note: Temporarily disable OPENCV.* From bfbbb941b2bc73a1151912522fa96bc6607cc556 Mon Sep 17 00:00:00 2001 From: Alexander Zai Date: Thu, 11 Oct 2018 13:40:24 -0700 Subject: [PATCH 4/8] update readme --- MKLDNN_README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MKLDNN_README.md b/MKLDNN_README.md index 015d6f7074d3..eb182ed9fa94 100644 --- a/MKLDNN_README.md +++ b/MKLDNN_README.md @@ -72,7 +72,7 @@ cd incubator-mxnet ### Build MXNet with MKL-DNN ``` -make -j $(sysctl -n hw.ncpu) CC=$(brew --prefix llvm)/bin/clang++ CXX=$(brew --prefix llvm)/bin/clang++ USE_OPENCV=0 USE_OPENMP=1 USE_MKLDNN=1 USE_BLAS=apple USE_PROFILER=1 +LIBRARY_PATH=$(brew --prefix llvm)/lib/ make -j $(sysctl -n hw.ncpu) CC=$(brew --prefix llvm)/bin/clang++ CXX=$(brew --prefix llvm)/bin/clang++ USE_OPENCV=0 USE_OPENMP=1 USE_MKLDNN=1 USE_BLAS=apple USE_PROFILER=1 ``` *Note: Temporarily disable OPENCV.* From a162f2aa14bd26255bc4c59b14571c47c690c7e3 Mon Sep 17 00:00:00 2001 From: Alexander Zai Date: Fri, 12 Oct 2018 15:01:53 -0700 Subject: [PATCH 5/8] set opencv to 1 in instructions --- MKLDNN_README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MKLDNN_README.md b/MKLDNN_README.md index eb182ed9fa94..02385a5c1c16 100644 --- a/MKLDNN_README.md +++ b/MKLDNN_README.md @@ -72,7 +72,7 @@ cd incubator-mxnet ### Build MXNet with MKL-DNN ``` -LIBRARY_PATH=$(brew --prefix llvm)/lib/ make -j $(sysctl -n hw.ncpu) CC=$(brew --prefix llvm)/bin/clang++ CXX=$(brew --prefix llvm)/bin/clang++ USE_OPENCV=0 USE_OPENMP=1 USE_MKLDNN=1 USE_BLAS=apple USE_PROFILER=1 +LIBRARY_PATH=$(brew --prefix llvm)/lib/ make -j $(sysctl -n hw.ncpu) CC=$(brew --prefix llvm)/bin/clang++ CXX=$(brew --prefix llvm)/bin/clang++ USE_OPENCV=1 USE_OPENMP=1 USE_MKLDNN=1 USE_BLAS=apple USE_PROFILER=1 ``` *Note: Temporarily disable OPENCV.* From e338f961b764ff6c05bce7813f50490a0fa412e0 Mon Sep 17 00:00:00 2001 From: Alexander Zai Date: Fri, 12 Oct 2018 15:12:36 -0700 Subject: [PATCH 6/8] remove disable opencv line --- MKLDNN_README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/MKLDNN_README.md b/MKLDNN_README.md index 02385a5c1c16..9da2eee297a2 100644 --- a/MKLDNN_README.md +++ b/MKLDNN_README.md @@ -75,8 +75,6 @@ cd incubator-mxnet LIBRARY_PATH=$(brew --prefix llvm)/lib/ make -j $(sysctl -n hw.ncpu) CC=$(brew --prefix llvm)/bin/clang++ CXX=$(brew --prefix llvm)/bin/clang++ USE_OPENCV=1 USE_OPENMP=1 USE_MKLDNN=1 USE_BLAS=apple USE_PROFILER=1 ``` -*Note: Temporarily disable OPENCV.* -

Windows

We recommend to build and install MXNet yourself using [Microsoft Visual Studio 2015](https://www.visualstudio.com/vs/older-downloads/), or you can also try experimentally the latest [Microsoft Visual Studio 2017](https://www.visualstudio.com/downloads/). From 4592a3b6256097e35979d5df9fb0d92e4472bd8c Mon Sep 17 00:00:00 2001 From: Alexander Zai Date: Fri, 12 Oct 2018 15:23:46 -0700 Subject: [PATCH 7/8] update mac docs --- docs/install/osx_setup.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/install/osx_setup.md b/docs/install/osx_setup.md index 53039252888d..9b2f494490cd 100644 --- a/docs/install/osx_setup.md +++ b/docs/install/osx_setup.md @@ -65,6 +65,10 @@ Install the dependencies, required for MXNet, with the following commands: brew install openblas brew tap homebrew/core brew install opencv + + # If building with MKLDNN + brew install llvm + # Get pip easy_install pip # For visualization of network graphs @@ -89,12 +93,18 @@ The file called ```osx.mk``` has the configuration required for building MXNet o make -j$(sysctl -n hw.ncpu) ``` +To build with MKLDNN + +```bash +LIBRARY_PATH=$(brew --prefix llvm)/lib/ make -j $(sysctl -n hw.ncpu) CC=$(brew --prefix llvm)/bin/clang++ CXX=$(brew --prefix llvm)/bin/clang++ USE_OPENCV=1 USE_OPENMP=1 USE_MKLDNN=1 USE_BLAS=apple USE_PROFILER=1 +``` + If building with ```GPU``` support, add the following configuration to config.mk and build: ```bash echo "USE_CUDA = 1" >> ./config.mk echo "USE_CUDA_PATH = /usr/local/cuda" >> ./config.mk echo "USE_CUDNN = 1" >> ./config.mk - make + make -j$(sysctl -n hw.ncpu) ``` **Note:** To change build parameters, edit ```config.mk```. From 874c8f9798b2886e37d462a22f72f39b5cc49ffe Mon Sep 17 00:00:00 2001 From: Alexander Zai Date: Mon, 15 Oct 2018 13:57:20 -0700 Subject: [PATCH 8/8] fix indent --- docs/install/osx_setup.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/install/osx_setup.md b/docs/install/osx_setup.md index 9b2f494490cd..9355dbed715f 100644 --- a/docs/install/osx_setup.md +++ b/docs/install/osx_setup.md @@ -65,10 +65,10 @@ Install the dependencies, required for MXNet, with the following commands: brew install openblas brew tap homebrew/core brew install opencv - + # If building with MKLDNN - brew install llvm - + brew install llvm + # Get pip easy_install pip # For visualization of network graphs