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.
本文详细介绍了如何在Lubuntu 14.04上安装和配置CUDA 6.0.37版本,包括必要的依赖安装、下载CUDA安装包、分离安装文件、卸载Ubuntu软件源中的NVIDIA组件、安装NVIDIA驱动、安装CUDA运行时库及测试CUDA是否成功安装等步骤。

1275

被折叠的 条评论
为什么被折叠?



