ubuntu12.04配置NVIDIA cuda7.0经验帖

今天安装了最新版本的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
主要检查是否有gpu,是否安装了gcc
二、 下载镜像:

       下.run好了,有点大1.1G,可到我的云盘里下载。

三、Ctrl+Alt+F1, 登陆

删除已有nvidia,拉黑名单


  1. sudo apt-get remove --purge nvidia*  
  2. sudo nano /etc/modprobe.d/blacklist.conf  

blacklist.conf加入

[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. lacklist amd76x_edac  
  2. blacklist vga16fb  
  3. blacklist nouveau  
  4. blacklist rivafb  
  5. blacklist nvidiafb  
  6. blacklist rivatv  
2 安装
[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. sudo service lightdm stop  
  2. chmod +x cuda_7.0.79_linux_64.run  
  3. 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:

[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. sh cuda_7.0.79_linux_64.run -extract=/path/to/extract/dir/  

到根目录下的 /path/to/extract/dir/去找c uda-samples_7.0.79_*******.run, 安装

[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. sh cuda-samples_7.0.79_*******.run  
4 Path配置:

$sudo gedit etc/profile或~/.bashrc

[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  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)

5 然后验证, nvcc -V
6 测试

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:

  
  
  1. $ mkdir ~/Documents/CUDA/CUDA_Hello_World
  2. $ cd ~/Documents/CUDA/CUDA_Hello_World
  3. $ nano CUDA_Hello_World.cu

In that file, write out the basic Hello World program:

  
  

  1. #include <stdio.h>
  2. __global__ void kernel(void) {
  3. }
  4. int main(void) {
  5. kernel<<<1,1>>>();
  6. printf("Hello, World!\n");
  7. return 0;
  8. }

Save and exit the editor. Then, compile the program:

  
  
  1. $ nvcc CUDA_Hello_World.cu -o CUDA_Hello_World

There shouldn’t be any errors. Therefore, you can just run it!

  
  
  1. $ ./CUDA_Hello_World


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值