[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-11。"],[],[],null,["# Manage TPU Spot VMs\n===================\n\nSpot VMs make unused capacity available at highly-discounted rates.\nSpot VMs can be preempted (shut down) at any time, but unlike [preemptible\nTPUs](/tpu/docs/preemptible), there is no limit on runtime duration. You can't\nrestart TPU Spot VMs, and you must recreate them after preemption. For\nmore information about Spot VMs in general, see the [Compute Engine\ndocumentation about Spot VMs](/compute/docs/instances/spot).\n| **Note:** TPU Spot VMs only support the [TPU VM architecture](/tpu/docs/system-architecture-tpu-vm#tpu-vm-arch).\n\nCreate TPU Spot VMs\n-------------------\n\nYou can create TPU Spot VMs using queued resources, which adds your\ncreate request to a queue and lets you receive capacity once it becomes\navailable. Creating TPUs as queued resources is a best practice. For more\ninformation, see [Queued resources user guide](/tpu/docs/queued-resources).\n\nThe following example shows how to create TPU Spot VMs using queued\nresources: \n\n### gcloud\n\nAdd the `--spot` flag to the `gcloud compute tpus queued-resources` command: \n\n```bash\ngcloud compute tpus queued-resources create QUEUED_RESOURCE_ID \\\n --node-id=NODE_ID \\\n --zone=europe-west4-a \\\n --accelerator-type=v3-8 \\\n --runtime-version=tpu-vm-tf-2.17.1-pod-pjrt \\\n --spot\n```\n\n### curl\n\nAdd `spot: {}` to the request body: \n\n```bash\ncurl -X POST https://tpu.googleapis.com/v2alpha1/projects/PROJECT_ID/locations/europe-west4-a/queuedResources?queued_resource_id=QUEUED_RESOURCE_ID \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n tpu: {\n node_spec: {\n parent: \"projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/locations/\u003cvar translate=\"no\"\u003eeurope-west4-a\u003c/var\u003e\",\n node_id: \"\u003cvar translate=\"no\"\u003eNODE_ID\u003c/var\u003e\",\n node: {\n accelerator_type: \"\u003cvar translate=\"no\"\u003ev3-8\u003c/var\u003e\",\n runtime_version: \"\u003cvar translate=\"no\"\u003etpu-vm-tf-2.17.1-pod-pjrt\u003c/var\u003e\"\n }\n }\n },\n spot: {}\n }'\n```\n\n### Console\n\n1. In the Google Cloud console, go to the **TPUs** page:\n\n [Go to TPUs](https://console.cloud.google.com/compute/tpus)\n2. Click **Create TPU**.\n\n3. In the **Name** field, enter a name for your TPU.\n\n4. In the **Zone** box, select the zone where you want to create the TPU.\n\n5. In the **TPU type** box, select an accelerator type. The accelerator\n type specifies the version and size of the Cloud TPU you want to\n create. For more information about supported accelerator types for each\n TPU version, see [TPU\n versions](/tpu/docs/system-architecture-tpu-vm#versions).\n\n6. In the **TPU software version** box, select a software version. When\n creating a Cloud TPU VM, the TPU software version specifies the\n version of the TPU runtime to install. For more information, see [TPU\n software versions](/tpu/docs/runtimes).\n\n7. Click the **Enable queueing** toggle.\n\n8. In the **Queued resource name** field, enter a name for your queued\n resource request.\n\n9. Expand the **Management** section.\n\n10. Select the **Make this a TPU Spot VM** checkbox.\n\n11. Click **Create**.\n\nYou can also create TPU Spot VMs without using queued resources: \n\n### gcloud\n\nAdd the `--spot` flag to the `gcloud compute tpus tpu-vm` command: \n\n```bash\ngcloud compute tpus tpu-vm create TPU_NAME \\\n --zone=europe-west4-a \\\n --accelerator-type=v3-8 \\\n --version=tpu-vm-tf-2.17.1-pod-pjrt \\\n --spot\n```\n\n### curl\n\nAdd `scheduling_config: {spot: true}` to the request body: \n\n```bash\ncurl -X POST https://tpu.googleapis.com/v2/projects/PROJECT_ID/locations/europe-west4-a/nodes?node_id=TPU_NAME \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n accelerator_type: \"\u003cvar translate=\"no\"\u003ev3-8\u003c/var\u003e\",\n runtime_version: \"\u003cvar translate=\"no\"\u003etpu-vm-tf-2.17.1-pod-pjrt\u003c/var\u003e\",\n network_config: {enable_external_ips: true},\n scheduling_config: {spot: true}\n }'\n```\n\n### Console\n\n1. In the Google Cloud console, go to the **TPUs** page:\n\n [Go to TPUs](https://console.cloud.google.com/compute/tpus)\n2. Click **Create TPU**.\n\n3. In the **Name** field, enter a name for your TPU.\n\n4. In the **Zone** box, select the zone where you want to create the TPU.\n\n5. In the **TPU type** box, select an accelerator type. The accelerator\n type specifies the version and size of the Cloud TPU you want to\n create. For more information about supported accelerator types for each\n TPU version, see [TPU\n versions](/tpu/docs/system-architecture-tpu-vm#versions).\n\n6. In the **TPU software version** box, select a software version. When\n creating a Cloud TPU VM, the TPU software version specifies the\n version of the TPU runtime to install. For more information, see [TPU\n software versions](/tpu/docs/runtimes).\n\n7. Expand the **Management** section.\n\n8. Select the **Make this a TPU Spot VM** checkbox.\n\n9. Click **Create**.\n\nCheck if a TPU VM is a Spot VM\n------------------------------\n\n### gcloud\n\nTo confirm if your TPU VM is a Spot VM, use the describe command: \n\n```bash\ngcloud compute tpus tpu-vm describe TPU_NAME --zone=europe-west4-a\n```\n\nIf the TPU VM is a Spot VM, then the output will include the\n`spot` field set to `true`, similar to the following: \n\n ...\n schedulingConfig:\n spot: true\n ...\n\n### Console\n\n1. In the Google Cloud console, go to the **TPUs** page:\n\n [Go to TPUs](https://console.cloud.google.com/compute/tpus)\n2. Click the name of your Cloud TPU.\n\n If the TPU VM is a Spot VM, then the **Tier** will be\n **Spot VM**.\n\nPricing and quota\n-----------------\n\nPricing for TPU Spot VMs is significantly lower than for on-demand and\nreserved TPUs. For more information about pricing, see [Cloud TPU\npricing](/tpu/pricing).\n\nYou need preemptible quota to use TPU Spot VMs. For more information,\nsee [Quotas](/tpu/docs/quota)."]]