Guide of Installing CUDA-7.5 on Ubuntu 14.04
I have struggled a whole day to install the driver of Nvidia GTX 970 on Ubuntu. In this blog, you will learn step by step to pre-configure your Linux and run the installation run-file. I hope this blog will save your time. You are welcome!
 PRE-INSTALLATION ACTIONS
(1)Verify You Have a CUDA-Capable GPU
To verify that your GPU is CUDA-capable, go to your distribution’s equivalent of System Properties, or, from the command line, enter:
$ lspci | grep -i nvidia
If you do not see any settings, update the PCI hardware database that Linux maintains by entering update-pciids (generally found in /sbin) at the command line and rerun the previous lspci command.
If your graphics card is from NVIDIA and it is listed in http://developer.nvidia.com/ cuda-gpus, your GPU is CUDA-capable.
The Release Notes for the CUDA Toolkit also contain a list of supported products.
(2) Verify You Have a Supported Version of Linux
The CUDA Development Tools are only supported on some specific distributions of Linux. These are listed in the CUDA Toolkit release notes.
To determine which distribution and release number you’re running, type the following at the command line:
$ uname -m && cat /etc/*release
You should see output similar to the following, modified for your particular system:
x86_64 Red Hat Enterprise Linux Workstation release 6.0 (Santiago)
The x86_64 line indicates you are running on a 64-bit system. The remainder gives information about your distribution.
(3) Verify the System Has gcc Installed
The gcc compiler is required for development using the CUDA Toolkit. It is not required for running CUDA applications. It is generally installed as part of the Linux installation, and in most cases the version of gcc installed with a supported version of Linux will work correctly.
To verify the version of gcc installed on your system, type the following on the command line:
$ gcc --version
If an error message displays, you need to install the development tools from your Linux distribution or obtain a version of gcc and its accompanying toolchain from the Web.
(4) Verify the System has the Correct Kernel Headers and Development Packages Installed
The CUDA Driver requires that the kernel headers and development packages for the running version of the kernel be installed at the time of the driver installation, as well whenever the driver is rebuilt. For example, if your system is running kernel version 3.17.4-301, the 3.17.4-301 kernel headers and development packages must also be installed.
While the Runfile installation performs no package validation, the RPM and Deb installations of the driver will make an attempt to install the kernel header and development packages if no version of these packages is currently installed. However, it will install the latest version of these packages, which may or may not match the version of the kernel your system is using. Therefore, it is best to manually ensure the correct version of the kernel headers and development packages are installed prior to installing the CUDA Drivers, as well as whenever you change the kernel version.
The version of the kernel your system is running can be found by running the following command:
$ uname -r
This is the version of the kernel headers and development packages that must be installed prior to installing the CUDA Drivers. This command will be used multiple times below to specify the version of the packages to install. Note that below are the common-case scenarios for kernel usage. More advanced cases, such as custom kernel branches, should ensure that their kernel headers and sources match the kernel build they are running.
The kernel headers and development packages for the currently running kernel can be installed with:
$ sudo apt-get install linux-headers-$(uname -r)
 RUNFILE INSTALLATION
Perform the following steps to install CUDA and verify the installation.
Because the GPU cannot be recognized by Ubuntu 14.04 automatically, you have to use iGpu first to play with your system, and you can set this in your BIOS.
step 0: Shutdown the X window.
sudo service lightdm stop
step 1: Disable the Nouveau drivers
1. Create a file at /etc/modprobe.d/blacklist-nouveau.conf with the following contents:
blacklist nouveau options nouveau modeset=0
2. Regenerate the kernel initramfs:
sudo update-initramfs -u
step 2: Reboot into runlevel 3
sudo init 3
step 3: Run the installer silently to install with the default selections (implies acceptance of the EULA):
sudo sh cuda_<version>_linux.run
After this step, you will see the installation failed. That maybe caused by you are using iGPU but not GPU. Now, you have to shutdown your computer and plug in your DVI cable on you GPU to connect with your screen and then enter your BIOS to set use GPU(maybe AUTO or PCIE). Although the previous installation has not successfully installed the whole CUDA, it still made the GPU driven to light the screen. With this GPU lighting screen, you need to repeat the previous four steps and you will see the successful installation.
step 4: Create an xorg.conf file to use the NVIDIA GPU for display
$ sudo nvidia-xconfig
Without this step, you will suffer from loop login.
step 5: Set up the development environment by modifying the PATH and LD_LIBRARY_PATH variables
You are recommended to add the following commands to your .bashrc
$ export PATH=/usr/local/cuda-7.5/bin:$PATH $ export LD_LIBRARY_PATH=/usr/local/cuda-7.5/lib64:$LD_LIBRARY_PATH
step 6: Reboot the system to load the graphical interface.
When you make OpenCV, you should try the following command.
cd opencv-[version]/ mkdir build cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D CUDA_GENERATION=Kepler .. make -j 4 sudo make install
This blog refers to the manual of CUDA and some Q&As on the web.
Enjoy your research!