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

Optimize our SpikeMonitor for Subgroups #293

Open
denisalevi opened this issue Jun 2, 2022 · 0 comments
Open

Optimize our SpikeMonitor for Subgroups #293

denisalevi opened this issue Jun 2, 2022 · 0 comments

Comments

@denisalevi
Copy link
Member

denisalevi commented Jun 2, 2022

Our current implementation is explained in PR #292

This implementation uses thrust::count_if and then thrust::copy_if to create a spikespace for a subgroup. This is likely not very performant because we have to call two kernel. A custom implementation could do both at the same time in one kernel (the copy_if kernel has to know the count anyways I believe). So there are two optimization options here:

  1. Write a custom kernel that basically does a copy_if and stores the number of spiking neurons in the subgroup. This would then still need a copy of that number to host.
  2. Better option: For each subgroup with a SpikeMonitor, let the thresholder of the full NeuronGroup also generate a spikespace for the subgroup. This can happen in the same kernel and would avoid one kernel call. Should also be rather easy to implement. The spikemonitor template would then just have to copy over the number of spiking neurons in the subgroup, which should eventually be done once per timestep for all spikespaces (Copy all eventspace counters to host efficiently at each time step #282 ).

EDIT: Another optimization can be done for EventMonitors which don't record variables. Currently, we do all the thrust functions and call our kernel just to count the number of events (see commits in PR #294 ). We could instead get rid of count_if, copy_if and our kernel and instead call some thrust function that just counts the occurrence of each ID in the eventspace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant