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.
Showing
- miniapp/io.cpp 19 additions, 1 deletionminiapp/io.cpp
- miniapp/io.hpp 2 additions, 0 deletionsminiapp/io.hpp
- miniapp/miniapp.cpp 18 additions, 2 deletionsminiapp/miniapp.cpp
- modcc/backends/avx2.hpp 10 additions, 0 deletionsmodcc/backends/avx2.hpp
- modcc/backends/avx512.hpp 10 additions, 0 deletionsmodcc/backends/avx512.hpp
- modcc/backends/base.hpp 5 additions, 0 deletionsmodcc/backends/base.hpp
- modcc/cprinter.cpp 56 additions, 23 deletionsmodcc/cprinter.cpp
- modcc/cprinter.hpp 1 addition, 0 deletionsmodcc/cprinter.hpp
- modcc/cudaprinter.cpp 97 additions, 21 deletionsmodcc/cudaprinter.cpp
- modcc/cudaprinter.hpp 1 addition, 0 deletionsmodcc/cudaprinter.hpp
- modcc/expression.cpp 13 additions, 1 deletionmodcc/expression.cpp
- modcc/expression.hpp 67 additions, 24 deletionsmodcc/expression.hpp
- modcc/module.cpp 25 additions, 9 deletionsmodcc/module.cpp
- modcc/simd_printer.hpp 45 additions, 13 deletionsmodcc/simd_printer.hpp
- modcc/visitor.hpp 1 addition, 0 deletionsmodcc/visitor.hpp
- scripts/cc-filter 1 addition, 1 deletionscripts/cc-filter
- src/CMakeLists.txt 1 addition, 0 deletionssrc/CMakeLists.txt
- src/backends/event.hpp 32 additions, 0 deletionssrc/backends/event.hpp
- src/backends/event_delivery.md 123 additions, 0 deletionssrc/backends/event_delivery.md
- src/backends/fvm.hpp 7 additions, 1 deletionsrc/backends/fvm.hpp
Please register or sign in to comment