Skip to content

Commit

Permalink
Default chipsPerHost to 4
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanaoleary committed Mar 12, 2024
1 parent ea0910a commit 3349df2
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions applications/ray/kuberay-tpu-webhook/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,22 +93,16 @@ func getNumTPUHostsFromTopology(topology string, acceleratorType string) (int32,
}
// calculate the # of VMs using # of chips per host
acceleratorTypeValues := strings.Split(acceleratorType, "-")
var vms int32
chipsPerHost := 4 // default to 4 chips per VM
if acceleratorTypeValues[0] == "v5litepod" {
// v5e TPU VMs can have 1, 4 or 8 chips
chipsPerHost, err := strconv.Atoi(acceleratorTypeValues[1])
if err != nil {
klog.Errorf("Unexpected acceleratorType: %s", acceleratorType)
}
if chipsPerHost > 8 {
chipsPerHost = 4
}
vms = int32(max(chips/chipsPerHost, 1))
} else {
// otherwise default to 4 chips per VM
vms = int32(max(chips/4, 1))
chipsPerHost = min(chipsPerHost, 8) // max of 8 chips per host
}
return vms, nil
return int32(max(chips/chipsPerHost, 1)), nil
}

// check if request is for TPU multi-host
Expand Down

0 comments on commit 3349df2

Please sign in to comment.