• ubuntu--- 【CUDA Toolkit Documentation】文档划重点


     

    认真阅读 https://docs.nvidia.com/cuda/archive/9.0/cuda-installation-guide-linux/index.html ,

    Installation Guide Linux::CUDA Toolkit Documentation ,会发现很多安装CUDA的细节问题。

    官网的安装说明,解释了之前安装踩过的一些坑的原因,截取其中一部分划重点。

    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. #有的ubuntu 版本不支持CUDA, Ubutnu 16+ 基本都支持CUDA
    • 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 enteringupdate-pciids(generally found in/sbin) at the command line and rerun the previouslspcicommand.

    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)

    Thex86_64line indicates you are running on a 64-bit system. The remainder gives information about your distribution.

    2.3. Verify the System Has gcc Installed

    Thegcccompiler 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 ofgccand 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.7. Handle Conflicting Installation Methods

    Before installing CUDA, any previously installations that could conflict should be uninstalled. This will not affect systems which have not had CUDA installed previously, or systems where the installation method has been preserved (RPM/Deb vs. Runfile). See the following charts for specifics.

    Table 2. CUDA Toolkit Installation Compatibility Matrix
      Installed Toolkit Version == X.Y Installed Toolkit Version != X.Y
    RPM/Deb run RPM/Deb run
    Installing Toolkit Version X.Y RPM/Deb No Action Uninstall Run No Action No Action
    run Uninstall RPM/Deb Uninstall Run No Action No Action
    Table 3. NVIDIA Driver Installation Compatibility Matrix
      Installed Driver Version == X.Y Installed Driver Version != X.Y
    RPM/Deb run RPM/Deb run
    Installing Driver Version X.Y RPM/Deb No Action Uninstall Run No Action Uninstall Run
    run Uninstall RPM/Deb No Action Uninstall RPM/Deb No Action
    Use the following command to uninstall a Toolkit runfile installation:
    $ sudo /usr/local/cuda-X.Y/bin/uninstall_cuda_X.Y.pl
    Use the following command to uninstall a Driver runfile installation:
    $ sudo /usr/bin/nvidia-uninstall

    .....

    The Runfile installation installs the NVIDIA Driver, CUDA Toolkit, and CUDA Samples via an interactive text-based interface.

    The installation steps are listed below. Distribution-specific instructions on disabling the Nouveau drivers as well as steps for verifying device node creation are also provided.

    Finally, advanced options for the installer and uninstallation steps are detailed below.

    The Runfile installation does not include support for cross-platform development. For cross-platform development, see the CUDA Cross-Platform Environment section.

    4.2. Installation

    1. Perform the pre-installation actions.

    2. Disable the Nouveau drivers.

    3. Reboot into text mode (runlevel 3).

      This can usually be accomplished by adding the number "3" to the end of the system's kernel boot parameters.

      Since the NVIDIA drivers are not yet installed, the text terminals may not display correctly. Temporarily adding "nomodeset" to the system's kernel boot parameters may fix this issue.

      Consult your system's bootloader documentation for information on how to make the above boot parameter changes.

      The reboot is required to completely unload the Nouveau drivers and prevent the graphical interface from loading. The CUDA driver cannot be installed while the Nouveau drivers are loaded or while the graphical interface is active.

    4. Verify that the Nouveau drivers are not loaded. If the Nouveau drivers are still loaded, consult your distribution's documentation to see if further steps are needed to disable Nouveau.

    5. Run the installer and follow the on-screen prompts:
      $ sudo sh cuda_<version>_linux.run
      The installer will prompt for the following:
      • EULA Acceptance
      • CUDA Driver installation
      • CUDA Toolkit installation, location, and/usr/local/cudasymbolic link
      • CUDA Samples installation and location
      The default installation locations for the toolkit and samples are:
      ComponentDefault Installation Directory
      CUDA Toolkit /usr/local/cuda-9.0
      CUDA Samples $(HOME)/NVIDIA_CUDA-9.0_Samples

      The/usr/local/cudasymbolic link points to the location where the CUDA Toolkit was installed. This link allows projects to use the latest CUDA Toolkit without any configuration file update.

      The installer must be executed with sufficient privileges to perform some actions. When the current privileges are insufficient to perform an action, the installer will ask for the user's password to attempt to install with root privileges. Actions that cause the installer to attempt to install with root privileges are:
      • installing the CUDA Driver
      • installing the CUDA Toolkit to a location the user does not have permission to write to
      • installing the CUDA Samples to a location the user does not have permission to write to
      • creating the/usr/local/cudasymbolic link
      Running the installer with sudo, as shown above, will give permission to install to directories that require root permissions. Directories and files created while running the installer with sudo will have root ownership.

      If installing the driver, the installer will also ask if the openGL libraries should be installed. If the GPU used for display is not an NVIDIA GPU, the NVIDIA openGL libraries should not be installed. Otherwise, the openGL libraries used by the graphics driver of the non-NVIDIA GPU will be overwritten and the GUI will not work. If performing a silent installation, the --no-opengl-libs option should be used to prevent the openGL libraries from being installed. See the Advanced Options section for more details.

      If the GPU used for display is an NVIDIA GPU, the X server configuration file,/etc/X11/xorg.conf, may need to be modified. In some cases,nvidia-xconfigcan be used to automatically generate axorg.conffile that works for the system. For non-standard systems, such as those with more than one GPU, it is recommended to manually edit thexorg.conffile. Consult thexorg.confdocumentation for more information.

      Note: Installing Mesa may overwrite the/usr/lib/libGL.so that was previously installed by the NVIDIA driver, so a reinstallation of the NVIDIA driver might be required after installing these libraries.
    6. Reboot the system to reload the graphical interface.

    7. Verify the device nodes are created properly.

    8. Perform the post-installation actions.

    4.3. Disabling Nouveau

    To install the Display Driver, the Nouveau drivers must first be disabled. Each distribution of Linux has a different method for disabling Nouveau.

    The Nouveau drivers are loaded if the following command prints anything:
    $ lsmod | grep nouveau
    ...

    4.3.5. Ubuntu

    1. Create a file at/etc/modprobe.d/blacklist-nouveau.confwith the following contents:
      blacklist nouveau
      options nouveau modeset=0
    2. Regenerate the kernel initramfs:
      $ sudo update-initramfs -u

    4.4. Device Node Verification

    Check that the device files/dev/nvidia*exist and have the correct (0666) file permissions. These files are used by the CUDA Driver to communicate with the kernel-mode portion of the NVIDIA Driver. Applications that use the NVIDIA driver, such as a CUDA application or the X server (if any), will normally automatically create these files if they are missing using the setuidnvidia-modprobetool that is bundled with the NVIDIA Driver. However, some systems disallow setuid binaries, so if these files do not exist, you can create them manually by using a startup script such as the one below:

    #!/bin/bash
    
    /sbin/modprobe nvidia
    
    if [ "$?" -eq 0 ]; then
      # Count the number of NVIDIA controllers found.
      NVDEVS=`lspci | grep -i NVIDIA`
      N3D=`echo "$NVDEVS" | grep "3D controller" | wc -l`
      NVGA=`echo "$NVDEVS" | grep "VGA compatible controller" | wc -l`
    
      N=`expr $N3D + $NVGA - 1`
      for i in `seq 0 $N`; do
        mknod -m 666 /dev/nvidia$i c 195 $i
      done
    
      mknod -m 666 /dev/nvidiactl c 195 255
    
    else
      exit 1
    fi
    
    /sbin/modprobe nvidia-uvm
    
    if [ "$?" -eq 0 ]; then
      # Find out the major device number used by the nvidia-uvm driver
      D=`grep nvidia-uvm /proc/devices | awk '{print $1}'`
    
      mknod -m 666 /dev/nvidia-uvm c $D 0
    else
      exit 1
    fi

    4.5. Advanced Options

    ActionOptions UsedExplanation
    Silent Installation --silent Required for any silent installation. Performs an installation with no further user-input and minimal command-line output based on the options provided below. Silent installations are useful for scripting the installation of CUDA. Using this option implies acceptance of the EULA. The following flags can be used to customize the actions taken during installation. At least one of --driver, --uninstall, --toolkit, and --samples must be passed if running with non-root permissions.
    --driver Install the CUDA Driver.
    --toolkit Install the CUDA Toolkit.
    --toolkitpath=<path> Install the CUDA Toolkit to the <path> directory. If not provided, the default path of/usr/local/cuda-9.0is used.
    --samples Install the CUDA Samples.
    --samplespath=<path> Install the CUDA Samples to the <path> directory. If not provided, the default path of$(HOME)/NVIDIA_CUDA-9.0_Samplesis used.
    --uninstall (DEPRECATED) Unnstall the CUDA Driver.
    Extraction --extract=<path>

    Extracts the individual driver, toolkit, and samples runfile installers to <path>.

    This is especially useful when one wants to install the driver using one or more of the command-line options provided by the driver installer which are not exposed in this installer.

    Overriding Installation Checks --override Ignores compiler, third-party library, and toolkit detection checks which would prevent the CUDA Toolkit and CUDA Samples from installing.
    No OpenGL Libraries --no-opengl-libs Prevents the driver installation from installing NVIDIA's GL libraries. Useful for systems where the display is driven by a non-NVIDIA GPU. In such systems, NVIDIA's GL libraries could prevent X from loading properly.
    Overriding Kernel Source --kernel-source-path=<path> Tells the driver installation to use <path> as the kernel source directory when building the NVIDIA kernel module. Required for systems where the kernel source is installed to a non-standard location.
    Running nvidia-xconfig --run-nvidia-xconfig Tells the driver installation to run nvidia-xconfig to update the system X configuration file so that the NVIDIA X driver is used. The pre-existing X configuration file will be backed up.
    No nvidia-drm kernel module --no-drm Do not install the nvidia-drm kernel module. This option should only be used to work around failures to build or install the nvidia-drm kernel module on systems that do not need the provided features.
    Custom Temporary Directory Selection --tmpdir=<path> Performs any temporary actions within <path> instead of /tmp. Useful in cases where /tmp cannot be used (doesn't exist, is full, is mounted with 'noexec', etc.).
    Show Verbose Output --verbose Prints all logging information to stdout as well as the log file.
    Show Installer Options --help Prints the list of command-line options to stdout.

    4.6. Uninstallation

    To uninstall the CUDA Toolkit, run the uninstallation script provided in the bin directory of the toolkit. By default, it is located in/usr/local/cuda-9.0/bin:
    $ sudo /usr/local/cuda-9.0/bin/uninstall_cuda_9.0.pl
    To uninstall the NVIDIA Driver, runnvidia-uninstall:
    $ sudo /usr/bin/nvidia-uninstall
    To enable the Nouveau drivers, remove the blacklist file created in the Disabling Nouveau section, and regenerate the kernel initramfs/initrd again as described in that section.

     

  • 相关阅读:
    很简单的企业管理器我写程序的方式,几个自定义控件。
    当OO遇到了持久化?!
    [自定义服务器控件] 第一步:文本框。
    [面向过程——老酒换新瓶] (一)开篇:是面向过程还是面向对象?
    个人理财小助手 —— 设计思路、功能说明
    《Head First 设计模式》 终于出中文版了。
    其实添加数据也可以这样简单——表单的第一步抽象(针对数据访问层)《怪怪设计论: 抽象无处不在 》有感
    基类、接口的应用——表单控件:一次添加、修改一条记录,一次修改多条记录。(上)
    其实添加数据也可以这样简单——表单的第三步抽象(针对UI及后置代码)
    转帖:客户端表单通用验证checkForm(oForm) js版
  • 原文地址:https://www.cnblogs.com/carle-09/p/12375821.html
Copyright © 2020-2023  润新知