今天安装了最新版本的cuda7.0,第一次安装,并测试成功。先将安装步骤,整理如下。
————————————————————————————————————————————————————————————
配置手册:http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-linux/index.html
这个针对linux系统的,讲的很复杂,看了一遍没看懂,最后参考Rachel-Zhang的安装文档(http://blog.csdn.net/abcjennifer/article/details/23016583),安装成功。
——————————————————————————————
一、 判断安装环境:
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
下.run好了,有点大1.1G,可到我的云盘里下载。
三、Ctrl+Alt+F1, 登陆
1 删除已有nvidia,拉黑名单
- sudo apt-get remove --purge nvidia*
- sudo nano /etc/modprobe.d/blacklist.conf
- lacklist amd76x_edac
- blacklist vga16fb
- blacklist nouveau
- blacklist rivafb
- blacklist nvidiafb
- blacklist rivatv
- sudo service lightdm stop
- chmod +x cuda_7.0.79_linux_64.run
- sudo ./cuda_7.0.79_linux_64.run
Cuda7.0集成了toolkit,sdk和driver, 所以安装的时候一路同意下来就好了
得到以下安装结果
Driver: Installed
Toolkit: Installed In /Usr/Local/Cuda-7.0
Samples: Installation Failed. Missing Required Libraries.
也就是SDK安装失败,这个官方手册上也提到了解决方案。
3 此时可以单独安装sdk
解压sdk:
- sh cuda_7.0.79_linux_64.run -extract=/path/to/extract/dir/
到根目录下的 /path/to/extract/dir/去找c uda-samples_7.0.79_*******.run, 安装
- sh cuda-samples_7.0.79_*******.run
$sudo gedit etc/profile或~/.bashrc
- export PATH=$PATH:/usr/local/cuda-5.5/bin
- export LD_LIBRARY_PATH=/usr/local/cuda-5.5/lib64:/lib
使之生效:
source /etc/profile(对应profile)或sudo ldconfig(对应bashrc)
Hello World
In the spirit of all good programming assignments, we’ll start off with a simple “Hello World†app that will give a good starting place for making your own programs.
Create a new folder in your CUDA work directory and open a new file:
- $ mkdir ~/Documents/CUDA/CUDA_Hello_World
- $ cd ~/Documents/CUDA/CUDA_Hello_World
- $ nano CUDA_Hello_World.cu
In that file, write out the basic Hello World program:
- #include <stdio.h>
- __global__ void kernel(void) {
- }
- int main(void) {
- kernel<<<1,1>>>();
- printf("Hello, World!\n");
- return 0;
- }
Save and exit the editor. Then, compile the program:
- $ nvcc CUDA_Hello_World.cu -o CUDA_Hello_World
There shouldn’t be any errors. Therefore, you can just run it!
- $ ./CUDA_Hello_World