ray icon indicating copy to clipboard operation
ray copied to clipboard

CPU device within AcceleratorContext independently of torch.

Open hipudding opened this issue 6 months ago • 1 comments

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.sh to 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 .rst file.
  • [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 :(

hipudding avatar Jun 16 '25 10:06 hipudding

@ruisearch42 @kevin85421 Could you please review this bug fix? Thanks.

hipudding avatar Jun 17 '25 00:06 hipudding

https://buildkite.com/ray-project/release/builds/45740#

ruisearch42 avatar Jun 17 '25 15:06 ruisearch42

Release test passed: https://buildkite.com/ray-project/release/builds/46021#019784e0-6688-4732-b8dc-2d2f81f2b1c6

jjyao avatar Jun 18 '25 22:06 jjyao