Menu
Amazon Elastic Compute Cloud
User Guide for Linux Instances

Installing the NVIDIA Driver on Linux Instances

A GPU-based accelerated computing instance must have the appropriate NVIDIA driver. The NVIDIA driver that you install must be compiled against the kernel that you plan to run on your instance.

Amazon provides AMIs with updated and compatible builds of the NVIDIA kernel drivers for each official kernel upgrade in the AWS Marketplace. If you decide to use a different NVIDIA driver version than the one that Amazon provides, or decide to use a kernel that's not an official Amazon build, you must uninstall the Amazon-provided NVIDIA packages from your system to avoid conflicts with the versions of the drivers that you are trying to install.

Use this command to uninstall Amazon-provided NVIDIA packages:

Copy
sudo yum erase nvidia cuda

The Amazon-provided CUDA toolkit package has dependencies on the NVIDIA drivers. Uninstalling the NVIDIA packages erases the CUDA toolkit. You must reinstall the CUDA toolkit after installing the NVIDIA driver.

Obtaining the NVIDIA GRID Virtual Workstation Driver for G3 Instances

For G3 instances, you can download the NVIDIA GRID Virtual Workstation driver from Amazon S3 using the AWS CLI or SDKs. To install the AWS CLI, see Installing the AWS Command Line Interface in the AWS Command Line Interface User Guide. Use the following AWS CLI command to download the driver:

Important

This download is available to AWS customers only. By downloading, you agree that you will only use the downloaded software to develop AMIs for use with the NVIDIA Tesla M60 hardware. Upon installation of the software, you will be bound by the terms of the NVIDIA GRID Cloud End User License Agreement.

Copy
aws s3 cp --recursive s3://ec2-linux-nvidia-drivers/ .

Note

If you receive an Unable to locate credentials error, see Configuring the AWS CLI to configure the AWS CLI to use your AWS credentials.

Obtaining the NVIDIA Driver

You can download the public NVIDIA drivers from http://www.nvidia.com/Download/Find.aspx.

Important

To use NVIDIA GRID Virtual Workstation features on a G3 instance, you must install the NVIDIA GRID Virtual Workstation driver instead of the public driver from the NVIDIA website. For more information, see Obtaining the NVIDIA GRID Virtual Workstation Driver for G3 Instances .

Select the appropriate driver for your instance:

P2 Instances

Product Type Tesla
Product Series K-Series
Product K-80
Operating System Linux 64-bit
Recommended/Beta Recommended/Certified

G2 Instances

Product Type GRID
Product Series GRID Series
Product GRID K520
Operating System Linux 64-bit
Recommended/Beta Recommended/Certified

CG1 Instances

Product Type Tesla
Product Series M-Class
Product M2050
Operating System Linux 64-bit
Recommended/Beta Recommended/Certified

For more information about installing and configuring the driver, choose the ADDITIONAL INFORMATION tab on the download page for the driver on the NVIDIA website and choose the README link.

Installing the NVIDIA Driver Manually

To install the driver on a Linux instance

  1. Update your package cache and get necessary package updates for your instance.

    • For Amazon Linux, CentOS, and Red Hat Enterprise Linux:

      Copy
      sudo yum update -y
    • For Ubuntu and Debian:

      Copy
      sudo apt-get update -y
  2. (Ubuntu 16.04 and later, with the linux-aws package) Upgrade the linux-aws package to receive the latest version.

    Copy
    sudo apt-get upgrade -y linux-aws
  3. Reboot your instance to load the latest kernel version.

    Copy
    sudo reboot
  4. Reconnect to your instance after it has rebooted.

  5. Install the gcc compiler and the kernel headers package for the version of the kernel you are currently running.

    • For Amazon Linux, CentOS, and Red Hat Enterprise Linux:

      Copy
      sudo yum install -y gcc kernel-devel-$(uname -r)
    • For Ubuntu and Debian:

      Copy
      sudo apt-get install -y gcc linux-headers-$(uname -r)
  6. (Graphical instances only) Disable the nouveau open source driver for NVIDIA graphics cards.

    1. Add nouveau to the modprobe blacklist file. Copy the following code block and paste it into a terminal.

      Copy
      cat << EOF | sudo tee --append /etc/modprobe.d/blacklist.conf blacklist vga16fb blacklist nouveau blacklist rivafb blacklist nvidiafb blacklist rivatv EOF
    2. Edit /etc/default/grub and add the following text to the GRUB_CMDLINE_LINUX line:

      Copy
      modprobe.blacklist=nouveau
    3. Rebuild the Grub configuration.

      • CentOS and Red Hat Enterprise Linux:

        Copy
        sudo grub2-mkconfig -o /boot/grub2/grub.cfg
      • For Ubuntu and Debian:

        Copy
        sudo update-grub
  7. Download the driver package that you identified earlier.

  8. Run the self-install script to install the NVIDIA driver that you downloaded in the previous step. For example:

    Copy
    sudo /bin/bash ./NVIDIA-Linux-x86_64-367.106.run
  9. Reboot the instance.

    Copy
    sudo reboot
  10. Confirm that the driver is functional. The response for the following command lists the installed NVIDIA driver version and details about the GPUs.

    Note

    This command may take several minutes to run.

    Copy
    nvidia-smi -q | head
  11. (G3 instances only) If you are using NVIDIA GRID Virtual Workstation features on a G3 instance, complete the GRID activation steps in Activate GRID Workstation Features (G3 Instances Only)

  12. (P2 and G3 instances only) If you are using a P2 or G3 instance, complete the optimization steps in Optimizing GPU Settings (P2 and G3 Instances Only) to achieve the best performance from your GPU.