- Nov 19, 2020
-
-
Brent Huisman authored
Change from long double to double for storing floating point values in modcc. WSL, and Windows generally, treats long double differently than Linux, which leads to inconsistencies in literal numeric values in code generated by modcc on the two platforms. Fixes #1245
-
- Dec 20, 2019
-
-
Nora Abi Akar authored
* Rewrite the function expander which lowers function calls and function arguments, such that both steps are done in the same visitor, and both visitors are applied to the entire procedure. * Rewrite the function inliner such that it is also applied to an entire procedure, after all functions have been expanded. The function inliner iterates over the body of the procedure, inlining one function call at a time, until all function calls have been inlined. * Conductivity and current accumulations are also modified to be done in one step at the end of `nrn_current`
-
- Dec 05, 2019
-
-
Nora Abi Akar authored
* Group common linear system solver code across `SparseSolverVisitor`, `SparseNonlinearSolverVisitor`, and `LinearSolverVisitor`. * Normalize intermediate values in Gaussian elimination when the matrix has more than 5 rows. Fixes #890
-
- Oct 01, 2019
-
-
Nora Abi Akar authored
* Modify `SparseSolverVisitor` to allow solving kinetic equations at steady state. Addresses #837
-
- Sep 02, 2019
-
-
Nora Abi Akar authored
* Adds modcc support for COMPARTMENT statements of the form: `COMPARTMENT v {state_0, state_1, ..., state_n}`. * Use `COMPARTMENT` values `v` to multiply the derivative of state variables `state_0, state_1, ..., state_n` in associated kinetic scheme blocks. Fixes #838.
-
- Aug 21, 2019
-
-
Add support for parsing and processing `LINEAR` blocks: Changes: * `SOLVE` expressions can be called from inside an `INITIAL` block, but only if they are solving a linear system * Tilde expressions can now be either linear expressions or reaction expressions * Linear expressions need to be rewritten before being sent to the solver, this is done using `LinearRewriter` * The linear system is setup in `LinearSolverVisitor` fills the lhs and rhs of the symbolic matrix * The matrix is recued using `gj_reduce`, which now works on non-diagonal matrices. Fixes #839
-
- Jul 02, 2019
-
-
Address inconsistencies in unit conversions between current updates, initialization, ionic currents etc. Fixes issues #793 and #798. * Correct units in comments for ion state iX_ to a current density. * Remove conversion factor for NMODL current densities [mA/cm²] to Arbor current densities [A/m²] from layout weight: from the point of view of Arbor, mechanisms now write in units that Arbor uses natively. * Remove weight_ as a magic modcc variable; applying weight_ is now performed directly by code generated by printers. * Change IndexedVariable interface: remove redundant index_name; remove 'op'. Whether external data is accumulated or assigned is now a property of the corresponding sourceKind. * Conversion factors for NMODL <-> Arbor are collated in printerutils.cpp, determined by the external data sourceKind. * Permit direct assignment of external data, as opposed to a weighted sum. This behaviour will be required for reversal potential handling...
-
- May 23, 2019
-
-
* Replace ionKind enumerations with corresponding string values. * Rename `ion.hpp` as `ion_info.hpp`. * Re-jig 'nonspecific' current handling in modcc: make explicit the external source of the corresponding current variable, and treat as non-indexed those locals with an external variable that has no data source, as opposed to special-casing the `ionKind::nonspecific` value. * Add another field in ion dependency information that captures a write to an ionic reversal potential. Fixes #748.
-
- Aug 20, 2018
-
-
Global temperature for mechanisms. * Make 'celsius' magic in modcc: now an indexed variable. * Add a new temperature data source for indexed variables. * Add support to printers for indexed variables that reference a scalar. * Check that indexed variables aren't used in PROCEDURE blocks (this is a problem not just for 'celsius'). * Modify built-in mod files to pass celsius as a parameter to rates() procedures. * Add global temperature to shared_state classes, and initialize through backend mechanism superclasses. * Add some infrastructure for unit-test only mechanisms. * Set modcc flags globally in top level CMakeLists.txt. * Add test mechanism/module for checking celsius setting. * Add unit test for multicore and gpu mechanism celsius setting. * Make common mechanism private field data access helper for unit tests. * Use helper in temperature, synapses tests. * Fix warning in `distribued_context.hpp` about errant semicolon. * Fix global scalar ref for SIMD printing. * Use correct ARB_CXXOPT_ARCH instead of incorrect CXXOPT_ARCH in various CMakeLists.txt files. * Add special case for no-non scalar indexed variables in API loop in SIMD printing. Fixes #386
-
- Jul 20, 2018
-
-
Sam Yates authored
Fixes #139. * Split colours and `pprintf(...)` into `io/pprintf.hpp` header. * Remove generic `to_string()` function, replacing its very occasional usage with `pprintf`. * Move block pretty printing into own .cpp file; this is the only place that the vector ostream printer was used. * Remove `enum_hash`, as not needed with C++14. * Move `is_in` utility function to `util.hpp`. * Remove old SIMD printer backend code.
-
- May 09, 2018
-
-
Sam Yates authored
First commit of two for mechanism refactor work (refer to PR #484 and PR #483). FVM/mechanism code: * Refactor mechanism data structures to decouple backend-specific implementations and mechanism metadata. * Add mechanism catalogue for managing mechanism metadata and concrete implementation prototypes. * Add fingerprint-checking to mechanism metadata and implementations to confirm they come from the same NMODL source (fingerprint is not yet computed, but tests are in place). * Split FVM discretization work out from FVM integrator code. * Use abstract base class over backend-templated FVM integrator class `fvm_lowered_cell_impl` to allow separate compilation of `mc_cell_group` and to remove the dummy backend code. * Add a new FVM-specific scalar type `fvm_index_type` that is an alias for `int` to replace `fvm_size_type` in fvm layouts and mechanisms. This was chosen as an alternative to making `unsigned` versions of all our SIMD implementation classes. * Extend `cable1d_neuron` global data to encompass: mechanism catalogue; default ion concentrations and charges; global temperature (only for Nernst); initial membrane potential. Modcc: * Collect printer sources in modcc under `printer/`. * Move common functionality across printers into `printer/printerutil.{hpp,cpp}`. * Add string to file I/O implemented in routines read_all and write_all in `io/bulkio.hpp`. * Implement indent-friendly source code generation via a `std::streambuf` filter `io::prefixbuf` defined in `io/prefixbuf.hpp`, together with manipulators and a corresponding std::ostream-derived wrapper. * Rewrite printers to use new infrastructure: cpu target incorporates SIMD printing options; CUDA printer at this point produces only stubs for CUDA kernel wrappers. * Modify SIMD printing command line options for modcc: `-s` enables explicit vectorization using the SIMD classes; `-S <N>` allows a specific data width to be prescribed. * Fix problem in `test_ca.mod` with uninitialized ion current. * Add infrastructure support to allow future pre-computation of SIMD index conflict cases for (hopefully) faster scatters and updates. * Simplify `IndexedVariable` expressions in the AST, making data source explicit via a `sourceKind` enum, and leaving the indexing method and index names up to the printers. * Allow state variables in the AST to 'shadow' an ion concentration — these are assigned in the generated `write_ions` method. SIMD classes: * Add `simd_cast` operation between SIMD value types of the same width, and with `std::array`. (Note: this was tested and used in an early development version of the code, but not in this version. It was still a lacuna in the original SIMD wrappers, so it has been left in.) * Restructure SIMD gather/scatter API to use a `simd::indirect` expression, which encapsulates a pointer and SIMD offset. * Add `simd::index_constraint` scoped enum to describe knowledge of contention in indirect indices, so that we can branch on this to the appropriate implementation. * Add SIMD concrete implementation routines `reduce_add` for horizontal reduction and `element0` for access to first lane scalar value. * Add SIMD value method `sum()` that exposes implementation `reduce_add`. * Add SIMD concrete implementation routine `compound_indexed_add` that provides the implementation for `indirect(p, simd_indices) += simd_value` construction. * Fix SIMD `implbase` bug where some static methods were using the `implbase` fall-back functions instead of the derived class specialized implementations. * Move SIMD mathematical functions into friend routines of `simd_impl` in order to resolve implicit conversions from scalars in mixed SIMD-scalar operations. * Use a templated `tag` class to dispatch on SIMD concrete implementation types, to avoid problems with incomplete types in method signatures. * Remove old SIMD intrinsics. CMake infrastructure: * Downcase some variables in `CMakeLists.txt` files to distinguish them visually from CMake keywords and variables. * Split arbor modcc vectorization option (now `ARB_VECTORIZE`) and target-architecture optimization (now `ARB_ARCH`). * For `arbor` and `arbormech` targets, and in particular not the `modcc` target, use `ARB_ARCH` to generate corresponding target-appropriate binaries, including, for example, appropriate SIMD support. * Extend `CompilerOptions.cmake` to map as best as able between the various target architecture names (we use the gcc names) and the correct option to pass to the compiler based on the compiler and platform. * Add work-around for misidentification by CMake of XL C as Clang. * As a temporary work-around, include `arbormech` library twice on link line to resolve circular arbor–arbormech dependencies. Unit tests: * Extend repertoire of generic sequence equality/near equality testing support in `common.hpp`. * Add warning suppression for icc for the malloc instrumentation code. * SIMD unit tests for indirect expressions, compound indirect add, reduction. * Make some exact tests into floating point 'near' tests when comparing computed areas and lengths in swc and fvm layout tests, to account for compiler (e.g. icc) performing semantically inequivalent floating point operation reordering or fusion at `-O3`. * Split out some of the CUDA tests into separate .cpp/.cu files for separate-compilation purposes. Other: * The `padded_allocator` has been modified to propagate alignment/padding on move and copy (these semantics make their use much easier and safer in the multicore mechanism instantiation code). * Map/table searching utilities in `util/maputil.hpp`. * Fixes for correct sequence type categorization and `begin/end` ADL. * Fixes for type guards for range methods that take universal references. * Removal of some redundant code in range utilities through the use of universal references. * Add new range view `reverse_view` for ranges delineated by bidirectional iterators. * Add single argument form of `make_span` to count up from zero, and associated helper `count_along` that gives a span that indexes a supplied container. * Moved `prefixbuf` to `modcc` source. * Make sequence positive and negative tests in algorithms generic. * Add `private`-subverting helper code/macro to `tests/unit/common.hpp` to reduce the number of public testing-only interfaces in the library code. * Add virtual destructors for virtual base classes. * Add new arb::math:: functions: `next_pow2` for unsigned integral types, `round_up` to round a number away from zero to next largest magnitude multiple. * New `index_into` implementation that supports bidirectional access (moved to `util::` namespace). * Fix problem in `test_ca.mod` with uninitialized ion current. * Rework dangerous `memory::array(Iter, Iter)` constructor to be less dangerous (and do the expected thing). * Allow ranges to be constructed from other ranges if the iterators are compatible.
-
- Dec 20, 2017
-
-
* Add three new mechanisms: `nax.mod`, `kdrmt.mod` and `kamt.mod`. * Add new built-in math operators to `modcc`: `min`, `max`, `abs` and `exprelr`. `exprelr` is defined as the reciprocal of the 'exprel' function, exprel(x)=x/(exp(x)-1), exprel(1)=1. This function occurs frequently in HH-style mechanisms, and having a built-in operator avoids the ad hoc `vtrap` functions found in NMODL files in the wild. * Split Arbor SIMD intrinsics support into AVX2- and AVX512-specific files. * Add unit tests for new maths operators for C++, SIMD and CUDA implementations.
-
- Nov 20, 2017
-
-
Derivatives should only appear on the left hand side of expressions that describe the time evolution of state variables. Without this check `modcc` segfaulted when processing a derivative expression of a non-state variable. * Specialize the semantic analysis of `DerivativeExpression` to enforce that derivatives are only applied to state variables.
-
- Jun 19, 2017
-
-
Sam Yates authored
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.
-
- Mar 20, 2017
-
-
Vasileios Karakasis authored
Basic features: * Compile with -t avx512 * Automatically set up by CMake if USE_OPTIMIZED_KERNELS is on and VECTORIZE_TARGET is set to KNL * Generic SIMD printer that contacts a SIMD backend for emitting the actual SIMD intrinsics Note: compilation for the avx512 target requires the Intel compiler.
-
- Mar 05, 2017
-
-
Sam Yates authored
Incorporate symbolic GE code from prototype (with some simplifications) in msparse.hpp, symge.hpp and symge.cpp, together with unit tests. Add two kinetic scheme test cases for validation: test_kin1 (simple exponential scheme) and test_kinlva (combination of exponential gate and a three-species kinetic scheme, modelling a low voltage-activated Calcium channel from Wang, X. J. et al., J. Neurophys. 1991). Adapt numeric HH validation data generation to LVA Ca channel, with explicit stopping at stimulus discontinuities. Add two new validation tests based on above: kinetic.kin1_numeric_ref and kinetic.kinlva_numeric_ref (multicore backend only). Introduce a BlockRewriterBase visitor base class, as an aid for visitors that transform/rewrite procedure bodies; refactor KineticRewriter over this class. Introduce common error_stack mixin class for common functionality across Module and the various procedure rewriters. Implement visitors and public-facing convenience wrappers in symdiff.hpp and symdiff.cpp: involves_identifer for testing if an expression contains given identifiers. constant_simplify for constant folding with removal of trivial terms arising from a NumberExpression of zero or one. expr_value to extract the numerical value of a NumberExpression, or NaN othereise. is_zero to test if an expression is numerically zero. symbolic_pdiff to perform symbolic partial differentiation; this adds a new (not parseable) expression subclass to represent opaque partial differential terms. substitute to substitute identifiers for other expressions within an expression. linear_test for linearity, diagonality and homogeneity testing (this is probably redundant, given ExpressionClassifier already exists). Simplify unnecessary uses of make_unique with Vistor subclasses. Make SOLVE statement rewriting more generic, through the use of solve-rewriter visitors CnexpSolverVisitor, SparseSolverVisitor, and DirectSolverVisitor; implementations in solvers.hpp and solvers.cpp. Supports multiple SOLVE statements for independent subsets of state variables with the BREAKPOINT block. Add block rewriter for the removal of unused local variables, with convenience wrapper remove_unused_locals. Generalize is_in utility in modccutil.hpp. Simplify expression comparison in modcc unit tests with EXPECT_EXPR_EQ macro added to tests/modcc/test.hpp, that operates by comparing expression text representations. Simplify and consolidate verbose printing in modcc unit tests with verbose_print function that tests the global verbose flag and handles expression_ptr and similar which have to_string methods.
-
- Nov 25, 2016
-
-
Sam Yates authored
Adds a new KineticRewriter visitor that transforms (after semantic analysis) a parsed KINETIC procedure into an equivalent DERIVATIVE procedure. The visitor takes a ProcedureExpression and composes the equivalent procedure, available via the as_procedure() method on the visitor object. Move common functinality for 'local' variable insertion during transformation phase to new files astmanip.?pp. Add Expression method for directly setting scope. Use scope_ptr type alias widely. Implement correct clone() behaviour for DerivativeExpression Implement KineticRewriter transforming visitor class. Add equivalence test for KineticRewriter: the test incorporates a simple ad-hoc algebraic expression simplifier. Add unit test to Parser.parse_binop to exercise bug #94
-
- Nov 07, 2016
-
-
Sam Yates authored
* Extend stoichiometric expressions to allow negative coefficients. * Check that terms in a reaction expression are all non-negative. * Add CONSERVE keyword. * Add `ConserveExpression` and corresponding parsing behaviour. * Add unit tests for above and for recognition of KINETIC block as a `procedure`.
-
- Nov 04, 2016
-
-
Sam Yates authored
* Make verbose printing in test_modcc a runtime flag `-v`. * Show results of `lexer.parse()` in test_modcc when run with `-v`. * Split numerical lexing and parsing into real and integer categories. * Add expression parsing for KINETIC block and enclosed reaction expressions. Note: does not parse CONSERVE yet; no test for KINETIC block (reactions are covered though.)
-
- Oct 31, 2016
-
-
Sam Yates authored
* Split `tok::number` token into `tok::real` and `tok::integer` * Add new tokens: `tok::tilde`, `tok::arrow` and `tok::kinetic` (keyword) * Add new expressions: `IntegerExpression` (deriving from `NumberExpression`), `ReactionExpression`, `StoichExpression` and `StoichTermExpression`. * Add new `procedureKind`: `kinetic`. * Add parse rules for KINETIC blocks. Note: no real testing yet.
-
- Oct 04, 2016
-
-
Benjamin Cumming authored
* update the out of date version of modparser was added to the repository * fix some warnings about unused static functions in a modcc test header * move modcc/src path contents to modcc, because there was little point having the additional sub directory.
-
Vasileios Karakasis authored
-
Benjamin Cumming authored
* only the source has been moved over and the cmake rules updated * the tests still have to be moved
-