Install AMD drivers on Linux instances - Amazon Elastic Compute Cloud
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Install AMD drivers on Linux instances

An instance with an attached AMD GPU, such as a G4ad instance, must have the appropriate AMD driver installed. Depending on your requirements, you can either use an AMI with the driver preinstalled or download a driver from Amazon S3.

To install NVIDIA drivers on an instance with an attached NVIDIA GPU, such as a G4dn instance, see Install NVIDIA drivers instead. To install AMD drivers on a Windows instance, see Install AMD drivers on Windows instances.

AMD Radeon Pro Software for Enterprise Driver

The AMD Radeon Pro Software for Enterprise Driver is built to deliver support for professional-grade graphics use cases. Using the driver, you can configure your instances with two 4K displays per GPU.

Supported APIs
  • OpenGL, OpenCL

  • Vulkan

  • AMD Advanced Media Framework

  • Video Acceleration API

AMIs with the AMD driver installed

Amazon offers different Amazon Machine Images (AMI) that come with the AMD drivers installed. Open Marketplace offerings with the AMD driver.

AMD driver download

If you aren't using an AMI with the AMD driver installed, you can download the AMD driver and install it on your instance. The AMD driver is only supported on Amazon Linux 2 with kernel version 4.14.

Note

AMD driver version amdgpu-pro-20.20-1184451 and newer driver releases require kernel version 5.15 or higher.

These downloads are available to Amazon customers only. By downloading, you agree to use the downloaded software only to develop AMIs for use with the AMD Radeon Pro V520 hardware. Upon installation of the software, you are bound by the terms of the AMD Software End User License Agreement.

To install the AMD driver on your Linux instance
  1. Connect to your Linux instance.

  2. Install the Amazon CLI on your Linux instance and configure default credentials. For more information, see Installing the Amazon CLI in the Amazon Command Line Interface User Guide.

    Important

    Your user or role must have the permissions granted that contains the AmazonS3ReadOnlyAccess policy. For more information, see Amazon managed policy: AmazonS3ReadOnlyAccess in the Amazon Simple Storage Service User Guide.

  3. Install gcc and make, if they are not already installed.

    $ sudo yum install gcc make
  4. Update your package cache and get the package updates for your instance.

    • For Amazon Linux 2:

      $ sudo amazon-linux-extras install epel -y $ sudo yum update -y
    • For Ubuntu 22.04:

      $ wget https://repo.radeon.com/.preview/a0e4ef1dffbc95b4abb54e891f265e61/amdgpu-install/5.5.02.05.2/ubuntu/jammy/amdgpu-install_5.5.02.05.50502-1_all.deb $ sudo apt install ./amdgpu-install_5.5.02.05.50502-1_all.deb $ sudo sed -i 's#repo.radeon.com#&/.preview/a0e4ef1dffbc95b4abb54e891f265e61#' /etc/apt/sources.list.d/{amdgpu.list,rocm.list,amdgpu-proprietary.list}
    • For other Ubuntu versions:

      $ sudo dpkg --add-architecture i386 $ sudo apt-get update -y && sudo apt upgrade -y
    • For CentOS:

      $ sudo yum install epel-release -y $ sudo yum update -y
  5. Reboot the instance.

    $ sudo reboot
  6. Reconnect to the instance after it reboots.

  7. Download the latest AMD driver.

    Note

    Skip this step for Ubuntu 22.04.

    $ aws s3 cp --recursive s3://ec2-amd-linux-drivers/latest/ .
  8. Extract the file.

    • For Amazon Linux 2 and CentOS:

      $ tar -xf amdgpu-pro-*rhel*.tar.xz
    • For Ubuntu:

      Note

      Skip this step for Ubuntu 22.04.

      $ tar -xf amdgpu-pro*ubuntu*.xz
  9. Change to the folder for the extracted driver.

  10. Add the missing modules for the driver installation.

    • For Amazon Linux 2 and CentOS:

      Skip this step.

    • For Ubuntu:

      Note

      Skip this step for Ubuntu 22.04.

      $ sudo apt install linux-modules-extra-$(uname -r) -y
  11. Run the self install script to install the full graphics stack.

    • For Ubuntu 22.04:

      $ sudo amdgpu-install --usecase=workstation --vulkan=pro --opencl=rocr,legacy -y
    • For Amazon Linux 2 and CentOS and other Ubuntu versions:

      $ ./amdgpu-pro-install -y --opencl=pal,legacy
  12. Reboot the instance.

    $ sudo reboot
  13. Confirm that the driver is functional.

    $ dmesg | grep amdgpu

    The response should look like the following:

    Initialized amdgpu

Set up an interactive desktop

After you confirm that your instance has the AMD GPU driver installed and amdgpu is in use, you can install an interactive desktop manager. We recommend the MATE desktop environment for the best compatibility and performance.

Prerequisite

Open a text editor and save the following as a file named xorg.conf. You'll need this file on your instance.

Section "ServerLayout" Identifier "Layout0" Screen 0 "Screen0" InputDevice "Keyboard0" "CoreKeyboard" InputDevice "Mouse0" "CorePointer" EndSection Section "Files" ModulePath "/opt/amdgpu/lib64/xorg/modules/drivers" ModulePath "/opt/amdgpu/lib/xorg/modules" ModulePath "/opt/amdgpu-pro/lib/xorg/modules/extensions" ModulePath "/opt/amdgpu-pro/lib64/xorg/modules/extensions" ModulePath "/usr/lib64/xorg/modules" ModulePath "/usr/lib/xorg/modules" EndSection Section "InputDevice" # generated from default Identifier "Mouse0" Driver "mouse" Option "Protocol" "auto" Option "Device" "/dev/psaux" Option "Emulate3Buttons" "no" Option "ZAxisMapping" "4 5" EndSection Section "InputDevice" # generated from default Identifier "Keyboard0" Driver "kbd" EndSection Section "Monitor" Identifier "Monitor0" VendorName "Unknown" ModelName "Unknown" EndSection Section "Device" Identifier "Device0" Driver "amdgpu" VendorName "AMD" BoardName "Radeon MxGPU V520" BusID "PCI:0:30:0" EndSection Section "Extensions" Option "DPMS" "Disable" EndSection Section "Screen" Identifier "Screen0" Device "Device0" Monitor "Monitor0" DefaultDepth 24 Option "AllowEmptyInitialConfiguration" "True" SubSection "Display" Virtual 3840 2160 Depth 32 EndSubSection EndSection
To set up an interactive desktop on Amazon Linux 2
  1. Install the EPEL repository.

    $ sudo amazon-linux-extras install epel -y
  2. Install the MATE desktop.

    $ sudo amazon-linux-extras install mate-desktop1.x -y $ sudo yum groupinstall "MATE Desktop" -y $ sudo systemctl disable firewalld
  3. Copy the xorg.conf file to /etc/X11/xorg.conf.

  4. Reboot the instance.

    $ sudo reboot
  5. (Optional) Install the NICE DCV server to use NICE DCV as a high-performance display protocol, and then connect to a NICE DCV session using your preferred client.

To set up an interactive desktop on Ubuntu
  1. Install the MATE desktop.

    $ sudo apt install xorg-dev ubuntu-mate-desktop -y $ sudo apt purge ifupdown -y
  2. Copy the xorg.conf file to /etc/X11/xorg.conf.

  3. Reboot the instance.

    $ sudo reboot
  4. Install the AMF encoder for the appropriate version of Ubuntu.

    $ sudo apt install ./amdgpu-pro-20.20-*/amf-amdgpu-pro_20.20-*_amd64.deb
  5. (Optional) Install the NICE DCV server to use NICE DCV as a high-performance display protocol, and then connect to a NICE DCV session using your preferred client.

  6. After the DCV installation give the DCV User video permissions:

    $ sudo usermod -aG video dcv
To set up an interactive desktop on CentOS
  1. Install the EPEL repository.

    $ sudo yum update -y $ sudo yum install epel-release -y
  2. Install the MATE desktop.

    $ sudo yum groupinstall "MATE Desktop" -y $ sudo systemctl disable firewalld
  3. Copy the xorg.conf file to /etc/X11/xorg.conf.

  4. Reboot the instance.

    $ sudo reboot
  5. (Optional) Install the NICE DCV server to use NICE DCV as a high-performance display protocol, and then connect to a NICE DCV session using your preferred client.