get_jax_env_vars#

SlicePlacementGroup.get_jax_env_vars(worker_id: int | None = None, slice_index: int = 0, worker_hostnames: str | List[str] | None = None) → Dict[str, str][source]#

Returns the JAX TPU environment variables for this slice.

Parameters:
  • worker_id (int | None) – Optional integer ID of the worker within the slice (0-indexed), between 0 and hosts_per_slice - 1. Defaults to 0 on a single-host slice; when omitted on a multi-host slice, TPU_WORKER_ID is not set.

  • slice_index (int) – The 0-based index of the TPU slice.

  • worker_hostnames (str | List[str] | None) – If omitted, resolved from the placement group bundles in this slice.

Returns:

A dictionary mapping JAX TPU environment variables to their values.

Raises:
  • ValueError – If slice_index is out of range or if worker_id is out of bounds.

  • RuntimeError – If worker hostnames cannot be resolved.

Return type:

Dict[str, str]