Enable GPU acceleration for Azure Virtual Desktop

Azure Virtual Desktop supports graphics processing unit (GPU) acceleration in rendering and encoding for improved app performance and scalability using the Remote Desktop Protocol (RDP). GPU acceleration is crucial for graphics-intensive applications and can be used with all supported operating systems for Azure Virtual Desktop.

There are three components to GPU acceleration in Azure Virtual Desktop that work together to improve the user experience:

  • GPU-accelerated application rendering: Use the GPU to render graphics in a remote session.

  • GPU-accelerated frame encoding: The Remote Desktop Protocol encodes all graphics rendered for transmission to the local device. When part of the screen is frequently updated, it's encoded with the H.264/AVC video codec.

  • Full-screen video encoding: A full-screen video profile provides a higher frame rate and better user experience, but uses more network bandwidth and both session host and client resources. It benefits applications such as 3D modeling, CAD/CAM, or video playback and editing.

Tip

  • You can enable full-screen video encoding even without GPU acceleration.

  • You can also increase the default chroma value to improve the image quality.

This article shows you which Azure VM sizes you can use as a session host with GPU acceleration, and how to enable GPU acceleration for rendering and encoding. You can use Group Policy to configure your session hosts.

Supported GPU-optimized Azure VM sizes

The following Azure VM sizes are optimized for GPU acceleration and are supported as session hosts in Azure Virtual Desktop:

The right choice of VM size depends on many factors, including your particular application workloads, desired quality of user experience, and cost. In general, larger and more capable GPUs offer a better user experience at a given user density. Smaller and fractional GPU sizes allow more fine-grained control over cost and quality.

VM sizes with an NVIDIA GPU come with a GRID license that supports 25 concurrent users.

Important

Azure NCv3 series VMs aren't generally appropriate as session hosts. These VM sizes are tailored for specialized, high-performance compute or machine learning tools, such as those built with NVIDIA CUDA. They don't support GPU acceleration for most applications or the Windows user interface.

Prerequisites

Before you can enable GPU acceleration, you need:

  • An existing host pool with session hosts using supported GPU-optimized Azure VM sizes.

  • To configure Group Policy, you need:

    • A domain account that is a member of the Domain Admins security group.

    • A security group or organizational unit (OU) containing the devices you want to configure.

Install supported graphics drivers in your virtual machine

To take advantage of the GPU capabilities of Azure N-series VMs in Azure Virtual Desktop, you must install the appropriate graphics drivers. Follow the instructions at Supported operating systems and drivers to install drivers.

Important

Only Azure-distributed drivers are supported.

When installing drivers, here are some important guidelines:

Enable GPU-accelerated application rendering, frame encoding, and full-screen video encoding

By default, remote sessions are rendered with the CPU and don't use available GPUs. You can enable GPU-accelerated application rendering, frame encoding, and full-screen video encoding using Group Policy.

Note

GPU-accelerated frame encoding isn't available with NVv4-series VMs.

Select the relevant tab for your scenario.

To enable GPU-accelerated application rendering using Group Policy:

  1. Open the Group Policy Management console on device you use to manage the Active Directory domain.

  2. Create or edit a policy that targets the computers providing a remote session you want to configure.

  3. Navigate to Computer Configuration > Policies > Administrative Templates > Windows Components > Remote Desktop Services > Remote Desktop Session Host > Remote Session Environment.

    A screenshot showing the redirection options in the Group Policy editor.

  4. Configure the following settings:

    1. For GPU-accelerated application rendering, double-click the policy setting Use hardware graphics adapters for all Remote Desktop Services sessions to open it. Select Enabled, then select OK.

    2. For GPU accelerated frame encoding, double-click the policy setting Configure H.264/AVC hardware encoding for Remote Desktop connections to open it. Select Enabled, then select OK. If you're using Windows Server 2016, you see an extra drop-down menu in the setting; set Prefer AVC Hardware Encoding to Always attempt.

    3. For full-screen video encoding, double-click the policy setting Prioritize H.264/AVC 444 Graphics mode for Remote Desktop connections to open it. Select Enabled, then select OK.

  5. Ensure the policy is applied to your session hosts, then restart them for the settings to take effect.

Verify GPU acceleration

To verify that a remote session is using GPU acceleration, GPU-accelerated application rendering, frame encoding, and full-screen video encoding:

  1. Connect to one of the session hosts you configured, either through Azure Virtual Desktop or a direct RDP connection.

  2. Open an application that uses GPU acceleration and generate some load for the GPU.

  3. Open Task Manager and go to the Performance tab. Select the GPU to see whether the GPU is being utilized by the application.

    A screenshot showing the GPU usage in Task Manager when in a Remote Desktop session.

    Tip

    For NVIDIA GPUs, you can also use the nvidia-smi utility to check for GPU utilization when running your application. For more information, see Verify driver installation.

  4. Open Event Viewer from the start menu, or run eventvwr.msc from the command line.

  5. Navigate to one of the following locations:

    1. For connections through Azure Virtual Desktop, go to Applications and Services Logs > Microsoft > Windows > RemoteDesktopServices-RdpCoreCDV > Operational.

    2. For connections through a direct RDP connection, go to Applications and Services Logs > Microsoft > Windows > RemoteDesktopServices-RdpCoreTs > Operational.

  6. Look for the following event IDs:

    • Event ID 170: If you see AVC hardware encoder enabled: 1 in the event text, RDP is using GPU-accelerated frame encoding.

    • Event ID 162: If you see AVC available: 1, Initial Profile: 2048 in the event text, RDP is using full-screen video encoding (H.264/AVC 444).

Increase the default chroma value to improve the image quality.