Centos环境下,Mxnet安装教程

简记我在centos上安装mxnet的心路历程~ ~

步骤一:首先乖乖的按照官方文档的安装教程

git clone --recursive https://github.com/dmlc/mxnetcdmxnet;

make -j16

进行安装。结果出现error...(系统自带的g++版本为4.4.7,而mxnet要求>=4.8),进而我就鬼迷心窍的去下载安装了最新版本的g++6.0。

步骤二:更新g++版本,最好更新4.8或着4.9两个版本,因为cuda-7.5编译要求g++版本要<=4.9,(哎,这就是在玩数学不等式呐。。)

升级g++的教程如下:

1、下载g++4.8.5的源码安装包 wget ftp://ftp.gnu.org/gnu/gcc/gcc-4.8.5/gcc-4.8.5.tar.gz,

2、下载依赖包(gcc自带下载脚本)

./contrib/download_prerequisites

3、直接编译会出现error

所以可以提前执行unset LIBRARY_PATH该命令(也是可以在编译报错之后再执行。。)

4、编译安装

mkdir gcc-build-4.8.5

cd gcc-build-4.8.5

../configure --prefix=/usr

make && make install

5、通过gcc --version 、g++ --version查看版本号

降级gcc教程如下:

sudo yum remove--skip-broken gcc

sudo yum install--skip-broken gcc

yum install gcc-c++

yum-yinstallglibc-devel.i686 glibc-devel

步骤三:自定义安装

将make文件夹下面的config.mk文件copy到mxnet根目录下面,然后再config.mk文件中自定义修改。如:

#---------------------

# choice of compiler

#--------------------

export CC = gcc

export CXX = g++

export NVCC = nvcc

# whether compile with debug

DEBUG = 0

# the additional link flags you want to add

ADD_LDFLAGS = -L/usr/lib64/atlas

# the additional compile flags you want to add

#ADD_CFLAGS =

#---------------------------------------------

# matrix computation libraries for CPU/GPU

#---------------------------------------------

# whether use CUDA during compile

USE_CUDA = 1

# add the path to CUDA library to link and compile flag

# if you have already add them to environment variable, leave it as NONE

USE_CUDA_PATH = /usr/local/cuda-7.5

#USE_CUDA_PATH = NONE

# whether use CuDNN R3 library

USE_CUDNN = 1

# whether use cuda runtime compiling for writing kernels in native language (i.e. Python)

USE_NVRTC = 0

# whether use opencv during compilation

# you can disable it, however, you will not able to use

# imbin iterator

USE_OPENCV = 1

# use openmp for parallelization

USE_OPENMP = 1

# choose the version of blas you want to use

# can be: mkl, blas, atlas, openblas

# in default use atlas for linux while apple for osx

UNAME_S := $(shell uname -s)

ifeq ($(UNAME_S), Darwin)

USE_BLAS = apple

else

USE_BLAS = atlas

endif

# add path to intel library, you may need it for MKL, if you did not add the path

# to environment variable

USE_INTEL_PATH = NONE

# If use MKL, choose static link automatically to allow python wrapper

ifeq ($(USE_BLAS), mkl)

USE_STATIC_MKL = 1

else

USE_STATIC_MKL = NONE

endif

#----------------------------

# distributed computing

#----------------------------

# whether or not to enable multi-machine supporting

USE_DIST_KVSTORE = 0

# whether or not allow to read and write HDFS directly. If yes, then hadoop is

# required

USE_HDFS = 0

# path to libjvm.so. required if USE_HDFS=1

LIBJVM=$(JAVA_HOME)/jre/lib/amd64/server

# whether or not allow to read and write AWS S3 directly. If yes, then

# libcurl4-openssl-dev is required, it can be installed on Ubuntu by

# sudo apt-get install -y libcurl4-openssl-dev

USE_S3 = 0

修改好config.mk文件后,就可以运行make -j8进行编译了。

步骤四:安装python包

cd /mxnet/python

执行 python setup.py

到此就大功告成啦!


Tips:直接手动从github上下载的文件要使用git submodule init和git submodule update更新子模块。

你可能感兴趣的:(Centos环境下,Mxnet安装教程)