Skip to content

Optimize computation in iaf_psc_alpha_ps model#3305

Merged
heplesser merged 7 commits intonest:masterfrom
heshpdx:iaf_psc_model
Sep 27, 2024
Merged

Optimize computation in iaf_psc_alpha_ps model#3305
heplesser merged 7 commits intonest:masterfrom
heshpdx:iaf_psc_model

Conversation

@heshpdx
Copy link
Contributor

@heshpdx heshpdx commented Sep 3, 2024

Replace FP divides with FP multiplies and pre-compute loop invariants. Gives about +10% performance. Similar to #3304.

Replace FP divides with FP multiplies and pre-compute loop invariants.
Similar to nest#3304
@heplesser
Copy link
Contributor

@heshpdx Thank you for this improvement, a great gain for little work. Your PR also made me realize that I really need to post documentation on NEST model structure. Briefly P_ contains parameters that are user-visible and kept constant during simulation. S_ are state variables, user-visible and evolving during simulation, B_ (buffers) and V_ (variables) are implementation details. The difference between B_ and V_ is that B_ is initialized upon the first Simulate() call (specifically, by the Prepare() step of Simulate()) and persists on subsequent Simulate() calls, while V_ is re-initialized on every Simulate()/Prepare() call. B_ contains typically buffers for input spikes and ODE solver objects, while V_ contains pre-computed quantities. Initialization functions are init_buffers_() for B_ and pre_run_hook() for V_.

So to make a long story short, the new inv_* members you introduced should go into V_ instead of P_ and the code for computing them into pre_run_hook().

@heplesser heplesser added S: Normal Handle this with default priority T: Maintenance Work to keep up the quality of the code and documentation. I: No breaking change Previously written code will work as before, no one should note anything changing (aside the fix) labels Sep 4, 2024
@heplesser heplesser requested review from clinssen and removed request for otcathatsya September 4, 2024 12:02
Copy link
Contributor

@heplesser heplesser left a comment

Choose a reason for hiding this comment

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

@heshpdx Thanks, all good now! One CI runner failed because a dependency could not be downloaded (SIONLIB). I have restarted the runner now.

@heshpdx
Copy link
Contributor Author

heshpdx commented Sep 26, 2024

@clinssen anything left for me to do here?

@clinssen
Copy link
Contributor

Hi, thanks for the updates, this looks great and I'm giving it my thumbs up!

@heplesser heplesser merged commit f0da7ab into nest:master Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

I: No breaking change Previously written code will work as before, no one should note anything changing (aside the fix) S: Normal Handle this with default priority T: Maintenance Work to keep up the quality of the code and documentation.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants

Comments