Centos + CUDA7.5 + caffe配置教程

安装操作系统

Install CentOS 7.x (开发版/完全版)

 

安装NVIDIA驱动与CUDA

进入操作系统本文模式

sudo ln -sf /lib/systemd/system/multi-user.target/etc/systemd/system/default.target


禁用Nouvean驱动

# 重新建立  initramfs image file

sudo mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak

sudo dracut -v /boot/initramfs-$(uname -r).img $(uname -r)

reboot


查看Nouvean驱动没有被启动

1.  图形界面分辨率降低

2.  lsmod | grep nouvean

执行:cuda_7.5.18_linux.run

sudo sh $(BACKUP_ROOT)/cuda_7.5.18_linux.run

 

安装CuDNN

tar zxvf $(BACKUP_ROOT)/cudnn-7.5-linux-x64-v5.1-rc.tgz

sudo cp $(BACKUP_ROOT)/cuda/include/cudnn.h /usr/local/cuda/include

sudo cp $(BACKUP_ROOT)/cuda/lib64/* /usr/local/cuda/lib64


安装YUM可直接配置的依赖项

sudo yum install gcc python-devel protobuf-devel snappy-develboost-devel opencv-devel opencv-python libpng-devel libjpeg-develfreetype-devel


安装CMake

wget https://cmake.org/files/v3.6/cmake-3.6.0-rc2-Linux-x86_64.sh

sudo cp cmake-3.6.0-rc2-Linux-x86_64.sh /usr/local

cd /usr/local

sudo sh cmake-3.6.0-rc2-Linux-x86_64.sh

sudo ln -sf /usr/local/cmake-3.6.0-rc2-Linux-x86_64 /usr/local/cmake


安装PIP

wget https://bootstrap.pypa.io/get-pip.py

sudo python get-pip.py


安装OpenCV-2.4.13

export PATH=/usr/local/cmake/bin:$PATH

unzip -q $(BACKUP_ROOT)/opencv-2.4.13.zip

sudo mv $(BACKUP_ROOT)/opencv-2.4.13 /usr/local/

cd /usr/local/opencv-2.4.13

mkdir release

cd release

cmake -D WITH_CUDA=ON -D WITH_CUBLAS=ON -D CMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local ..

make -j8

sudo make install

安装HDF5

wget http://www.hdfgroup.org/ftp/HDF5/current/bin/linux-centos7-x86_64-gcc485/hdf5-1.8.17-linux-centos7-x86_64-gcc485-shared.tar.gz

tar zxvf hdf5-1.8.17-linux-centos7-x86_64-gcc485-shared.tar.gz

sudo mv hdf5-1.8.17-linux-centos7-x86_64-gcc485-shared /usr/local

sudo ln -sf /usr/local/hdf5-1.8.17-linux-centos7-x86_64-gcc485-shared//usr/local/hdf5

cd /usr/local/hdf5

sudo cp ./bin/* /usr/local/bin

sudo cp ./include/* /usr/local/include

sudo cp -r ./lib/* /usr/local/lib

sudo cp -rR ./share/* /usr/local/share


安装LevelDB

wget https://github.com/google/leveldb/archive/v1.18.zip

mv v1.18.zip leveldb-v1.18.zip

unzip -q leveldb-v1.18.zip

sudo mv leveldb-1.18 /usr/local

sudo ln -sf /usr/local/leveldb-1.18 /usr/local/leveldb

cd /usr/local/leveldb

make

sudo cp -r libleveldb.* /usr/local/lib

cd include

sudo cp -R leveldb /usr/local/include


安装LMDB

git clone https://github.com/LMDB/lmdb

sudo mv lmdb /usr/local

cd /usr/local/lmdb/libraries/liblmdb

sudo make

sudo make install


安装GLog

wget https://google-glog.googlecode.com/files/glog-0.3.3.tar.gz
tar zxvf glog-0.3.3.tar.gz

sudo mv glog-0.3.3 /usr/local/

sudo ln -sf /usr/local/glog-0.3.3 /usr/local/glog

cd /usr/local/glog
./configure
make

sudo make install


安装GFlags

wget https://github.com/schuhschuh/gflags/archive/master.zip

mv master.zip gflags.zip

unzip -q gflags.zip

cd gflags-master

mkdir build && cd build

export PATH=/usr/local/cmake/bin:$PATH

export CXXFLAGS="-fPIC" && cmake.. && make VERBOSE=1
make && sudo make install

cd ../../ && sudo mv gflags-master/usr/local/gflags


安装OpenBlas

git clone git://github.com/xianyi/OpenBLAS.git

sudo cp -r OpenBLAS/ /usr/local/

cd /usr/local/OpenBLAS

sudo make

sudo make PREFIX=/usr/local install


安装python依赖项

sudo pip install easydict cython scipy protobuf scikit-image matplotlib

sudo pip install --upgrade numpy


OK! 最后下载caffe安装包,编辑下Makefile.config编译就可以啦!


你可能感兴趣的:(深度学习)