diff --git a/MKLDNN_README.md b/MKLDNN_README.md index 43cced49ed0d..9da2eee297a2 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 @@ -70,28 +69,12 @@ 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 ``` -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 +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/). diff --git a/Makefile b/Makefile index fe2df2c20afa..ab19607a5aa3 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) diff --git a/docs/install/osx_setup.md b/docs/install/osx_setup.md index 53039252888d..9355dbed715f 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```. diff --git a/make/osx.mk b/make/osx.mk index 5653b3924351..3e2e592323f4 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