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] Speed up single_client_tasks_sync #41743

Merged
merged 2 commits into from
Dec 9, 2023
Merged

Conversation

jjyao
Copy link
Collaborator

@jjyao jjyao commented Dec 8, 2023

Why are these changes needed?

Currently IntelGPUAcceleratorManager.get_current_node_num_accelerators() will be called everytime we try to get accelerator manager for GPU resource. This is expensive and makes single_client_tasks_sync slower. This PR changes to only call it once.

Related issue number

#41695

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 :(

Signed-off-by: Jiajun Yao <jeromeyjj@gmail.com>
@jjyao
Copy link
Collaborator Author

jjyao commented Dec 8, 2023

Microbenchmark: https://buildkite.com/ray-project/release/builds/3607#018c4af2-38cb-468f-9403-f6bc9cccd1db

single_client_tasks_sync = [1028.731851730263, 6.294947883118997]
multi_client_tasks_async = [25705.306014103495, 2792.8083138099164]

Signed-off-by: Jiajun Yao <jeromeyjj@gmail.com>
@jjyao jjyao requested a review from rickyyx December 8, 2023 22:11
)
except AttributeError:
# Lazy initialization.
resource_name_to_accelerator_manager = {
Copy link
Contributor

Choose a reason for hiding this comment

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

oh this gets cache across invocation? i thought function doesn't have attribute cached like this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, this basically implements function static variable in C++.

@jjyao jjyao requested a review from rickyyx December 8, 2023 23:42
@rickyyx rickyyx merged commit ab36f94 into ray-project:master Dec 9, 2023
14 of 15 checks passed
@jjyao jjyao deleted the jjyao/slow branch December 9, 2023 04:31
jjyao added a commit that referenced this pull request Dec 9, 2023
---------

Signed-off-by: Jiajun Yao <jeromeyjj@gmail.com>
@jjyao jjyao mentioned this pull request Dec 11, 2023
architkulkarni pushed a commit that referenced this pull request Dec 12, 2023
Currently IntelGPUAcceleratorManager.get_current_node_num_accelerators() will be called everytime we try to get accelerator manager for GPU resource. This is expensive and makes single_client_tasks_sync slower. This PR changes to only call it once.

Related issue number
#41695

---------

Signed-off-by: Jiajun Yao <jeromeyjj@gmail.com>
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.

2 participants