[Draft] add option to clear the alloc cache#1623
[Draft] add option to clear the alloc cache#1623tdavidcl wants to merge 2 commits intoShamrock-code:mainfrom
Conversation
|
Thanks @tdavidcl for opening this PR! You can do multiple things directly here: Once the workflow completes a message will appear displaying informations related to the run. Also the PR gets automatically reviewed by gemini, you can: |
Summary of ChangesHello @tdavidcl, 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 enhances memory management within the Highlights
Changelog
Activity
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.
Code Review
This pull request introduces clear() methods to DDSCommCache and DDSCommCacheTarget, providing a way to release memory from the allocation cache. This is a useful addition for memory management. However, the cache is then unconditionally cleared within distributed_data_sparse_comm, which negates the performance benefits of caching across multiple calls. My review highlights this issue and suggests making the cache clearing behavior optional or leaving it to the caller to decide when to clear the cache.
| } | ||
| } | ||
|
|
||
| cache.clear(); |
There was a problem hiding this comment.
Calling cache.clear() here unconditionally defeats the purpose of the cache, which is to reuse buffer allocations across multiple calls to distributed_data_sparse_comm. With this change, buffers will be deallocated at the end of this function and reallocated at the beginning of the next call, which can be inefficient.
The clear() method is a valuable addition to DDSCommCache as it provides control over memory management. However, the decision to clear the cache should be left to the caller, who can do so when communication patterns change or when memory needs to be reclaimed.
I recommend removing this line to preserve the caching behavior. The caller can then explicitly call cache.clear() when necessary.
Alternatively, if the goal is to control this from distributed_data_sparse_comm, you could add a boolean parameter to the function signature (e.g., bool clear_cache_at_end = false) to make this behavior optional.
Workflow reportworkflow report corresponding to commit 5d23818 Light CI is enabled. This will only run the basic tests and not the full tests. Pre-commit check reportSome failures were detected in base source checks checks. Suggested changesDetailed changes :diff --git a/src/shamsys/src/NodeInstance.cpp b/src/shamsys/src/NodeInstance.cpp
index 4f8f4093..c30164a1 100644
--- a/src/shamsys/src/NodeInstance.cpp
+++ b/src/shamsys/src/NodeInstance.cpp
@@ -107,7 +107,8 @@ namespace syclinit {
std::shared_ptr<sham::DeviceScheduler> sched_alt;
std::string callback_mem_perf_info1() {
- return "Memory performance info (compute) :\n" + sham::details::log_mem_perf_info(sched_compute);
+ return "Memory performance info (compute) :\n"
+ + sham::details::log_mem_perf_info(sched_compute);
}
std::string callback_mem_perf_info2() {
return "Memory performance info (alt) :\n" + sham::details::log_mem_perf_info(sched_alt);
|
No description provided.