-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[Device] Replace hardcoded devices with 'torch._C._get_accelerator()' #139032
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
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/139032
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 20e708d with merge base 07b0d63 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
@pytorchbot rebase -b main |
@pytorchbot started a rebase job onto refs/remotes/origin/main. Check the current status here |
Successfully rebased |
38ed115
to
562e2c0
Compare
device = torch._C._get_accelerator() | ||
mesh = init_device_mesh(device.type, mesh_shape=(default_pg.size(),)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
device = torch._C._get_accelerator() | |
mesh = init_device_mesh(device.type, mesh_shape=(default_pg.size(),)) | |
device = torch.accelerator.current_accelerator() if torch.accelerator.is_available() else torch.device("cpu") | |
mesh = init_device_mesh(device.type, mesh_shape=(default_pg.size(),)) |
I think torch._C._get_accelerator
will be removed in future, refer to #137493.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I see, will make change after your PR merged
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Merge failedReason: 1 mandatory check(s) failed. The first few are: Dig deeper by viewing the failures on hud |
@pytorchbot rebase -b main |
@pytorchbot started a rebase job onto refs/remotes/origin/main. Check the current status here |
Successfully rebased |
562e2c0
to
20e708d
Compare
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
…pytorch#139032) I noticed that some hard-code like `"cuda" if torch.cuda.is_available() else "cpu"` which can be replaced with `torch._C._get_accelerator()` Pull Request resolved: pytorch#139032 Approved by: https://github.com/ezyang
…pytorch#139032) I noticed that some hard-code like `"cuda" if torch.cuda.is_available() else "cpu"` which can be replaced with `torch._C._get_accelerator()` Pull Request resolved: pytorch#139032 Approved by: https://github.com/ezyang
I noticed that some hard-code like
"cuda" if torch.cuda.is_available() else "cpu"
which can be replaced withtorch._C._get_accelerator()
cc: @albanD @guangyey @FFFrog @zeshengzong @noemotiovon
cc @H-Huang @awgu @kwen2501 @wanchaol @fegin @fduwjj @wz337 @wconstab @d4l3k @c-p-i-o