Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Gerenciar VMs spot da TPU
As VMs do Spot disponibilizam capacidade não utilizada com taxas com grandes descontos.
As VMs spot podem ser interrompidas (desativadas) a qualquer momento, mas, ao contrário dos TPUs
preemptivos, não há limite na duração do tempo de execução. Não é possível
reiniciar VMs spot da TPU. Elas precisam ser recriadas após a preempção. Para
mais informações sobre VMs spot em geral, consulte a documentação do Compute Engine
sobre VMs spot.
Criar VMs do Spot da TPU
É possível criar VMs spot de TPU usando recursos enfileirados, o que adiciona sua solicitação de criação a uma fila e permite que você receba capacidade quando ela estiver disponível. Criar TPUs como recursos em fila é uma prática recomendada. Para mais
informações, consulte o guia do usuário de recursos em fila.
O exemplo a seguir mostra como criar VMs spot de TPU usando recursos
em fila:
gcloud
Adicione a flag --spot ao comando gcloud compute tpus queued-resources:
Na caixa Zona, selecione a zona em que você quer criar a TPU.
Na caixa Tipo de TPU, selecione um tipo de acelerador. O tipo de acelerador especifica a versão e o tamanho da Cloud TPU que você quer criar. Para mais informações sobre os tipos de aceleradores compatíveis com cada versão de TPU, consulte Versões de TPU.
Na caixa Versão do software da TPU, selecione uma versão do software. Ao
criar uma VM do Cloud TPU, a versão do software da TPU especifica a
versão do ambiente de execução da TPU que será instalada. Para mais informações, consulte Versões do software da TPU.
Clique no botão Ativar fila.
No campo Nome do recurso em fila, digite um nome para a solicitação de recurso
em fila.
Expanda a seção Gerenciamento.
Marque a caixa de seleção Transformar esta VM em uma spot da TPU.
Clique em Criar.
Também é possível criar VMs spot de TPU sem usar recursos na fila:
gcloud
Adicione a flag --spot ao comando gcloud compute tpus tpu-vm:
Na caixa Zona, selecione a zona em que você quer criar a TPU.
Na caixa Tipo de TPU, selecione um tipo de acelerador. O tipo de acelerador especifica a versão e o tamanho da Cloud TPU que você quer criar. Para mais informações sobre os tipos de aceleradores compatíveis com cada versão de TPU, consulte Versões de TPU.
Na caixa Versão do software da TPU, selecione uma versão do software. Ao
criar uma VM do Cloud TPU, a versão do software da TPU especifica a
versão do ambiente de execução da TPU que será instalada. Para mais informações, consulte Versões do software da TPU.
Expanda a seção Gerenciamento.
Marque a caixa de seleção Transformar esta VM em uma spot da TPU.
Clique em Criar.
Verificar se uma VM TPU é uma VM spot
gcloud
Para confirmar se a VM TPU é uma VM do Spot, use o comando "describe":
Se a VM TPU for uma VM do Spot, o nível será
VM do Spot.
Preços e cotas
O preço das VMs spot de TPU é significativamente menor do que o das TPUs sob demanda e reservadas. Para mais informações sobre preços, consulte Preços do Cloud TPU.
Você precisa de uma cota preemptiva para usar VMs do Spot da TPU. Para mais informações,
consulte Cotas.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-08-18 UTC."],[],[],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)."]]