Skip to content
Snippets Groups Projects
Commit 9319b302 authored by Sam Yates's avatar Sam Yates Committed by Ben Cumming
Browse files

Implement device-side event delivery.

Finalizes #184 and includes fix for #285. This PR constitutes a brutal rebase of the `devel/async-integration` branch onto current master: git patch, baby.

Implements asynchronous integration of cells within an `fvm_multicell` instance together with the code to implement efficient device-side event delivery.

Summarized patch notes from the development branch:

* Add four new views in mechanism state:
   * `vec_ci`: cv index to cell index (w.r.t. one lowered multicell instance) map.
   * `vec_t`: current or integration starting time, indexed by cell.
   * `vec_t_to`: integration stopping time, indexed by cell.
   * `vec_dt`: pre-computed delta between `vec_t` and `vec_t_to`, to address performance regression on multicore backend.
* Extend notion of indexed view in `modcc` to encompass `CellIndexedVariable` variables, which have a per-cell value.
* Add/change 'built-in' variables `t`, `t_to`, and `dt` for NMODL.
* Additional utility functions:
   * `util::minmax_value`: return one-pass reduction for minimum and maximum.
   * `util::fill`: range-compatible wrapper for `std::fill`.
   * `util::empty` now works across arbitrary sequences (defaults to calling `empty()` method if it exists).
   * Extends C++17-like functionality for path testing and manipulation (c.f. PR #233).
* Use a cached copy of the per-cell time vector for queries in `fvm_multicell`.
* Modifies back-end matrix assembly, threshold detection and stimulus implementations to be asynchronous-friendly.
* Rename some back-end mechanism variables for clarity, now that there are multiple sorts of cell index vectors present. `cell_index` for example has been renamed to `cell_cv_divs` where it acts as a partition division of cv indices (length 1+#cells), and `cell_to_cv` where it acts as a map from cell to index of first cv for that cell (length #cells).
* Move common event-delivery types (`target_handle`, `deliverable_event`) to `src/backends/event.hpp`.
* Add `multi_event_stream` data structure for `gpu` and `multicore` backends, which handles multiple streams of events, bulk loaded but individually popped.
* Add unit tests for `multi_event_stream`.
* Document event delivery process and abstraction in `src/backends/event_delivery.md`.
* Virtualize `mechanism::deliver_events`.
* Perform event delivery in `fvm_multicell::step_integration()`, using the backend-provided interfaces.
* Add zero dt check/support to matrix state implementations.
* Add zero dt unit tests for multicore and gpu back-end matrices.
* Add debugging helper `util::sepval` for printing/tracing container values.
* Add trace csv output option to miniapp.
* Add GPU kernel and unit test for end-of-integration time step test. By default, keep using the copy-to-host-and-test method, as it is faster for cell counts up to circa 10k; investigate adaptive/threshold solutions in the future.
* Explicitly compute and store per-cell and per-compartment `dt` from integration time bounds.
* Determine lower bound on number of integration steps per interval in order to avoid explicit checking of minimum cell times each step.
* Avoid any time value checking for samplers in the integration loop if none of them could be triggered in the interval.
parent 153aeaee
No related branches found
No related tags found
No related merge requests found
Showing with 534 additions and 96 deletions
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment