Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Improve slow monitor performance #143

Merged
merged 5 commits into from
Apr 11, 2022

Conversation

kernfel
Copy link
Contributor

@kernfel kernfel commented Jan 21, 2022

In my previous pull request (#140) I introduced support for slower clocks for StateMonitor objects, but failed to notice that the necessary data transfers are not rolled into the code objects, but are rather processed (somewhat) parsimoniously in the engine template.

This pull request expands on the general principle of minimizing unnecessary transfers in the following ways:

  • Data requested by StateMonitors are only transferred in the required iterations, rather than at every tick as before
  • Data transfers are consolidated across StateMonitor and run_regularly operations, including both 'start' and 'end' slots for SMs
  • Rather than pulling the full state of a given model, only the required variables are pulled, which should further reduce overhead, including in operations that run on every iteration.

Since this was a little too much to ask of Jinja, I've placed the consolidation logic into device.py, providing the template with the names of the variables to be pulled, along with their periods.

kernfel and others added 4 commits January 18, 2022 11:23
This fixes an issue where slow StateMonitor clocks incurred
state pull operations on every tick. Additionally, operations
across StateMonitor and run_regularly operations are consolidated,
reducing transfers to the minimum necessary.
Instead of pulling the entire state of a particular model, we
can just pull the individual variables requested by each
StateMonitor / run_regularly operation.
Copy link
Member

@mstimberg mstimberg left a comment

Choose a reason for hiding this comment

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

Sorry for the late review. This looks great! I only recently realized that Brian2GeNN is pulling all the variables when using a StateMonitor – this is a nice improvement. I made two minor comments. Let me know if you don't have the time to take them into account, I can also fix these details myself.

@kernfel
Copy link
Contributor Author

kernfel commented Apr 11, 2022

Done. Test failures seem to point to a bug revealed by brian-team/brian2@aff91cb outside of the scope of this PR, I believe.

Copy link
Member

@mstimberg mstimberg left a comment

Choose a reason for hiding this comment

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

All looks great to me, thanks!

@mstimberg
Copy link
Member

Done. Test failures seem to point to a bug revealed by brian-team/brian2@aff91cb outside of the scope of this PR, I believe.

Yes, the failures do not seem to have anything to do with this PR.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants