Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
23 changes: 3 additions & 20 deletions MKLDNN_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

```
Expand All @@ -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
Expand All @@ -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.*

<h2 id="3">Windows</h2>

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/).
Expand Down
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,7 @@ else
endif

ifeq ($(USE_OPENMP), 1)
ifneq ($(UNAME_S), Darwin)
CFLAGS += -fopenmp
endif
CFLAGS += -fopenmp
endif

ifeq ($(USE_NNPACK), 1)
Expand Down
12 changes: 11 additions & 1 deletion docs/install/osx_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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```.

Expand Down
1 change: 1 addition & 0 deletions make/osx.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down