Consume a reservation

If you have a TPU reservation, you can use your reserved resources to create TPUs that match the reservation's properties. This action is known as consuming a reservation . For information about consuming a TPU reservation when using GKE, see TPU reservation in the GKE documentation.

Consume a specific reservation

When you create resources with the gcloud alpha compute tpus queued-resources create command , use the --reservation flag to specify the name of the reservation to consume. For future reservations created in calendar mode, you must also set the --provisioning-model flag to reservation-bound :

gcloud  
alpha  
compute  
tpus  
queued-resources  
create  
 QUEUED_RESOURCE_ID 
  
 \ 
  
--node-id = 
 TPU_NAME 
  
 \ 
  
--zone = 
 ZONE 
  
 \ 
  
--accelerator-type = 
 ACCELERATOR_TYPE 
  
 \ 
  
--runtime-version = 
 SOFTWARE_VERSION 
  
 \ 
  
--reservation = 
 RESERVATION_URL 
  
 \ 
  
--provisioning-model = 
reservation-bound  
 # Only required for calendar mode 

Replace the following placeholder variables:

  • QUEUED_RESOURCE_ID : A user-assigned ID for the queued resource request.
  • TPU_NAME : A user-assigned ID (name) for the TPU that is created when the queued resource request is allocated.
  • ZONE : The zone in which to create the TPU VM. For more information about supported zones, see Regions and zones .
  • ACCELERATOR_TYPE : Specifies the version and size of the Cloud TPU to create. For more information about supported accelerator types for each TPU version, see TPU versions .
  • SOFTWARE_VERSION : The Cloud TPU software version .
  • RESERVATION_URL : The URL of the reservation. Specify one of the following values:
    • If the reservation is in your project: RESERVATION_NAME
    • If the reservation is in another project and your project can consume it: projects/ OWNER_PROJECT_ID /reservations/ RESERVATION_NAME

Consume any matching reservation

You can use the --reserved flag to automatically determine the reservation to use based on the accelerator type, project ID, and zone.

CreateNode

To consume any matching reservation using the CreateNode API, use the gcloud alpha compute tpus tpu-vm create command with the --reserved flag :

gcloud  
alpha  
compute  
tpus  
tpu-vm  
create  
 TPU_NAME 
  
 \ 
  
--zone = 
 ZONE 
  
 \ 
  
--accelerator-type = 
 ACCELERATOR_TYPE 
  
 \ 
  
--version = 
 SOFTWARE_VERSION 
  
 \ 
  
--reserved

Replace the following placeholder variables:

  • TPU_NAME : A name for the TPU.
  • ZONE : The zone where to create the TPU VM, which must match the reservation zone.
  • ACCELERATOR_TYPE : Specifies the version and size of the Cloud TPU to create. For more information about supported accelerator types for each TPU version, see TPU versions .
  • SOFTWARE_VERSION : The Cloud TPU software version .

Queued resources

To consume any matching reservation using queued resources , use the gcloud alpha compute tpus queued-resources create command with the --reserved flag :

gcloud  
alpha  
compute  
tpus  
queued-resources  
create  
 QUEUED_RESOURCE_ID 
  
 \ 
  
--node-id = 
 TPU_NAME 
  
 \ 
  
--zone = 
 ZONE 
  
 \ 
  
--accelerator-type = 
 ACCELERATOR_TYPE 
  
 \ 
  
--runtime-version = 
 SOFTWARE_VERSION 
  
 \ 
  
--reserved

Replace the following placeholder variables:

  • QUEUED_RESOURCE_ID : A user-assigned ID for the queued resource request.
  • TPU_NAME : A user-assigned ID (name) for the TPU that is created when the queued resource request is allocated.
  • ZONE : The zone in which to create the TPU VM and where the reservation exists.
  • ACCELERATOR_TYPE : Specifies the version and size of the Cloud TPU to create. For more information about supported accelerator types for each TPU version, see TPU versions .
  • SOFTWARE_VERSION : The Cloud TPU software version .

Check reservation usage

You can only check a shared reservation usage from its owner project. If you are in a consumer project, then you must switch to the owner project to check the reservation usage.

To see how much of the reservation is in use, use the gcloud compute reservations describe command :

gcloud  
compute  
reservations  
describe  
 RESERVATION_NAME 
  
 \ 
  
--project = 
 PROJECT_ID 
  
--zone = 
 ZONE 

Replace the following placeholder variables:

  • RESERVATION_NAME : The name of the reservation.
  • PROJECT_ID : The ID of the project that contains the reservation.
  • ZONE : The zone where the reservation exists.

To list all reservations in a project, use the gcloud compute reservations list command :

gcloud  
compute  
reservations  
list  
--project = 
 PROJECT_ID 

Replace the following placeholder variable:

  • PROJECT_ID : The ID of the project.

What's next

Create a Mobile Website
View Site in Mobile | Classic
Share by: