-
Notifications
You must be signed in to change notification settings - Fork 594
docs: add developer guide on memory management with RMM #7174
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: branch-25.12
Are you sure you want to change the base?
Conversation
|
||
- **Memory leaks**: forgetting to free memory after use. | ||
- **Dangling pointers**: using freed memory by mistake. | ||
- **Incompatibility**: does not integrate well with========================================= |
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.
syntax error
Raw Allocation vs. RMM | ||
---------------------- | ||
**❌ Raw Allocation Example:** | ||
.. code-block:: cpp |
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.
please review this in the github preview; this doesn't render correctly
Migration Strategy | ||
------------------ | ||
When contributing to cuML: |
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.
Does this apply to new contributions? Or a migration effort? This seems unclear.
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.
Overall this seems a bit overly verbose. I would prefer this to be a bit more concise and tailored to the specific needs of the cuML project. We should avoid duplicating the RMM docs and instead refer to those where appropriate.
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.
Thanks for the feedback! I’ve simplified the documentation to avoid duplication with RMM, kept it cuML-specific, and added a reference link to the RMM docs. Please let me know if further adjustments are needed.
ddddc64
to
949ecab
Compare
Thanks for addressing my comments. Quick note: please do not merge the upstream branch unless this branch is significantly out of date. It unnecessarily increases our Ci worker load. |
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.
Please make sure to integrate this guide with wiki/cpp/DEVELOPER_GUIDE.md .
Thanks for the feedback! I’ve integrated the memory management guide into wiki/cpp/DEVELOPER_GUIDE.md as requested. Also noted about not merging upstream unless the branch is significantly out of date - I’ll keep that in mind going forward. This should now be ready for another review. |
quite sorry again for the unnecessary clicking of the update branch, noted I wont press it again the branch is actually out of the date. |
Please actually integrate it rather than linking to it. Thanks! |
Thanks for the feedback! I’ve now integrated the memory management content directly into DEVELOPER_GUIDE.md instead of linking out. Please let me know if there are any further adjustments needed. |
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.
LGTM
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.
I have some suggestions for improvement. More generally I am unsure about the duplication of information.
|
||
When contributing to cuML: | ||
|
||
- Replace raw ``cudaMalloc/cudaFree`` with RMM containers. |
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.
- Replace raw ``cudaMalloc/cudaFree`` with RMM containers. | |
- Use RMM containers instead of raw ``cudaMalloc``/``cudaFree``. |
When contributing to cuML: | ||
|
||
- Replace raw ``cudaMalloc/cudaFree`` with RMM containers. | ||
- Prefer ``device_uvector`` for typed data. |
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.
- Prefer ``device_uvector`` for typed data. | |
- Prefer ``rmm::device_uvector<T>`` for typed data. |
|
||
- Replace raw ``cudaMalloc/cudaFree`` with RMM containers. | ||
- Prefer ``device_uvector`` for typed data. | ||
- Refer to the official `RMM documentation <https://github.com/rapidsai/rmm>`_ for advanced features. No newline at end of file |
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.
- Refer to the official `RMM documentation <https://github.com/rapidsai/rmm>`_ for advanced features. | |
- Refer to the `RMM documentation <https://docs.rapids.ai/api/rmm/>`_ or `RMM repository <https://docs.rapids.ai/api/rmm/>`_ for more information. |
thrust::for_each(execution_policy->on(stream), ... ); | ||
} | ||
``` | ||
## Memory Management in cuML |
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.
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.
Considering the information density, we should just integrate everything into this document. We should also be careful in duplicating information from the RMM docs and instead refer to them where possible.
thrust::for_each(execution_policy->on(stream), ... ); | ||
} | ||
``` | ||
## Memory Management in cuML |
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.
Considering the information density, we should just integrate everything into this document. We should also be careful in duplicating information from the RMM docs and instead refer to them where possible.
I'm retargeting this for 25.12. |
have done the documentation in the basic of understanding and the workflow, feel free to make changes.