cuda测试caffe编译安装
2017-02-13 23:32
357 查看
4. 安装CUDA Sample 及 ATLAS
4.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
Tntegrated 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咯:
sudo apt-get install libatlas-base-dev
5. 安装Caffe需要的Python包
网上介绍用现有的anaconda,我反正不建议,因为路径设置麻烦,很容易出错,而且自己安装很简单也挺快的。
首先需要安装pip
sudo apt-get install python-pip
再下载caffe,我把caffe放在用户目录下
cd
git clone https://github.com/BVLC/caffe.git
再转到caffe的python目录,安装scipy
cd caffe/python
sudo apt-get install python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose
最后安装requirement里面的包,需要root权限
sudo su
for req in $(cat requirements.txt); do pip install $req; done
如果提示报错,一般是缺少必须的包引起的,直接根据提示 pip install <package-name>就行了。
安装完后退出root权限
exit
6. 编译caffe
首先修改配置文件,回到caffe目录
cd ~/caffe
cp Makefile.config.example Makefile.config
gedit Makefile.config
这里仅需修改两处:
i) 使用cuDNN
# USE_CUDNN := 1
这里去掉#,取消注释为
USE_CUDNN := 1
ii) 修改python包目录,这句话
PYTHON_INCLUDE := /usr/include/python2.7 \
/usr/lib/python2.7/dist-packages/numpy/core/include
改为
PYTHON_INCLUDE := /usr/include/python2.7 \
/usr/local/lib/python2.7/dist-packages/numpy/core/include
因为新安装的python包目录在这里: /usr/local/lib/python2.7/dist-packages/
接下来就好办了,直接make
make all -j8
make test
make runtest
make pycaffe
这时候cd 到caffe 下的 python 目录,试试caffe 的 python wrapper安装好没有:
python
import caffe
如果不报错,那就说明安装好了。
4.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
Tntegrated 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咯:
sudo apt-get install libatlas-base-dev
5. 安装Caffe需要的Python包
网上介绍用现有的anaconda,我反正不建议,因为路径设置麻烦,很容易出错,而且自己安装很简单也挺快的。
首先需要安装pip
sudo apt-get install python-pip
再下载caffe,我把caffe放在用户目录下
cd
git clone https://github.com/BVLC/caffe.git
再转到caffe的python目录,安装scipy
cd caffe/python
sudo apt-get install python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose
最后安装requirement里面的包,需要root权限
sudo su
for req in $(cat requirements.txt); do pip install $req; done
如果提示报错,一般是缺少必须的包引起的,直接根据提示 pip install <package-name>就行了。
安装完后退出root权限
exit
6. 编译caffe
首先修改配置文件,回到caffe目录
cd ~/caffe
cp Makefile.config.example Makefile.config
gedit Makefile.config
这里仅需修改两处:
i) 使用cuDNN
# USE_CUDNN := 1
这里去掉#,取消注释为
USE_CUDNN := 1
ii) 修改python包目录,这句话
PYTHON_INCLUDE := /usr/include/python2.7 \
/usr/lib/python2.7/dist-packages/numpy/core/include
改为
PYTHON_INCLUDE := /usr/include/python2.7 \
/usr/local/lib/python2.7/dist-packages/numpy/core/include
因为新安装的python包目录在这里: /usr/local/lib/python2.7/dist-packages/
接下来就好办了,直接make
make all -j8
make test
make runtest
make pycaffe
这时候cd 到caffe 下的 python 目录,试试caffe 的 python wrapper安装好没有:
python
import caffe
如果不报错,那就说明安装好了。
相关文章推荐
- caffe安装,编译(包括CUDA和cuDNN的安装),并训练,测试自己的数据(caffe使用教程)
- cuda7.5+cudnn5.1+opencv3.1(ubuntu14.04上安装caffe并测试)
- ubuntu16.04+gtx1060+cuda8.0+caffe安装、测试经历
- [Caffe] - No.2 ssd-caffe(1):编译、安装、测试
- Ubuntu 14.04 LTS, 64bit, cuda 7, Caffe环境配置编译和安装
- ubuntu16 CUDA 编译opencl caffe版本并通过mnist训练测试
- caffe编译安装( Ubuntu16.04.3+cuda8.0+opencv3.3.0+anaconda3)
- 64位win10+cuda8.0+vs2013+cuDNN V5下Caffe的编译安装教程并配置matlab2014a 接口
- ubuntu14.04+caffe+cuda8.0+cudnn-8.0-v5.1(gtx1070)安装与测试
- Ubuntu16.04+Cuda8.0+Caffe+ Opencv3.2+Matlab2015b的配置、安装与编译(三)
- ubuntu16.04+gtx1060+cuda8.0+caffe安装、测试经历
- Windows+VS2013+cuda7.5爆详细Caffe编译安装教程
- ubuntu16.04+gtx1060+cuda8.0+caffe安装、测试经历
- ubuntu16.04+gtx1070/1060+cuda8.0+caffe安装、测试[亲测]
- CentOS6.8 + cuda + caffe安装记录 (之二 caffe测试)
- Ubuntu16.04+Cuda8.0+Caffe+ Opencv3.2+Matlab2015b的配置、安装与编译 (二)
- ubuntu16.04+cuda8.0+cudnn5.1+caffe------caffe安装与编译
- jetson tx1安装caffe 编译时 出现error==cudaSuccess(8 VS 0)类似错误
- 【神经网络与深度学习】【CUDA开发】服务器(多GPU)caffe安装和编译
- Ubuntu16.04+Cuda8.0+Caffe+ Opencv3.2+Matlab2015b的配置、安装与编译(一)