Compute Engine provides graphics processing units (GPUs) that you can add to your virtual machines (VMs). You can use these GPUs to accelerate specific workloads on your VMs such as machine learning and data processing.
This document provides an overview of the steps required for creating a VM with attached GPUs.
Select the GPU model
For a list of GPU models that are available, see GPU platforms. Also make a note of the machine type that is supported for the selected GPU model.
For each model, it might also be helpful to review the following:
- Supported region and zones.
- GPU pricing to understand the cost to use each GPU model on your VMs. For VMs that use accelerator-optimized machines, also review VM instance pricing.
- Review the restrictions for VMs with GPUs.
Choose an operating system
If you are using GPUs for machine learning, you can use a Deep Learning VM Images for your VM. Each Deep Learning VM Images has a GPU driver pre-installed and include packages, such as TensorFlow and PyTorch. You can also use a Deep Learning VM Images for general GPU workloads. For information about the images available and the packages installed on the images, see Choosing an image. You can also use any public image or custom image, but some images might require a unique driver or install process that is not covered in this document.
You must identify which drivers are appropriate for your OS image. For steps to install drivers, see installing GPU drivers.
Check GPU quota
To protect Compute Engine systems and users, new projects have a global GPU quota, which limits the total number of GPUs you can create in any supported zone.
regions describe command
to ensure that you have sufficient GPU quota in the region where you
want to create VMs with GPUs.
gcloud compute regions describe REGION
REGION with the
region that you want to check for GPU quota.
If you need additional GPU quota, request a quota increase. When you request a GPU quota, you must request a quota for the GPU types that you want to create in each region and an additional global quota for the total number of GPUs of all types in all zones.
If your project has an established billing history, it will receive quota automatically after you submit the request.
Create a VM that has attached GPUs
To create a VM that has attached GPUs, complete the following steps:
Create the VM. The method used to create a VM depends on the GPU model selected.
- To create a VM that has attached NVIDIA A100 and L4 GPUs, see Create an accelerator-optimized VM.
- To create a VM that has attached NVIDIA T4, P4, P100, and V100 GPUs, see Create an N1 VM that has attached GPUs.
For the VM to use the GPU, you need to install the GPU driver on your VM. If you enabled an NVIDIA RTX virtual workstation (formerly known as NVIDIA GRID), install a driver for virtual workstation.
- Learn more about GPU platforms.
- For features and limitations of using GPUs, see About GPUs.