Skip to content

Instantly share code, notes, and snippets.

@corenel
Last active January 16, 2018 21:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save corenel/6dd5e1599fa14337c9910c4e4fab2597 to your computer and use it in GitHub Desktop.
Save corenel/6dd5e1599fa14337c9910c4e4fab2597 to your computer and use it in GitHub Desktop.
Install MXNet on macOS High Sierra 10.13.2 with GTX1080Ti, CUDA 9.1 and cuDNN 7
  1. Since CUDA 9.1 doesn't support LLVM 9.0.0, you need to install Xcode 8.3.2 with LLVM 8.1.0 for compiling CUDA programs.
  2. Select Xcode 8.3.2 for Command Line Tools in Xcode. (Or use xcode-select)
  3. Clone MXNet
$ https://github.com/apache/incubator-mxnet.git --recursive
$ cd incubator-mxnet
  1. Configure:
  • use default config for macOS:
$ cp make/osx.mk config.mk
  • Give only one KNOWN_CUDA_ARCHS to spped up compiling:
diff --git a/Makefile b/Makefile
index 8584ab65..0b6e4792 100644
--- a/Makefile
+++ b/Makefile
@@ -254,7 +254,8 @@ endif
 # be JIT-compiled by the updated driver from the included PTX.
 ifeq ($(USE_CUDA), 1)
 ifeq ($(CUDA_ARCH),)
-       KNOWN_CUDA_ARCHS := 30 35 50 52 60 61 70
+       # KNOWN_CUDA_ARCHS := 30 35 50 52 60 61 70
+       KNOWN_CUDA_ARCHS := 61
        # Run nvcc on a zero-length file to check architecture-level support.
        # Create args to include SASS in the fat binary for supported levels.
        CUDA_ARCH := $(foreach arch,$(KNOWN_CUDA_ARCHS), \
  1. Compile
$ make -j4 USE_OPENCV=1 USE_CUDA=1 USE_CUDA_PATH=/usr/local/cuda USE_CUDNN=1
  1. Install
$ cd python
$ pip3 install --upgrade pip
$ pip3 install -e .
  1. Validate
>>> import mxnet as mx
>>> a = mx.nd.ones((2, 3), mx.gpu())
>>> b = a * 2 + 1
>>> b.asnumpy()
array([[ 3.,  3.,  3.],
       [ 3.,  3.,  3.]], dtype=float32)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment