Skip to content
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

[Core] Update Ascend NPU environment variable and test cases #42030

Merged
merged 3 commits into from
Dec 24, 2023

Conversation

liuxsh9
Copy link
Contributor

@liuxsh9 liuxsh9 commented Dec 20, 2023

Why are these changes needed?

With the updates to the NPU foundational software CANN, frameworks like PyTorch(NPU) and MindSpore can now detect the ASCEND_RT_VISIBLE_DEVICES environment variable and intelligently configure devices. This is the recommended usage by the official documentation.

Before:

@ray.remote(resources={"NPU":1})
def Func():
    npu_ids = ray.get_runtime_context().get_accelerator_ids()["NPU"]
    torch_npu.npu.set_device(int(npu_ids[0]))
    model.to("npu")

After:

@ray.remote(resources={"NPU":1})
def Func():
    model.to("npu")

Therefore, we update the environment variable and modify the test cases accordingly.

Related issue number

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • 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.
  • 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
    • Unit tests
    • Release tests
    • This PR is not tested :(

@liuxsh9 liuxsh9 requested a review from a team as a code owner December 20, 2023 07:32
@jjyao jjyao self-assigned this Dec 22, 2023
@jjyao jjyao merged commit 3d32f98 into ray-project:master Dec 24, 2023
9 checks passed
vickytsang pushed a commit to ROCm/ray that referenced this pull request Jan 12, 2024
…ject#42030)

With the updates to the NPU foundational software CANN, frameworks like PyTorch(NPU) and MindSpore can now detect the ASCEND_RT_VISIBLE_DEVICES environment variable and intelligently configure devices. This is the recommended usage by the official documentation.

Signed-off-by: Xiaoshuang Liu <[email protected]>
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