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 Google Kubernetes Engine (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
- If the reservation is in your project:
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.