AI-Hypercomputer / AI-Hypercomputer/ray-tpu

Race condition in acquiring TPU heads?

未关闭
#17 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
15
派生
8
PR 合并指标
30 天内没有已合并 PR

描述

I'm pretty sure that the two-step logic to acquire TPU slices has a race condition. It may be too low probability to care about, but I think it's there.

The [reserve call](https://github.com/AI-Hypercomputer/ray-tpu/blob/main/src/ray_tpu.py#L265) gets and then releases a tpu head to get its name, then it sleeps, then it allocates using that TPU head resource. If, during that sleep, another driver process manages to request a TPU, it can wind up with the same TPU head, in which case one of the two driver processes will block on the other.

I think this can be solved by creating the second pg (the one with tpu.name) inside of reserve and not releasing the outer pg until the inner one is ready... Alternatively, in the Levanter version of this logic, we don't release the TPU-head resource which also solves this.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。