To get free TPU access for 30 days from google for your machine/deep learning projects. Please read the terms and conditions.
- Apply to TPU Research Cloud
- Instantly receieve an email form with subject
[TRC] Welcome to the TPU Research Cloud!
- Follow the steps in the received email, create your project, and send the form
- Receive an email with subject
[TRC] You have access to free Cloud TPUs
within 3-4 days
Because I encountered ERROR: (gcloud.compute.tpus.tpu-vm.create) INVALID_ARGUMENT: Cloud TPU received a bad request. The value "default" provided for field "Subnetwork" does not exist. See "https://cloud.google.com/vpc/docs/create-modify-vpc-networks" for more information: invalid argument
in running gcloud compute tpus tpu-vm create node-02 --zone=us-central2-b --accelerator-type=v4-8 --version=tpu-ubuntu2204-base --preemptible
while following this tutorial on GitHub
All steps here will be done through the google cloud browser terminal unless stated (Local Machine) although they can also be done by installing the goodle cloud CLI (see step 6) first. Keep in mind in what regions your quota from the email is located and modify accordingly. Replace the variables like $EXAMPLE
- Switch project
gcloud projects list
gcloud config set project $GCP_PROJECT_ID
- Create network
gcloud compute networks create my-network --subnet-mode=auto
- Create subnet
gcloud compute networks subnets create my-subnet \
--network=my-network \
--region=us-central2 \
--range=172.16.1.0/24
- Enable SSH
gcloud compute firewall-rules create allow-ssh \
--network=my-network \
--allow=tcp:22
- Create TPU
gcloud compute tpus tpu-vm create $CLOUD_TPU_PROJECT_NAME \
--zone=us-central2-b \
--accelerator-type=v4-8 \
--version=tpu-ubuntu2204-base \
--network my-network \
--subnetwork my-subnet
- Install Google Cloud CLI (Local Machine)
mkdir google_cloud
cd google_cloud
curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-linux-x86_64.tar.gz
tar -xf google-cloud-cli-linux-x86_64.tar.gz
./google-cloud-sdk/install.sh
./google-cloud-sdk/bin/gcloud init
- SSH into TPU instance (Local Machine)
./google-cloud-sdk/bin/gcloud compute tpus tpu-vm ssh \
--zone "us-central2-b" \
"$CLOUD_TPU_PROJECT_NAME" \
--project "$GCP_PROJECT_ID"