How to: Configuring GPU Passthrough on a Virtual Machine

6

GPU Capability on a VM

Recently there’s been a lot of talk regarding Machine Learning, IoT, Big Data, AI, etc. All of these industry buzz words have been the talk of the industry. These technologies now are starting to creep into the world of Virtualization. About ten years ago, it was all about moving away from Physical to Virtual, but now the conversation is starting to shift to a new conversation, which is Virtualization of new and emerging workloads.

Years ago, if you told someone they needed a dedicated Graphics card for an ESXi host, they would probably look at you funny, but today it’s becoming more and more popular. The use first became popular with VDI environments. The graphics cards would help offload resolution and graphics tasks from the host, which in turn provided a better user experience.  One may ask, why in the world would you need a dedicated graphics card for an ESXi host? Well, it’s got to do with the above mentioned, which is Virtualization of new and emerging technologies.

Why GPUs? Benefits?

Machine learning, IoT, Big Data, AI, (insert future fancy IT Buzz word) all require enormous amounts of compute, and as these workloads become more popular in today’s enterprises, the need for virtualization also changes. One of the key changes recently has been the adaptation of ESXi host with dedicated GPUs. These graphics cards aren’t your typical desktop graphics cards. Instead these are beefy enterprise class cards that have the hardware requirements required for satisfying the most demanding workloads.  Additionally these workloads are best suited for GPUs. The architecture of the GPUs helps process these data sets quicker and faster than x86 compute nodes. It also frees up CPU cycles for other processing needs, which is an added benefit.

Graphics card use cases within ESXi continue to grow. The primary use cases are render farms, graphics intense image processing, machine learning, etc. These workloads, if optimized, can utilize graphics cards (GPUs) to offset the data processing of the workloads. However, the software should be written in a way to take advantage of these capabilities. These applications are specifically written to take advantage of the cores and memory of the GPU. For example: If you have an application written that takes advantage of the OpenGL library, then enabling GPU passthrough should provide a benefit.

Requirements:

  1. ESXi host with GPU Capabilities (GPU needs to be compatible with VMware)
  2. Application that can take advantage of the GPU capabilities
  3. Drivers loaded on to the Guest OS (Linux or Windows)
  4. VM Placement on ESXi host with GPU

Before starting, it’s important to note the above requirements before starting.

*NOTE* My test VM is already on a ESXi host with GPUs. This won’t work unless you have a compatible ESXi host with compatible GPUs. This is clearly from the perspective of enabling GPU passthrough on the VM once everything has been configured beforehand correctly. 

*Additional configuration is required on the ESXi Side, so be sure to check your documentation from your HW Vendor*

Enabling GPU Passthrough on a VM

First, log into vCenter. Locate the VM you wish to configure and “shut down” the GuestOS.

Next, select “Add New Device”

Add New Device

Select, “PCI Device” PCI Device

The GPU is automatically detected as a new PCI Device.

New PCI Device added

Next, review the warning and select “Reserve all Memory”, and note the warning about vMotion/Snapshots. Some of these limitations are to be addressed with 6.7 U1

Reserve All Memory

Once you have added the device, select “OK” and power on the VM.

Head over to device manager in the VM and you should see that the graphics card is being detected. Almost done, but first we need to download the GPU Driver.

1

In this particular instance, NVIDIA GPUs are being utilized. Head over to their website, downloads and drivers.

First, Select your OS. 2
Then, Select download

3

The file should now start downloading.

4

Once completed, extract the contents.

5

The contents will now extract.

6
For the easiest installation, select “Express” 

8

Select, next, then agree.

7

The installation has now commenced.

9

Once completed, select “Restart Now” to restart the GuestOS.

10

After rebooting check the Device Manager to see if the installation was successful.

12

That completes the process of giving a VM GPU capability. Applications should now be able to pass through to the GPU and utilize it for computing purposes.