-
Notifications
You must be signed in to change notification settings - Fork 278
Optimize the auto num_proc calculation of operators in ray mode #789
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
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @Cathy0908, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the efficiency of operator execution within the Ray framework by implementing an intelligent, automatic concurrency calculation. The new system dynamically allocates CPU, GPU, and memory resources to operators, ensuring optimal utilization and balanced processing. It respects user-defined concurrency settings while preventing resource over-allocation, leading to more robust and performant data processing pipelines. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request introduces a sophisticated mechanism for automatically calculating the optimal concurrency (num_proc
) for operators when running in Ray mode. It aims to maximize resource utilization by considering CPU, GPU, and memory requirements of each operator. The core logic is implemented in RayDataset.set_resource_for_ops
and a new helper function find_optimal_concurrency
. The changes also include fetching total GPU memory and adding comprehensive unit tests for the new resource allocation logic.
My feedback focuses on improving robustness by handling potential division-by-zero errors, enhancing code clarity and maintainability through refactoring and better documentation of constants, and optimizing performance by reducing redundant subprocess calls.
data_juicer/core/data/ray_dataset.py
Outdated
return batch.filter(mask) | ||
|
||
|
||
def find_optimal_concurrency(resource_ratios, total_resource): |
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.
can we have perf test results to go with the optimization?
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.
We will conduct detailed perf testing and provide reports afterward.
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.
…r of ray to ensure performance
* * start & stop ray cluster in setUp and tearDown method of test cases for ray mode * * start & stop ray cluster in setUp and tearDown method of test cases for ray mode * * try another garbage collection method * * clean up extra code
The ![]() |
参考文档:https://aliyuque.antfin.com/pai-innovative-algo/reep8g/czmqm2vxa0u7arkz