Getting capacity and installing: VM and GKE¶
Prerequisites: The TorchTPU stack and the CUDA translation table, Dynamic shapes and recompilation
Most first days on Cloud TPU are not lost to PyTorch. They are lost to a request that sits in a queue for hours because a project quota you never heard of is zero, to a VM that disappears after exactly 24 hours, to a pip install that quietly pulls a multi-gigabyte CUDA build of torch, or to a multi-host slice where the install ran on one worker out of four. This chapter is the procedure that avoids those: choose a capacity model that fits your TPU generation and job length, check quotas before you ask, create a single-host or multi-host TPU VM with the exact gcloud command, install TorchTPU in the order the documentation gives, and then prove, with a script and its expected output, that every host sees every device. The second half does the same on Google Kubernetes Engine (GKE), where TorchTPU's own examples run on TPU v7x as a Kubernetes Job on one host and a JobSet across sixteen.
What this chapter covers¶
- Capacity models (flex-start, spot, on-demand, reservations, queued resources and GKE node pools) and the
gcloudcommand for each TPU generation. - Project APIs and quotas a TPU request needs, including the global
GPUS_ALL_REGIONSquota. - A TorchTPU install that uses the CPU build of PyTorch, and a bottom-up check that every device is visible and computes.
- Multi-host slices: running the install and a preflight check on every worker, and spotting the worker that disagrees.
- TorchTPU's reference
JobandJobSetmanifests on a GKE TPU node pool, with node selectors, chip request andTORCH_TPU_TOPOLOGYkept consistent. - A troubleshooting table that maps onboarding symptoms to causes and fixes.
The decision before any command¶
TPU capacity comes in a few shapes, and the right one depends on three facts about your job: the TPU generation, whether the chips fit on one host, and how long the job runs and how well it survives being stopped.
The TPU generation decides the API. The vLLM-TorchTPU setup guide lists two Google Cloud APIs for creating TPUs. TPU v6e (Trillium) and TPU v5p are created as ordinary Compute Engine VM instances with gcloud compute instances create. TPU v5e is created through the older Cloud TPU API, with gcloud alpha compute tpus queued-resources create. For TPU v7x (Ironwood), the published guides disagree, and the disagreement settles the choice for you: the vLLM-TorchTPU guide also generates queued-resource commands for v7x, but Google's queued resources documentation says the Cloud TPU API is in maintenance mode and does not support TPU7x or later versions, and TorchTPU's own VM guide says GKE "is necessary to access recent TPU hardware". Every TorchTPU GKE example targets v7x. Plan on GKE for v7x.
The chip count decides single-host or multi-host. A single-host slice is one VM with its chips attached over PCIe: ct6e-standard-1t, -4t or -8t give 1, 4 or 8 v6e chips, and ct5p-hightpu-4t gives 4 v5p chips. Larger slices span several hosts whose chips are joined by ICI (chapter 1). The vLLM-TorchTPU generator notes that v6e topologies of 16 or more chips, and v5p topologies of 8 or more, need multi-host managed instance groups or GKE rather than a single instances create. Outside GKE, Google's flex-start queued resources serve v6e, v5p and v5e in a few zones (v5p only in us-east5-a), through a Cloud TPU API that is in maintenance mode; the 16-chip v6e example later in this chapter is one. The generator's managed-instance-group route is not covered here.
The generation picks the API and the chip count picks one host or a slice. A one-host VM then needs a provisioning model, chosen in the next figure. The queued-resource route goes through the Cloud TPU API, which is in maintenance mode and does not serve v7x.
The job length and its tolerance for interruption decide the provisioning model.
| Model | What you get | How to ask |
|---|---|---|
| Flex-start (Dynamic Workload Scheduler) | Discounted capacity from a queue; once provisioned it runs uninterrupted for up to 7 days; cannot be stopped and restarted, only deleted | --provisioning-model=FLEX_START on instances create; --provisioning-model=flex-start on queued resources |
| Spot | The same capacity pool as flex-start, much cheaper, preemptible at any time | --provisioning-model=SPOT in place of FLEX_START |
| On-demand ("standard") | Pay-as-you-go; not preempted once provisioned, but physical capacity is not guaranteed to be free when you ask | instances create without a provisioning-model flag |
| Reservation | Capacity arranged in advance | The vLLM-TorchTPU generator's "Standard / Reserved" option, --reserved for queued resources, or a reservation as the first choice in a GKE ComputeClass |
| GKE node pool | Kubernetes nodes backed by TPU VMs; capacity from a reservation, spot or flex-start, often in that order of preference | gcloud container node-pools create, or node auto-provisioning from a custom ComputeClass |
Flex-start is the TPU Builders program's primary recommendation, because a provisioned VM is guaranteed up to seven days without interruption. Spot is for jobs that checkpoint often and want the credits to last longer. A long-running service should not rely on flex-start alone: the llm-d GKE TPU page warns that flex-start nodes run for at most seven days and are then preempted.
The cards are values of the provisioning-model setting of gcloud compute instances create; only flex-start has the seven-day limit. A queued resource takes the lowercase value flex-start instead.
The branches of the two figures rest on documented facts: v7x through GKE, v5e through the legacy API, single-host machine types for v6e and v5p, flex-start's seven-day limit and spot's preemption. Inside GKE the same capacity choice reappears as a property of the node pool.
Before the first request: project, APIs and quotas¶
Every path starts with an authenticated gcloud and the TPU API enabled. The TPU Builders guide's prerequisites, with the Compute Engine API added, as the vLLM-TorchTPU guide does:
gcloud auth login
gcloud config set project YOUR_PROJECT_ID
gcloud services enable tpu.googleapis.com compute.googleapis.com
gcloud components install alpha --quiet # needed for queued-resources commands
Use a new project. Reusing an old Google Cloud project, for example one from the earlier TPU Research Credits program, can fail every TPU request with Error: code 10, Failed to perform tenant project creation. The Builders guide's fix is a new, separate project.
Check the global accelerator quota first. New projects and new billing accounts start with GPUS_ALL_REGIONS (Compute Engine's global accelerator quota) at 0. At 0, the project cannot use any accelerator, GPU or TPU, even when the regional TPU quota looks fine; requests hang in WAITING_FOR_RESOURCES or PROVISIONING, or fail with STOCKOUT or RESOURCE_POOL_EXHAUSTED. It is an anti-fraud default. The fix, in order: link an active paid billing account (credits alone are not enough if billing is disabled), add a card or bank account to raise the billing account's reputation, then request GPUS_ALL_REGIONS of 8 or 16 under IAM & Admin, Quotas. Institutional invoice accounts that cannot add a card email their billing account ID to the program's support address, tpu-builders-support@google.com.
Then the regional TPU quota. The metric depends on the API:
| Generation | API | Quota metric |
|---|---|---|
| v6e | Compute Engine | PREEMPTIBLE_TPU_V6E |
| v5p | Compute Engine | PREEMPTIBLE_TPU_V5P |
| v5e serving | Cloud TPU (legacy) | tpu-v5s-litepod-serving-preemptible |
| v5e training | Cloud TPU (legacy) | tpu-v5s-litepod-preemptible |
| Any, on GKE (on-demand or spot node pools) | Compute Engine | Compute Engine quota, not Cloud TPU quota; a node pool that consumes a reservation needs none |
Request increases in the Cloud Console per region, giving the number of chips. Reviews can take up to two business days, and an immediate automated rejection usually means a brand-new billing account; the Builders guide says to wait 48 hours and retry. A pre-flight diagnostic script checks billing, the default VPC, organization policies, API access, service account permissions and quotas, and writes tpu_diagnostic_report.txt; it is published in the TPU Builders Program Getting Started Guide. Download it, read it, then run it:
curl -sSO https://gist.githubusercontent.com/RobMulla/ee1a530f9ff0bdb9aa5b493c7faf9aa2/raw/tpu_diagnostic.py
less tpu_diagnostic.py # read it first: it runs gcloud commands as your account
python3 tpu_diagnostic.py
Zones. Capacity is per zone. The Builders guide lists the zones where its program's flex-start capacity is: v6e (ct6e-standard-4t) in us-east5-a, us-east5-b, us-central1-a, europe-west4-a and southamerica-west1-a; v5p (ct5p-hightpu-4t) in us-east5-a and us-central1-a, both marked as limited and prone to stockouts; and v5e through the legacy API in us-west4-a and europe-west4-b. Outside the program, check Google's TPU regions and zones page for your generation.
Credits and budgets, for TPU Builders participants
Program credits arrive only after the final credit application is approved, which typically takes two to three weeks. A budget alert at 50, 75 and 90 percent of the credit amount sends email only: it does not stop TPUs or charges. Deleting idle VMs is still your job.
Creating a single-host TPU VM¶
v6e or v5p with flex-start¶
The TPU Builders guide's command for a four-chip v6e VM, verbatim:
gcloud compute instances create tpu-v6e-vm \
--zone=us-east5-a \
--machine-type=ct6e-standard-4t \
--provisioning-model=FLEX_START \
--request-valid-for-duration=2h \
--max-run-duration=4h \
--instance-termination-action=DELETE \
--image-project=ubuntu-os-accelerator-images \
--image-family=ubuntu-accel-2204-amd64-tpu-v5e-v5p-v6e \
--maintenance-policy=TERMINATE \
--metadata=startup-script="echo 'TPU VM Booted'"
The v5p version changes only the name and --machine-type=ct5p-hightpu-4t. Three flags carry the behaviour:
--request-valid-for-duration=2hsets how long the request stays valid while it waits in the flex-start queue for capacity.--max-run-durationsets how long the VM runs once provisioned. Without it, flex-start VMs terminate after 24 hours; the maximum is168h, the seven days the model guarantees.--instance-termination-action=DELETEdeletes the VM at the end of that window. Flex-start VMs cannot be stopped and restarted, so there is nothing to keep.
The Cloud Console offers the same request: Compute Engine, Create instance, the TPUs tab, a machine type such as ct6e-standard-1t, and Flex-start under VM provisioning model. The instance shows a spinner while it waits in the queue and a green check when capacity arrives. If the Console option is missing for you, use the gcloud commands in this section.
For spot, replace --provisioning-model=FLEX_START with --provisioning-model=SPOT. For a standard on-demand VM, the vLLM-TorchTPU generator drops the provisioning, duration and termination flags:
gcloud compute instances create my-tpu-vm \
--project=PROJECT_ID \
--zone=ZONE \
--machine-type=ct6e-standard-4t \
--image-project=ubuntu-os-accelerator-images \
--image-family=ubuntu-accel-2204-amd64-tpu-v5e-v5p-v6e \
--maintenance-policy=TERMINATE
Watch the request and connect when it is running:
gcloud compute instances describe tpu-v6e-vm --zone=us-east5-a
gcloud compute ssh tpu-v6e-vm --zone=us-east5-a
Keep data and setup off the VM¶
Because a flex-start VM is deleted rather than stopped, the Builders guide recommends treating it as disposable: keep data on a separate persistent disk and rebuild the environment with a startup script on every boot. For v6e and v5p the disk must be hyperdisk-balanced or hyperdisk-ml.
gcloud compute disks create my-data-disk \
--size=100GB \
--zone=us-east5-a \
--type=hyperdisk-balanced
startup.sh formats the disk only if it has no filesystem yet, then mounts it. Put the TorchTPU install from the next section at its end.
#!/bin/bash
if [ -z "$(sudo blkid /dev/disk/by-id/google-data-disk)" ]; then
sudo mkfs.ext4 -m 0 -E lazy_itable_init=0,lazy_journal_init=0,discard /dev/disk/by-id/google-data-disk
fi
sudo mkdir -p /mnt/data
sudo mount -o discard,defaults /dev/disk/by-id/google-data-disk /mnt/data
sudo chmod a+w /mnt/data
Attach both at creation. name= must match the disk, and device-name=data-disk is what makes the path /dev/disk/by-id/google-data-disk inside the VM:
gcloud compute instances create my-tpu-vm \
--zone=us-east5-a \
--machine-type=ct6e-standard-4t \
--provisioning-model=FLEX_START \
--request-valid-for-duration=2h \
--max-run-duration=4h \
--instance-termination-action=DELETE \
--image-project=ubuntu-os-accelerator-images \
--image-family=ubuntu-accel-2204-amd64-tpu-v5e-v5p-v6e \
--maintenance-policy=TERMINATE \
--disk=name=my-data-disk,device-name=data-disk,mode=rw,boot=no \
--metadata-from-file=startup-script=startup.sh
The boot disk of an instances create VM is 10 GB by default (100 GB for legacy queued resources). Add --boot-disk-size=100GB if the environment and a model cache live on it, or stream large datasets from Cloud Storage after granting the compute service account access to the bucket:
gcloud storage buckets add-iam-policy-binding gs://YOUR_BUCKET_NAME \
--member=serviceAccount:YOUR_PROJECT_NUMBER-compute@developer.gserviceaccount.com \
--role=roles/storage.objectAdmin
A persistent disk is also the natural home for a persistent compilation cache: chapter 3 explained that a new VM otherwise starts with an empty cache and compiles every graph again.
v5e through queued resources¶
v5e uses the legacy Cloud TPU API, so it is requested as a queued resource: a request object that waits for capacity and, once granted, owns the TPU VM. The Builders guide's v5e serving request:
gcloud alpha compute tpus queued-resources create tpu-v5e-request \
--zone=us-west4-a \
--accelerator-type=v5litepod-4 \
--runtime-version=v2-alpha-tpuv5-lite \
--node-id=tpu-v5e-node \
--provisioning-model=flex-start \
--max-run-duration=4h \
--valid-until-duration=4h \
--labels=purpose=flex-start
gcloud alpha compute tpus queued-resources describe tpu-v5e-request --zone=us-west4-a
Note the different vocabulary: --accelerator-type and --runtime-version instead of a machine type and an image, lowercase flex-start, and --valid-until-duration for how long the request may wait. Accelerator type names count chips for v6e and v5e (v6e-16, v5litepod-4) but TensorCores for v7x, v5p and v4 (tpu7x-8 is 4 chips), as the vLLM-TorchTPU generator computes them.
Only the ACTIVE box means you can log in. A request holds quota in every state, including FAILED, until you delete it. State names and meanings follow Google's queued resources documentation; the teardown row shows the order the state descriptions imply.
When a request is stuck or done, delete it with the command the Builders and vLLM-TorchTPU guides give, gcloud alpha compute tpus queued-resources delete QR_NAME --zone=ZONE --force, and for a Compute Engine instance gcloud compute instances delete VM_NAME --zone=ZONE --quiet.
Multi-host slices on TPU VMs¶
A slice larger than one host is several worker VMs whose chips form one ICI network. The hardware is one slice, but the software is not: each worker is its own Linux machine with its own Python environment, and the TorchTPU program runs as a set of processes on every worker at once. Everything you do to one worker, you must do to all of them.
On the left, one ssh session reaches every chip. On the right, the 16 chips are one ICI-connected slice, but they belong to four Linux hosts; a command reaches all of them only with --worker=all.
A 16-chip v6e slice can be requested as a flex-start queued resource:
gcloud alpha compute tpus queued-resources create "${TPU_NAME}-qr" \
--node-id="${TPU_NAME}" --zone="${ZONE}" \
--accelerator-type=v6e-16 --runtime-version=v2-alpha-tpuv6e \
--provisioning-model=flex-start --max-run-duration=168h --valid-until-duration=4h
The flags are those of Google's flex-start queued resource command, which lists v6e, v5p and v5e among the generations it serves, and v2-alpha-tpuv6e is the runtime the vLLM-TorchTPU generator uses for v6e. Flex-start zones for v6e differ from the TPU Builders list above, so check the page for your zone.
Workers of a queued-resource slice are reached with gcloud compute tpus tpu-vm ssh, not gcloud compute ssh. Its --worker flag defaults to 0: a bare ssh silently reaches only the first host. With --command, --worker also accepts a list (1,4,6), a range (1-3) or all, which runs the command on every worker concurrently. --output-directory writes each worker's output to its own <worker id>.log file in a directory that must already exist; without it, the workers' output is interleaved. The gcloud reference also says to cache the SSH key (ssh-add ~/.ssh/google_compute_engine) before targeting several workers.
gcloud compute tpus tpu-vm ssh "${TPU_NAME}" --zone="${ZONE}" --worker=all \
--command="uname -a" --output-directory=logs
Installing TorchTPU¶
The TorchTPU VM guide installs in a fixed order, Python first and then the package, "to ensure the PyTorch dispatcher and TPU drivers align correctly":
sudo apt update && sudo apt install -y python3.12 python3.12-venv
python3.12 -m venv env
source env/bin/activate
pip install torch_tpu==0.2.0 --extra-index-url https://download.pytorch.org/whl/cpu
The last line differs from the VM guide on purpose. The guide writes plain pip install torch_tpu. The TorchTPU README pins the release and adds the PyTorch CPU index, and explains why: without --extra-index-url https://download.pytorch.org/whl/cpu, pip installs the CUDA build of torch, which TorchTPU does not use. The Hugging Face announcement uses the same index with the hyphenated name, pip install torch-tpu --extra-index-url https://download.pytorch.org/whl/cpu. The README calls 0.2.0 the latest public release on PyPI; the repository's pyproject.toml is already at 0.2.1, which requires torch>=2.11.0 and Python 3.11 or later. Pin whatever version you test with, so every worker gets the same one.
There is no import torch_tpu step. As chapter 3 explained, import torch autoloads the backend and registers the tpu device.
On a multi-host slice, run the same install on every worker:
gcloud compute tpus tpu-vm ssh "${TPU_NAME}" --zone="${ZONE}" --worker=all --command="
sudo apt update && sudo apt install -y python3.12 python3.12-venv
python3.12 -m venv ~/env && source ~/env/bin/activate
pip install torch_tpu==0.2.0 --extra-index-url https://download.pytorch.org/whl/cpu
"
The allocator. On every import, TorchTPU checks whether tcmalloc is the process allocator and, if not, warns once with a message starting //TorchTpu/Performance/TcMalloc//. The reason given in the source: in eager execution, the Python dispatch thread and the runtime's worker threads allocate and free objects across threads, which contends on glibc's default allocator. The TorchTPU Docker image preloads tcmalloc; on a bare Ubuntu VM, install the google-perftools package and preload the library, for example export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4. Any preloaded tcmalloc satisfies the check.
Verifying one host¶
A VM in state RUNNING with TorchTPU installed is not yet proof of anything. Check from the bottom of the stack up.
1. The devices exist. The vLLM-TorchTPU guide checks that the accelerator devices are visible to the VM before installing anything:
ls /dev/vfio/
An empty or missing directory means no TPU is attached to this VM; no Python setting will fix it.
2. PyTorch sees TorchTPU. The TorchTPU API reference's device query, which uses the portable torch.accelerator API (PyTorch 2.11 or later) plus torch.tpu.get_device_properties() for the chip's name:
import torch
device = torch.device("tpu")
print(f"torch.accelerator.is_available(): {torch.accelerator.is_available()}")
print(f"torch.accelerator.device_count(): {torch.accelerator.device_count()}")
print(f"torch.accelerator.current_device_index(): {torch.accelerator.current_device_index()}")
print(f"torch.tpu.get_device_properties().name: {torch.tpu.get_device_properties().name}")
is_available() must be True. The device count must equal chips times devices per chip: one device per chip on v6e and v5p, two on v7x, so 4 on a ct6e-standard-4t and 8 on a four-chip v7x host. The API reference's example name is "TPU v6e". The current index on a single process is 0.
3. Tensors live on the TPU and compute. TorchTPU's minimal example, examples/simple_pytorch/simple_pytorch.py, is the VM guide's notebook in one file. It creates a CPU tensor, moves it to the TPU two ways, and creates one directly on the TPU. Its README gives the expected output:
TPU Initialization complete. Primary device: tpu:0
cpu_tensor is on: cpu
tpu_tensor is on: tpu:0
direct_tpu_tensor is on: tpu:0
The VM guide then adds the two TPU tensors and brings the sum back with .cpu(), printing Result Checksum (Sum): .... The value is random (one operand is torch.randn), but it must be a finite number, and the .cpu() call is the synchronization point where any device error would surface (chapter 4).
4. The preflight script runs those checks and a few install checks in one go and ends with a single summary line, which is what makes it useful across a slice:
python3 preflight.py --chips 4
| Check | What it tests | Why |
|---|---|---|
python |
3.11 or later | TorchTPU's supported versions; the VM guide uses 3.12 |
torch |
2.11 or later | torch_tpu requires it, and so do the torch.accelerator device APIs |
cpu_build |
torch.version.cuda is None (warning if not) |
Catches the install without the CPU index |
torch_tpu |
The distribution is installed | Autoload needs it |
autoload |
TORCH_DEVICE_BACKEND_AUTOLOAD is not 0 |
Otherwise import torch skips TorchTPU |
vfio |
/dev/vfio is not empty |
The VM really has TPU devices |
accelerator |
The current accelerator is tpu |
TorchTPU registered the device |
devices |
device_count() equals chips times devices_per_chip |
A wrong count means devices are hidden or held elsewhere |
compute |
The VM guide's add and .cpu() gives a finite checksum |
The device executes and returns data |
launch_env (optional) |
Runs python3 -m torch.tpu.distributed and checks its output |
The distributed launcher can derive a topology |
On a healthy four-chip v6e host the last line reads like this (host name and versions are yours):
PREFLIGHT host=... python=3.12.3 torch=2.11.0+cpu torch_tpu=0.2.0 accelerator=tpu devices=4 name='TPU v6e' status=PASS
The script's --cpu-smoke mode runs on a laptop: it parses example outputs in the formats the documented commands print (not captured from a TPU) and shows which mistakes each check catches. The numerical check from chapter 3 (code/ch03_stack/check_env.py, a matmul against a CPU reference) comes after this one passes.
Verifying every host of a slice¶
On a multi-host slice, a check that passes on worker 0 says nothing about worker 3. Run the preflight on all workers, keep each worker's output in its own file, and compare:
for w in 0 1 2 3; do
gcloud compute tpus tpu-vm scp code/ch08_install/preflight.py "${TPU_NAME}":~ --zone="${ZONE}" --worker=$w
done
ssh-add ~/.ssh/google_compute_engine
mkdir -p preflight-logs
gcloud compute tpus tpu-vm ssh "${TPU_NAME}" --zone="${ZONE}" --worker=all \
--command="source ~/env/bin/activate && python3 preflight.py --chips 4" \
--output-directory=preflight-logs
python code/ch08_install/preflight.py --aggregate preflight-logs --expect-hosts 4
The copy loop uses --worker one value at a time because the gcloud reference documents fan-out (all, lists, ranges) only together with --command, which scp does not have. The aggregate step fails if any worker failed, if a worker's log has no summary line (the command never ran there), if the workers disagree on the Python, torch or torch_tpu version, the device count or the chip name, if two logs come from the same host, or if the number of logs is not the number of workers you expect. Its output on the broken fixture in the companion code shows the two most common multi-host install faults at once:
FAIL worker 2: status FAIL on host host-2
FAIL slice: workers disagree on torch_tpu: 0.2.0, 0.2.1
FAIL slice: workers disagree on devices: 0, 4
FAIL slice: workers disagree on name: None, TPU v6e
verdict: FAIL
Launching across hosts. TorchTPU's multi-host launcher derives the distributed settings for each host with eval "$(python3 -m torch.tpu.distributed)". That module calls torch.tpu.distributed.set_tpu_launch_env() and prints shell assignments: TORCH_TPU_TOPOLOGY, TORCH_TPU_SLICEBUILDER_ADDRESSES (one host:port per device, ports from 8070 on multi-host), TORCH_TPU_XPROF_SESSION_ID, WORLD_SIZE (the number of those addresses, so one per device), NODE_RANK, and on multi-host NNODES, MASTER_ADDR (by default the first worker) and MASTER_PORT (default 29500). Two properties matter when it goes wrong. On multi-host it needs TPU_WORKER_HOSTNAMES, the comma-separated worker list, and raises ValueError if a value it must derive needs that list and the list is unset. And it never overwrites a variable that is already set, so a stale TORCH_TPU_TOPOLOGY in your environment or manifest wins over the detected one. preflight.py --launch-env runs the module and checks that WORLD_SIZE equals the number of addresses, that NNODES equals the number of distinct hosts and that NODE_RANK is in range.
TORCH_TPU_TOPOLOGY has two spellings in TorchTPU's documentation. The API reference's example writes 2x2x1; the launcher and every manifest write four comma-separated numbers such as 2,2,1,2, where the fourth is the number of TensorCores per chip the job uses. Use the comma form; it is what the launcher prints.
Running on GKE¶
On GKE you do not log in to TPU hosts. A node pool owns the TPU VMs, and you submit Kubernetes objects that ask for chips. TorchTPU's GKE guide assumes a GKE Standard cluster that already has a TPU v7x (tpu7x) node pool with four chips per node (topology 2x2x1), and points to Google's "Deploy TPU workloads in GKE Standard" for creating one.
The node pool¶
GKE TPU node pools are created with gcloud container node-pools create; the flags do not carry over from gcloud compute tpus. Google's GKE TPU documentation gives the general form:
gcloud container node-pools create NODE_POOL_NAME \
--cluster=CLUSTER_NAME --location=CONTROL_PLANE_LOCATION \
--node-locations=NODE_ZONE --machine-type=MACHINE_TYPE \
--tpu-topology=TPU_TOPOLOGY --placement-type=COMPACT
Three properties of TPU node pools shape everything above them:
- Single-host pools hold independent VMs that scale and are repaired one at a time. Multi-host pools are one slice: they scale atomically between zero and the full slice, and an upgrade, repair or failure of one node recreates or evicts the whole slice. With
--enable-autoscaling, set--num-nodes=0so nodes appear on demand. - TPU v7x binds its topology differently. Earlier generations pass
--tpu-topology; for Ironwood, Google's GKE page puts the topology into a workload policy (gcloud compute resource-policies create workload-policy --type=HIGH_THROUGHPUT --accelerator-topology=...) that the node pool references with--placement-policy. Follow Google's current GKE page for v7x. - Quota and capacity. On-demand and spot TPU node pools consume Compute Engine quota. The llm-d TPU guides describe a custom ComputeClass that prefers a reservation, then spot, then DWS flex-start, with node auto-provisioning creating the pool, and warn again that flex-start nodes last at most seven days.
Point kubectl at the cluster with the GKE guide's commands:
export PROJECT=<YOUR_PROJECT_ID>
export CLUSTER=<YOUR_CLUSTER_NAME>
export LOCATION=<YOUR_CLUSTER_ZONE_OR_REGION>
export NODEPOOL_NAME=<YOUR_4CHIP_NODEPOOL_NAME>
export DOCKER_IMAGE=us-docker.pkg.dev/ml-oss-artifacts-published/torch-tpu-public-release-container/torch-tpu:latest
gcloud auth login
gcloud auth application-default login
gcloud components install kubectl gke-gcloud-auth-plugin
gcloud container clusters get-credentials ${CLUSTER} --location=${LOCATION} --project=${PROJECT}
The public container image already contains TorchTPU and the example scripts under /workspace/examples/. The manifests live in the examples/ directory of the TorchTPU repository; run the commands below from the root of a checkout.
The first job: one device¶
examples/simple_pytorch/torchtpu_singledevice_slice_job.yaml runs simple_pytorch.py on one TensorCore of a four-chip v7x host. The parts that tie the pod to TPU hardware:
spec:
template:
metadata:
annotations:
cloud.google.com/gke-tpu-slice-topology: 2x2x1
spec:
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
nodeSelector:
cloud.google.com/gke-nodepool: <NODEPOOL_NAME>
cloud.google.com/gke-tpu-accelerator: tpu7x
cloud.google.com/gke-tpu-topology: 2x2x1
tolerations:
- key: "google.com/tpu"
operator: "Exists"
containers:
- name: tpu-container
image: <DOCKER_IMAGE>
securityContext:
privileged: true
env:
- name: TORCH_TPU_TOPOLOGY
value: "1,1,1,1"
resources:
limits:
google.com/tpu: 4
requests:
google.com/tpu: 4
Read it in three layers. The node selectors pick the node: the pool, the accelerator (tpu7x) and the topology (2x2x1, one host of four chips). The resource request counts physical chips, and a single pod takes all four chips of the node even though the job uses one TensorCore; GKE requires the request to equal the limit. The TORCH_TPU_TOPOLOGY tells TorchTPU what the job uses: 1,1,1,1 is one chip in each dimension and one TensorCore per chip. A v7x host therefore has 8 devices, of which this job uses 1 and leaves 7 idle. The llm-d TPU page adds the rule that catches most first deployments: accelerator, topology and chip count must all agree with the node's machine type, or the pod stays Pending without a clear error.
Patch, apply and read the logs:
sed -i "s|<DOCKER_IMAGE>|${DOCKER_IMAGE}|g" examples/simple_pytorch/torchtpu_singledevice_slice_job.yaml
sed -i "s|<NODEPOOL_NAME>|${NODEPOOL_NAME}|g" examples/simple_pytorch/torchtpu_singledevice_slice_job.yaml
kubectl apply -f examples/simple_pytorch/torchtpu_singledevice_slice_job.yaml
kubectl get job,pods -n default
kubectl logs -n default -l job-name=torchtpu-singledevice-1chip-job -f
The job runs to completion and prints the same four lines as on a VM, between the manifest's own === Starting Single-Device 1-Chip, 1-Device TPU v7x Workload === and === Single-Host single-device Workload Completed Successfully === banners.
One host, all eight devices¶
examples/tensor_parallel/torchtpu_singlehost_slice_job.yaml keeps the same node selectors and chip request and changes what TorchTPU uses: TORCH_TPU_TOPOLOGY becomes "2,2,1,2", all four chips and both TensorCores of each. The container runs launch_singlehost.sh, which detects the topology and starts one process per device:
eval "$(python3 -m torch.tpu.distributed)"
export TORCH_TPU_TOPOLOGY TORCH_TPU_SLICEBUILDER_ADDRESSES
python3 -m torch.distributed.run --nnodes=1 --node_rank=0 \
--master_addr=localhost --master_port=29500 \
--nproc_per_node=8 ./tp_worker.py
tp_worker.py runs a three-layer feed-forward model with manual tensor parallelism over the tpu_dist backend and checks it against an unsharded CPU run with torch.testing.assert_close, so a completed job is a correctness check as well as a launch check.
Sixteen hosts with a JobSet¶
Past one host, the TorchTPU guide switches from a Job to a JobSet, a Kubernetes SIG API for groups of jobs that must run together. examples/tensor_parallel/torchtpu_multihost_slice_jobset.yaml targets a 4x4x4 v7x slice: 64 chips on 16 hosts, 128 devices.
One pod per node, each claiming its node's four chips; only together do the 16 pods hold the whole 4x4x4 slice that ICI connects. Three of the sixteen pods and nodes are drawn.
The manifest's essentials:
apiVersion: jobset.x-k8s.io/v1alpha2
kind: JobSet
spec:
replicatedJobs:
- name: slice-job
replicas: 1
template:
spec:
parallelism: 16
completions: 16
backoffLimit: 0
template:
spec:
nodeSelector:
cloud.google.com/gke-nodepool: <NODEPOOL_NAME>
cloud.google.com/gke-tpu-accelerator: tpu7x
cloud.google.com/gke-tpu-topology: 4x4x4
containers:
- name: tpu-container
env:
- name: TORCH_TPU_TOPOLOGY
value: "4,4,4,2"
resources:
limits:
google.com/tpu: 4
requests:
google.com/tpu: 4
Each of the 16 pods runs launch_multihost.sh, which calls the same python3 -m torch.tpu.distributed to derive NNODES, NODE_RANK, MASTER_ADDR and MASTER_PORT for its host from the slice, then starts torchrun with --nproc_per_node=8. Apply it like the others:
sed -i "s|<DOCKER_IMAGE>|${DOCKER_IMAGE}|g" examples/tensor_parallel/torchtpu_multihost_slice_jobset.yaml
sed -i "s|<NODEPOOL_NAME>|${NODEPOOL_NAME}|g" examples/tensor_parallel/torchtpu_multihost_slice_jobset.yaml
kubectl apply -f examples/tensor_parallel/torchtpu_multihost_slice_jobset.yaml
kubectl get jobset,pods -n default
The cluster needs the JobSet controller installed. Install a current release from the JobSet project (its release manifests are applied with kubectl apply --server-side); the vLLM-TorchTPU deployment guide documents JobSet 0.12. The vLLM-TorchTPU deployment guide also recommends completionMode: Indexed and enableDNSHostnames: true for multi-host slices, which give pods stable indices and DNS names; TorchTPU's reference manifest does not set them; its launcher derives each host's rank from its position in the slice, and set_tpu_launch_env() falls back to JOB_COMPLETION_INDEX only when it cannot.
| Workload | Manifest | gke-tpu-topology |
TORCH_TPU_TOPOLOGY |
Processes |
|---|---|---|---|---|
| Single device | examples/simple_pytorch/torchtpu_singledevice_slice_job.yaml |
2x2x1 |
"1,1,1,1" |
1 |
| Single host, all devices | examples/tensor_parallel/torchtpu_singlehost_slice_job.yaml |
2x2x1 |
"2,2,1,2" |
8, via torchrun |
| Multi-host | examples/tensor_parallel/torchtpu_multihost_slice_jobset.yaml |
4x4x4 |
"4,4,4,2" |
16 pods x 8 |
To target another topology, change all three of cloud.google.com/gke-tpu-slice-topology, cloud.google.com/gke-tpu-topology and TORCH_TPU_TOPOLOGY together.
Other controllers. For multi-host serving, the llm-d TPU guides deploy with LeaderWorkerSet, so that all hosts of a replica are created, scheduled and restarted together (chapter 20). Ray on TPU, including KubeRay, is the subject of chapter 15. For training jobs like the ones above, Job and JobSet are what TorchTPU documents.
An upstream example with no code changes¶
Because TorchTPU is a native backend, torch.accelerator.current_accelerator() returns the tpu device when torch_tpu is installed. The upstream pytorch/examples MNIST script picks its device that way, so it runs on GKE unchanged, with one adjustment: keep the DataLoader's num_workers at 0, because a forked worker process would try to reacquire the libtpu device lockfile (the one-process-per-device rule from chapter 1). The GKE guide replaces the single-device manifest's command block with:
command:
- /bin/bash
- -c
- |
set -ex
export PYTHONUNBUFFERED=1
apt-get update && apt-get install -y git
git clone --depth 1 https://github.com/pytorch/examples.git /tmp/pytorch_examples
cd /tmp/pytorch_examples/mnist
sed -i "/'num_workers': 1,/d; /'persistent_workers': True,/d" main.py
python3 main.py --epochs=1 --dry-run
Kubernetes Job specs are immutable once created, so delete the previous run before applying again:
kubectl delete -f examples/simple_pytorch/torchtpu_singledevice_slice_job.yaml --ignore-not-found
kubectl apply -f examples/simple_pytorch/torchtpu_singledevice_slice_job.yaml
kubectl logs -n default -l job-name=torchtpu-singledevice-1chip-job -f
The guide's rule of thumb for other upstream code: non-distributed examples that use torch.accelerator or torch.device need no changes, and distributed examples tuned for GPUs (NCCL-specific backends, flags or sharding assumptions) may need small ones. Chapter 9 takes that further.
Troubleshooting¶
| Symptom | Cause | Fix |
|---|---|---|
Request stuck in WAITING_FOR_RESOURCES or PROVISIONING, or STOCKOUT / RESOURCE_POOL_EXHAUSTED |
GPUS_ALL_REGIONS is 0 on a new project or billing account |
Link paid billing, verify the billing account, request GPUS_ALL_REGIONS of 8 or 16, delete the stuck request and resubmit |
Error: code 10, Failed to perform tenant project creation |
Reused legacy project (for example from TPU Research Credits) | Create a new project |
| VM terminated after exactly 24 hours | Flex-start default run duration | Pass --max-run-duration (up to 168h) with --instance-termination-action=DELETE |
| Cannot stop or pause the VM | Flex-start and Compute Engine TPU VMs do not support stop and restart | Delete it; keep data on a persistent disk and rebuild with a startup script |
| Disk full | Default boot disk is 10 GB for instances create |
--boot-disk-size=100GB, Cloud Storage, or a Hyperdisk ML volume |
| v5e request fails with "Code 13: Internal Error" | A backend quota issue in the v5e alpha API | Email program support to have the project allowlisted |
| Quota increase rejected at once | Brand-new billing account | Wait 48 hours and retry |
| Stockouts in a zone | Limited capacity (v5p zones are marked limited) | Another listed zone, spot, or a queued request that can wait |
pip downloads a large CUDA torch |
Installed without the CPU index | Reinstall with --extra-index-url https://download.pytorch.org/whl/cpu |
No tpu device after install |
Wrong Python, wheel missing, or TORCH_DEVICE_BACKEND_AUTOLOAD=0 |
Activate the venv; unset the variable |
torch.tpu.device_count() raises an error |
On PyTorch 2.11 and later, torch.tpu device APIs that have a torch.accelerator equivalent are internal |
Use torch.accelerator.device_count(); TORCH_TPU_ALLOW_LEGACY_DEVICE_APIS is a temporary escape hatch |
| Fewer devices than chips times devices per chip | Devices restricted or held elsewhere | Check TPU_VISIBLE_DEVICES; make sure no other process is using the devices |
Warning starting //TorchTpu/Performance/TcMalloc// |
glibc allocator in use; eager mode contends on it | Preload tcmalloc with LD_PRELOAD (the Docker image already does) |
| A command or check worked on one worker only | tpu-vm ssh defaults to --worker=0 |
Use --worker=all with --command; aggregate the per-worker logs |
ValueError from set_tpu_launch_env() about TPU_WORKER_HOSTNAMES |
Multi-host launch without the worker list | Run inside the slice's environment, or set the variables yourself |
| A retargeted job still uses the old topology | set_tpu_launch_env() never overwrites a set variable, and the manifest sets TORCH_TPU_TOPOLOGY |
Change TORCH_TPU_TOPOLOGY together with both topology labels |
| DataLoader workers fail to open the TPU | Forked workers try to reacquire the libtpu lockfile |
num_workers=0 |
Pod stays Pending with no clear error |
Accelerator, topology and chip count disagree with the node's machine type | Make all three match the node pool |
| Re-applying a Job does nothing new | Job specs are immutable | kubectl delete -f ... --ignore-not-found, then apply |
When you need help from the TPU Builders program, its guide asks for your project ID and, ideally, the diagnostic report, sent to tpu-builders-support@google.com.
Verifying the result¶
The install is trustworthy when every host passes the same checks with the same versions and the expected device count, and a TorchTPU program runs to completion on the TPU. Run these in order and compare with the expected output.
# On your workstation, no TPU needed: see what each check catches.
python code/ch08_install/preflight.py --cpu-smoke # ends: "cpu-smoke: OK, every fixture parsed ..."
pytest tests/ch08 -q
- The request reached a usable state.
gcloud compute instances describeshows the instance running, orqueued-resources describeshowsACTIVE. Anything else is not yet a VM you can use. - One host: devices, backend, compute.
ls /dev/vfio/is not empty.simple_pytorch.pyprints exactly the four lines from its README, withcpufor the CPU tensor andtpu:0for the others.preflight.py --chips Nends withstatus=PASSanddevices=equal to chips times devices per chip (4 onct6e-standard-4t, 8 ontpu7x-standard-4t). Acpu_buildwarning means reinstalling with the CPU index before going further. - All hosts agree.
preflight.py --aggregate preflight-logs --expect-hosts Nprintsverdict: PASS. It fails on any worker that did not run the check, failed it, or has a different version or device count. - The launcher can see the slice.
preflight.py --chips N --launch-envpasses:WORLD_SIZEequals the number of slice builder addresses, and on multi-hostNNODESis the number of hosts andNODE_RANKis in range. - On GKE, the reference jobs complete. The single-device job's log shows the four
simple_pytorch.pylines between the start and "Completed Successfully" banners. The single-host tensor-parallel job finishes, which means its eight ranks matched the CPU reference withinassert_close's tolerance. - Numbers come next. Run chapter 3's
check_env.py, which compares a matmul on the TPU against a CPU reference at the expected bf16 precision. Do not judge speed from the first steps of a fresh VM: they compile.
The --cpu-smoke fixtures are written in the formats the documented commands print; they show what each check catches, not real TPU measurements. Keep the JSON report (--json) from your first passing run as the record for your TorchTPU version and machine type.
Worked problems¶
Problem 1. You need four v6e chips for a fine-tuning run of about three days. The run checkpoints every two hours to Cloud Storage, and you will create the VM more than once while you debug. Write the gcloud command, and say what you do about data and setup.
Answer
A single host fits (four chips, ct6e-standard-4t), and three days of uninterrupted running fits flex-start's seven-day guarantee:
gcloud compute instances create ft-v6e \
--zone=us-east5-a \
--machine-type=ct6e-standard-4t \
--provisioning-model=FLEX_START \
--request-valid-for-duration=2h \
--max-run-duration=72h \
--instance-termination-action=DELETE \
--image-project=ubuntu-os-accelerator-images \
--image-family=ubuntu-accel-2204-amd64-tpu-v5e-v5p-v6e \
--maintenance-policy=TERMINATE \
--boot-disk-size=100GB \
--disk=name=my-data-disk,device-name=data-disk,mode=rw,boot=no \
--metadata-from-file=startup-script=startup.sh
Without --max-run-duration the VM would be deleted after 24 hours. Because the VM cannot be stopped, create the hyperdisk-balanced data disk once and let startup.sh mount it and run the TorchTPU install, so each new VM is ready without manual steps. Since the run checkpoints every two hours, SPOT is a reasonable cheaper alternative: a preemption costs at most two hours of work plus the time to get capacity back.
Problem 2. A teammate's request for a v6e VM has been in PROVISIONING for a day in a new project. The regional PREEMPTIBLE_TPU_V6E quota shows 16 chips. What do you check first, and what are the steps to fix it?
Answer
GPUS_ALL_REGIONS, the global accelerator quota. On a new project or billing account it is 0, which blocks every GPU and TPU request regardless of regional TPU quota. Check it in the Cloud Console quotas page (or in the diagnostic script's tpu_diagnostic_report.txt). To fix it: make sure the project is linked to an active paid billing account, verify the billing account with a card or bank account (or, for an institutional invoice account, send the billing account ID to support), request GPUS_ALL_REGIONS of 8 or 16, and once approved delete the stuck VM (gcloud compute instances delete VM_NAME --zone=ZONE --quiet) and submit the request again.
Problem 3. You ran the install on a four-worker v6e slice and then preflight.py on all workers. --aggregate reports the output shown in the section "Verifying every host of a slice". Explain each line and fix the slice.
Answer
Worker 2 failed: its summary shows accelerator=None and devices=0, so import torch there did not load TorchTPU. Worker 3 passed but has torch_tpu 0.2.1 while the others have 0.2.0. The device-count and name lines are the same fault seen from the slice level. Both are symptoms of an install that was not run identically on every worker: a step that ran on worker 0 only, or an unpinned pip install that resolved to a different version at a different time. Rerun the install with --worker=all and a pinned version (torch_tpu==0.2.0 with the CPU index), check that worker 2's /dev/vfio is not empty, and rerun the preflight and the aggregate until it prints verdict: PASS. Never launch a multi-host job on a slice whose workers run different TorchTPU versions.
Problem 4. You want to run the single-host tensor-parallel example on a GKE node pool of ct6e-standard-8t v6e nodes (one host, topology 2x4) instead of v7x. List every field in torchtpu_singlehost_slice_job.yaml you must change, and the process count.
Answer
The node selector cloud.google.com/gke-tpu-accelerator becomes tpu-v6e-slice, and cloud.google.com/gke-tpu-topology and the cloud.google.com/gke-tpu-slice-topology annotation become 2x4. The chip request and limit become google.com/tpu: 8, all eight chips of the node, so that accelerator, topology and chip count agree with the machine type (otherwise the pod stays Pending). A v6e chip is one device, so there are 8 devices and the job still runs 8 processes, but TORCH_TPU_TOPOLOGY must change too: the manifest's "2,2,1,2" describes four v7x chips with two TensorCores each. Because set_tpu_launch_env() never overwrites a variable that is already set, the cleanest fix is to delete that env entry and let eval "$(python3 -m torch.tpu.distributed)" in launch_singlehost.sh detect the topology; then confirm what it chose in the job's log. --nproc_per_node=8 in the launch script stays correct.
Problem 5. Your team runs a nightly evaluation that needs a 64-chip v7x slice for about two hours, and a long-running inference service on v7x. Choose a capacity path for each and justify it from the chapter.
Answer
Both go on GKE, because TorchTPU's documentation says GKE is necessary for recent TPU hardware and the Cloud TPU API does not support v7x. The nightly evaluation is a batch job of 16 hosts (64 chips, four per host): a multi-host tpu7x node pool with autoscaling from zero, so the slice exists only while the job runs, fed by flex-start or spot capacity, and a JobSet like TorchTPU's 4x4x4 example. Multi-host pools scale atomically, so the job gets the whole slice or nothing. The service should not depend on flex-start alone, because flex-start nodes are preempted after at most seven days; use a reservation first, with spot and flex-start as fallbacks in a custom ComputeClass, as the llm-d TPU guides do, and deploy multi-host replicas with LeaderWorkerSet so all hosts of a replica restart together.
Problem 6. Write the command sequence that takes a newly ACTIVE four-worker queued-resource slice to a verified install, using only commands from this chapter.
Answer
ssh-add ~/.ssh/google_compute_engine
gcloud compute tpus tpu-vm ssh "${TPU_NAME}" --zone="${ZONE}" --worker=all --command="
sudo apt update && sudo apt install -y python3.12 python3.12-venv
python3.12 -m venv ~/env && source ~/env/bin/activate
pip install torch_tpu==0.2.0 --extra-index-url https://download.pytorch.org/whl/cpu
"
for w in 0 1 2 3; do
gcloud compute tpus tpu-vm scp code/ch08_install/preflight.py "${TPU_NAME}":~ --zone="${ZONE}" --worker=$w
done
mkdir -p preflight-logs
gcloud compute tpus tpu-vm ssh "${TPU_NAME}" --zone="${ZONE}" --worker=all \
--command="source ~/env/bin/activate && python3 preflight.py --chips 4 --launch-env" \
--output-directory=preflight-logs
python code/ch08_install/preflight.py --aggregate preflight-logs --expect-hosts 4
The install and the check both use --worker=all; the copy uses one worker at a time; the aggregate compares all four logs. Only when it prints verdict: PASS do you launch the real job.
Quick questions¶
- Which API and command create a v6e VM, a v5e TPU, and v7x capacity, and why is v7x different?
- What does
GPUS_ALL_REGIONScontrol, what is its value on a new project, and what does a request look like while it is 0? - What do
--request-valid-for-duration,--max-run-durationand--instance-termination-action=DELETEeach control on a flex-start VM, and what happens without--max-run-duration? - Why does the chapter's install command add
--extra-index-url https://download.pytorch.org/whl/cpu, and what goes wrong without it? - How many devices should
torch.accelerator.device_count()report onct6e-standard-4t, and ontpu7x-standard-4t? - What does
gcloud compute tpus tpu-vm sshdo without--worker, and what does--output-directoryadd? - In the single-device GKE manifest, what do
google.com/tpu: 4,gke-tpu-topology: 2x2x1andTORCH_TPU_TOPOLOGY "1,1,1,1"each describe? - Why must
TORCH_TPU_TOPOLOGYbe changed when you retarget a manifest, even though the launcher detects the topology?
Key takeaways¶
- Choose capacity from three facts: the TPU generation (v6e and v5p as Compute Engine VMs, v5e through legacy queued resources, v7x through GKE), whether the chips fit on one host, and how long the job runs and how well it tolerates interruption (flex-start up to seven days, spot for frequent checkpointers, on-demand or reservations for services).
- Check
GPUS_ALL_REGIONSand the generation's regional quota before the first request, and use a new project. A request that waits forever on a new project is usually a quota of 0, not a capacity shortage. - Flex-start VMs cannot be stopped and default to 24 hours; set
--max-run-duration, keep data on a Hyperdisk and rebuild the environment from a startup script. - Install in the documented order, Python 3.12 venv then TorchTPU, with a pinned version and the PyTorch CPU index;
import torchloads TorchTPU by itself. - Verify bottom-up on each host:
/dev/vfio,torch.acceleratorand the device count, thesimple_pytorch.pyoutput, thenpreflight.py. On a multi-host slice, run everything with--worker=alland compare the workers' logs; one disagreeing worker is enough to break a job. - On GKE, the node selectors, the chip request and
TORCH_TPU_TOPOLOGYmust describe the same hardware. AJobcovers one host, aJobSeta multi-host slice, and the launcher derives ranks withpython3 -m torch.tpu.distributedbut never overwrites what you set. - Chapter 9 starts from a host that passes these checks and ports a real model to it.
References¶
- Get started with TorchTPU on a TPU VM: install order, Python 3.12 venv, first tensors on the TPU
- Get started with TorchTPU on GKE: reference
JobandJobSetmanifests, MNIST without code changes - TorchTPU API Reference: device queries,
set_tpu_launch_env, environment variables - TorchTPU repository: README (pinned install with the CPU index),
pyproject.toml,simple_pytorchexample, tensor-parallel launchers,distributed.pyand_tcmalloc_check.py - TPU Builders Program Getting Started Guide: quotas, flex-start and spot commands, zones, troubleshooting FAQ; its visual walkthrough shows the Console flow
- vLLM-TorchTPU: Cloud TPU Setup: provisioning APIs, generated commands, accelerator-type naming
- vLLM-TorchTPU: Kubernetes & GKE Deployment: JobSet,
completionMode: Indexed,enableDNSHostnames - vLLM-TorchTPU: Multi-Host Serving
- llm-d: Google Cloud TPU: GKE TPU machine types, node selectors, ComputeClass capacity order, LeaderWorkerSet
- Hugging Face and TorchTPU: TPUs, Natively: one-command install with the CPU index
- Request TPUs using Flex-start
- About Flex-start VMs
- Manage queued resources: queued resource states; Cloud TPU API not supported on TPU7x
- Deploy TPU workloads in GKE Standard: TPU node pools, v7x workload policies
- gcloud compute tpus tpu-vm ssh:
--workerand--output-directory - JobSet
- Companion code for this chapter




