簡記我在centos上安裝mxnet的心路歷程~ ~
步驟一:首先乖乖的按照官方文檔的安裝教程
git clone --recursive https://github.com/dmlc/mxnetcdmxnet;
make -j16
進(jìn)行安裝茅糜。結(jié)果出現(xiàn)error...(系統(tǒng)自帶的g++版本為4.4.7猿推,而mxnet要求>=4.8)莺葫,進(jìn)而我就鬼迷心竅的去下載安裝了最新版本的g++6.0匪凉。
步驟二:更新g++版本,最好更新4.8或著4.9兩個版本捺檬,因為cuda-7.5編譯要求g++版本要<=4.9再层,(哎,這就是在玩數(shù)學(xué)不等式吶。树绩。)
升級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、直接編譯會出現(xiàn)error
所以可以提前執(zhí)行unset LIBRARY_PATH該命令(也是可以在編譯報錯之后再執(zhí)行职车。瘫俊。)
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進(jìn)行編譯了。
步驟四:安裝python包
cd /mxnet/python
執(zhí)行 python setup.py
到此就大功告成啦茫孔!
Tips:直接手動從github上下載的文件要使用git submodule init和git submodule update更新子模塊叮喳。