Installing and testing CUDA in Ubuntu 14.04
Solution 1
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
:
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. Press 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.
Solution 2
For CUDA-6.5 I followed this simple tutorial:
Download the .deb here then
sudo dpkg -i cuda-repo-ubuntu1404_6.5-14_amd64.deb
sudo apt-get update
sudo apt-get install cuda
echo 'export PATH=/usr/local/cuda-6.5/bin:$PATH #CUDA' >> ~/.bashrc
That's everything I needed to start coding on a fresh 14.04.1 install with my GTX 750ti. It installs the nvidia-340 driver. deviceQuery and all of the other samples ran properly after I compiled them.
Solution 3
I have installed the nvidia-cuda-toolkit
package this morning on a fresh 14.04. I also installed the nvidia driver (version 331.38
marked as tested) from the additional driver interface.
sudo apt-get install nvidia-cuda-toolkit
Up to now everything seems to work well (nvcc
is here, display is correct). You need to restart to use the new driver.
As you mentioned this is CUDA 5.5 but in my case it's not a problem.
Solution 4
Quick and easy solution that worked for me (cuda 5.5, Lubuntu 14.04 64-bit):
Make sure you're using nvidia's propietary driver (331.38 for me) from Start menu-> Preferences->Software & Updates.
Download the .deb package for your Ubuntu release from Nvidia's site.
Add repo:
sudo dpkg -i cuda-repo-ubuntu1304_6.0-37_amd64.deb
sudo apt-get update
Get dependencies:
sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev
Get the toolkit:
sudo apt-get install nvidia-cuda-toolkit
(Optional) Get nsight IDE:
sudo apt-get install nvidia-nsight
And you're ready to go!
Solution 5
I got CUDA 6.0 up and working on 14.04 using the following steps.
Install the nvidia-331, nvidia-331-dev and nvidia-331-uvm packages from xorg-edgers using instructions for adding the ppa from here.
Install CUDA 6.0 using the "-extract" method above, except ignore the steps for installing the driver and instead rely on the packages. Only install the compiler and samples.
Related videos on Youtube
nass
Updated on September 18, 2022Comments
-
nass over 1 year
I am uncertain about how to install CUDA in my system. looking around there are many tutorials about cuda on 12.04 LTS and a few on 13.04 and 13.10, but they all talk about acquiring a
deb
package from the NVidia CUDA developer zone.Well NVidia does not offer a Debian package for 14.04 as of yet.
However, there is a promising package in
apt
repository:nvidia-cuda-toolkit
.The problem is that I didn't find any example with it. At least not the examples that are referred to in cuda6 online documentation section 4.11.
I should mention that the toolkit installed is v5.5, not v6 but I haven't found documentation for cuda v5.5 on the NVidia website.
So I can verify that
nvcc
is there, but nothing further than that. How can I get some examples to run to verify the CUDA is installed properly?-
TinyEpic almost 10 years@Chris.Wilson I was following your instruction and everything was fine; but at the ./deviceQuery stage my machine said no CUDA-capable device is detected. My machine has Nvidia GTX780. Do you have any idea about this problem?
-
Nickolai Leschov almost 10 yearsMy Ubuntu 14.04 complains: "E: Unable to locate package nvidia-cuda-toolkit". Maybe because I have a 64-bit server distribution? Do you know how I can install CUDA on Ubuntu 14.04 64-bit server?
-
stealthcopter almost 10 yearsProbably need to add the nvidia repo to your sources
-
200_success over 8 years@NickolaiLeschov nvidia-cuda-toolkit is part of multiverse, which you may need to enable.
-
-
nass about 10 years
cuda-5.5 samples
are in /usr/share/doc/? -
Coiby about 10 yearsIt depends. Please check /usr/local/cuda/samples/. It it doesn't exist, you can download .run from developer.nvidia.com/cuda-downloads and only install samples. It'll be installed to ~/NVIDIA_CUDA-5.5_Samples/ by default.
-
Chris.Wilson almost 10 years@tohnperfect: you might need to modprobe nvidia after the driver install so that the ./deviceQuery actually hits the nvidia driver. Did it happen to work after a reboot? If so, the nvidia driver probably wasn't actually loaded.
-
Nickolai Leschov almost 10 yearsNotes: 1) On my system the package is called
build-essential
, notbuild-essentials
2) I don't have X to stop, as I run a server variant without X 3) sudo modprobe nvidia goesFATAL
at this point, looks like the driver wasn't installed? My version of the recipe is here, but it doesn't work. -
Nickolai Leschov almost 10 yearsWhen I install driver with
sudo ./NVIDIA-Linux-x86_64-331.62.run
, I get an this error. In/var/log/nvidia-installer.log
I see the following lines. When I trymake oldconfig && make prepare
I get this. At this point I gave up. -
hookenz almost 10 yearsThe correct build essential package name is "build-essential" (no s).
-
Bart almost 10 yearsIt is not necessary to extract the .run file. Instead, just supply the appropriate command line options. E.g.,
sudo ./cuda_6.0.37_linux_64.run -driver -silent
to install the driver,sudo ./cuda_6.0.37_linux_64.run -toolkit -samples -silent -override
to install the toolkit and samples (use-help
for more options). Also, better notchmod
the samples directly: the toolkit contains a scriptcuda-install-samples-6.0.sh
in its bin directory to copy them to a local location. -
Arjun about 9 yearsI'm getting a Fatal error: can't create
deviceQuery.o: Permission Denied
. What am I to do? Sorry I'm new to linux. I didchmod -R root *
before. @Chris.Wilson Besides, I do not know if it is due to the driver, but I can log in but nothing happens after that. The screen remains frozen. -
Steven C. Howell almost 9 yearsThis worked well for me (got CUDA 7.0). It took a long time to download the files (during the apt-get install) but it now works.
-
user1282043 over 8 yearsDoes this still work if I want to install CUDA purely for parallel processing purposes, and I don't want my graphics card to be used for rendering?
-
mkuse over 8 yearsI get a pre-install script error and finally it fails to install.
-
Scott Stensland about 7 yearsCUDA 7.5 is at r-tutor.com/gpu-computing/cuda-installation/cuda7.5-ubuntu