Skip to content

Set JAX_PLATFORMS to "tpu, cpu" for ray worker #145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 9, 2024
Merged

Set JAX_PLATFORMS to "tpu, cpu" for ray worker #145

merged 1 commit into from
Jul 9, 2024

Conversation

richardsliu
Copy link
Collaborator

Issue: The Ray worker could fail to actuall acquire the TPU devices if another process is already using the TPU. This would cause Jax to fall back to CPUs in the Ray worker process.

Fix: If running with Ray, all processes by default should have JAX_PLATFORMS set to cpu (this can be set from the yaml configuration, which is not included in this PR). When a Ray worker is created, override the runtime environment to tpu,cpu. This ensures that the Ray worker can acquire access to the TPU device.

@qihqi qihqi requested a review from FanhaiLu1 July 9, 2024 18:02
@richardsliu richardsliu merged commit 508d71c into AI-Hypercomputer:main Jul 9, 2024
4 checks passed
Copy link
Collaborator

@FanhaiLu1 FanhaiLu1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes!

wang2yn84 pushed a commit that referenced this pull request Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants