MXNet - 安装
基于Ubuntu14.04/16.04,Python,GPU,Build from Sources
Prerequisites
export LD_LIBRARY_PATH=/usr/local/cuda/lib64/:$LD_LIBRARY_PATH
编译 MXNnet核心库
从 C++ 源码编译 MXNet core shared library - libmxnet.so.
Minimum Requirements:
- GCC 4.8 or later to compile C++ 11
- GNU Make
# Step 1 Install build tools and git.
$ sudo apt-get update
$ sudo apt-get install -y build-essential git
# Step 2 Install OpenBLAS.
$ sudo apt-get install -y libopenblas-dev
# Step 3 Install OpenCV.
$ 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
编译 MXNet的Python API
# 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 Validate the installation by running simple MXNet code.
>>> import mxnet as mx
>>> a = mx.nd.ones((2,3),mx.gpu()) # 在GPU上创建 2×3 矩阵
>>> b = a * 2 + 1 # 矩阵a各元素 ×2 + 1
>>> b.asnumpy()
array([[ 3.,3.,3.],[ 3.,3.]],dtype=float32)
原文地址:https://www.jb51.cc/ubuntu/352868.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。