File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -501,6 +501,13 @@ def _build_container(self) -> Nested[Any]:
501501 topology = cfg .accelerator .topology or system .topology
502502 env_vars ["TPU_TOPOLOGY" ] = topology
503503
504+ # From 7x user guide, this value needs to be the tpu type
505+ # prefixed by tpu, where our tpu type will have the tpu prefix stripped:
506+ # For some examples:
507+ # - tpu7x-128
508+ # - tpu7x-1024
509+ env_vars ["TPU_ACCELERATOR_TYPE" ] = f"tpu{ self ._tpu_type } "
510+
504511 tpu_version = infer_tpu_version (self ._tpu_type )
505512 bounds = get_host_bounds (topology , tpu_version )
506513 if bounds :
@@ -802,8 +809,14 @@ def _build_pod(self) -> Nested[Any]:
802809 if cfg .enable_tpu_slice_auto_provisioning :
803810 annotations .update (
804811 {
812+ # This is used by the TPU provisioner to determine the slice size
813+ # of a particular pod
805814 "cloud.google.com/gke-tpu-topology" : cfg .accelerator .topology
806815 or system .topology ,
816+ # This annotation is required for GKE to populate the `TPU_TOPOLOGY_WRAP` envvar
817+ # and other system properties
818+ "cloud.google.com/gke-tpu-slice-topology" : cfg .accelerator .topology
819+ or system .topology ,
807820 }
808821 )
809822 tolerations .append (
You can’t perform that action at this time.
0 commit comments