Skip to content

Optimize our SpikeMonitor for Subgroups #293

@denisalevi

Description

@denisalevi

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions