This document describes how to create a managed instance group (MIG) with virtual machine (VM) instances that have attached GPUs. Specifically, it describes how to add GPU VMs all at once in a zonal MIG by using resize requests and the flex-start provisioning model. The VMs that you create by using the flex-start provisioning model are called Flex-start VMs . If you want to create a MIG resize request to consume a reservation, then see instead the following:
-
To consume a reservation for a future reservation in AI Hypercomputer, see Create a MIG and a resize request in the AI Hypercomputer documentation.
-
To consume a reservation for a future reservation in calendar mode, see Create a resize request in a MIG .
Use a MIG resize request with the flex-start provisioning model to increase your chances of obtaining GPU Flex-start VMs. In the request, you must specify the number of GPU Flex-start VMs that you want to create. Dynamic Workload Scheduler (DWS) , the underlying scheduler mechanism, makes best-effort attempts to schedule resize requests created across Compute Engine based on requested durations and resource availability. If your request resources become available, then the MIG creates the Flex-start VMs.
If your job finishes earlier than the requested duration, then you can delete the created Flex-start VMs. Otherwise, the MIG deletes Flex-start VMs at the end of their run duration.
You can also read about other basic scenarios for creating a MIG .
Before you begin
- To make sure that you have sufficient GPU quota for the resources you're requesting, check your GPU quota .
- To understand quota consumption, read GPU VMs and preemptible allocation quotas .
- If you haven't already, set up authentication
.
Authentication verifies your identity for access to Google Cloud services and APIs. To run
code or samples from a local development environment, you can authenticate to
Compute Engine by selecting one of the following options:
Select the tab for how you plan to use the samples on this page:
Console
When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
gcloud
-
Install the Google Cloud CLI. After installation, initialize the Google Cloud CLI by running the following command:
gcloud init
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity .
- Set a default region and zone .
REST
To use the REST API samples on this page in a local development environment, you use the credentials you provide to the gcloud CLI.
Install the Google Cloud CLI. After installation, initialize the Google Cloud CLI by running the following command:
gcloud init
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity .
For more information, see Authenticate for using REST in the Google Cloud authentication documentation.
-
Limitations
Review the limitations for creating a MIG resize request.
Create a MIG and add GPU VMs all at once
To create a MIG and add GPU Flex-start VMs all at once in the group, do the following:
-
Create an instance template , which is required to create a MIG. The MIG creates each VM in the group based on the instance template. In the template, specify the configuration for GPU Flex-start VMs and additional configurations required to use resize requests.
For more information about instance templates, see About instance templates .
-
Create a MIG and a resize request to add GPU Flex-start VMs all at once.
Create an instance template
Create an instance template that specifies a supported GPU machine series for MIG resize requests, as described in this section. Then, use the template to create a MIG .
Note: If you want to run data science or machine learning workloads, consider using a Deep Learning VM image when you create an instance template. Deep Learning VM Images is a set of prepackaged VM images that comes with machine learning frameworks and essential tools. For more information about these images, see Choose an image in the Deep Learning VM Images documentation.
Permissions required for this task
To perform this task, you must have the following permissions :
- All permissions required to call the
instanceTemplates.insertmethod .

