Create a MIG with a multi-host Cloud TPU slice
This document describes how to create a managed instance group (MIG) with a multi-host TPU slice.
Prerequisites
Complete the following prerequisites:
- Create a project for your TPUs as described in Set up a project for TPUs.
- Determine your TPU requirements as described in Plan your resources.
Create a MIG with multi-host TPU slices
- Create an instance template.
- Create a workload policy.
- Create the MIG.
Create an instance template
The command to create an instance template depends on the consumption option you use: on-demand, Spot, reservation-bound, or flex-start. For more information about consumption options, see Plan your TPU resources.
Create an instance template for an on-demand TPU VM
The following command creates an instance template using the on-demand consumption option:
gcloud
gcloud compute instance-templates create INSTANCE_TEMPLATE_NAME \
--machine-type=MACHINE_TYPE \
--maintenance-policy=TERMINATE \
--image-family=IMAGE_FAMILY \
--image-project=IMAGE_PROJECT
REST
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
-d '{
"name": "INSTANCE_TEMPLATE_NAME",
"properties": {
"machineType": "MACHINE_TYPE",
"scheduling": {
"onHostMaintenance": "TERMINATE"
},
"disks": [
{
"boot": true,
"initializeParams": {
"sourceImage": "projects/IMAGE_PROJECT/global/images/family/IMAGE_FAMILY"
}