Skip to content

Commit b17d1af

Browse files
Alexandre Jameschanglan
authored andcommitted
Add Slice Topology Annotation and Accelerator Type
GitOrigin-RevId: 2a0ecbb
1 parent 41d4839 commit b17d1af

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

axlearn/cloud/gcp/jobset_utils.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff 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(

0 commit comments

Comments
 (0)