-
Notifications
You must be signed in to change notification settings - Fork 13
Description
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:
- Write a custom kernel that basically does a
copy_ifand stores the number of spiking neurons in the subgroup. This would then still need a copy of that number to host. - Better option: For each subgroup with a
SpikeMonitor, let thethresholderof the fullNeuronGroupalso 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.