关于Ubuntu 版本的选择,建议用14.04这个比较稳定的版本,但是千万不要用麒麟版!!!比原版体验要差很多!!!
Caffe的安装过程,基本采纳 这篇文章 然后稍作改动,跳过大坑。
Caffe + Ubuntu 14.04 64bit + CUDA 6.5 配置说明
1. 安装开发依赖包sudo apt-get install build-essential sudo apt-get install vim cmake git sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler
2. 安装CUDA一般电脑都有双显卡:Intel 的集成显卡 + Nvidia 的独立显卡。要想两个显卡同时运行,需要关闭 lightdm 服务。
2.1 到 这里 下载安装包,选Linux x86 下的 Ubuntu 14.04, Local Package Installer,下载下来的文件为
cuda-repo-ubuntu1404-7-0-local_7.0-28_amd64.deb
2.2 在BIOS设置里选择用Intel显卡来显示或作为主要显示设备
2.3 进入Ubuntu, 按 ctrl+alt+F1 ,登入自己的账号,然后输入以下命令
sudo service lightdm stop
2.4 安装 CUDA,cd 到安装包目录,输入以下命令:
sudo dpkg -i cuda-repo-ubuntu1404-7-0-local_7.0-28_amd64.deb sudo apt-get update sudo apt-get install cuda
安装完后重启电脑。
3. 安装cuDNN3.1 到这里注册下载,貌似注册验证要花一两天的样子,嫌麻烦的可以直接到Linux公社资源站下载
资源包下载地址:
------------------------------------------分割线------------------------------------------
FTP地址:ftp://ftp1.linuxidc.com
用户名:ftp1.linuxidc.com
密码:
在 2015年LinuxIDC.com\7月\Caffe在Ubuntu 14.04 64bit 下的安装
------------------------------------------分割线------------------------------------------
3.2 完后到下载目录,执行以下命令安装
tar -zxvf cudnn-6.5-linux-x64-v2.tgz cd cudnn-6.5-linux-x64-v2 sudo cp lib* /usr/local/cuda/lib64/ sudo cp cudnn.h /usr/local/cuda/include/
再更新下软连接
cd /usr/local/cuda/lib64/ sudo rm -rf libcudnn.so libcudnn.so.6.5 sudo ln -s libcudnn.so.6.5.48 libcudnn.so.6.5 sudo ln -s libcudnn.so.6.5 libcudnn.so
3.3 设置环境变量
gedit /etc/profile
在打开的文件尾部加上
PATH=/usr/local/cuda/bin:$PATH export PATH
保存后执行以下命令使之生效
source /etc/profile
同时创建以下文件
sudo vim /etc/ld.so.conf.d/cuda.conf
内容是
/usr/local/cuda/lib64
保存后,使之生效
sudo ldconfig
4. 安装CUDA Sample 及 ATLAS4.1 Build sample
cd /usr/local/cuda/samples sudo make all -j8
我电脑是八核的,所以make 时候用-j8参数,大家根据情况更改,整个过程有点长,十分钟左右。
4.2 查看驱动是否安装成功
cd bin/x86_64/linux/release ./deviceQuery
出现以下信息则成功
./deviceQuery Starting... CUDA Device Query (Runtime API) version (CUDART static linking) Detected 1 CUDA Capable device(s) Device 0: "GeForce GTX 670" CUDA Driver Version / Runtime Version 6.5 / 6.5 CUDA Capability Major/Minor version number: 3.0 Total amount of global memory: 4095 MBytes (4294246400 bytes) ( 7) Multiprocessors, (192) CUDA Cores/MP: 1344 CUDA Cores GPU Clock rate: 1098 MHz (1.10 GHz) Memory Clock rate: 3105 Mhz Memory Bus Width: 256-bit L2 Cache Size: 524288 bytes Maximum Texture Dimension Size (x,y,z) 1D=(65536), 2D=(65536, 65536), 3D=(4096, 4096, 4096) Maximum Layered 1D Texture Size, (num) layers 1D=(16384), 2048 layers Maximum Layered 2D Texture Size, (num) layers 2D=(16384, 16384), 2048 layers Total amount of constant memory: 65536 bytes Total amount of shared memory per block: 49152 bytes Total number of registers available per block: 65536 Warp size: 32 Maximum number of threads per multiprocessor: 2048 Maximum number of threads per block: 1024 Max dimension size of a thread block (x,y,z): (1024, 1024, 64) Max dimension size of a grid size (x,y,z): (2147483647, 65535, 65535) Maximum memory pitch: 2147483647 bytes Texture alignment: 512 bytes Concurrent copy and kernel execution: Yes with 1 copy engine(s) Run time limit on kernels: Yes Integrated GPU sharing Host Memory: No Support host page-locked memory mapping: Yes Alignment requirement for Surfaces: Yes Device has ECC support: Disabled Device supports Unified Addressing (UVA): Yes Device PCI Bus ID / PCI location ID: 1 / 0 Compute Mode: < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) > deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 6.5, CUDA Runtime Version = 6.5, NumDevs = 1, Device0 = GeForce GTX 670 Result = PASS
4.3 安装ATLAS
ATLAS是做线性代数运算的,还有俩可以选:一个是Intel 的 MKL,这个要收费,还有一个是OpenBLAS,这个比较麻烦;但是运行效率ATLAS < OpenBLAS < MKL
我就用ATLAS咯: