This topic describes how to uninstall the GPU driver from a GPU instance. Depending on the installation script and the image type, the command needed to uninstall the GPU driver varies.

Background

This topic uses Driver 390.46 and CUDA 9.0.176 in the example. The GPU driver can only be uninstalled by the root user. If you are a common user, you must run the sudo command to obtain the privileges of the root user.

If you use the nvidia_install_v1.0 package, the format is either rpm or deb. If you use nvidia_install_v2.0 package, the format is runfile

Uninstall the GPU driver installed by using nvidia_install_v1.0

  • If the operating system of your GPU instance is Ubuntu, follow these steps:
    1. Run the following command to uninstall the GPU driver:
      apt-get remove --purge nvidia-390 nvidia-modprobe nvidia-settings
      apt-get remove nvidia-diag-driver-local-repo-ubuntu1604-390.46
    2. Optional. Run the following command to uninstall X server.
      Note If you install the GPU driver by using the deb format package, an error message is displayed when you use the runfile package to install the GPU driver. You need to uninstall or stop X server and restart the GPU instance before you can use the runfile package to install the GPU driver.
      apt-get remove xserver-xorg xserver-xorg-core
    3. Run the following command to uninstall the CUDA Toolkit.
      apt autoremove --purge cuda-9.0
    4. Run the following command to restart the instance.
      reboot
  • If the operating system of your GPU instance is CentOS 7, follow these steps:
    1. Run the following command to uninstall the GPU driver:
      yum remove xorg-x11-drv-nvidia nvidia-kmod cuda-drivers
      yum remove nvidia-diag-driver-local-repo-rhel7-390.46
    2. Run the following command to uninstall the CUDA Toolkit.
      yum remove /usr/local/cuda-9.0
    3. Run the following command to restart the instance.
      reboot
  • If the operating system of your GPU instance is CentOS 6, follow these steps:
    1. Run the following command to uninstall the GPU driver:
      yum remove xorg-x11-drv-nvidia nvidia-kmod cuda-drivers
      yum remove nvidia-diag-driver-local-repo-rhel6-390.46
    2. Run the following command to uninstall the CUDA Toolkit.
      yum remove /usr/local/cuda-9.0
    3. Run the following command to restart the instance.
      reboot

Uninstall the GPU driver installed by using nvidia_install_v2.0

To uninstall the GPU driver, follow these steps:

  1. Run the following command to uninstall the GPU driver:
    /usr/bin/nvidia-uninstall
  2. Run the following command to uninstall the CUDA Toolkit and the cuDNN library.
    /usr/local/cuda/bin/uninstall_cuda_9.0.pl
    rm -rf /usr/local/cuda-9.0