SubslicePlacementGroup#

class ray.util.tpu.SubslicePlacementGroup(placement_group: PlacementGroup, parent_topology: str, subslice_topology: str, subslice_index: int, slice_name: str, num_hosts: int, chips_per_host: int, bundle_resources: Dict[str, float], head_placement_groups: List[PlacementGroup] | None = None, bundle_label_selectors: List[Dict[str, str]] | None = None)[source]#

Bases: object

A handle to a placement group reservation for a TPU subslice.

Reserves a contiguous subset of workers within a larger TPU slice. The selected subset is guaranteed to be a valid slice and TPU topology; i.e. the workers are fully connected with ICI.

Example for a 4x4 v6e slice (4 workers, 4 TPU chips each):

Worker grid:    (0,0) --- (1,0)
                  |         |
                (0,1) --- (1,1)

Valid 2x4 subslices:
  Subslice 0: workers (0,0) and (0,1)  (left column)
  Subslice 1: workers (1,0) and (1,1)  (right column)
Parameters:
  • placement_group – The underlying Ray PlacementGroup.

  • parent_topology – Full parent TPU topology (e.g. “4x4”).

  • subslice_topology – Subslice TPU topology (e.g. “2x4”).

  • subslice_index – Index of this subslice within the parent.

  • slice_name – Name of the physical TPU slice.

  • num_hosts – Number of hosts (VM workers) in this subslice.

  • chips_per_host – TPU chips available per host.

  • bundle_resources – Resources per PG bundle.

  • head_placement_groups – Internal head PGs for cleanup.

  • bundle_label_selectors – Label selectors used per bundle when creating the PG.

PublicAPI (alpha): This API is in alpha and may change before becoming stable.

Methods

release_head_pgs

Remove all internal head placement groups.

shutdown

Remove the worker placement group and all head PGs.

Attributes

bundle_label_selector

Label selectors used for each bundle when creating the PG.

bundle_resources

Resources assigned to each bundle.

chips_per_host

TPU chips available per host.

head_placement_groups

Internal head PGs used for slice reservation.

num_hosts

Number of hosts (VM workers) in this subslice.

parent_topology

The full parent TPU topology.

placement_group

The underlying PlacementGroup object.

slice_name

The name of the physical TPU slice.

subslice_index

The subslice index within the parent.

subslice_topology

The requested subslice TPU topology.