From 2f2f24e5ae2f07167acfcb27274b0d46134812d2 Mon Sep 17 00:00:00 2001 From: Zach Kimberg Date: Wed, 21 Nov 2018 13:42:27 -0800 Subject: [PATCH 1/6] Always use config.mk in make install instructions --- docs/install/build_from_source.md | 38 ++++++++++++++++++++++++------- docs/install/c_plus_plus.md | 6 ++++- docs/install/osx_setup.md | 9 +++++++- docs/install/ubuntu_setup.md | 20 ++++++++++++---- 4 files changed, 59 insertions(+), 14 deletions(-) diff --git a/docs/install/build_from_source.md b/docs/install/build_from_source.md index e41b1d0f1804..ba51e5fec772 100644 --- a/docs/install/build_from_source.md +++ b/docs/install/build_from_source.md @@ -214,7 +214,7 @@ It is recommended to set environment variable NCCL_LAUNCH_MODE to PARALLEL when For example, you can specify using all cores on Linux as follows: ```bash -cmake -j$(nproc) +cmake -j $(nproc) . ``` @@ -222,28 +222,44 @@ cmake -j$(nproc) * Build MXNet with `cmake` and install with MKL DNN, GPU, and OpenCV support: ```bash -cmake -j USE_CUDA=1 USE_CUDA_PATH=/usr/local/cuda USE_CUDNN=1 USE_MKLDNN=1 +echo "USE_OPENCV = 1" >> ./config.mk +echo "USE_CUDA = 1" >> ./config.mk +echo "USE_CUDA_PATH = /usr/local/cuda" >> ./config.mk +echo "USE_CUDNN = 1" >> ./config.mk +echo "USE_MKLDNN = 1" >> ./config.mk +cmake -j $(nproc) USE_CUDA=1 USE_CUDA_PATH=/usr/local/cuda USE_CUDNN=1 USE_MKLDNN=1 . ``` #### Recommended for Systems with NVIDIA GPUs * Build with both OpenBLAS, GPU, and OpenCV support: ```bash -cmake -j BLAS=open USE_CUDA=1 USE_CUDA_PATH=/usr/local/cuda USE_CUDNN=1 +echo "USE_BLAS = openblas" >> ./config.mk +echo "USE_OPENCV = 1" >> ./config.mk +echo "USE_CUDA = 1" >> ./config.mk +echo "USE_CUDA_PATH = /usr/local/cuda" >> ./config.mk +echo "USE_CUDNN = 1" >> ./config.mk +cmake -j $(nproc) BLAS=open USE_CUDA=1 USE_CUDA_PATH=/usr/local/cuda USE_CUDNN=1 . ``` #### Recommended for Systems with Intel CPUs * Build MXNet with `cmake` and install with MKL DNN, and OpenCV support: ```bash -cmake -j USE_CUDA=0 USE_MKLDNN=1 +echo "USE_CUDA = 0" >> ./config.mk +echo "USE_OPENCV = 1" >> ./config.mk +echo "USE_MKLDNN = 1" >> ./config.mk +cmake -j $(nproc) USE_CUDA=0 USE_MKLDNN=1 . ``` #### Recommended for Systems with non-Intel CPUs * Build MXNet with `cmake` and install with OpenBLAS and OpenCV support: ```bash -cmake -j USE_CUDA=0 BLAS=open +echo "USE_BLAS = openblas" >> ./config.mk +echo "USE_OPENCV = 1" >> ./config.mk +echo "USE_CUDA = 0" >> ./config.mk +cmake -j $(nproc) USE_CUDA=0 BLAS=open . ``` #### Other Examples @@ -251,20 +267,26 @@ cmake -j USE_CUDA=0 BLAS=open * Build without using OpenCV: ```bash -cmake USE_OPENCV=0 +echo "USE_OPENCV = 0" >> ./config.mk +cmake -j $(nproc) USE_OPENCV=0 . ``` * Build on **macOS** with the default BLAS library (Apple Accelerate) and Clang installed with `xcode` (OPENMP is disabled because it is not supported by the Apple version of Clang): ```bash -cmake -j BLAS=apple USE_OPENCV=0 USE_OPENMP=0 +echo "USE_BLAS = openblas" >> ./config.mk +echo "USE_OPENCV = 0" >> ./config.mk +echo "USE_OPENMP = 0" >> ./config.mk +cmake -j $(sysctl -n hw.ncpu) BLAS=apple USE_OPENCV=0 USE_OPENMP=0 . ``` * To use OpenMP on **macOS** you need to install the Clang compiler, `llvm` (the one provided by Apple does not support OpenMP): ```bash brew install llvm -cmake -j BLAS=apple USE_OPENMP=1 +echo "USE_BLAS = openblas" >> ./config.mk +echo "USE_OPENMP = 1" >> ./config.mk +cmake -j $(sysctl -n hw.ncpu) BLAS=apple USE_OPENMP=1 . ```
diff --git a/docs/install/c_plus_plus.md b/docs/install/c_plus_plus.md index 6078877c27c8..b66ee7d0b80a 100644 --- a/docs/install/c_plus_plus.md +++ b/docs/install/c_plus_plus.md @@ -6,7 +6,11 @@ To enable C++ package, just add `USE_CPP_PACKAGE=1` in the [build from source](b For example to build MXNet with GPU support and the C++ package, OpenCV, and OpenBLAS, from the project root you would run: ```bash -make -j USE_CPP_PACKAGE=1 USE_OPENCV=1 USE_BLAS=openblas USE_CUDA=1 +echo "USE_CPP_PACKAGE=1" >> ./config.mk +echo "USE_OPENCV=1" >> ./config.mk +echo "USE_BLAS=openblas" >> ./config.mk +echo "USE_CUDA=1" >> ./config.mk +make -j $(nproc) ``` You may also want to add the MXNet shared library to your `LD_LIBRARY_PATH`: diff --git a/docs/install/osx_setup.md b/docs/install/osx_setup.md index 4e9293efce93..a2b59fe03618 100644 --- a/docs/install/osx_setup.md +++ b/docs/install/osx_setup.md @@ -96,7 +96,14 @@ The file called ```osx.mk``` has the configuration required for building MXNet o 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 +echo "CC=$(brew --prefix llvm)/bin/clang++" >> ./config.mk +echo "CXX=$(brew --prefix llvm)/bin/clang++" >> ./config.mk +echo "USE_OPENCV=1" >> ./config.mk +echo "USE_OPENMP=1" >> ./config.mk +echo "USE_MKLDNN=1" >> ./config.mk +echo "USE_BLAS=apple" >> ./config.mk +echo "USE_PROFILER=1" >> ./config.mk +LIBRARY_PATH=$(brew --prefix llvm)/lib/ make -j $(sysctl -n hw.ncpu) ``` If building with ```GPU``` support, add the following configuration to config.mk and build: diff --git a/docs/install/ubuntu_setup.md b/docs/install/ubuntu_setup.md index 538d38dbb267..31612fc30f9a 100644 --- a/docs/install/ubuntu_setup.md +++ b/docs/install/ubuntu_setup.md @@ -165,7 +165,9 @@ If building on CPU and using OpenBLAS: ```bash git clone --recursive /~https://github.com/apache/incubator-mxnet.git cd incubator-mxnet - make -j $(nproc) USE_OPENCV=1 USE_BLAS=openblas + echo "USE_OPENCV = 1" >> ./config.mk + echo "USE_BLAS = openblas" >> ./config.mk + make -j $(nproc) ``` If building on CPU and using MKL and MKL-DNN (make sure MKL is installed according to [Math Library Selection](build_from_source.html#math-library-selection) and [MKL-DNN README](/~https://github.com/apache/incubator-mxnet/blob/master/MKLDNN_README.md)): @@ -173,7 +175,10 @@ If building on CPU and using MKL and MKL-DNN (make sure MKL is installed accordi ```bash git clone --recursive /~https://github.com/apache/incubator-mxnet.git cd incubator-mxnet - make -j $(nproc) USE_OPENCV=1 USE_BLAS=mkl USE_MKLDNN=1 + echo "USE_OPENCV = 1" >> ./config.mk + echo "USE_BLAS = openblas" >> ./config.mk + echo "USE_MKLDNN = 1" >> ./config.mk + make -j $(nproc) ``` If building on GPU and you want OpenCV and OpenBLAS (make sure you have installed the [CUDA dependencies first](#cuda-dependencies)): @@ -181,7 +186,12 @@ If building on GPU and you want OpenCV and OpenBLAS (make sure you have installe ```bash git clone --recursive /~https://github.com/apache/incubator-mxnet.git cd incubator-mxnet - make -j $(nproc) USE_OPENCV=1 USE_BLAS=openblas USE_CUDA=1 USE_CUDA_PATH=/usr/local/cuda USE_CUDNN=1 + echo "USE_OPENCV = 1" >> ./config.mk + echo "USE_BLAS = openblas" >> ./config.mk + echo "USE_CUDA = 1" >> ./config.mk + echo "USE_CUDA_PATH = /usr/local/cuda" >> ./config.mk + echo "USE_CUDNN = 1" >> ./config.mk + make -j $(nproc) ``` *Note* - USE_OPENCV and USE_BLAS are make file flags to set compilation options to use OpenCV and BLAS library. You can explore and use more compilation options in `make/config.mk` and also review common [usage examples](build_from_source.html#usage-examples). @@ -351,7 +361,9 @@ $ sudo apt-get install -y libopencv-dev ```bash $ git clone --recursive /~https://github.com/apache/incubator-mxnet $ cd incubator-mxnet -$ make -j $(nproc) USE_OPENCV=1 USE_BLAS=openblas +$ echo "USE_OPENCV = 1" >> ./config.mk +$ echo "USE_BLAS = openblas" >> ./config.mk +$ make -j $(nproc) ``` *Note* - USE_OPENCV and USE_BLAS are make file flags to set compilation options to use OpenCV and BLAS library. You can explore and use more compilation options in `make/config.mk`. From d2970bb92e20ad00f448de37640a059087649fe0 Mon Sep 17 00:00:00 2001 From: Zach Kimberg Date: Tue, 27 Nov 2018 17:49:35 -0800 Subject: [PATCH 2/6] Specify Cuda 0 for ubuntu with mkldnn --- docs/install/ubuntu_setup.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/install/ubuntu_setup.md b/docs/install/ubuntu_setup.md index 31612fc30f9a..f54da6170a3d 100644 --- a/docs/install/ubuntu_setup.md +++ b/docs/install/ubuntu_setup.md @@ -177,6 +177,7 @@ If building on CPU and using MKL and MKL-DNN (make sure MKL is installed accordi cd incubator-mxnet echo "USE_OPENCV = 1" >> ./config.mk echo "USE_BLAS = openblas" >> ./config.mk + echo "USE_CUDA = 0" >> ./config.mk echo "USE_MKLDNN = 1" >> ./config.mk make -j $(nproc) ``` From a332c3c2f4c5a2f8b60190247fec8c5578f5651f Mon Sep 17 00:00:00 2001 From: Zach Kimberg Date: Tue, 4 Dec 2018 16:34:20 -0800 Subject: [PATCH 3/6] Scala install doc avoid build_from_source Minor doc fixes --- docs/install/build_from_source.md | 43 ++++++++----------------------- docs/install/java_setup.md | 4 ++- docs/install/scala_setup.md | 4 ++- 3 files changed, 17 insertions(+), 34 deletions(-) diff --git a/docs/install/build_from_source.md b/docs/install/build_from_source.md index ba51e5fec772..8b0b62241a91 100644 --- a/docs/install/build_from_source.md +++ b/docs/install/build_from_source.md @@ -2,6 +2,7 @@ This document explains how to build MXNet from source code. +**For Java/Scala/Clojure, please follow [this guide instead](./scala_setup.md)** ## Overview @@ -27,7 +28,6 @@ MXNet's newest and most popular API is Gluon. Gluon is built into the Python bin - [Python (includes Gluon)](../api/python/index.html) - [C++](../api/c++/index.html) - [Clojure](../api/clojure/index.html) - - Java (coming soon) - [Julia](../api/julia/index.html) - [Perl](../api/perl/index.html) - [R](../api/r/index.html) @@ -35,6 +35,7 @@ MXNet's newest and most popular API is Gluon. Gluon is built into the Python bin - [Java](../api/java/index.html)
+ ## Build Instructions by Operating System Detailed instructions are provided per operating system. Each of these guides also covers how to install the specific [Language Bindings](#installing-mxnet-language-bindings) you require. @@ -160,7 +161,7 @@ More information on turning these features on or off are found in the following ## Build Configurations There is a configuration file for make, -[`make/config.mk`](/~https://github.com/apache/incubator-mxnet/blob/master/make/config.mk), that contains all the compilation options. You can edit it and then run `make` or `cmake`. `cmake` is recommended for building MXNet (and is required to build with MKLDNN), however you may use `make` instead. +[`make/config.mk`](/~https://github.com/apache/incubator-mxnet/blob/master/make/config.mk), that contains all the compilation options. You can edit it and then run `make` or `cmake`. `cmake` is recommended for building MXNet (and is required to build with MKLDNN), however you may use `make` instead. For building with Java/Scala/Clojure, only `make` is supported.
@@ -214,7 +215,7 @@ It is recommended to set environment variable NCCL_LAUNCH_MODE to PARALLEL when For example, you can specify using all cores on Linux as follows: ```bash -cmake -j $(nproc) . +cmake -j$(nproc) ``` @@ -222,44 +223,28 @@ cmake -j $(nproc) . * Build MXNet with `cmake` and install with MKL DNN, GPU, and OpenCV support: ```bash -echo "USE_OPENCV = 1" >> ./config.mk -echo "USE_CUDA = 1" >> ./config.mk -echo "USE_CUDA_PATH = /usr/local/cuda" >> ./config.mk -echo "USE_CUDNN = 1" >> ./config.mk -echo "USE_MKLDNN = 1" >> ./config.mk -cmake -j $(nproc) USE_CUDA=1 USE_CUDA_PATH=/usr/local/cuda USE_CUDNN=1 USE_MKLDNN=1 . +cmake -j USE_CUDA=1 USE_CUDA_PATH=/usr/local/cuda USE_CUDNN=1 USE_MKLDNN=1 ``` #### Recommended for Systems with NVIDIA GPUs * Build with both OpenBLAS, GPU, and OpenCV support: ```bash -echo "USE_BLAS = openblas" >> ./config.mk -echo "USE_OPENCV = 1" >> ./config.mk -echo "USE_CUDA = 1" >> ./config.mk -echo "USE_CUDA_PATH = /usr/local/cuda" >> ./config.mk -echo "USE_CUDNN = 1" >> ./config.mk -cmake -j $(nproc) BLAS=open USE_CUDA=1 USE_CUDA_PATH=/usr/local/cuda USE_CUDNN=1 . +cmake -j BLAS=open USE_CUDA=1 USE_CUDA_PATH=/usr/local/cuda USE_CUDNN=1 ``` #### Recommended for Systems with Intel CPUs * Build MXNet with `cmake` and install with MKL DNN, and OpenCV support: ```bash -echo "USE_CUDA = 0" >> ./config.mk -echo "USE_OPENCV = 1" >> ./config.mk -echo "USE_MKLDNN = 1" >> ./config.mk -cmake -j $(nproc) USE_CUDA=0 USE_MKLDNN=1 . +cmake -j USE_CUDA=0 USE_MKLDNN=1 ``` #### Recommended for Systems with non-Intel CPUs * Build MXNet with `cmake` and install with OpenBLAS and OpenCV support: ```bash -echo "USE_BLAS = openblas" >> ./config.mk -echo "USE_OPENCV = 1" >> ./config.mk -echo "USE_CUDA = 0" >> ./config.mk -cmake -j $(nproc) USE_CUDA=0 BLAS=open . +cmake -j USE_CUDA=0 BLAS=open ``` #### Other Examples @@ -267,26 +252,20 @@ cmake -j $(nproc) USE_CUDA=0 BLAS=open . * Build without using OpenCV: ```bash -echo "USE_OPENCV = 0" >> ./config.mk -cmake -j $(nproc) USE_OPENCV=0 . +cmake USE_OPENCV=0 ``` * Build on **macOS** with the default BLAS library (Apple Accelerate) and Clang installed with `xcode` (OPENMP is disabled because it is not supported by the Apple version of Clang): ```bash -echo "USE_BLAS = openblas" >> ./config.mk -echo "USE_OPENCV = 0" >> ./config.mk -echo "USE_OPENMP = 0" >> ./config.mk -cmake -j $(sysctl -n hw.ncpu) BLAS=apple USE_OPENCV=0 USE_OPENMP=0 . +cmake -j BLAS=apple USE_OPENCV=0 USE_OPENMP=0 ``` * To use OpenMP on **macOS** you need to install the Clang compiler, `llvm` (the one provided by Apple does not support OpenMP): ```bash brew install llvm -echo "USE_BLAS = openblas" >> ./config.mk -echo "USE_OPENMP = 1" >> ./config.mk -cmake -j $(sysctl -n hw.ncpu) BLAS=apple USE_OPENMP=1 . +cmake -j BLAS=apple USE_OPENMP=1 ```
diff --git a/docs/install/java_setup.md b/docs/install/java_setup.md index fe55d074e754..5e805b3d398c 100644 --- a/docs/install/java_setup.md +++ b/docs/install/java_setup.md @@ -89,11 +89,13 @@ The official Java Packages will be released with the release of MXNet 1.4 and wi The previously mentioned setup with Maven is recommended. Otherwise, the following instructions for macOS and Ubuntu are provided for reference only: +**If you have already built mxnet from source using `cmake`, run `make clean` and then follow the appropriate guide below*** + | OS | Step 1 | Step 2 | |---|---|---| |macOS | [Shared Library for macOS](../install/osx_setup.html#build-the-shared-library) | [Scala Package for macOS](http://mxnet.incubator.apache.org/install/osx_setup.html#install-the-mxnet-package-for-scala) | | Ubuntu | [Shared Library for Ubuntu](../install/ubuntu_setup.html#installing-mxnet-on-ubuntu) | [Scala Package for Ubuntu](http://mxnet.incubator.apache.org/install/ubuntu_setup.html#install-the-mxnet-package-for-scala) | -| Windows | [Shared Library for Windows](../install/windows_setup.html#build-the-shared-library) | Call for Contribution | +| Windows | | Call for Contribution | #### Build Java from an Existing MXNet Installation diff --git a/docs/install/scala_setup.md b/docs/install/scala_setup.md index 0dadd8bca400..98e752b21dd5 100644 --- a/docs/install/scala_setup.md +++ b/docs/install/scala_setup.md @@ -79,11 +79,13 @@ https://mvnrepository.com/artifact/org.apache.mxnet The previously mentioned setup with Maven is recommended. Otherwise, the following instructions for macOS, Ubuntu, and Windows are provided for reference only: +**If you have already built mxnet from source using `cmake`, run `make clean` and then follow the appropriate guide below*** + | OS | Step 1 | Step 2 | |---|---|---| |macOS | [Shared Library for macOS](http://mxnet.incubator.apache.org/install/osx_setup.html#build-the-shared-library) | [Scala Package for macOS](http://mxnet.incubator.apache.org/install/osx_setup.html#install-the-mxnet-package-for-scala) | | Ubuntu | [Shared Library for Ubuntu](http://mxnet.incubator.apache.org/install/ubuntu_setup.html#installing-mxnet-on-ubuntu) | [Scala Package for Ubuntu](http://mxnet.incubator.apache.org/install/ubuntu_setup.html#install-the-mxnet-package-for-scala) | -| Windows | [Shared Library for Windows](http://mxnet.incubator.apache.org/install/windows_setup.html#build-the-shared-library) | Call for Contribution | +| Windows | | Call for Contribution | #### Build Scala from an Existing MXNet Installation From f05032181bcee25f84344ebf823ae8d51c12fbdf Mon Sep 17 00:00:00 2001 From: Zach Kimberg Date: Wed, 5 Dec 2018 17:08:43 -0800 Subject: [PATCH 4/6] Fix build_from_source CMake usage --- docs/install/build_from_source.md | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/docs/install/build_from_source.md b/docs/install/build_from_source.md index 8b0b62241a91..f4f2eba7fe4e 100644 --- a/docs/install/build_from_source.md +++ b/docs/install/build_from_source.md @@ -204,18 +204,17 @@ It is recommended to set environment variable NCCL_LAUNCH_MODE to PARALLEL when ### Build MXNet with C++ -* To enable C++ package, just add `USE_CPP_PACKAGE=1` when you run `make` or `cmake`. +* To enable C++ package, just add `USE_CPP_PACKAGE=1` when you run `make` or `cmake` (see examples).
### Usage Examples -* `-j` runs multiple jobs against multi-core CPUs. - For example, you can specify using all cores on Linux as follows: ```bash -cmake -j$(nproc) +cmake -GNinja . +ninja -v ``` @@ -223,28 +222,32 @@ cmake -j$(nproc) * Build MXNet with `cmake` and install with MKL DNN, GPU, and OpenCV support: ```bash -cmake -j USE_CUDA=1 USE_CUDA_PATH=/usr/local/cuda USE_CUDNN=1 USE_MKLDNN=1 +cmake -DUSE_CUDA=1 -DUSE_CUDA_PATH=/usr/local/cuda -DUSE_CUDNN=1 -DUSE_MKLDNN=1 -GNinja . +ninja -v ``` #### Recommended for Systems with NVIDIA GPUs * Build with both OpenBLAS, GPU, and OpenCV support: ```bash -cmake -j BLAS=open USE_CUDA=1 USE_CUDA_PATH=/usr/local/cuda USE_CUDNN=1 +cmake -DBLAS=open -DUSE_CUDA=1 -DUSE_CUDA_PATH=/usr/local/cuda -DUSE_CUDNN=1 -GNinja . +ninja -v ``` #### Recommended for Systems with Intel CPUs * Build MXNet with `cmake` and install with MKL DNN, and OpenCV support: ```bash -cmake -j USE_CUDA=0 USE_MKLDNN=1 +cmake -DUSE_CUDA=0 -DUSE_MKLDNN=1 -GNinja . +ninja -v ``` #### Recommended for Systems with non-Intel CPUs * Build MXNet with `cmake` and install with OpenBLAS and OpenCV support: ```bash -cmake -j USE_CUDA=0 BLAS=open +cmake -DUSE_CUDA=0 -DBLAS=open -GNinja . +ninja -v ``` #### Other Examples @@ -252,20 +255,23 @@ cmake -j USE_CUDA=0 BLAS=open * Build without using OpenCV: ```bash -cmake USE_OPENCV=0 +cmake -DUSE_OPENCV=0 -GNinja . +ninja -v ``` * Build on **macOS** with the default BLAS library (Apple Accelerate) and Clang installed with `xcode` (OPENMP is disabled because it is not supported by the Apple version of Clang): ```bash -cmake -j BLAS=apple USE_OPENCV=0 USE_OPENMP=0 +cmake -DBLAS=apple -DUSE_OPENCV=0 -DUSE_OPENMP=0 -GNinja . +ninja -v ``` * To use OpenMP on **macOS** you need to install the Clang compiler, `llvm` (the one provided by Apple does not support OpenMP): ```bash brew install llvm -cmake -j BLAS=apple USE_OPENMP=1 +cmake -DBLAS=apple -DUSE_OPENMP=1 -GNinja . +ninja -v ```
From e5ffd3286fd0ccef18ff008911514da7fe4741df Mon Sep 17 00:00:00 2001 From: Zach Kimberg Date: Fri, 7 Dec 2018 10:58:02 -0800 Subject: [PATCH 5/6] CPP Install Instruction with CMake --- docs/install/c_plus_plus.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/docs/install/c_plus_plus.md b/docs/install/c_plus_plus.md index b66ee7d0b80a..6ad67e2803db 100644 --- a/docs/install/c_plus_plus.md +++ b/docs/install/c_plus_plus.md @@ -6,11 +6,8 @@ To enable C++ package, just add `USE_CPP_PACKAGE=1` in the [build from source](b For example to build MXNet with GPU support and the C++ package, OpenCV, and OpenBLAS, from the project root you would run: ```bash -echo "USE_CPP_PACKAGE=1" >> ./config.mk -echo "USE_OPENCV=1" >> ./config.mk -echo "USE_BLAS=openblas" >> ./config.mk -echo "USE_CUDA=1" >> ./config.mk -make -j $(nproc) +cmake -DUSE_CUDA=1 -DUSE_CUDA_PATH=/usr/local/cuda -DUSE_CUDNN=1 -DUSE_MKLDNN=1 -DUSE_CPP_PACKAGE=1 -GNinja . +ninja -v ``` You may also want to add the MXNet shared library to your `LD_LIBRARY_PATH`: From 192311459176f8e09359a65999e6f868a1cbe0e3 Mon Sep 17 00:00:00 2001 From: Zach Kimberg Date: Mon, 10 Dec 2018 11:22:36 -0800 Subject: [PATCH 6/6] Use cmake out of source build --- docs/install/build_from_source.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/install/build_from_source.md b/docs/install/build_from_source.md index f4f2eba7fe4e..e807fb44b599 100644 --- a/docs/install/build_from_source.md +++ b/docs/install/build_from_source.md @@ -213,6 +213,7 @@ It is recommended to set environment variable NCCL_LAUNCH_MODE to PARALLEL when For example, you can specify using all cores on Linux as follows: ```bash +mkdir build && cd build cmake -GNinja . ninja -v ``` @@ -222,6 +223,7 @@ ninja -v * Build MXNet with `cmake` and install with MKL DNN, GPU, and OpenCV support: ```bash +mkdir build && cd build cmake -DUSE_CUDA=1 -DUSE_CUDA_PATH=/usr/local/cuda -DUSE_CUDNN=1 -DUSE_MKLDNN=1 -GNinja . ninja -v ``` @@ -230,6 +232,7 @@ ninja -v * Build with both OpenBLAS, GPU, and OpenCV support: ```bash +mkdir build && cd build cmake -DBLAS=open -DUSE_CUDA=1 -DUSE_CUDA_PATH=/usr/local/cuda -DUSE_CUDNN=1 -GNinja . ninja -v ``` @@ -238,6 +241,7 @@ ninja -v * Build MXNet with `cmake` and install with MKL DNN, and OpenCV support: ```bash +mkdir build && cd build cmake -DUSE_CUDA=0 -DUSE_MKLDNN=1 -GNinja . ninja -v ``` @@ -246,6 +250,7 @@ ninja -v * Build MXNet with `cmake` and install with OpenBLAS and OpenCV support: ```bash +mkdir build && cd build cmake -DUSE_CUDA=0 -DBLAS=open -GNinja . ninja -v ``` @@ -255,6 +260,7 @@ ninja -v * Build without using OpenCV: ```bash +mkdir build && cd build cmake -DUSE_OPENCV=0 -GNinja . ninja -v ``` @@ -262,6 +268,7 @@ ninja -v * Build on **macOS** with the default BLAS library (Apple Accelerate) and Clang installed with `xcode` (OPENMP is disabled because it is not supported by the Apple version of Clang): ```bash +mkdir build && cd build cmake -DBLAS=apple -DUSE_OPENCV=0 -DUSE_OPENMP=0 -GNinja . ninja -v ``` @@ -270,6 +277,7 @@ ninja -v ```bash brew install llvm +mkdir build && cd build cmake -DBLAS=apple -DUSE_OPENMP=1 -GNinja . ninja -v ```