Skip to content
Snippets Groups Projects
  1. Dec 22, 2016
  2. Dec 21, 2016
  3. Dec 20, 2016
    • Ben Cumming's avatar
      generalised stimulus (#126) · 8b30c273
      Ben Cumming authored and Sam Yates's avatar Sam Yates committed
      feature: #67 (GPU Support)
      
      Implement stimulii as part of the mechanism framework, as described here: #87 (comment)
      
      * A hand-written stimulus point process derived from `mechanisms::mechanism` was written for each back end. 
      * The lowered `fvm_multicell` type explicitly constructs a stimulus mechanism if there are any stimuli attached to the its cells.
      * This mechanism is added to the other mechanisms in the lowered cell, so that the update of current is performed in the current update loop (i.e. via the `nrn_current()`) method.
      
      This isn't an ideal solution: we still have a hard coded stimulus type in the lowered cell, however the stimulus is now "in the right spot", and we can refine this better when we work on a better design for generalised mechanisms (i.e. when we have figured out what we going to do).
      
      fixes #104.
      8b30c273
    • Vasileios Karakasis's avatar
      Feature/mechanisms unit tests (#96) · fc7e2785
      Vasileios Karakasis authored and Sam Yates's avatar Sam Yates committed
      These tests are intended to test the sanity of the `modcc` generated code for the individual mechanisms. The don't have any physical background. Potentially optimized CPU-targeted mechanisms generated in the build are compared with unoptimized mechanisms generated from the reference modules.
      
      * Add generic unit tests for individual mechanisms.
      * Make unit tests exercise potential problems with aliased indexes (point processes).
      * Ensure unit tests correspond to multiple low level vector operations.
      * Ensure unit tests run with voltage, current and indices initialized with varying values.
      * Refactor CMake code for module compilation to reduce cut-and-paste code and build complexity.
      fc7e2785
  4. Dec 19, 2016
  5. Dec 13, 2016
    • Sam Yates's avatar
      Re-instate ball-and-taper validation tests. (#124) · 1963634e
      Sam Yates authored
      Fixes #85
      1963634e
    • Sam Yates's avatar
      Fix modcc precedence parsing bug (#127) · dfb32094
      Sam Yates authored
      * Modify `parse_expression` to take a controlling (parent) precedence.
      * `parse_expression` folds left over sequences of sub-expressions with decreasing operator precedence (accumulates in `lhs`).
      * Use recursion rather than accumulator for left fold in `parse_binop` to simplify code logic.
      * Extend parser unit test to cover more complicated, multi-level expression.
      * Remove (now) redundant parenthesis from derivative check block in kinetic rewriter test.
      
      Fixes #94
      dfb32094
    • Ben Cumming's avatar
      Bug/issue#20 (#123) · fbe3f45a
      Ben Cumming authored and Sam Yates's avatar Sam Yates committed
      This PR addresses two issues that were closely related:
      * correctly accounting for the current contribution of density mechanisms to CVs at branch points, where the density mechnanism is not present on all branches. This was discussed in issue #20.
      * adding support for weighting of current densities calculated from density mechanism. This is required to weight the current contribution to CVs in issue #20.
      
      ## small updates
      
      * update CMake rules for finding libunwind, because it broke for some reason.
      * add `binary_find` and unit tests to the algorithms library
          * returns an iterator, as opposed to `std::binary_search`, which returns a boolean.
          * works with ranges.
      * added `subrange_view` specialization that takes a subrange specified by a pair of indexes
      * added `assign_from` to range utils
          * a helper function that returns a proxy type that can be copied into a container
          * evaluate a range and store contents in a container, with minimal verbosity in user cod...
      fbe3f45a
    • Vasileios Karakasis's avatar
      Cyclic iterators and cyclic range views (#119) · 06be3ec6
      Vasileios Karakasis authored and Sam Yates's avatar Sam Yates committed
      Add cyclic iterators and cyclic range view.
      
      Cyclic iterators wrap around when the reach the end of the underlying range over which they are defined.
      06be3ec6
  6. Dec 09, 2016
    • Alexander Peyser's avatar
      Add initializer_list version for is_in in modccutil.hpp (#122) · 368d3284
      Alexander Peyser authored and Sam Yates's avatar Sam Yates committed
      Fix `is_in` compilation error with initializer lists and clang 3.7.1.
      
      Addresses part of issue #121: `template <typename T, int N> bool is_in(T thing, const T (&list)[N])` fails to match against an initializer list second argument with clang-3.7.1 in `modcc/cprinter.cpp`.
      
      * Add overload `template <typename T> bool is_in(T thing, const std::initializer_list<T> list) ` for `is_in` in `modccutil.hpp`. Fixes clang issue and verified to work with a version of gcc as well.
      368d3284
  7. Nov 30, 2016
    • Sam Yates's avatar
      Work around xlC 13.1.4 compiler bugs. (#115) · d73f2240
      Sam Yates authored
      Addresses in part issue #113.
      
      * Make compatibility wrappers/functions that dance around xlC
        bugs. Wrappers are provied in `util/compat.hpp` and live in
        the `compat` namespace.
            - `compat::end` reimplements `std::end` but in a way that
      	apparently does not trigger the xlC bug.
            - `compat::compiler_barrier_if_xlc_leq()` inserts a compiler
      	reordering barrier if the compiler is xlC and the version
      	less than or equal to that specified. Name is deliberately
      	verbose.
            - `compat::isinf()` is an inline wrapper around `std::isinf()`,
      	which apparently is sufficient to defuse an evaluation
      	order bug with `std::isinf()` in switch statements.
      * Use `compat::compiler_barrier_if_xlc_leq()` in `util::unitialized`
        reference access methods to avoid improper reordering with -O2.
      * Use `compat::isinf()` in `test_math.cpp` to defuse improper
        reordering within `EXPECT_EQ` gtest macro of `std::isinf()`.
      * Use `compat::end()` in `util::back()` and `util::cend()` to avoid
        incorrect `std::end()` behaviour with -O2.
      * Use `util::cend()` in `algorithms::sum()`, again to avoid
        incorrect `std::end()` behaviour with -O2.
      d73f2240
  8. Nov 29, 2016
  9. Nov 25, 2016
    • Sam Yates's avatar
      Add KINETIC block rewriter (issue #63) (#95) · 4e229b01
      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
      4e229b01
    • Ben Cumming's avatar
      Bug/issue#97 (#102) · db5a7362
      Ben Cumming authored and Sam Yates's avatar Sam Yates committed
      This addresses all of the compiler warnings and errors for xlc when compiled at -O0. There are still compiler bugs when compiling with higher optimization levels, however they are more challenging.
      
      * Ignore the incorrect `-Wno-missing-braces` warnings (similarly to Clang).
      * Remove `-qhalt=e flag` inserted by CMake.
      * Remove redundant comparison of char to EOF in lexer.
      * The XLC compiler was crashing inexplicably on one call of the following method:
         ```void run(..., const std::vector<float>& excl={}) {...}```
        This was fixed by not having a default value for the last argument.
      * Add some curly braces to silence warning for dangling else.
      
      fixes #97
      db5a7362
    • Sam Yates's avatar
      Correct pointer casting operations in `uninitialized` (#101) · 62b57271
      Sam Yates authored
      Correct pointer casting operations in `uninitialized`: issue #100
      62b57271
  10. Nov 21, 2016
    • Ben Cumming's avatar
      fix modcc bug printing else branches (#93) · bc6bb3ba
      Ben Cumming authored and Sam Yates's avatar Sam Yates committed
      fixes #90
      
      The c and cuda printer were not printing else branches in if else statements.
      * added logic for printing else branches
      * added if-else expressions to data/test.mod
      
      No unit tests were added because we don't currently have a unit testing framework for the output mechanisms.
      bc6bb3ba
  11. Nov 16, 2016
    • Ben Cumming's avatar
      Feature/gpu validation issue #68 (#84) · 0aafd72d
      Ben Cumming authored and Sam Yates's avatar Sam Yates committed
      Fixes #68
      Corresponding feature: #67
      
      * Reproduce the hh-soma validation test on GPU.
      * Reproduce the ball and stick model on GPU.
      * Reproduce miniapp spike chains.
      * Add `cell_group` unit test to the cuda unit tests: builds simple ball and stick model and integrates for 50ms and records how many spikes occur; it is a simple early warning that something is broken, but is no substitute for the validation tests.
      * Update the `validate_soma`, `validate_ball_and_stick` and `validate_synapses` validation tests for the GPU backend:
          * refactor individual tests into test runner functions that are templated on lowered cell type;
          * for each of the original validation tests add a cuda (.cu) implementation, and write an additional "backend" field to the validation trace metadata.
      * Use a `CPrinter` to generate the same `net_receive` block that is used for the multicore backend.
        Note: this is not efficient, because each read/write requires a cuda memcpy betwe...
      0aafd72d
    • Sam Yates's avatar
      Bugfix/issue 82 (#83) · a8aa3f03
      Sam Yates authored
      Fixes #80
        * Avoid ctor ambiguity by using parentheses for copy ctor invocation with `nlohmann::json` class.
      
      Fixes #82
      a8aa3f03
  12. Nov 15, 2016
  13. Nov 14, 2016
    • Ben Cumming's avatar
      First GPU support (#77) · 97e17b18
      Ben Cumming authored
      This PR is part of the gpu feature merge. The GPU implementation is not implemented here. Instead, we focus on refactoring of the original "multicore" back end so that it is ready for adding the GPU back end.
      
      This is a big and messy change, for which I am sorry.
      
      ## build System
      
      - A `WITH_CUDA` option has been added to the main CMakeLists. This finds the CUDA toolkit, and sets CUDA compiler flags, and will build unit tests for the gpu back end.
      - The CMakeLists that generates mechanisms with modcc has been updated to generate CUDA mechanisms.
      - the library is now named `libnestmc` instead of `libcellalgo`
      - merge the external libraries that are optionally linked againts (tbb, libunwind, etc) into a single
        `EXTERNAL_LIBRARIES` list for ease of linking
      
      ## modcc
      
      - the cprinter and cudaprinter have had small changes to generate mechanism files that are compatible with the refactored library.
      
      ## algorithms
      
      - the indexes into algorithm was "rangified". An algori...
      97e17b18
    • Ben Cumming's avatar
      Add simple KINETIC block parsing (#71) · 4fcf4e57
      Ben Cumming authored
      Targets issue #62.
      
      New tokens added:
      
      keywords tok::kinetic, tok::conserve;
      symbols tok::tilde, tok::arrow;
      split tok::number into tok::real and tok::integer (stoichiometric expressions may have only integer coefficients).
      New expression sub-types added, together with parsing:
      
      IntegerExpression (derives from NumberExpression);
      ReactionExpression — represents a line of the form "~ a + b <-> c (f, r)";
      StoichTermExpression — represents a single term in the lhs or rhs of a reaction as an integral coefficient and identifier, for example "3c" or "-2 sp2";
      StoichExpression — represents a possibly empty series of StoichTermExpressions, corresponding to the lhs or rhs of a reaction, or the lhs of a CONSERVE declaration;
      ConserveExpression (derives from BinaryExpression) — represents a line of the form "CONSERVE a + 2b - c = expr".
      Unit tests added for parsing and lexing of the above, with some clean up of the testing code:
      
      verbose testing selectable at run time with -v, instead of being a compile time decision;
      code duplication reduced in test_parser.cpp through the use of helper functions check_parse and check_parse_fail;
      handle verbose output from lexer tests by subclassing the lexer; additionally, emit tokens from Lexer::parse() in verbose output.
      4fcf4e57
    • Sam Yates's avatar
      Tighten number lexing · 584c70fe
      Sam Yates authored
      * Tokenize strings of the form "7E+X", "2.3E " etc as a number
        (integer, real) followed by a new token starting with 'E'.
        Note that this makes the string "1.2E3E4" no longer cause a
        lexer error status.
      * Add tests for corresponding numeric disambiguation in
        `text_lexer.cpp`.
      * Add tests for stoichiometric expressions that ensure that only
        otherwise ambiguous phrases such as "7E+2F" fail to parse
        ("7E+F" should parse correctly as a stoich expression.)
      * Add missing comma in list of 'good' expressions in
        the `Parser.parse_line_expressions` test.
      584c70fe
  14. Nov 07, 2016
    • Sam Yates's avatar
      Add support for CONSERVE parsing. · 3850c41a
      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`.
      3850c41a
  15. Nov 04, 2016
    • Sam Yates's avatar
      Add lexing, parsing for KINETIC, reactions · 4587836e
      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.)
      4587836e
    • Ivan Martinez's avatar
      Omp (#38) · 0ded25a6
      Ivan Martinez authored
      * first version of openmp threading back end
      
      * adding openmp parallel sort implementation
      
      * OpenMP sort working
      
      * Support for units syntax within state block.
      
      * Add soma-less cable cell to test cells.
      
      Also:
      * Ensure intrinsic and passive properties properly set on test cells.
      
      * Change bulk resistivity default.
      
      * Align defaults with values used in most of the NEURON
        validation scripts.
      * Use consistent 100 Ω·m bulk resistivity across both
        NEURON test models and basic validation cells.
      
      * OpenMP back end working
      
      * Add Extrae+paraver support, needs to fix compilation warnings
      
      * Reorganize validation data generation
      
      * Move generation and data to top-level validation directory.
      * Make BUILD_VALIDATION_DATA and VALIDATION_DATA_DIR cache vars.
      * Add helper CMake functions for data generation.
      
      Note `validation/ref/numeric/foo.sh` is just a placeholder.
      
      * Bugfix: hh_soma.jl
      
      * Use consistent scaling for y[1] scalar voltage in hh_soma.jl
      * Also: add more reserved target names to CMakeLists.txt
        helper function.
      
      * Refactor convergence tests; add numeric soma ref.
      
      * Amend data directory path in validation tests.
      * Enmodulate `hh_soma.jl`
      * Add HH channel reference data generations script.
      * Switch `validate_soma.cpp` to numeric reference data.
      * Consolidate common code in `validate_ball_and_stick.cpp`
      * Add (nearly) Rallpack1 validation test (see below).
      * Gentle failure on absence of reference data in
        `validate_ball_and_stick.cpp`
      
      Can't yet override mechanism default parameter values,
      so the cable cell model added to `test_common_cells.hpp`
      lets the default stand; validation script will have
      to use the default membrane conductance rather than that
      given by Rallpack1.
      
      * Add Rallpack1 validation, plus bugfix, clean
      
      * Implement Rallpack1 validation test (with a workaround
        for inability to set membrane conductance).
      * Fix bug in L≠1 case in PassiveCable.jl (this may still be
        wrong).
      * Fix bug in peak delta computation in trace analysis when
        both traces have no local maxima.
      * Gentle failure on missing `numeric_soma.json`
      * Allow multiple `-s` selection operations for `tsplot`,
        acting disjunctively.
      
      * Remove errant test file.
      
      * file's cleanup
      
      * Remove tabs
      
      * Use correct routine in numeric_rallpack1.jl x0.3
      
      * Configure-time test for julia
      
      * `math::infinity<>()` wrapper for infinity
      
      * Use name `i_e` for Stim current density
      
      * Use `math::infinity<>()` for infinite value
      
      * Adds unit tests for the STATE block.
      
      * Add "lib" to search prefixes for libtbb
      
      * Fix quoting error in library search.
      * Add "lib" to prefixes when system is "Linux".
      
      * Address deprecated use of 'symbol' warning.
      
      Julia 0.5 deprecates use of `symbol` instead of
      `Symbol`. This patch just substitutes the
      correct call.
      
      * Address deprecated use of 'symbol' warning.
      
      Julia 0.5 deprecates use of `symbol` instead of
      `Symbol`. This patch just substitutes the
      correct call.
      
      * Addresses PR comments.
      
      * Unit tests for math.hpp
      
      * Tests for `math::pi`, `math::lerp`, `math::area_frustrum`
        and `math::volume_frustrum`
      * Fix `math:pi<long double>()`.
      
      * Extend range, view functionality.
      
      * New `filter` view: lazily selects based on predicate.
      * Generic `front` and `back` for sequences.
      * New rangeutil STL wrappers `stable_sort_by`, `all_of`, `any_of`.
      * Consolidate common utility unit testing structures into
        `tests/unit/common.hpp`
      
      * Add `ball_and_squiggle` model; fix `ball_and_taper`.
      
      * Make `test_common_cells.hpp` and `ball_and_taper.py` agree.
      * Add `ball_and_squiggle` model that has a tapering undulating
        profile.
      
      * Address PR#46 review comments.
      
      * Add documentation of template parameters for `filter_iterator`.
      * Document use of `uninitalized<F>` for holding functional objects
        in `filter_iterator` and `transform_iterator`
      
      * Consolidate validation test code (issue #41)
      
      * Simplify trace analysis and reporting code in
        `trace_analysis.hpp`
      * Consolidate convergence test run procedures into
        new class `convergence_test_runner`.
      
      * New compartment info structure for FVM.
      
      * Make `algorithm::sum`, `algorithm::mean` more generic,
        allowing use with array types.
      * Add `div_compartment` compartment representation, that
        holds geometric information for each half of a compartment
        that will then be used in calculating control volumes.
      * Add three compartmentalisation schemes/policies that
        discretize a segment into `div_compartment` objects:
          * `div_compartment_by_ends` divides based only on the
            segment end points and radii.
          * `div_compartment_sampler` forms frusta by sampling
            the segment radius at each compartment boundary
          * `div_compartment_integrator` computes the compartment
            areas and volumes exactly by summing all frustra
            in the intersection of the segment and the compartmnet
            span.
      
      * Extrae linked at execution time
      
      * cleaning project
      
      * Complex compartments
      
      * Use divided compartments to determine FVM coefficients.
      * Pick correct control volume in FVM from sgement position (avoids
        off-by-half error.)
      * Add colour override functionality to tsplot: `--colour` option.
      * Add const accessor for cell soma.
      * Source formatting, comments in `math.hpp`
      * Fix `range_view`: was using incorrectly named type trait.
      * Add unit test for `range_view`.
      * Allow points of discontinuity to be omitted from L-infinity norm
        calculations.
      * Add `-d, --min-dt` option to `validate.exe` to control time
        step in validation convergence tests.
      * Add validation test: confirm divided compartment policy does
        not effect results on simple frustrum dendrites.
      * Change default max compartments on validation tests to 100
        (ad hoc observed convergence limit at dt circa 0.001 ms;
        finder spatial division would required much finer dt.)
      * Make NEURON validation data generation scripts use CVODE by
        default, and with `secondorder=2` when non-zero `dt` is given.
      
      * Remove division policy type parameter.
      
      * Use only `div_compartment_integrator` for compartmentalization in
        `fvm_multicell`. The policy will later be moved to a backend
        policy class.
      * For now, disable validation tests that test different division
        policies (see above).
      * Tweak comments and remove redundant `using`, following comments
        on PR#54.
      
      * Minor twicks and corrections
      0ded25a6
  16. Oct 31, 2016
    • Sam Yates's avatar
      Add parsing support for KINETIC blocks - WIP · bcbff7df
      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.
      bcbff7df
    • Ben Cumming's avatar
      Merge pull request #54 from halfflat/feature/complex-compartments · e8d32855
      Ben Cumming authored
      Complex compartments
      e8d32855
    • Sam Yates's avatar
      Remove division policy type parameter. · 5aeea90d
      Sam Yates authored
      * Use only `div_compartment_integrator` for compartmentalization in
        `fvm_multicell`. The policy will later be moved to a backend
        policy class.
      * For now, disable validation tests that test different division
        policies (see above).
      * Tweak comments and remove redundant `using`, following comments
        on PR#54.
      5aeea90d
  17. Oct 30, 2016
    • Sam Yates's avatar
      Complex compartments · e7a8fb6f
      Sam Yates authored
      * Use divided compartments to determine FVM coefficients.
      * Pick correct control volume in FVM from sgement position (avoids
        off-by-half error.)
      * Add colour override functionality to tsplot: `--colour` option.
      * Add const accessor for cell soma.
      * Source formatting, comments in `math.hpp`
      * Fix `range_view`: was using incorrectly named type trait.
      * Add unit test for `range_view`.
      * Allow points of discontinuity to be omitted from L-infinity norm
        calculations.
      * Add `-d, --min-dt` option to `validate.exe` to control time
        step in validation convergence tests.
      * Add validation test: confirm divided compartment policy does
        not effect results on simple frustrum dendrites.
      * Change default max compartments on validation tests to 100
        (ad hoc observed convergence limit at dt circa 0.001 ms;
        finder spatial division would required much finer dt.)
      * Make NEURON validation data generation scripts use CVODE by
        default, and with `secondorder=2` when non-zero `dt` is given.
      e7a8fb6f
  18. Oct 28, 2016
  19. Oct 27, 2016