Enabling Physical GPUs in Hyper

by [Published on 12 Oct. 2016 / Last Updated on 12 Oct. 2016]

In this article we will look at how to add GPU acceleration to a virtual machine.

In recent months, I have been noticing two Hyper-V trends that seem to be completely at odds with one another. On one hand, I have been noticing a lot of people transitioning away from virtual servers that are set up to use the full blown desktop experience, and making the move to Server Core deployments instead. This transition makes a lot of sense, because it helps admins to utilize hardware resources as efficiently as possible. My guess is that over the next year, this trend will go even further and we will see a lot of workloads migrated to Nano Servers or even to containers.

The other trend, which is completely at odds with the first trend, is that I have also been seeing organizations virtualizing workloads that are increasingly graphically intensive.

Hyper-V’s default configuration really isn’t well suited to running graphically intensive workloads. However, it is possible to configure Hyper-V to leverage a server’s physical GPUs. That way, graphical rendering can be offloaded to dedicated video hardware.

Before You Begin

Before I show you how to configure Hyper-V to use GPU acceleration, there are a few gotchas that I need to warn you about. First, GPU acceleration is based on RemoteFX, which is part of the Remote Desktop Service. Microsoft requires organizations using the Remote Desktop Services to deploy an RDS licensing server, and to purchase the required number of Client Access Licenses. You can operate without a licensing server for a while, but the Hyper-V host will display this warning:


The next thing that you need to be aware of is the fact that not every Hyper-V virtual machine can take advantage of GPU acceleration. Obviously, guest operating system support is required, but there is more to it than that. When you create a virtual machine in Hyper-V, you are asked whether you would like to create a Generation 1 virtual machine or a Generation 2 virtual machine. Generation 2 virtual machines do not include an option to add a RemoteFX 3D Video Adapter. The option exists only for Generation 1 virtual machines.

Another consideration is live migration and failover clustering. If a virtual machine is configured to use GPU acceleration, then any Hyper-V host that could potentially host the VM must be equipped with similar video hardware. Furthermore, hosts must have a sufficient number of GPUs available to accommodate any inbound virtual machines.

Finally, some documentation indicates that once a Hyper-V virtual machine has been configured to use RemoteFX, then the VM becomes accessible only through an RDP session, and not through the Hyper-V Manager console. This limitation might have existed at one time, but does not appear to be an issue today. The figure below shows a Windows Server 2016 (preview 5) VM running on a Windows Server 2012 R2 Hyper-V host. As you can see in the figure, the VM is configured to use the RemoteFX graphics device, and yet I am able to view it through the Hyper-V Manager’s console.


Configuring Hyper-V

You can access the Physical GPU settings by opening the Hyper-V Manager, right clicking on the Hyper-V host server, and choosing the Hyper-V Settings command from the shortcut menu. Upon doing so, you will be taken to the Hyper-V Settings dialog box for the selected host server. As you can see in the figure below, this dialog box contains a Physical GPU container that you can use to enable a physical GPU for use with Hyper-V. As you look at this dialog box however, you will notice that its configuration options are greyed out.


The first step in providing Hyper-V with GPU support is to check your video hardware configuration. In Windows Server 2012 R2, you can do this by right clicking on the Start button, and selecting the System option from the shortcut menu. When the System dialog box appears, click on the Device Manager link and expand the Display Adapters node. As you can see in the figure below, this server is configured to use the Microsoft Basic Display Adapter. This configuration is fairly common for server hardware, but does not provide good GPU support.


In this type of situation, it is necessary to determine the actual video hardware that is installed in your Hyper-V host server, make sure that the video adapter is equipped with a suitable GPU, and download a new driver if necessary. If you look at the figure below for example, you can see that after installing the correct driver, Windows went from identifying the driver as a generic Microsoft Basic Display Adapter, to correctly identifying the adapter as a NVIDIA GeForce GTX 750.


If I open the Hyper-V Manager, Hyper-V still does not make the GPU available for use. If you look at the summary information in the dialog box below however, you will notice that the Remote Desktop Virtualization Host role service must be installed.


You can install this role service by using PowerShell if you like, but if you prefer to use the GUI then it is easy enough to install the role service by using the Server Manager. To do so, open Server Manager, and select the Add Roles and Features option from the Manage menu. This will cause Windows to launch the Add Roles and Features Wizard.

Click Next to skip the wizard’s Before You Begin screen. You will now be taken to the Installation Type screen. Select the Role-Based or Feature-Based Installation option and click Next.

You will now be prompted to choose the server on which you wish to install the role. Choose the Select a Server from the Server Pool option. Make sure that the correct server is selected, and click Next.

You should now see the Select Server Roles screen. Select the Remote Desktop Services role, and click Next. Click Next again to bypass the Features screen, and once again to bypass the Remote Desktop Services introduction.

The next screen that you will see asks you to select the role services that you wish to install. Select the Remote Desktop Virtualization Host checkbox, as shown below. If prompted to install the Media Foundation and the Remote Server Administration Tools, be sure to click the Add Features button.


Click Next, followed by Install, and the required role services will be installed onto the server. When the process completes, click Close. You will need to reboot the server in order to finish the installation.

After the machine reboots, you can go back into the Hyper-V Manager, right click on the host server, and choose the Hyper-V Settings command from the shortcut menu. When the Hyper-V Settings dialog box appears, select the Physical GPUs container. This time, you should see the GPU listed, as shown in the figure below.


Now, click OK, and then right click on the virtual machine for which you want to enable GPU acceleration, and choose the Settings command from the shortcut menu. When Windows opens the Settings dialog box, select the Add Hardware container, select RemoteFX 3D Video Adapter as shown below, and click Add.


You will also need to set the number of monitors that will be supported by the VM and the maximum display resolution, as shown below.


As you can see, it is relatively easy to add GPU acceleration to a virtual machine. It is worth noting however, that RemoteFX acceleration incurs licensing costs and does not work for every virtual machine.

See Also

The Author — Brien M. Posey

Brien M. Posey avatar

Brien Posey is an MCSE and has won the Microsoft MVP award for the last few years. Brien has written well over 4,000 technical articles and written or contributed material to 27 books.


Featured Links