标签:
主要参考:
sudo apt-get update sudo apt-get upgrade sudo apt-get install build-essential sudo apt-get autoremove
sudo apt-get install git
lspci | grep -i nvidia
在线安装:
sudo add-apt-repository ppa:graphics-drivers/ppa sudo apt-get update sudo apt-get install nvidia-352
或者官网下载离安装包,安装
sudo shutdown -r now
查看驱动版本:
cat /proc/driver/nvidia/version
sudo dpkg -i cuda-repo-ubuntu1404*amd64.deb sudo apt-get update sudo apt-get install cuda
添加路径:
echo ‘export PATH=/usr/local/cuda/bin:$PATH‘ >> ~/.bashrc echo ‘export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH‘ >> ~/.bashrc source ~/.bashrc
检查CUDA版本:
nvcc -V
重启系统:
sudo shutdown -r now
cd ~/Downloads/ tar xvf cudnn*.tgz cd cuda sudo cp */*.h /usr/local/cuda/include/ sudo cp */libcudnn* /usr/local/cuda/lib64/ sudo chmod a+r /usr/local/cuda/lib64/libcudnn*
这里其实就是复制相关文件到cuda目录,奇怪为啥cuda不集成cuDNN,也有可能已经自带,未做验证;
sudo ln -sf /usr/local/lib/libcudnn.so.4.0.7 /usr/local/lib/libcudnn.so.4 sudo ln -sf /usr/local/lib/libcudnn.so.4 /usr/local/lib/libcudnn.so
检查:
nvidia-smi
mkdir ~/git cd ~/git git clone https://github.com/xianyi/OpenBLAS.git cd OpenBLAS make FC=gfortran -j $(($(nproc) + 1)) sudo make PREFIX=/usr/local install
添加路径:
echo ‘export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH‘ >> ~/.bashrc
sudo apt-get install -y libfreetype6-dev libpng12-dev pip install -U matplotlib ipython[all] jupyter pandas scikit-image
还有一些caffe的依赖包:
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler sudo apt-get install --no-install-recommends libboost-all-dev sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
OpenCV
sudo sh Ubuntu/dependencies.sh
进入Ubuntu\3.0\安装OpenCV 3.0.0:
sudo sh opencv3_0_0.sh
如果成功安装应该不会有什么错误提示:
pkg-config --modversion opencv
cd ~/git git clone https://github.com/BVLC/caffe.git cd caffe cp Makefile.config.example Makefile.config
主要是新建了一个git文件夹,下载caffe安装包到git路径里面:
sudo gedit /caffe/Makefile.config USE_CUDNN := 1 INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/lib/x86_64-linux-gnu/hdf5/serial/include LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu/hdf5/serial # 默认启用OpenBLAS PYTHON_LIB := /usr/local/lib # pythn库 MATLAB_DIR := /usr/local/MATLAB/R2014a # Matlab安装路径,用于链接Matlab OPENCV_VERSION =3 # OpenCV
仅仅列出修改部分,如果使用Anaconda配置文件中有相关修改,只需要取消注释就可以了,并修改路径为自己Anaconda安装路径;
make all -j16 make test -j16 make runtest -j16
添加“-16”为使用多核进行编译,速度更快;
make pycaffe -j16 make matcaffe -j16
标签:
原文地址:http://www.cnblogs.com/zhanglianbo/p/5648261.html