CentOS7源码安装MxNet

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值