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

CVode.poolshrink(1) deletes unused mechanism pools. #2033

Merged
merged 4 commits into from Oct 28, 2022
Merged

Conversation

nrnhines
Copy link
Member

To delete unused mechanism memory pools (e.g. when you have cleared the model) use

cv = h.CVode()
cv.poolshrink(1) # deletes pools if number of items used is 0
cv.poolshrink() # prints current number of items used and number of items allocated for double arrays and Datum arrays.

Needs documentation.

@azure-pipelines
Copy link

✔️ d2256f2 -> Azure artifacts URL

@alexsavulescu
Copy link
Member

alexsavulescu commented Oct 21, 2022

Just thinking out loud, would it be possible to automatically call poolshrink and avoid leaving this in the user's hands?

@azure-pipelines
Copy link

✔️ c8d7eb6 -> Azure artifacts URL

Copy link
Member

@iomaganaris iomaganaris left a comment

Choose a reason for hiding this comment

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

I did some tests and this seems to work as expected.
I am just thinking that this should be added to the documentation and maybe we could also add a test about this?

@nrnhines
Copy link
Member Author

possible to automatically call poolshrink

I suppose that if a model is empty (no pool item in use for any pool) that all the memory could be reclaimed. But poolshrink
started out as a temporary measure to solve a specific issue and I think will be superseded by the std::vector reorganization.

@alexsavulescu
Copy link
Member

will be superseded by the std::vector reorganization

I believe that will still imply calls to clear() and/or shrink_to_fit()

@alexsavulescu
Copy link
Member

@iomaganaris maybe we can merge this and tackle docs/handling in another PR?

Copy link
Member

@iomaganaris iomaganaris left a comment

Choose a reason for hiding this comment

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

Sure we can merge this without the docs at the moment. I just have one question looking at the code.

src/nrniv/cxprop.cpp Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

Codecov Report

Merging #2033 (5fbf643) into master (1346a84) will decrease coverage by 0.01%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master    #2033      +/-   ##
==========================================
- Coverage   48.64%   48.63%   -0.02%     
==========================================
  Files         519      519              
  Lines      116039   116068      +29     
==========================================
+ Hits        56447    56449       +2     
- Misses      59592    59619      +27     
Impacted Files Coverage Δ
src/nrncvode/cvodeobj.cpp 85.66% <0.00%> (-0.69%) ⬇️
src/nrniv/cxprop.cpp 57.45% <0.00%> (-3.65%) ⬇️
src/sundials/cvodes/cvodes.c 32.74% <0.00%> (+0.07%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@azure-pipelines
Copy link

✔️ 5fbf643 -> Azure artifacts URL

@nrnhines nrnhines merged commit d4254f0 into master Oct 28, 2022
@nrnhines nrnhines deleted the hines/poolshrink branch October 28, 2022 07:55
iomaganaris pushed a commit that referenced this pull request Nov 9, 2022
* CVode.poolshrink(1) deletes unused mechanism pools.

Co-authored-by: Alexandru Săvulescu <alexandru.savulescu@epfl.ch>
nrnhines added a commit that referenced this pull request Nov 9, 2022
* refactoring: drop java code (#1937)

* Update removed_features.rst

* Fine tune clang-format and fix CI (#2041)

* Delete return statement to avoid ASan error.

* CVode.poolshrink(1) deletes unused mechanism pools. (#2033)

* Pin bokeh<3, don't pin matplotlib (#2048)

* Add list(...) for new matplotlib.

Co-authored-by: Alexandru Săvulescu <alexandru.savulescu@epfl.ch>
Co-authored-by: Olli Lupton <oliver.lupton@epfl.ch>
Co-authored-by: nrnhines <michael.hines@yale.edu>
alexsavulescu added a commit that referenced this pull request Dec 15, 2022
* refactoring: drop java code (#1937)

* Update removed_features.rst

* Fine tune clang-format and fix CI (#2041)

* Delete return statement to avoid ASan error.

* CVode.poolshrink(1) deletes unused mechanism pools. (#2033)

* Pin bokeh<3, don't pin matplotlib (#2048)

* Add list(...) for new matplotlib.

Co-authored-by: Alexandru Săvulescu <alexandru.savulescu@epfl.ch>
Co-authored-by: Olli Lupton <oliver.lupton@epfl.ch>
Co-authored-by: nrnhines <michael.hines@yale.edu>
pramodk pushed a commit to BlueBrain/neurodamus that referenced this pull request Jun 1, 2023
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.

None yet

5 participants