Enabling Physical GPUs in Hyper-V

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.

Post Views: 10,993

Featured Links

Read Next

Author

Brien Posey

Brien Posey is a freelance technology author and speaker with over two decades of IT experience. Prior to going freelance, Brien was a CIO for a national chain of hospitals and healthcare facilities. He has also served as a network engineer for the United States Department of Defense at Fort Knox. In addition, Brien has worked as a network administrator for some of the largest insurance companies in America. To date, Brien has received Microsoft’s MVP award numerous times in categories including Windows Server, IIS, Exchange Server, and File Systems / Storage. You can visit Brien’s Website at: www.brienposey.com.

I’ve created a local Hyper-V Windows 10 Pro X64 Guest OS client, configured to use the RemoteFx Video Adapter

Issue: I’m attempting to install software on the Guest OS, that is looking for a ‘compatible’ video subsystem and is failing to run, because it can’t find one. This same software runs on the Host without issue.

Question: Is there a way to ‘spoof’ software installed in a Guest OS into believing it is communicating with the Host GPU type installed in the Host?

I have the same setup. Win10pro Guest running on top of Win10pro host. Problem: youtube videos 480p and up) have quality problems when running on Guest but run Ok on Host. But the same video runs Ok in HD in guest windows 2016 multipoint server(running also on top of host windows 10 pro). All guests have Remotefx card activated. Anyone knows why the video quality on windows 10 pro guest is of lower quality than video run on Guest Win 2016 server?

I am trying to configure a Hyper-V on windows server 2016 with 4 Nvidia 1080 for deep learning. Is it possible that I can install 3-4 instances of ubuntuOS on the machine for multiple research and also make for eg 2GPU on system1 and 1 for other 2 system2 and system3 respectively?

Latest Podcast

Featured Freeware

Recommended

Follow Us

Enabling Physical GPUs in Hyper-V

TECHGENIX

TechGenix reaches millions of IT Professionals every month, and has set the standard for providing free technical content through its growing family of websites, empowering them with the answers and tools that are needed to set up, configure, maintain and enhance their networks.