Skip to content

Lvardt cell CvMembList.ml.size() should be the number of contiguous regions of the fixed step thread Memb_list #3299

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

Merged
merged 9 commits into from
May 29, 2025

Conversation

nrnhines
Copy link
Member

@nrnhines nrnhines commented Jan 6, 2025

There are serious performance problems with the local variable time step method in comparison with 8.2 This PR is a prerequisite for fixing one of them.

The 9.0 implementation for local variable time step (each cell is integrated by its own cvode instance) demanded that a cell's CvMembList.ml.size() could be either 1 or Memb_list .nodecount.
Thus, if there were multiple cells in a thread, the ml.size() == nodecount, and each Memb_list instance was limited to a single Node*.

A subsequent PR (#3300) will default sort the fixed step nodes so that Nodes of each cell will be as contiguous as possible. Presently, the default is that only nodes in a Section are contiguous.

Ringtest performance on Linux comparing 8.2.7, current master, and this series ending with #3314 is

Linux
-method N          0-fixed, 1-global cvode, 2-local cvode
python ringtest.py -method 1 -2nd_order_thresh
              fixed      global    local
spikes        688        695       694 
8.2.7         0.65       3.83      0.77
master        0.58       7.58      2.09
#3314         0.53       3.74      0.78

@nrnhines nrnhines requested a review from JCGoran January 6, 2025 16:07
Copy link

✔️ d73896e -> Azure artifacts URL

Copy link

codecov bot commented Jan 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.37%. Comparing base (81ca7d6) to head (ef7cce5).
Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3299   +/-   ##
=======================================
  Coverage   68.36%   68.37%           
=======================================
  Files         682      682           
  Lines      116555   116574   +19     
=======================================
+ Hits        79686    79706   +20     
+ Misses      36869    36868    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Collaborator

@JCGoran JCGoran left a comment

Choose a reason for hiding this comment

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

From a high level perspective, do you happen to have some performance numbers related to this change, or do we also need #3300 to be able to see a (substantial) difference? Also, are the improvements consistent on both Linux and MacOS?

Regarding the CI failure on MacOS, I don't really see how it's related to this change (something about fmt? But the PR doesn't touch those parts at all), so we can probably ignore it.

@nrnhines
Copy link
Member Author

nrnhines commented Jan 7, 2025

From a high level perspective, do you happen to have some performance numbers related to this change, or do we also need #3300 to be able to see a (substantial) difference? Also, are the improvements consistent on both Linux and MacOS?

Ironically, this is performant equivalent to #3300 for a single cell model. (For a single cell model global vardt and local vardt are conceptually equivalent since in both cases there is only a single instance of the cvode integrator). I say "ironically" because the my first sight of the issue was for the single cell modeldb model 267666 discrepancy between master local and global cv:advance_tn time and instructions retired:
#3283 (comment)

Task Type / Function / Call Stack	CPU Time	Instructions Retired	Task Time	Task Count
cv:advance_tn	14.851s	177,837,700,000	15.277s	207,743   #local vardt
cv:advance_tn   6.207s  67,917,900,000  6.354s  207,743   #global vardt

The reason this PR is not an endpoint solution to the problem is that default node ordering is globally section depth first which interleaves sections of different cells. Here is a ringtest sim time comparison between master, this pr, and #3300 using the intel compiler

$ nrniv -python ringtest.py -rparm -nring 32 -npt 1 -compart 1 3 -method 2 -2nd_order_thresh
version simtime (s)
master  6.7
this PR 3.8
PR3300  2.8

I have not checked the mac performance.

Regarding the CI failure on MacOS, I don't really see how it's related to this change (something about fmt? But the PR doesn't touch those parts at all), so we can probably ignore it.

I believe that was localized to the new NMODL and I didn't look closely about where the specific failing CI's were getting that version. I do notice that locally my PR and the master are both getting 49fdfe6c from https://github.com/BlueBrain/nmodl

Copy link

✔️ ac1c6a9 -> Azure artifacts URL

Copy link

✔️ 8e1e0e5 -> Azure artifacts URL

Copy link

sonarqubecloud bot commented Jan 8, 2025

Copy link

✔️ 32921b2 -> Azure artifacts URL

@nrnhines
Copy link
Member Author

@JCGoran I'm ready to start pushing through this series of PR's of which this is the first step. At the end of the series the 9.0 performance will equal or exceed 8.2. I want to keep the PR's localized to specific cvode submodules in order to avoid a mega PR that would be difficult to understand as a squashed blob.

Copy link
Contributor

✔️ ef7cce5 -> artifacts URL

Copy link

Copy link

✔️ ef7cce5 -> Azure artifacts URL

@nrnhines nrnhines merged commit 02db1b2 into master May 29, 2025
43 checks passed
@nrnhines nrnhines deleted the hines/cvlocal-bug branch May 29, 2025 19:24
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