Rate This Document
Findability
Accuracy
Completeness
Readability

Installing CUDA

Procedure

  1. Use PuTTY to log in to the server as the root user.
  2. Check whether the Nouveau driver is disabled.
    lsmod |grep nouveau
    • If a command output is displayed, the Nouveau driver is not disabled. In this case, perform 3.
    • If no command output is displayed, the Nouveau driver is disabled. No further action is required.
  3. Disable the Nouveau driver.
    1. Create a disable-nouveau.conf file.
      vi /etc/modprobe.d/disable-nouveau.conf
    2. Press i to enter the insert mode and add the following content:
      blacklist nouveau
      options nouveau modeset=0
    3. Press Esc, type wq!, and press Enter to save the file and exit.
  4. Back up the initramfs file and create a new one.
    cp /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r)-nouveau.img 
    dracut -f /boot/initramfs-$(uname -r).img $(uname -r)
  5. Restart the computer.
    reboot
  6. Check whether the Nouveau driver is disabled (no command output is displayed).
    lsmod |grep nouveau
  7. Install NVIDIA CUDA.
    wget https://developer.download.nvidia.com/compute/cuda/11.4.0/local_installers/cuda_11.4.0_470.42.01_linux_sbsa.run
    sudo sh cuda_11.4.0_470.42.01_linux_sbsa.run
  8. Set the environment variables.
    export CUDA_HOME=/usr/local/cuda
    export PATH=$CUDA_HOME/bin:$PATH
    export LD_LIBRARY_PATH=$CUDA_HOME/lib64:$LD_LIBRARY_PATH
  9. Verify the version.
    nvcc -V

    If the following information is displayed, the installation is successful: