TPU 스팟 VM 관리

스팟 VM은 미사용 용량을 대폭 할인된 가격으로 제공합니다. 스팟 VM은 언제든지 선점(종료)할 수 있지만 선점형 TPU와 달리 런타임 기간에는 제한이 없습니다. TPU 스팟 VM을 다시 시작할 수 없으며 선점 후 다시 만들어야 합니다. 스팟 VM에 대한 일반적인 내용은 스팟 VM에 대한 Compute Engine 문서를 참조하세요.

TPU 스팟 VM 만들기

큐에 추가된 리소스를 사용하여 TPU 스팟 VM을 만들 수 있습니다. 그러면 만들기 요청이 큐에 추가되어 TPU 스팟 VM이 사용 가능해지는 대로 용량을 받을 수 있습니다. TPU를 큐에 추가된 리소스로 만드는 것이 가장 좋습니다. 자세한 내용은 큐에 추가된 리소스 사용자 가이드를 참조하세요.

큐에 추가된 리소스 만들기 명령어에 --spot 플래그를 추가하여 TPU 스팟 VM을 큐에 추가된 리소스로 만듭니다.

gcloud

gcloud compute tpus queued-resources create QUEUED_RESOURCE_ID \
  --node-id=NODE_ID \
  --zone=europe-west4-a \
  --accelerator-type=v3-8 \
  --runtime-version=tpu-vm-tf-2.16.1-pod-pjrt \
  --spot

curl

curl -X POST https://tpu.googleapis.com/v2alpha1/projects/PROJECT_ID/locations/europe-west4-a/queuedResources?queued_resource_id=QUEUED_RESOURCE_ID \
  -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  -d '{
    tpu: {
      node_spec: {
        parent: "projects/PROJECT_ID/locations/europe-west4-a",
        node_id: "NODE_ID",
        node: {
          accelerator_type: "v3-8",
          runtime_version: "tpu-vm-tf-2.16.1-pod-pjrt"
        }
      }
    },
    spot: {}
  }'

create 명령어에 --spot 플래그를 추가하여 큐에 추가된 리소스를 사용하지 않고 TPU 스팟 VM을 만들 수도 있습니다.

gcloud

gcloud compute tpus tpu-vm create TPU_NAME \
  --zone=europe-west4-a \
  --accelerator-type=v3-8 \
  --version=tpu-vm-tf-2.16.1-pod-pjrt \
  --spot

curl

curl -X POST https://tpu.googleapis.com/v2/projects/PROJECT_ID/locations/europe-west4-a/nodes?node_id=TPU_NAME \
  -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  -d '{
    accelerator_type: "v3-8",
    runtime_version: "tpu-vm-tf-2.16.1-pod-pjrt",
    network_config: {enable_external_ips: true},
    scheduling_config: {spot: true}
  }'

TPU VM이 스팟 VM인지 확인

TPU VM이 스팟 VM인지 확인하려면 describe 명령어를 사용합니다.

gcloud compute tpus tpu-vm describe TPU_NAME --zone=europe-west4-a

TPU VM이 스팟 VM이면 출력에는 다음과 비슷하게 true로 설정된 spot 필드가 포함됩니다.

...
schedulingConfig:
  spot: true
...

가격 책정 및 할당량

TPU 스팟 VM의 가격 책정은 주문형 및 예약 TPU에 비해 훨씬 저렴합니다. 가격 책정에 대한 자세한 내용은 Cloud TPU 가격 책정을 참조하세요.

TPU 스팟 VM을 사용하려면 선점형 할당량이 필요합니다. 자세한 내용은 할당량을 참조하세요.