First you need to download the appropriate installation packages.

As of 07-30-2016 the Nvidia linux toolkit consisted of:

  • cuda_8.0.27_linux.run:


  • NVIDIA-Linux-x86_64-367.35.run:



  • Before doing the actual install consider updating your system:

    $ sudo apt-get update
    $ sudo apt-get dist-upgrade
    $ sudo update-pciids
    $ sudo update-usbids
    


    The *.run package will not install when a nvidia graphics driver is loaded in the kernel. As stated elsewhere my setup uses an AMD video card for X11 to simplify use of the Nvidia GPU for compute only. Since the generic kernel loads the nouveau driver to support Nvidia cards on X11, we must prevent this by editing:

    /etc/modprobe.d/blacklist.conf:

     ...
        blacklist nouveau
     ...
    


    Then you will need to remove it from initramfs. The following will update initramfs with the above blacklist info. Be sure to reboot your system after the update:

    $ sudo update-initramfs -u
    update-initramfs: Generating /boot/initrd.img-4.4.0-21-generic
    $ sudo reboot
    


    We then need to install the nvidia drivers with X11 disabled. The "control-alt-function1" sequence should bring you to a virtual console. Log in, then stop X11:

    CNTL-ALT-F1
    $ sudo service lightdm stop
    


    Next we install the CUDA GPU driver. Ignore the "pre-install script failed!" message. Be sure to answer 'NO' to the "run the nvidia-xconfig utility" question. You should also ignore the "update your XF86Config or xorg.conf file" message.

    $ sudo sh ./NVIDIA-Linux-x86_64-367.35.run --no-opengl-files
    
    Accept licence?
    
    OK
    
    The distributuon-provided pre-install script failed!  Are you sure you want to continue? Continue Installation
    
    Building kernel modules  100%
    
    Warning: Unable to find a suitable destination to install 32-bit compatibility libraries.
    Your system amy not be set up for 32-bit compatibility.
    32-bit compatibility files will not be installed: if you wish to install them,
    re-run the installation and set a valid directory with the --compat32-libdir option.
    
    OK
    
    Installing NVIDIA driver ...
    
    Would you like to run the nvidia-xconfig utility to automatically update your x configuration so that the
    NVIDIA X driver will be used when you restart X?
    Any pre-existing X configuration file will be backed up.
    
    NO
    
    Installation of the NVIDIA Accelerated Graphics Driver for Linux-x86_64 (version: 367.27) is now complete.
    Please update your XF86Config or xorg.conf file as appropriate;
    see the file/usr/share/doc/NVIDIA_GLX-1.0/README.txt for details.
    
    OK
    


    While still in the virtual console we install the SDK. Be sure to respond NO to the "Install NVIDIA Accelerated Graphics Driver" question. We loaded a newer driver in the previous step.

    $ sudo sh ./cuda_6.0.37_linux_64.run
    
    [ EULA aggrement is presented thru less ]
     ...
    1%q
    
    Do you accept the previously read EULA?
    accept/decline/quit: accept
    
    Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 361.62?
    ((y)es/(n)o/(q)uit): n
    
    Install the CUDA 8.0 Toolkit?
    ((y)es/(n)o/(q)uit): y
    
    Enter Toolkit Location [ default is /usr/local/cuda-8.0 ]: 
    
    Do you want to install a symbolic link at /usr/local/cuda?
    ((y)es/(n)o/(q)uit): y
    
    Install the CUDA 8.0 Samples?
    ((y)es/(n)o/(q)uit): y
    
    Enter CUDA Samples Location
     [ default is /home/you]: 
    
    Installing the CUDA toolkit in /usr/local/cuda-8.0 ...
    Missing recommended library: libGLU.so
    Missing recommended library: libX11.so
    Missing recommended library: libXi.so
    Missing recommended library: libXmu.so
    Missing recommended library: libGL.so
    
    Installing the CUDA Samples in /home/you ...
    Copying Samples to /home/you/NVIDIA_CUDA-8.0_Samples now...
    Finished copying Samples.
    
    ===========
    = Summary =
    ===========
    
    Driver:   Not Selected
    Toolkit:  Installed in /usr/local/cuda-8.0
    Samples:  Installed in /home/you, but missing recommended libraries
    
    Please make sure that
     -  PATH includes /usr/local/cuda-8.0/bin
     -  LD_LIBRARY_PATH includes /usr/local/cuda-8.0/lib64, or,
         add /usr/local/cuda-8.0/lib64 to /etc/ld.so.conf and run ldconfig as root
    
    To uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-8.0/bin
    
    Please see CUDA_Installation_Guide_Linix.pdf in /usr/local/cuda-8.0/doc/pdf for
     detailed information on setting up CUDA.
    
    ***Warning Incomplete Installation! This installation did not install the CUDA Driver.
    A driver of version of at least 361.00 is required for CUDA-8.0 functionality to work.
    To install the driver using this installer, run the following command,
     replacing  with the name of this run file:
    
        sudo .run -silent -driver
    
    Logfile is /tmp/cuda_install_5974.log
    
    $ sudo reboot
    

    The missing file warnings and post-install instructions should all be ignored, except:

      PATH includes /usr/local/cuda-8.0/bin
      add /usr/local/cuda-8.0/lib64 to /etc/ld.so.conf and run ldconfig as root
    



    The driver should be loaded at boot time. You can automate this on boot by editing:

    /etc/modules:

     ...
    #
    nvidia-uvm
     ...
    


    Reboot your system one final time and everything should be running. Test the CUDA driver load by running:

    $ sudo modprobe --first-time nvidia-uvm
    modprobe: ERROR: could not insert 'nvidia_uvm': Module already in kernel
    
    $ dmesg | grep nouveau
    $
    

    The modprobe call should fail, if not, something is wrong with your driver install or /etc/modules file.
    The dmesg call should NOT find a nouveau reference.



    You can test the CUDA system by going to /home/you/NVIDIA_CUDA-8.0_Samples and running:

    $ cd /home/you/NVIDIA_CUDA-8.0_Samples
    $ make -j16
     ...
    Finished building CUDA samples
    
    $ bin/x86_64/linux/release/deviceQuery
    bin/x86_64/linux/release/deviceQuery Starting...
    
     CUDA Device Query (Runtime API) version (CUDART static linking)
    
    Detected 1 CUDA Capable device(s)
    
    Device 0: "GeForce GTX 750 Ti"
      CUDA Driver Version / Runtime Version          8.0 / 8.0
      
       ...
    
    deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 8.0, CUDA Runtime Version = 8.0, NumDevs = 1, Device0 = GeForce GTX 750 Ti
    Result = PASS