GPU Optimization with WVD (Spring 2020)

One great advantage of WVD within Azure is the ability to leverage the GPU enabled NV series virtual machines for GPU acceleration.

RemoteFX optimization for GPU offloading has been around for years but its nice to see GPU rendering work so seamlessly with Microsoft’s new WVD offering.

In this blog I will be going through the steps of configuring RemoteFX using a NVIDIA GPU powered virtual machine through WVD.

Prepare Image

As with most WVD build I wanted to capture all the required configuration into a golden image so I could scale this out when needed (the idea being customer POC platforms)

Therefore, I first provisioned out my standard customized image (FSLogix with Optimized Teams) as a NVIDIA GPU virtual machine. I would have loved to use the NVas_V4 machines but these are not currently available in my subscription 😦

I was however able to use the NV6_Promo which is more than adequate for my testing.

A nice 6 vCPUs and 56GB of RAM

Once the image had deployed I next needed to install the relevant NVIDIA graphics drivers. Without these the machine wouldn’t be much use!

There is a NVIDIA GPU driver extension that can be installed on the VM, however in this case I want to ensure the Windows drivers are install and captured in the image as required. So shall be walking through the manual installation.

You can find the driver in the below link.

https://docs.microsoft.com/en-us/azure/virtual-machines/windows/n-series-driver-setup

Download the relevant driver onto the new machine and run the installer.

Agree to the License agreement.

Then select the option for Express install

Once the driver is installed you will be prompted to reboot. So please do so.

After rebooting the virtual machine, open up Device Manager and check that the NVIDIA card is now showing under Display Adapters

A nice shiny NVIDIA Tesla M60!

Capture Image

Now the drivers are installed I will Sysprep to prepare the machine to be re-imaged.

Once the virtual machine has completed the Sysprep we need to capture it within the Azure Portal as with a standard image creation. I will be creating an Image Definition for a Shared Image Library but you can do as you wish.

In the Azure portal click the Capture option.

Fill in the Image Name and the select Automatically delete this virtual machine after creating the image

Now under my Shared Image Library I will add a new Image Definition to be used for my GPU accelerated WVD image.

Fill in the image definition details as required.

I am going to add very simple information to the image definition such as a major version number 1.0.0 and then select the image we created.

I will skip replication for now as I will primarily be provisioning into West Europe. Then click Review + Create. Then Create.

Deploy Image

Now deploy your WVD session host as you would normally do. I will deploy a new Host Pool via the Spring 2020 Update in the Azure Portal.

Navigate to the Windows Virtual Desktop service in the Azure Portal and click Create a host pool.

Select Create a host pool

Next select the required name for your Host Pool, the resource group metadata location (which currently can only be in the US). And finally the type of Host Pool. I have chosen Pooled

Enter the required options

On the next screen select the option to Add Virtual Machines. Then select the required options. Making sure to select the machine size as a NV series machine, and select the new image (in my case from the Shared Library)

Make sure to select the NV series machine

Fill in the required VNET settings and enter the AD Join UPN and Password needed for the image to join your domain.

Now on the Workspace tab. Select Register desktop app group and then either selected an existing workspace or create a new one. For reference workspace is to Spring 2020 what Tenant was to Fall 2019.

I’m adding to my existing Workspace

Finally, add tags if required. I like to do this even in my lab. Once done Create!

Group Policy Settings

Now we have deployed the GPU accelerated virtual machine, we need to make few changes via Group Policy to ensure the GPU is used correctly for Remote Desktop Sessions.

From the Microsoft Docs

By default, apps and desktops running in multi-session configurations are rendered with the CPU and do not leverage available GPUs for rendering.

Remote Desktop encodes all graphics rendered by apps and desktops (whether rendered with GPU or with CPU) for transmission to Remote Desktop clients. By default, Remote Desktop does not leverage available GPUs for this encoding.

https://docs.microsoft.com/en-us/azure/virtual-desktop/configure-vm-gpu

Therefore, we will enable some settings via Group Policy to ensure the GPU is used by Remote Desktop to render.

Open up Group Policy Management Console on a relevant machine. Either create a new GPO or add to an existing WVD policy.

In my case I created a new policy called WVD-GPU.

Edit the policy and navigate to Computer Configuration > Administrative Templates > Windows Components > Remote Desktop Services > Remote Desktop Session Host > Remote Session Environment

Then edit the Use hardware graphics adapters for all Remote Desktop Services sessions and set this to Enabled

Then select Prioritize H.264/AVC 444 Graphics mode for Remote Desktop connections and set to Enabled.

Finally, select Configure H.264/AVC hardware encoding for Remote Desktop connections and set to Enabled

Now assign this policy to the OU containing your GPU enabled host.

And set the scoping to the relevant machine and WVD users.

Ensure Loopback Policy is enabled as needed.

Testing!

I now will test the GPU acceleration and install a game from my Steam collection and then run this over the WVD session.

However, I can quickly check if the GPU is being user via Task Manager under the Performance tab.

Oh look GPU in in use!

So, I installed the Steam client and then installed Celeste for testing as this is a pretty fast game.

I did have some issues with Direct X. So I manually installed it.

*Also for some weird reason Celeste didn’t like the graphics card so had to switch to the OpenGL version. (Other games worked fine like Super Meat Boy and Duke Nukem 3D)

The experience was pretty awesome. There was a tiny bit of screen tear here and there. But it performed well enough to play through Celeste for a bit with full audio redirection too!

Here’s some footage of Celeste in action!

The best part was it also worked on my iPhone! (although controls were obviously an issue)

2 thoughts on “GPU Optimization with WVD (Spring 2020)

    1. That is my next test I think. So far only used with a single user logged in.
      Also of note is the the release of NV V4 series machines which use a fractional GPU (from 1/8 to a whole GPU) good low cost alternative.

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s