This is an automated email from the ASF dual-hosted git repository.
aaronmarkham pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
The following commit(s) were added to refs/heads/master by this push:
new 014ca13 [DOC] Update ubuntu install instructions from source (#14534)
014ca13 is described below
commit 014ca13ceae48d5e9ecc8d7a4a0809978ef696c1
Author: Pedro Larroy <[email protected]>
AuthorDate: Wed Apr 24 13:10:44 2019 -0700
[DOC] Update ubuntu install instructions from source (#14534)
* Update ubuntu install instructions from source
* Update docs/install/ubuntu_setup.md
Co-Authored-By: larroy <[email protected]>
* Address CR comments
* Address CR comments
---
docs/install/ubuntu_setup.md | 97 ++++++++++++++++++++++++++++++++------------
1 file changed, 71 insertions(+), 26 deletions(-)
diff --git a/docs/install/ubuntu_setup.md b/docs/install/ubuntu_setup.md
index f225023..01b11cd 100644
--- a/docs/install/ubuntu_setup.md
+++ b/docs/install/ubuntu_setup.md
@@ -137,12 +137,33 @@ It is recommended that you review the general [build from
source](build_from_sou
On Ubuntu versions 16.04 or later, you need the following dependencies:
-**Step 1:** Install build tools and git.
+**Step 1:** Install prerequisite packages.
```bash
sudo apt-get update
- sudo apt-get install -y build-essential git
+ sudo apt-get install -y build-essential git ninja-build ccache
```
+**For Ubuntu 18.04 and CUDA builds you need to update CMake**
+
+```bash
+#!/usr/bin/env bash
+set -exuo pipefail
+sudo apt remove --purge --auto-remove cmake
+
+# Update CMAKE for correct cuda autotedetection:
https://github.com/clab/dynet/issues/1457
+version=3.14
+build=0
+mkdir -p ~/tmp
+cd ~/tmp
+wget https://cmake.org/files/v$version/cmake-$version.$build.tar.gz
+tar -xzvf cmake-$version.$build.tar.gz
+cd cmake-$version.$build/
+./bootstrap
+make -j$(nproc)
+sudo make install
+```
+
+
**Step 2:** Install a Math Library.
Details on the different math libraries are found in the build from source
guide's [Math Library Selection](build_from_source.html#math-library-selection)
section.
@@ -167,49 +188,73 @@ For other libraries, visit the [Math Library
Selection](build_from_source.html#m
If building on CPU and using OpenBLAS:
+Clone the repository:
+
```bash
git clone --recursive https://github.com/apache/incubator-mxnet.git
cd incubator-mxnet
- 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/docs/tutorials/mkldnn/MKLDNN_README.md)):
+Build with CMake and ninja, without GPU and without MKL.
```bash
- git clone --recursive https://github.com/apache/incubator-mxnet.git
- 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)
+ rm -rf build
+ mkdir -p build && cd build
+ cmake -GNinja \
+ -DUSE_CUDA=OFF \
+ -DUSE_MKL_IF_AVAILABLE=OFF \
+ -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache \
+ -DCMAKE_C_COMPILER_LAUNCHER=ccache \
+ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
+ ..
+ ninja
```
-If building on GPU and you want OpenCV and OpenBLAS (make sure you have
installed the [CUDA dependencies first](#cuda-dependencies)):
+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/docs/tutorials/mkldnn/MKLDNN_README.md)):
```bash
- git clone --recursive https://github.com/apache/incubator-mxnet.git
- cd incubator-mxnet
- 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)
+ rm -rf build
+ mkdir -p build && cd build
+ cmake -GNinja \
+ -DUSE_CUDA=OFF \
+ -DUSE_MKL_IF_AVAILABLE=ON \
+ -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache \
+ -DCMAKE_C_COMPILER_LAUNCHER=ccache \
+ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
+ ..
+ ninja
```
-*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).
+If building on GPU (make sure you have installed the [CUDA dependencies
first](#cuda-dependencies)):
+Cuda 10.1 in Ubuntu 18.04 builds fine but is not currently tested in CI.
-Building from source creates a library called ```libmxnet.so``` in the `lib`
folder in your MXNet project root.
+```bash
+ rm -rf build
+ mkdir -p build && cd build
+ cmake -GNinja \
+ -DUSE_CUDA=ON \
+ -DUSE_MKL_IF_AVAILABLE=OFF \
+ -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache \
+ -DCMAKE_C_COMPILER_LAUNCHER=ccache \
+ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
+ ..
+ ninja
+```
-You may also want to add the MXNet shared library to your `LD_LIBRARY_PATH`:
+*Note* - You can explore and use more compilation options as they are delcared
in the top of `CMakeLists.txt` and also review common [usage
examples](build_from_source.html#usage-examples).
+Optionally, you can also use a higher level, scripted version of the above
with an editable CMake options file by doing the
+following:
```bash
-export LD_LIBRARY_PATH=$PWD/lib
+cp cmake/cmake_options.yml .
+# Edit cmake_options.yml in the MXNet root to your taste
+$EDITOR cmake_options.yml
+# Launch a local CMake build
+./dev_menu.py build
```
+Building from source creates a library called ```libmxnet.so``` in the `build`
folder in your MXNet project root.
+
After building the MXNet library, you may install language bindings.
<hr>