Step 0: Install cuda from the standard repositories. (See How can I install CUDA on Ubuntu 16.04?)
Step 1: Register an nvidia developer account and download cudnn here (about 80 MB)
Step 2: Check where your cuda installation is. For the installation from the repository it is /usr/lib/...
and /usr/include
. Otherwise, it will be /usr/local/cuda/
or /usr/local/cuda-<version>
. You can check it with which nvcc
or ldconfig -p | grep cuda
Step 3: Copy the files:
Repository installation:
$ cd folder/extracted/contents
$ sudo cp -P include/cudnn.h /usr/include
$ sudo cp -P lib64/libcudnn* /usr/lib/x86_64-linux-gnu/
$ sudo chmod a+r /usr/lib/x86_64-linux-gnu/libcudnn*
Runfile installation:
$ cd folder/extracted/contents
$ sudo cp include/cudnn.h /usr/local/cuda/include
$ sudo cp lib64/libcudnn* /usr/local/cuda/lib64
$ sudo chmod a+r /usr/local/cuda/lib64/libcudnn*
Refer the NVIDIA's CUDA Installation Guide page 32/33(_according to PDF reader page 36/37) for more details on how to install at the custom location for the CUDA libaries, and also what environment variables to set to make it work.
Update:
As per the documentation:
Runfile
The Runfile can be extracted into the standalone Toolkit, Samples and
Driver Runfiles by using the --extract parameter. The Toolkit and Samples
standalone Runfiles can be further extracted by running:
$ ./runfile.run --tar mxvf
The Driver Runfile can be extracted by running:
$ ./runfile.run -x
...
For debian systems:
$ dpkg-deb -x package.deb output_dir
# Where package.deb is the downloaded debian package for cuda
# and output_dir is the directory where you want to extract the files.
Update 2:
As commented by the OP the installation guide page 34 ( PDF Reader Page 38) contains the necessary steps/references posted below for reference here:
How do I install the Toolkit in a different location?
The Runfile installation asks where you wish to install the Toolkit and the
Samples during an interactive install. If installing using a non-interactive
install, you can use the --toolkitpath and --samplespath parameters to
change the install location:
$ ./runfile.run --silent \
--toolkit --toolkitpath=/my/new/toolkit \
--samples --samplespath=/my/new/samples
The RPM and Deb packages cannot be installed to a custom install location
directly using the package managers. See the "Install CUDA to a specific
directory using the Package Manager installation method" scenario in the
Advanced Setup section for more information.
Best Answer
Install CUDA for Ubuntu
There is an Linux installation guide. However, it is basically only these steps:
md5sum cuda_7.5.18_linux.run
. Only continue if it is correct.sudo apt-get purge nvidia-cuda*
- if you want to install the drivers too, thensudo apt-get purge nvidia-*
.)sudo service lightdm stop
/etc/modprobe.d/blacklist-nouveau.conf
with the following contents:sudo update-initramfs -u
sudo sh cuda_7.5.18_linux.run --override
. Make sure that you sayy
for the symbolic link.sudo service lightdm start
See also: NVIDIA CUDA with Ubuntu 16.04 beta on a laptop (if you just cannot wait)
Notes: Yes, there is the possibility to install it via
apt-get install cuda
. I strongly suggest not to use it, as it changes the paths and makes the installation of other tools more difficult.You might also be interested in How can I install CuDNN on Ubuntu 16.04?.
*: Don't install the display drivers with this script. They are old. Download the latest ones from http://www.nvidia.com/Download/index.aspx
Verify CUDA installation
The following command shows the current CUDA version (last line):
The following command shows your driver version and how much GPU memory you have:
See also: Verify CuDNN installation
Help! The new driver does not work!
Don't panic. Even if you can't see anything on your computer, the following steps should get you back to the state before:
mount -o remount,rw /
(-
is?
and/
is-
in the american layout)sh cuda_7.5.18_linux.run --uninstall
sudo apt-get install nvidia-361 nvidia-common nvidia-prime nvidia-settings
Graphics drivers
Installing the graphics drivers is a bit tricky. This has to be done without graphics support.
dpkg -l | grep -i nvidia
sudo apt-get remove --purge nvidia-WHATEVER
sudo service lightdm stop
reboot
your pc / blacklist the nouveau driver (German tutorial)