ray
ray copied to clipboard
CPU device within AcceleratorContext independently of torch.
Why are these changes needed?
In cases where the actor involved in the Compiled Graph exclusively uses the CPU, AcceleratorContext unnecessarily loads torch’s CPU module, resulting in an avoidable dependency. This PR eliminates that dependency by avoiding the torch module loading for CPU-only actors.
Related issue number
Closes #53716
Checks
- [x] I've signed off every commit(by using the -s flag, i.e.,
git commit -s) in this PR. - [x] I've run
scripts/format.shto lint the changes in this PR. - [ ] I've included any doc changes needed for https://docs.ray.io/en/master/.
- [ ] I've added any new APIs to the API Reference. For example, if I added a
method in Tune, I've added it in
doc/source/tune/api/under the corresponding.rstfile.
- [ ] I've added any new APIs to the API Reference. For example, if I added a
method in Tune, I've added it in
- [x] I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
- Testing Strategy
- [x] Unit tests
- [ ] Release tests
- [ ] This PR is not tested :(
@ruisearch42 @kevin85421 Could you please review this bug fix? Thanks.
https://buildkite.com/ray-project/release/builds/45740#
Release test passed: https://buildkite.com/ray-project/release/builds/46021#019784e0-6688-4732-b8dc-2d2f81f2b1c6