How to Install NVIDIA Drivers in GCP VMs

Prev Next

Workspot supports NVIDIA GPUs in a variety of Windows and Linux desktop and application server VMs (see Workspot Compatibility Matrices for supported products). This article shows you how to install NVIDIA drivers on your GCP VMs (or, more commonly, the templates from which your VMs are imaged).

Note: GPU VMs cannot migrate in GCP. Therefore, if you create a VM that needs GPU in GCP, you need to change the “On Host Maintenance” from “Migrate VM” Instance to “Terminate VM Instance.” See Warning: Migration not Supported on Host Maintenance, below.

Adding a GPU

Adding a GPU to a VM is done on the Google Cloud Console under “CPU PLATFORM AND GPU.”

Expand and add the GPU needed.

Installing Drivers

Installing Drivers Manually

  1. Install the CUDA Drivers for (for example) Tesla T4 from the GCP Website. https://cloud.google.com/compute/docs/gpus/install-drivers-gpu#verify-windows

  2. Once installed install the GRID drivers from the GCP Site https://cloud.google.com/compute/docs/gpus/grid-drivers-table Use the drivers that match the version of OS and the version of your CUDA drivers.

  3. Once that is installed, you can verify the installation. See Google’s Verifying the GPU driver install.

Installing Using Google’s Driver Script

This installation script can be used on VMs that have secure boot enabled.

  • For Windows VMs that use a G2 machine series, this script installs only the NVIDIA driver.

  • For other machine types, the script installs the NVIDIA driver and CUDA toolkit.

Open a PowerShell terminal as an administrator, then complete the following steps:

  1. If you are using Windows Server 2016, set the Transport Layer Security (TLS) version to 1.2.

    [Net.ServicePointManager]::SecurityProtocol = 'Tls12'
  2. Download the script.

    Invoke-WebRequest https://github.com/GoogleCloudPlatform/compute-gpu-installation/raw/main/windows/install_gpu_driver.ps1 -OutFile C:\install_gpu_driver.ps1
  3. Run the script.

    C:\install_gpu_driver.ps1

    The script takes some time to run. No command prompts are given during the installation process. Once the script exits, the driver is installed.

    This script installs the drivers in the following default location on your VM: C:\Program Files\NVIDIA Corporation\.

  4. Verify the installation with nvidia-smi.exe. (See Google’s Verifying the GPU driver install for additional details.)

C:\Program Files\NVIDIA Corporation\NVSMI\nvidia-smi.exe

Your result should look like this:

Enabling WDDM

Note: WDDM is needed if your software requires OpenGL. The TCC driver model does not support OpenGL

  1. If WDDM is not enabled, you can enable it by getting the GUID for the Driver, run this command:

C:\Program Files\NVIDIA Corporation\NVSMI
nvidia-smi -q
  1. Your result should look like this. Copy the GUID.

  1. If TCC is enabled and you need to enable WDDM, then run this command.

nvidia-smi -g GPU-c3a82135-86d1-d8c5-b480-7ac94419489b -dm 0

The argument for -dm sets the driver model:

0 = WDDM Driver Model

1 = TCC Driver Model

Warning: Migration Not Supported on Host Maintenance

Just know that if GCP ever performs maintenance in the host where this VM is located, the VM will terminate. So, there will be a down time.

Related Document

Workspot Compatibility Matrices.