ubuntu14.04安装cuda驱动

from http://askubuntu.com/questions/451672/installing-and-testing-cuda-in-ubuntu-14-04


I got Cuda6 working on Lubuntu 14.04. This already had build-essentials installed, so if you're using a fresh install, you should probably install it:

apt-get install build-essential

Download the cuda6 run package (6.0.37 at the current time of writing) to ~/Downloads:http://developer.download.nvidia.com/compute/cuda/6_0/rel/installers/cuda_6.0.37_linux_64.run

Open up a terminal and extract the separate installers via:

mkdir ~/Downloads/nvidia_installers;
cd ~/Downloads
./cuda_6.0.37_linux_64.run -extract=~/Downloads/nvidia_installers;

(I tried running the .run file directly, but it kept screwing up my Xorg install and would never let X run. I believe it is a config issue between driver versions: those installed by apt-get nvidia-331-updates and the cuda*.run driver.)  这一步非常关键!!!

Completely uninstall anything in the ubuntu repositories with nvidia-*. I used synaptic and did a purge, AKA completely uninstall programs and configuration.

sudo apt-get --purge remove nvidia-*

Have these instructions handy as we need to kill X install the driver. Hit CTL+ALT+F1 to drop to the physical terminal and log in.

cd ~/Downloads/nvidia_installers;
sudo service lightdm stop
sudo killall Xorg
sudo ./NVIDIA-Linux-x86_64-331.62.run 

Accept the EULA and install the driver. I would recommend letting it update Xorg config files.

After that installer finishes, turn on the nvidia module and install CUDA.

sudo modprobe nvidia
sudo ./cuda-linux64-rel-6.0.37-18176142.run
sudo ./cuda-samples-linux-6.0.37-18176142.run

test if the drivers are working by going to your sample directory

cd /usr/local/cuda/samples
sudo chown -R <username>:<usergroup> .
cd 1_Utilities/deviceQuery
make .
./deviceQuery    

Worked for me at this point. Now restart X

sudo service lightdm start

You should be able to do

lsmod | grep nv

and see a line with nvidia listed. Don't forget to log back out of your physical terminal if it all worked.

APPENDIX

In my case it was necessary to add the folder that contains the executable to your $PATH.

One way of doing it is to edit the ~/.bashrc file in your Home folder. Add a line to your .bashrc (modify the location if you changed the default CUDA installation folder)

export PATH=/usr/local/cuda-6.0/bin:$PATH

Save the file and then source your .bashrc by typing

source .bashrc

when in your home folder.


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值