Build the MXNet core shared library
Step 1 Install build tools and git.
$ sudo apt-get update
$ sudo apt-get install -y build-essential git
Step 2 Install OpenBLAS.
MXNet uses BLAS library for accelerated numerical computations. There are several flavors of BLAS libraries - OpenBLAS, ATLAS and MKL. In this step we install OpenBLAS. You can choose to install ATLAS or MKL.
$ sudo apt-get install -y libopenblas-dev
Step 3 Install OpenCV.
MXNet uses OpenCV for efficient image loading and augmentation operations.
$ sudo apt-get install -y libopencv-dev
Step 4 Download MXNet sources and build MXNet core shared library.
$ git clone --recursive https://github.com/dmlc/mxnet
$ cd mxnet
$ make -j $(nproc) USE_OPENCV=1 USE_BLAS=openblas USE_CUDA=1 USE_CUDA_PATH=/usr/local/cuda USE_CUDNN=1
Note - USE_OPENCV, USE_BLAS, USE_CUDA, USE_CUDA_PATH AND USE_CUDNN are make file flags to set compilation options to use OpenCV, OpenBLAS, CUDA and cuDNN libraries. You can explore and use more compilation options in make/config.mk
. Make sure to set USE_CUDA_PATH to right CUDA installation path. In most cases it is - /usr/local/cuda.
Build the MXNet Python binding
Step 1 Install prerequisites - python setup tools and numpy.
$ sudo apt-get install -y python-dev python-setuptools python-numpy
Step 2 Build the MXNet Python binding.
$ cd python
$ sudo python setup.py install
Step 3 Install Graphviz. (Optional, needed for graph visualization using mxnet.viz
package).
sudo apt-get install graphviz
pip install graphviz
Step 4 Validate the installation by running simple MXNet code described here.
参考网址: http://mxnet.io/get_started/install.html