CentOS7源码安装MxNet
本文介绍如何从源码方式安装MXNet
- requirement
- 编译源码
- 安装python支持
- 分布式支持
- 测试
- C++支持
- benchmark
Requirement
安装编程环境:
sudo yum install build-essential git
sudo yum install openblas-devel lapack-devel.x86_64 \
lapack-devel blas-devel opencv-devel
下载源码
git clone --recursive https://github.com/apache/incubator-mxnet
编译源码
make -j $(nproc) USE_OPENCV=1 USE_BLAS=openblas USE_CUDA=1 \
USE_CUDA_PATH=/usr/local/cuda USE_CUDNN=1 USE_DIST_KVSTORE=1 USE_NCCL=1 USE_CPP_PACKAGE=1
说明
- $(nproc): 指定编译核数
- USE_OPENCV: 指定使用OpenCV处理图像
- USE_BLAS: 指定使用blas运算库做快速运算
- USE_CUDA: 指定使用CUDA
- USE_CUDA_PATH: 指定CUDA路径
- USE_CUDNN: 指定CUDNN支持
- USE_DIST_KVSTORE: 指定分布式节点支持,使用KV-store
- USE_NCCL: 使用NCCL同步不同device
- USE_CPP_PACKAGE: C++版本支持
安装python bind
sudo yum install python-devel
安装python支持
cd python
python setup.py install
分布式支持
MXNet支持分布式,需要配置k-v store
make的时候,需要添加编译选项:USE_DIST_KVSTORE=1
测试-手写字体识别
cd mxnet/example/image-classification
python train_mnist.py //不使用gpu
python train_mnist.py --gpus 0 //使用gpu0
CPP支持
在编译选项中添加USE_CPP_PACKAGE=1
benchmark
性能测试
cd example/image-classification
python train_imagenet.py --benchmark 1 --gpus 0,1 --network inception-v3 --batch-size 64 \
--image-shape 3,299,299 --num-epochs 1 --kv-store device
参考
https://blog.csdn.net/s_sunnyy/article/details/56479077?utm_source=itdadao&utm_medium=referral