NVIDIA440.44-CUDA10.0.130-CUDNN7.6.5 in Ubuntu16.04

NVIDIA440.44-CUDA10.0.130-CUDNN7.6.5 in Ubuntu16.04

NVIDIA

  1. Look up the version of NVIDIA, and download it.

    Compute Capability ref: https://developer.nvidia.com/cuda-gpus

    search ref: https://www.geforce.com/drivers

    1589385106504

  2. Pre-installation Actions

    2.1 Verify the System has the Correct Kernel Headers and Development Packages Installed

    The version of the kernel your system is running can be found by running the following command:

    $ uname -r
    

    If this command output nothing, the kernel headers and development packages for the currently running kernel can be installed with:

    $ sudo apt-get install linux-headers-$(uname -r)
    
  3. Uninstall

    Use the following command to uninstall a Driver runfile installation:

    $ sudo /usr/bin/nvidia-uninstall
    

    Use the following commands to uninstall a RPM/Deb installation:

    $ sudo apt-get --purge remove <package_name>          # Ubuntu
    

    Or

    $ sudo apt-get purge nvidia*
    $ sudo apt-get autoremove
    $ sudo ./NIVIDIA-Linux-X86_64-440.44.run --uninstall
    
  4. Installation

    Disable the Nouveau drivers:

    4.1 Create a file at/etc/modprobe.d/blacklist-nouveau.conf

    $ sudo gedit /etc/modprobe.d/blacklist-nouveau.conf
    

    with the following contents:

    blacklist nouveau
    options nouveau modeset=0
    

    4.2 Regenerate the kernel initramfs:

    $ sudo dracut --force
    or
    $ sudo update-initramfs -u
    

    4.3 Test nouveau

    $ lsmod | grep nouveau
    
    

    if there are nothing in the screen, you are successful.

    4.4 To runlevel 1

    Press Ctrl+Alt+F1 into runlevel1

    4.5 Shutdown graphical interface

    $ sudo service lightdm stop
    
    

    4.6 Install Nvidia

    $ sudo chmod +x ./NVIDIA-Linux-x86_64-440.44.run
    $ sudo ./NVIDIA-Linux-x86_64-440.44.run -no-opengl-files
    
    

    some choices needed to do.

    4.6.1 nVidia Installer Register the Kernel Source Modules with DKMS

    1589387535108

    No.

    4.6.2 nVidia Installer 32-bit Compatibility Libraries

    1589387609568

    No.

    4.6.3 nVidia Installer Installing Drivers and Building kernel module

    1589387672749

    Note: If you get libglvnd error, then abort installation and try this. Also “Install and overwrite existing files” works, but fixing this error is more clean way to install NVIDIA Drivers.

    4.6.4 nVidia Installer Automatic Xorg Config and Backup

    1589387721452

    Yes.

    4.6.5 nVidia Drivers Installation Complete

    1589387766339

    4.7 Mount Nvidia Drive and check the installation

    $ sudo modprobe nvidia
    $ nvidia-smi
    
    

    4.8 All Is Done and Then Back to Runlevel 5

    $ sudo service lightdm restart
    or
    Ctrl + Alt + F7
    or
    $ sudo init 5
    
    

    4.9 Reboot

    $ reboot
    

ref1: https://www.cnblogs.com/pprp/p/9430836.html

ref2: https://www.if-not-true-then-false.com/2015/fedora-nvidia-guide/

CUDA

  1. uninstall

    $ sudo /usr/local/cuda-10.0/bin/uninstall_cuda_10.0.pl
    $ sudo rm -rf /usr/local/cuda-10.0 
    
    
  2. lookup the version acccording to Tensor Version

​ ref: https://www.tensorflow.org/install/source

1589388279439

2. Pre-installation Actions

Some actions must be taken before the CUDA Toolkit and Driver can be installed on Linux:

  • Verify the system has a CUDA-capable GPU.
  • Verify the system is running a supported version of Linux.
  • Verify the system has gcc installed.
  • Verify the system has the correct kernel headers and development packages installed.
  • Download the NVIDIA CUDA Toolkit.
  • Handle conflicting installation methods.

Note: You can override the install-time prerequisite checks by running the installer with the -override flag. Remember that the prerequisites will still be required to use the NVIDIA CUDA Toolkit.

2.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.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.

2.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.

2.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.

Note: If you perform a system update which changes the version of the linux kernel being used, make sure to rerun the commands below to ensure you have the correct kernel headers and kernel development packages installed. Otherwise, the CUDA Driver will fail to work with the new kernel.

Ubuntu

The kernel headers and development packages for the currently running kernel can be installed with:

$ sudo apt-get install linux-headers-$(uname -r)

2.5. Choose an Installation Method

The CUDA Toolkit can be installed using either of two different installation mechanisms: distribution-specific packages (RPM and Deb packages), or a distribution-independent package (runfile packages). The distribution-independent package has the advantage of working across a wider set of Linux distributions, but does not update the distribution's native package management system. The distribution-specific packages interface with the distribution's native package management system. It is recommended to use the distribution-specific packages, where possible.

Note: Standalone installers are not provided for architectures other than the x86_64 release. For both native as well as cross development, the toolkit must be installed using the distribution-specific installer. See the CUDA Cross-Platform Installation section for more details.

2.6. Download the NVIDIA CUDA Toolkit

The NVIDIA CUDA Toolkit is available at http://developer.nvidia.com/cuda-downloads.

Choose the platform you are using and download the NVIDIA CUDA Toolkit

The CUDA Toolkit contains the CUDA driver and tools needed to create, build and run a CUDA application as well as libraries, header files, CUDA samples source code, and other resources.

Download Verification

The download can be verified by comparing the MD5 checksum posted at http://developer.nvidia.com/cuda-downloads/checksums with that of the downloaded file. If either of the checksums differ, the downloaded file is corrupt and needs to be downloaded again.

To calculate the MD5 checksum of the downloaded file, run the following:

$ md5sum <file>

3 Runfile Installer

Perform the following steps to install CUDA and verify the installation.

  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
      
      
  2. No operation.

  3. Press ctrl+alt+F1 into command-line interface and do following command to shutdown graphical interface:

    $ sudo service lightdm stop
    
    
  4. Run cuda file:

    $ sudo sh cuda_10.0.130_410.48_linux.run
    
    

    During the process, some choices need to be cautious.
    Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 410.48?
    (y)es/(n)o/(q)uit: n
    OpenGL is refused. (No)

  5. Restart graphical interface:

    $ sudo service lightdm start
    
    
  6. Set up the development environment by modifying the PATH and LD_LIBRARY_PATH variables in the end of file /etc/profile:

    $ export PATH=/usr/local/cuda-10.2/bin${PATH:+:${PATH}}
    $ export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64\
                            {LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
    $ souce /etc/profile
    $ reboot
    
    
  7. Install a writable copy of the samples then build and run the nbody sample:

    $ cuda-install-samples-10.0.sh ~  #could be ignored
    $ cd /usr/local/cuda-10.0/samples
    $ make
    $ cd ~/NVIDIA_CUDA-10.0_Samples/1_Utilities/deviceQuery
    $ make
    $ ./deviceQuery
    
    

​ The final show is Pass.

  1. Check the CUDA Version

    $ nvcc -V
    Or
    cat /usr/local/cuda/version.txt
    
    

ref1: https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html>

ref2: https://docs.nvidia.com/cuda/cuda-quick-start-guide/index.html#ubuntu-x86_64

ref3: https://blog.csdn.net/qlulibin/article/details/78714596

CUDNN

1. Downloading cuDNN For Linux

In order to download cuDNN, ensure you are registered for the NVIDIA Developer Program.

  1. Go to: NVIDIA cuDNN home page.
  2. Click Download.
  3. Complete the short survey and click Submit.
  4. Accept the Terms and Conditions. A list of available download versions of cuDNN displays.
  5. Select the cuDNN version you want to install. A list of available resources displays.

2. Downloading cuDNN For Linux

In order to download cuDNN, ensure you are registered for the NVIDIA Developer Program.

  1. Go to: NVIDIA cuDNN home page.
  2. Click Download.
  3. Complete the short survey and click Submit.
  4. Accept the Terms and Conditions. A list of available download versions of cuDNN displays.
  5. Select the cuDNN version you want to install. A list of available resources displays.

3. Installing cuDNN On Linux

The following steps describe how to build a cuDNN dependent program. Choose the installation method that meets your environment needs. For example, the tar file installation applies to all Linux platforms, and the debian installation package applies to Ubuntu 14.04,16.04, and 18.04.

In the following sections:

  • your CUDA directory path is referred to as /usr/local/cuda/
  • your cuDNN download path is referred to as

3.1. Installing From A Tar File

  1. Navigate to your directory containing the cuDNN Tar file.

  2. Unzip the cuDNN package.

    $ tar -xzvf cudnn-10.2-linux-x64-v7.6.5.32.tgz
    
    
  3. Copy the following files into the CUDA Toolkit directory, and change the file permissions.

    $ sudo cp cuda/include/cudnn.h /usr/local/cuda/include
    $ sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
    $ sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
    
    

3.2. Installing From A Debian File

  1. Navigate to your directory containing cuDNN Debian file.

  2. Install the runtime library, for example:

    sudo dpkg -i libcudnn7_7.6.5.32-1+cuda10.2_amd64.deb
    
    
  3. Install the developer library, for example:

    sudo dpkg -i libcudnn7-dev_7.6.5.32-1+cuda10.2_amd64.deb
    
    
  4. Install the code samples and the cuDNN Library User Guide, for example:

    sudo dpkg -i libcudnn7-doc_7.6.5.32-1+cuda10.2_amd64.deb
    
    

3.3. Installing From An RPM File

  1. Download the rpm package libcudnn*.rpm to the local path.

  2. Install the rpm package from the local path. This will install the cuDNN libraries.

    rpm -ivh libcudnn7-*.x86_64.rpm
    rpm -ivh libcudnn7-devel-*.x86_64.rpm
    rpm -ivh libcudnn7-doc-*.x86_64.rpm
    
    

4.Check Cudnn Version

$ cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2

ref1: https://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html#download

ref2: https://www.cnblogs.com/pprp/p/9463974.html

Error

The system is running in low-graphics mode

Solution1:

No internet

1.Ctrl + Alt + F1

2.login

3.input the code below:

`sudo` `chown` `lightdm:lightdm -R ``/var/lib/lightdm``sudo` `chown` `avahi-autoipd:avahi-autoipd -R ``/var/lib/avahi-autoipd``sudo` `chown` `colord:colord -R ``/var/lib/colord``sudo` `reboot`

Solution2:

$ sudo apt-get purge nvidia*

Solution3:

$ sudo apt-get purge fglrx

posted @ 2020-05-14 01:29  sailonzn  阅读(462)  评论(0编辑  收藏  举报