Skip to content
Snippets Groups Projects
  • Ben Cumming's avatar
    move spiked detection to back end (#167) · 86384267
    Ben Cumming authored and Sam Yates's avatar Sam Yates committed
    Moves spike detection to the back end, which is required to have fast spike detection on the gpu.
    
    Fixes #106.
    
    Backend:
    * Move spike detection into the backend.
    * Add a `threshold_watcher` type to each backend that is initialized with a reference to the field that it is to watch, along with indexes and thresholds for each variable in the field that is being watched. This class presents a simple host-side interface:
       * `test(t)` tests for crossings at time `t`.
       *  `crossings()` returns all threshold crossings.
       * `clear_crossings()` resets (clears) the collected crossing events.
    * Implement the multicore back end detector directly from the original code.
    * Implement a `gpu_stack` for use with the gpu back end, that lets threads in a kernel conditionally push back into a flat array.
    
    Miniapp:
    * Run a single-step dummy run of model before starting the profiler, when profiling is enabled.
    * Initialize the spike output callback functions _after_ the dummy run so that spikes from the dummy step are not output.
    
    `cell_group`:
    * Pass responsibility for spike detection to the lowered cells (`fvm_multicell`) and associated back ends.
    
    `memory`:
    * Add a new allocator for CUDA managed memory.
    * Implement `managed_ptr` and `make_managed_ptr`, which are managed memory equivalents of `std::unique_ptr` and `std::make_unique_ptr`.
    
    Tests:
    * Improve host-side spike detection unit tests.
    * Add device-side spike detection unit tests.
    * Add unit tests for `gpu_stack`.
    
    Building:
    * Surpress CMP0023 CMake warning.
    86384267