A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://cloud.google.com/compute/docs/instance-groups/create-mig-with-gpu-vms below:

Create a MIG with GPU VMs | Compute Engine Documentation

Create a MIG with GPU VMs

Stay organized with collections Save and categorize content based on your preferences.

This document describes how to create a managed instance group (MIG) with virtual machine (VM) instances that have attached GPUs. It describes how to add GPU VMs all at once in a zonal MIG by using resize requests and the flex-start provisioning model. If you want to create a MIG resize request to consume a reservation, then see instead the following:

Use a MIG resize request with the flex-start provisioning model to increase your chances of obtaining GPU VMs. In the request, you must specify the number of GPU VMs. Dynamic Workload Scheduler (DWS), the underlying scheduler mechanism, schedules resize requests created across Compute Engine based on requested durations and resource availability. When the resources become available, the MIG creates the VMs.

If your job finishes earlier than the requested duration, then you can delete the created VMs. Otherwise, the MIG deletes VMs at the end of their run duration.

You can also read about other basic scenarios for creating a MIG.

Before you begin 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 VMs all at once in the group, do the following:

  1. 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 VMs and additional configurations required to use resize requests.

    For more information about instance templates, see About instance templates.

  2. Create a MIG and a resize request to add GPU VMs all at once.

Create an instance template

Preview — The flex-start provisioning model

This feature is subject to the "Pre-GA Offerings Terms" in the General Service Terms section of the Service Specific Terms. Pre-GA features are available "as is" and might have limited support. For more information, see the launch stage descriptions.

Create an instance template as described in this section, and 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:

Console
  1. Go to the Instance templates page.

    Go to Instance templates

  2. Click Create instance template. The Create an instance template page opens.

  3. In the Name field, enter a name for the instance template.

  4. In the Machine configuration section, do the following:

    1. Click the GPUs tab.

    2. In the GPU type list, select the GPU type.

    3. In the Number of GPUs list, select the number of GPUs.

    4. In the Machine type section, select a machine type.

  5. In the Provisioning model section, do the following:

    1. In the VM provisioning model list, select Flex-start.

      Note: When you select the flex-start provisioning model, you can't use reservations. The Google Cloud console automatically selects the Don't use a reservation option in the Advanced options > Management > Reservations section.
    2. To set a run duration for the VMs created through the instance template, in the Enter number of hours field, enter the number of hours. The value must be between one hour (1) and seven days (168).

  6. Optional: To change the default value boot disk type or image, in the Boot disk section, click Change. Then, follow the prompts to change the boot disk.

  7. Click Create.

gcloud

Create an instance template by using the beta instance-templates create command:

gcloud beta compute instance-templates create INSTANCE_TEMPLATE_NAME \
    --image-project=IMAGE_PROJECT \
    --image-family=IMAGE_FAMILY \
    --instance-termination-action=DELETE \
    --instance-template-region=REGION \
    --machine-type=MACHINE_TYPE \
    --maintenance-policy=TERMINATE \
    --max-run-duration=RUN_DURATION \
    --provisioning-model=FLEX_START \
    --reservation-affinity=none

Replace the following:

REST

Create an instance template by making a POST request to the beta.instanceTemplates.insert method:

POST https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/regions/REGION/instanceTemplates

{
  "name": "INSTANCE_TEMPLATE_NAME",
  "properties": {
    "disks": [
      {
        "boot": true,
        "initializeParams": {
          "sourceImage": "projects/IMAGE_PROJECT/global/images/IMAGE
        }
      }
    ],
    "machineType": "MACHINE_TYPE",
    "networkInterfaces": [
      {
        "network": "global/networks/default"
      }
    ],
    "reservationAffinity": {
      "consumeReservationType": "NO_RESERVATION"
    },
    "scheduling": {
      "instanceTerminationAction": "DELETE",
      "maxRunDuration": {
        "seconds": RUN_DURATION
      },
      "onHostMaintenance": "TERMINATE",
      "provisioningModel": "FLEX_START"
    }
  }
}

Replace the following:

After you create the instance template, you can view it to see its ID and review its instance properties.

Create a MIG and add GPU VMs all at once

Create a MIG as described in this section. To create a resize request in the MIG, you must not configure autoscaling and must turn off repairs.

Note: When you create a MIG by using the Google Cloud console, you can also create a resize request in the MIG at the same time. Otherwise, if you want to use the gcloud CLI or REST, then you must create a MIG, and then a resize request in the MIG. Permissions required for this task

To perform this task, you must have the following permissions:

Console
  1. Go to the Instance groups page.

    Go to Instance groups

  2. Click Create instance group. The Create instance group page opens.

  3. In the Name field, enter a name for the MIG.

  4. Before you select an instance template, you must delete the autoscaling configuration and turn off repairs as follows:

    1. To delete the autoscaling configuration, do the following:
      1. In the Autoscaling section, click the Autoscaling mode list, and then click Delete autoscaling configuration.
      2. In the confirmation dialog, click Delete.
    2. To turn off repairs, in the VM instance lifecycle section, click the Default action on failure list, and then select No action.
  5. Go back to the Instance template field. In the Instance template list, select the instance template that you created in the previous section.

  6. Do one of the following:

  7. In the Location section, specify whether you want to create a zonal or a regional MIG as follows:

    1. To create a zonal MIG, select Single zone. Or, to create a regional MIG, select Multiple zones.
    2. Select the Region and Zones of the MIG.
    3. If you're creating a regional MIG, then do the following:
      1. In the Target distribution shape field, select Any single zone.
      2. In the dialog that appears, click Disable instance redistribution.
  8. Click Create.

gcloud
  1. Create a zonal MIG using the instance-groups managed create command:

    gcloud compute instance-groups managed create INSTANCE_GROUP_NAME \
       --template=INSTANCE_TEMPLATE_URL \
       --size=0 \
       --zone=ZONE \
       --default-action-on-vm-failure=do_nothing
    
  2. In the MIG, create a resize request using the instance-groups managed resize-requests create command. Specify the number of GPU VMs that you want and the duration for which you want to run those VMs.

    gcloud compute instance-groups managed resize-requests create INSTANCE_GROUP_NAME \
       --resize-request=RESIZE_REQUEST_NAME \
       --resize-by=COUNT \
       --zone=ZONE
    

Replace the following:

REST
  1. Create a zonal MIG by making a POST request to the instanceGroupManagers.insert method.

    POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instanceGroupManagers
    
    {
     "versions": [
       {
         "instanceTemplate": "INSTANCE_TEMPLATE_URL"
       }
     ],
     "name": "INSTANCE_GROUP_NAME",
     "targetSize": 0,
     "instanceLifecyclePolicy": {
       "defaultActionOnFailure": "DO_NOTHING"
     }
    }
    
  2. In the MIG, create a resize request by making a POST request to the instanceGroupManagerResizeRequests.insert method. In the request body, specify the number of GPU VMs that you want to create all at once and the duration that you want to run those VMs.

    POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instanceGroupManagers/INSTANCE_GROUP_NAME/resizeRequests
    
    {
     "name": "RESIZE_REQUEST_NAME",
     "resizeBy": COUNT
    }
    

Replace the following:

The resize request that you create stays in the ACCEPTED state until the MIG creates all the requested GPU VMs. After all GPU VMs are created in the group, the state of the request changes to SUCCEEDED.

What's next

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-08-07 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["This document guides users on creating a managed instance group (MIG) with GPU-attached virtual machine (VM) instances, utilizing resize requests for efficient deployment."],["Resize requests allow users to specify the number of GPU VMs and the duration they are needed, with the Dynamic Workload Scheduler (DWS) managing resource allocation, improving GPU VM obtainability."],["To create a MIG with GPU VMs, users must first create an instance template that configures the VM settings, including the specified GPU type, followed by the creation of a MIG and resize request to indicate the desired quantity and duration of the GPU VMs."],["The document outlines the necessary steps for creating instance templates and MIGs, providing instructions for using the Google Cloud console, gcloud CLI, and REST API, and requires the user to have sufficient quota."],["The document also provides information on the management of GPU VMs created with resize requests, including instructions for deletion if jobs finish early or are automatically deleted when the requested run duration expires."]]],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4