Repository navigation
[Train][TPU] Sort TPU workers within each slice by host worker ID and device ID - #67575
Conversation
…signed TPU ID Signed-off-by: Ryan O'Leary <[email protected]>
Signed-off-by: Ryan O'Leary <[email protected]>
Manual Testing StepsStep 1: Deploy a TPU v7x
|
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Signed-off-by: Ryan O'Leary <[email protected]>
TPU v7x Performance ImpactBenchmarks on GKE TPU v7x ( 1. Per-Host Rank Contiguity (2 Hosts, 16 Workers)TorchRec's intra-node process groups group consecutive blocks of 8 global ranks. Grouping each host's workers into contiguous ranks (
2. Intra-Host Device Ordering (1 Host, 8 Workers)When
|
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Signed-off-by: Ryan O'Leary <[email protected]>
Why are these changes needed?
When
use_tpu=True, Ray Train previously sorted workers only by TPU slice name viaTPU_NAME. Because placement group bundles are not ordered by host worker ID or device ID, workers within a slice received ranks in arbitrary scheduling order:This PR updates
WorkerGroup._sort_workers_by_tpu_pod_nameto fetch each worker's slice name and integerTPU_WORKER_IDin a single parallel call and sort TPU workers by(pod_name, tpu_worker_id, node_id, min_tpu_id):world_rankblock keeps intra-node process groups on one TPU host and prevents TorchTPU slice-builder port collisions.TPU_WORKER_ID, withnode_idas a tie-breaker whenTPU_WORKER_IDis unset, pinsworld_rank 0to host 0 of slice 0 and aligns host rank blocks with KubeRay'sTPU_WORKER_HOSTNAMESandTORCH_TPU_SLICEBUILDER_ADDRESSES.local_rank 0..N-1to ascending TPU devices, matchingTPU_VISIBLE_CHIPSand SetTPU_VISIBLE_DEVICESalongsideTPU_VISIBLE_CHIPSfor per-device MPMD (ray#67029).Related issue number
Contributes to [Core][Train] Support Torch runtime with TPUs (ray#64055).
Related to Set
TPU_VISIBLE_DEVICESalongsideTPU_VISIBLE_CHIPSfor per-device MPMD (ray#67029), Order subslice hosts by physical topology and pin slice bundles to worker IDs (ray#66029), and Wait for worker TPU VFIO devices before distributed init (ray#67756).Checks
git commit -s) in this PR.scripts/format.shto lint the changes in this PR.doc/source/tune/api/under the corresponding.rstfile.test_worker_group.py,test_jax_trainer.py) and manual verification on GKE TPU v7x (see comment below)