以下是实验室linux服务器cuda安装和kaldi带cuda编译的流程,在pcc和pc上测试通过。
在pcc上实验了cuda7和cuda6.5,结果kaldi(2015年3月版)似乎不兼容cuda7,在kaldi-trunk/src/cudamatrix下
make test 总是失败,最后安装的cuda6.5。
在pc上的kaldi(2014年10月以前)在cuda6.5下测试不通过,kaldi(2015年3月版)可以测试通过。
在pcc上的kaldi在gpu 0 上总报错,在gpu 1上可以,最后我拷贝的文鹏的没改过的cudamatrix/Makefile,并执行make -B 重新编译,可以用gpu 0了。
安装前准备 cuda_6.5.14_linux_64.run, 文件大小928M,这是pc服务器上保存安装包的位置。
928M pc-pc: /home/pc/disk2/hcq/install_cuda/cuda_6.5.14_linux_64.run
kaldi版本 2015年3月
ps: 可以通过运行 locate --regex cuda.*.run$ 来查找机器上别人以前下的cuda安装包。
一、安装 cuda
(1) 删除已有nvidia,拉黑名单
sudo apt-get remove --purge nvidia*
sudo nano /etc/modprobe.d/blacklist.conf
blacklist.conf加入
1. blacklist amd76x_edac
2. blacklist vga16fb
3. blacklist nouveau
4. blacklist rivafb
5. blacklist nvidiafb
6. blacklist rivatv
(2) 开始安装
sudo service lightdm stop
chmod +x cuda_6.5.14_linux_64.run
sudo ./cuda_6.5.14_linux_64.run
安装一路yes或默认配置。
成功提示:
===========
= Summary =
===========
Driver: Installed
Toolkit: Installed in /usr/local/cuda-6.5
Samples: Installed in /home/hcq, but missing recommended libraries
Please make sure that
- PATH includes /usr/local/cuda-6.5/bin
- LD_LIBRARY_PATH includes /usr/local/cuda-6.5/lib64, or, add /usr/local/cuda-6.5/lib64 to /etc/ld.so.conf and run ldconfig as root
To uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-6.5/bin
To uninstall the NVIDIA Driver, run nvidia-uninstall
Please see CUDA_Getting_Started_Guide_For_Linux.pdf in /usr/local/cuda-6.5/doc/pdf for detailed information on setting up CUDA.
(3) 配置环境变量
按照上一步成功提示设置PATH和LD_LIBRARY_PATH 环境变量
sudo vim /etc/profile
/etc/profile加入
PATH=$PATH:/usr/local/cuda-6.5/bin
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-6.5/lib64
export PATH
export LD_LIBRARY_PATH
(4) 测试
1. /usr/local/cuda/bin/nvcc -V
显示所安装cuda版本:
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2014 NVIDIA Corporation
Built on Thu_Jul_17_21:41:27_CDT_2014
Cuda compilation tools, release 6.5, V6.5.12
可以确定安装的版本为6.5
2. cd /home/hcq/NVIDIA_CUDA-6.5_Samples/
可以make 并进入相应子目录运行测试
例如: ./0_Simple/simplePrintf/simplePrintf 打印
GPU Device 0: "Quadro 600" with compute capability 2.1
Device 0: "Quadro 600" with Compute 2.1 capability
printf() is called. Output:
[3, 0]: Value is:10
[3, 1]: Value is:10
.....
[2, 6]: Value is:10
[2, 7]: Value is:10
二、kaldi带cuda编译
(1) 首先进入tools目录并按照INSTALL指示编译。如果之前已经编译过跳过此步骤(tools下的程序没有使用cuda库)。
(2) 进入src目录
1. make clean
2. ./configure
可以看到打印信息的最后有这么一行:
Using CUDA toolkit /usr/local/cuda (nvcc compiler and runtime libraries)
可以确定kaldi将要带cuda安装。
3. make depend -j 24
4. make -j 24
在 make -j 24 过程中如果有类似一下错误:
nvcc fatal : Unsupported gpu architecture 'compute_10'
则进入src/cudamatrix目录,修改Makefile,
把 CUDA_ARCH=-gencode arch=compute_10,code=sm_10 中的
-gencode arch=compute_10,code=sm_10 去掉。
重新 make -j 24。
(3) 如果以上步骤没有错误,则进入src/cudamatrix目录进行测试
make test -j 5
成功的话提示:
Running cu-vector-test ...... SUCCESS
Running cu-matrix-test ...... SUCCESS
Running cu-math-test ...... SUCCESS
以上参考自
http://blog.csdn.net/abcjennifer/article/details/23016583
Ubuntu12.04配置NVIDIA cuda5.5经验帖
分类: Computer System Linux & MAC Python2014-04-06 08:58 9938人阅读 评论(16) 收藏 举报
之前配过一遍都忘光了,现在要重新配一遍真是好难过。。。特此记录参考网站以便查阅。
=============
环境:Ubuntu 12.04+Cuda5.5
- 判断安装环境:
The setup of CUDA development tools on a system running the appropriate version of Linux consists of a few simple steps:
* Verify the system has a CUDA-capable GPU.
* Verify the system has a supported version of Linux.
* Verify the system has gcc installed.
见官方配置手册:http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-linux/index.html
下run好了
- 安装必要的库
[plain] view plaincopy
1. sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev
2. libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev
- 删除已有nvidia,拉黑名单
[plain] view plaincopy
1. sudo apt-get remove --purge nvidia*
2. sudo nano /etc/modprobe.d/blacklist.conf
blacklist.conf加入
[plain] view plaincopy
1. lacklist amd76x_edac
2. blacklist vga16fb
3. blacklist nouveau
4. blacklist rivafb
5. blacklist nvidiafb
6. blacklist rivatv
- Ctrl+Alt+F1, 登陆后安装
[plain] view plaincopy
1. sudo service lightdm stop
2. chmod +x cuda_5.5.22_linux_64.run
3. sudo ./cuda_5.5.22_linux_64.run
Cuda5.5集成了toolkit,sdk和driver, 所以安装的时候一路同意下来就好了
- 得到以下安装结果
Driver: Installed
Toolkit: Installed In /Usr/Local/Cuda-5.0
Samples: Installation Failed. Missing Required Libraries.
也就是SDK安装失败,这个官方手册上也提到了解决方案。
- 单独安装SDK
解压sdk:
[plain] view plaincopy
1. sh cuda_5.5.22_linux_64.run -extract=/path/to/extract/dir/
到根目录下的/path/to/extract/dir/去找cuda-samples_5.5.22_*******.run, 安装
[plain] view plaincopy
1. sh cuda-samples_5.5.22_*******.run
- Path配置:
$sudo gedit etc/profile或~/.bashrc
[plain] view plaincopy
1. export PATH=$PATH:/usr/local/cuda-5.5/bin
2. export LD_LIBRARY_PATH=/usr/local/cuda-5.5/lib64:/lib
使之生效:
source /etc/profile(对应profile)或sudo ldconfig(对应bashrc)
还有一种装sdk的方法见http://askubuntu.com/questions/338907/how-to-install-cuda-5-5-under-ubuntu-12-04-lts-64-bit
- 验证
见官网http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-linux/index.html#verify-installation
nvcc-V:
deviceQuery:
正文最下方
- 装好theano的前提下配置~/.theanorc配置GPU
sudo vim ~/.theanorc
写入
[global]
floatX = float32
device = gpu
进行测试:http://deeplearning.net/software/theano/tutorial/using_gpu.html#testing-theano-with-gpu
=============
此外附上其他配置参考:
- theano+python模块
(Ubuntu 12.04自带python不用装,但要注意系统里很多模块依赖python,没事不要随便删!!!)
http://www.cnblogs.com/Ponys/p/3438491.html
网友评论