Skip to content
Snippets Groups Projects
  1. Dec 12, 2022
    • boeschf's avatar
      Sde Tutorial (#2044) · abbf6bbd
      boeschf authored
      Implementation of stochastic calcium plasticity curves, originally
      authored by Sebastian Schmitt @schmitts, and adapted here for Arbor
      inclusion.
      - python example plasticity_stdp.py
      - stochastic mechanism calcium_based_synapse.mod
      - tutorial
      
      Closes #1987
      abbf6bbd
  2. Nov 21, 2022
    • Thorsten Hater's avatar
      :zap: Voltage Processes (#2033) · b63cca1c
      Thorsten Hater authored
      Add the VOLTAGE_PROCESS mechanism kind to modcc, allowing for direct writing to the membrane voltage
      Obviously these are extremely sharp tools and can break the cable model, so we add some constraints to their
      use (see docs). Still, user discretion is required.
      
      As a sneak peek for what this might be useful for
      
      * implementing voltage clamps
      * limiting membrane voltage (irritatingly also a kind of clamping)
      * faking ABSTRACT_CELL like behaviour (although that might require a bit more work)
      
      Closes #1343
      b63cca1c
  3. Nov 15, 2022
    • boeschf's avatar
      SDE examples (#2030) · 1b268ecf
      boeschf authored
      Addresses #1987
      
      * reproducibility test for random number generator
      * C++ example demonstrating Ornstein-Uhlenbeck process
      * Python example featuring stochastic mechanism
      * stochastic mechanism catalogue
      
      The Python example is contributed by Jannik Luboeinski's (@jlubo): https://github.com/jlubo/arbor_ou_lif_example
      and adapted to fit into Arbor.
      1b268ecf
  4. Sep 20, 2022
    • Thorsten Hater's avatar
      generate-catalogue is gone (#1975) · 04762cf2
      Thorsten Hater authored
      This is prep for meson in addition to simplifying (ie reducing) the amount of scripting
      we have. In the long run, I'd like to remove `BuildModules.cmake` too, but this might
      be superseded by meson and this PR is self-contained.
      
      # Changes
      - `modcc` accepts now a list of NMODL files
      - likewise, `modcc` is now able to spit out a catalogue.cpp file
      - remove the `generate-catalogue` script, simplify a-b-c
      - remove some options from `modcc` we never use
      - No longer allow external modcc
      04762cf2
  5. Jun 21, 2022
    • Thorsten Hater's avatar
      Ionic Diffusion along the Morphology · 4a305b4f
      Thorsten Hater authored
      # Introduction
      
      Plasticity processes are mediated by signalling ions, eg Ca++, which are generated by 
      synapses upon reception of a spike. This adds a quantity `Xd` for any ion `X`
      - initialised as `Xi`
      - read from and written to by NMODL density and point mechanisms.
      - propagates according to a diffusion law `∂_t Xd = ∂_z c X ∂_z Xd + iX/qi`.
      - in contrast to `Xi` and `Xo` there's no buffering and the update in mechanisms
        occurs atomically (and at a different time)
      
      More details can be found in the documentation.
      
      For the future there are some low hanging optimisations
      - per-ion conductivity for the matrix solver could be disabled if no diffusion is computed
      - cable and diffusion solvers store duplicates of the solver state, could be merged
      
      Closes #1651 
      4a305b4f
  6. Jun 14, 2022
  7. Jan 24, 2022
    • Thorsten Hater's avatar
      More robust build-catalogue (#1784) · d0dc6bd7
      Thorsten Hater authored
      - build-catalogue
        - now installed by pip
        - enable GPU-backends
        - isolate from being installed in a non-default dir
        - rename to arbor-build-catalogue
        - allow hand-written C++ mechanisms to be linked in the same catalogue.
      - CMake
        - enable PIC on arbor always to allow linking to shared objects
        - use relative paths when configuring a-b-c, to make relocation less of a problem
      - Python
          - ensure a-b-c is installed by pip, along with headers and libarbor.a
          - throw errors if tools (cmake scripts, arbor package, modcc) missing
          - transition setup.py setuptools -> skbuild.
      - Wheels
          - Add NML2 support to wheels
          - scripts/build-wheels.sh builds wheels, in principle valid for submission to PyPI, on your own hardware. This should be kept in sync with .github/workflows/ciwheel.yml
          - scripts/patchwheel.py corrects the rpath in the libraries in the wheels, working around a bad interplay between auditwheel and skbuild, see pypa/auditwh...
      d0dc6bd7
  8. Oct 22, 2021
    • Nora Abi Akar's avatar
      Gap Junction mechanisms (#1682) · dc371e5d
      Nora Abi Akar authored
      Adds support for user-defined gap junction mechanisms. Fixes #1600.
      
      - API Change: Wrap `mechanism_desc` in one of `density`, `synapse`, `junction` to be able to differentiate the kind of placed mechanism between point and junction mechanisms. 
      - API Change: The `ggap` parameter of a `gap_junction_connection` renamed to `weight` and is not a unit-less parameter. 
      - Mechanism ABI change: New `peer_index` vector which stores the indices of the peer sites of a gap-junction-connection. New mechanism kind. 
      - Internal API change: `shared_state` no longer controls the gap junction current contribution, that is now handled in the mechanism callbacks.
      - Modcc change: Add `JUNCTION_PROCESS` and `v_peer` keywords to nmodl, the first to identify a gap-junction mechanism, the second to access the peer voltage of a gap-junction connection. Modify modcc to be able to compile nmodl and generate correct code.
      - Behavior change: gap-junctions now contribute to both the current and conductance of a CV as opposed to just the current.
      - Add new "gj" mechanism, to replace the built-in constant-conductance based linear gap-junction implementation.
      - Fix unit tests.
      - Fix python wrapper. 
      - Fix docs. 
      dc371e5d
  9. Jul 29, 2021
    • thorstenhater's avatar
      Implement mechanism ABI · ff12bb82
      thorstenhater authored
      Implements #1376.
      
      * Provide a common C linkage ABI for externally compiled mechanisms, for both CPU and GPU.
      * Remove mechanism type hierarchy (`concrete_mechanism` etc.), and move corresponding functionality to the back-end shared state objects. Mechanism catalogue is no longer indexed by type id.
      * Distinguish between SIMD optimal alignment and SIMD width with new `min_align` attribute. Mechanisms provide both pieces of information via ABI.
      ff12bb82
  10. Jun 23, 2021
    • Benjamin Cumming's avatar
      Add optional target-specific configuration for CMake (#1586) · bcd2ca1e
      Benjamin Cumming authored
      - Add an optional CMake option `ARB_CXX_FLAGS_TARGET` for setting target-specific flags to use when compiling for the target architecture (not applied to compilation of modcc).
      - If `ARB_ARCH=="none"` CMake will not add architecture-specific `mtune/march/mcpu` flags
      - Remove `ARB_CXXOPT_ARCH` from the installed `arbor-config.cmake`, and replace with more general `ARB_CXX_FLAGS_TARGET`.
      - Update spack `package.py` to use this feature to pass custom flags.
      
      Fixes #1519
      Fixes #1522 
      
      Replaces PR #1518 
      bcd2ca1e
  11. Feb 19, 2021
  12. Feb 11, 2021
  13. Feb 03, 2021
    • thorstenhater's avatar
      Allow dynamically creating and loading of mechanism catalogue (#1287) · aa1b6f04
      thorstenhater authored
      First phase of dynamically loaded mechanism catalogues.
      
      - Add functionality to load and use catalogues from DSOs in Python and C++.
      - Add documentation and support scripts to build catalogues DSOs.
      - Re-factor CMakeLists.txt for mechanisms
      - Limitations
        - Needs (compatible, preferably identical) arbor sources when building catalogues
        - Can only work on MacOS and Linux (uses dlfnc)
      aa1b6f04
  14. Nov 06, 2020
  15. Oct 09, 2020
  16. Jul 13, 2020
    • thorstenhater's avatar
      Python/allen catalogue (#1074) · 6151e173
      thorstenhater authored
      * Add import method for mechanism catalogues, allowing mechanisms from a second catalogue to be incorporated with a prefix, together with Python interface.
      * Expose `global_allen_catalogue`.
      * Extend unit tests to cover mechanism catalogue import and check for name collision error cases.
      6151e173
  17. Jun 24, 2020
  18. Apr 15, 2020
    • Nora Abi Akar's avatar
      Compile arbor for AMD and Nvidia GPUs using clang (#1007) · 90a1e6d7
      Nora Abi Akar authored
      - Add option to compile Arbor for HIP/CUDA backend using Clang. 
      - Add new CMake option `ARB_GPU_COMPILE_TYPE` to distinguish between three possible gpu platforms/builds: `cuda-nvcc`; `cuda-clang`; `hip-clang`
      - Add gpu wrapper functions in `arbor/backends/gpu/gpu_api.hpp` and `arborenv/gpu_api.hpp` which call HIP/CUDA functions depending on the platform
      - Rename functions and files: cuda -> gpu
      - Add downgraded warp primitives for HIP
      - Implement `uuid` workaround for HIP
      - Set correct alignment and warp size for AMD gpus
      - Update installation guide and docs.
      - Update pip/setuptools to support new gpu targets
      
      Fixes #833
      90a1e6d7
  19. Jul 29, 2019
    • Sam Yates's avatar
      New revpot and per-cell/segment parameters. (#823) · fd4f4def
      Sam Yates authored
      * Collect cable cell parameter setting structures into `include/cable_cell_param.hpp`.
      * Restructure electrical specifications (axial resistance, membrane capacitance) and ionic concentrations and reversal potentials on cable cells, so that these can be specified with a global default, per-cell defaults, and per-segment values.
      * Allow reversal potentials to be set by a mechanism of a new kind 'revpot', which are prohibited from maintaining state or writing to any shared state other than ionic reversal potentials.
      * Specify reversal potential mechanisms as global defaults or per-cell. Reversal potential mechanisms may not be specified at the level of a segment in order to avoid non-linearities arising from the discretization.
      * Supply default cable cell parameter data that matches NEURON values (this is _not_ used by default).
      * Replace the d_lambda calculation with one that approximates more faithfully the effect of tapered segments, and which will use the electrical values inherited by cell or global defaults.
      * Supply a bundled mechanism 'nernst' that replaces the previous hard-coded Nernst potential calculation, for use (together with ion rebinding) in the new ion description scheme.
      * All ions used in a cable_cell model must be present in the top level global parameter table, together with their charge.
      * Extend semantics of external variables in modcc, to permit direct assignment (as opposed to just += or -=.)
      * Extend `util::binary_search_index` to allow for a projection functional analagous to other range utilites.
      * Add documentation on the cable cell API, sketching over many of the details, but describing in particular the interface changes for default parameters and reversal potential behaviour.
      * Adjust pyarb for new API
      * Hard code global cable cell properties in the python recipe shim to useneuron default parameters.
      fd4f4def
  20. Aug 20, 2018
    • Sam Yates's avatar
      Global temperature for NMODL mechanisms. (#565) · fa0d7aef
      Sam Yates authored and Benjamin Cumming's avatar Benjamin Cumming committed
      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
      fa0d7aef
  21. Jul 10, 2018
  22. Jun 25, 2018
    • Sam Yates's avatar
      Feature/lib install target part i (#506) · ad1c78ab
      Sam Yates authored and Benjamin Cumming's avatar Benjamin Cumming committed
      CMake and build refactoring
      
      *   Use CUDA as first-class language (leading to CMake 3.9 minimum version requirement).
      
      *   Use 'modern CMake' interface libraries for compiler options, include file and library dependency tracking. Interface library targets:
          * `arbor-deps`: compiler options and library requirements for the `libarbor.a` static library, as governed by configure-time options and environment.
          * `arbor-private-headers`: include path for non-installed headers, as required by unit tests and arbor itself.
          * `arbor-aux`: helper classes and utilities used across tests and examples.
          * `ext-json`, `ext-tclap`, `ext-tbb`, `ext-benchmark`, `ext-sphinx_rtd_theme`: externally maintained software that we include (directly or via submodule) in the `ext/` subdirectory.
       
      *   Single static library `libarbor.a` includes all built-in modules and CUDA objects.
      
      *   Simply configuration options:
          *  `ARB_WITH_TRACE`, `ARB_AUTORUN_MODCC_ON_CHANGES` `ARB_SYSTEM_TYPE` removed.
          * External `modcc` is provided by `ARB_MODCC` configuration option; if provided `modcc` is still buildable, but is not included in the default target.
          * `ARB_PRIVATE_TBBLIB`, defaulting to `OFF`, instructs the build to make TBB from the included submodule.
      
      *   Extend `ErrorTarget` functionality to provide a dummy target or an error target based on a condition.
      *   Generate header version defines and library version variables based on git status and project version, via new script `include/git-source-id`.
      *   All generated binaries now placed in `bin/` subdirectory at build.
      *   Install targets installs: public headers (incomplete); static library; `modcc` tool; `lmorpho` executable; `html` documentation (examples, tests and validation data are currently not installed).
      *   Executable targets have had the `.exe` suffix removed; unit tests are labelled `unit` (arbor unit tests), `unit-modcc` (modcc unit tests), `unit-local` (distributed tests with local context), `unit-mpi` (distributed tests with MPI context).
      *   More graceful handling of configure-time detection of `nrniv`, Julia and required Julia modules for validation data generation.
      *   Add `cmake/FindJulia.cmake`, `cmake/FindTBB.cmake`  package finders, and adjust `cmake/FindUnwind.cmake` to use link library-style properties.
      *  Adjust travis script to test `unit-local` and `unit-mpi` if appropriate.
      *  Simply documentation `conf.py`.
      
      Source relocation and reorganization
      
      * All external project sources and files moved to `ext/`.
      * Source code refactoring to decouple library-using code from the configure-time definitions that govern arbor behaviour: removes conditional code in public headers that depends upon `ARB_WITH_X`-type definitions at compile time. Affected code is is in the public interfaces for MPI, the threading implementation, and the profiler.
      * Remove `util/debug.hpp`; split out functionality for pretty-printing from assertion handling.
      * Make FVM cell non-physical voltage check a run-time cell-group parameter.
      * Move spike double buffer implementation to `simulation.cpp`.
      * Make timer utility wrap POSIX `clock_gettime` independent of threading configuration.
      * Make `mpi_error` derive from `system_error` and follow C++11 `system_error` semantics.
      * `EXPECTS` macro replaced by `arb_assert` macro.
      * JSON dependency removed from `libarbor.a` and header files: moved to auxiliary library.
      * Publicly visible macros garner an `ARB_` prefix as required.
      * Move SWC test file to `test/unit` directory.
      * Work-in-progress splitting of public from private includes: as a convention not entirely adhered to as yet, private headers within arbor source are included with `""`, public headers with `<>`.
      
      Modcc interface changes
      
      * Expose via `--namespace` option the functionality that sets the namespace in generated code.
      * Use `--profile` option to add profiler hooks to generated code; uses public function interface directly rather than `PE/PL` macros in order to avoid public `PE` and `PL` defines.
      ad1c78ab
  23. May 09, 2018
    • Sam Yates's avatar
      Mechanism Refactor: multicore and simd (#484) · 68135148
      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.
      68135148
  24. Dec 20, 2017
    • Ben Cumming's avatar
      Add granule cell mechanisms (#421) · a80df6fa
      Ben Cumming authored and Sam Yates's avatar Sam Yates committed
      * 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.
      a80df6fa
  25. Nov 29, 2017
    • Ben Cumming's avatar
      support ion species concentration updates (#398) · fa7d99b6
      Ben Cumming authored and Sam Yates's avatar Sam Yates committed
      * Add querying methods to modcc ion species type to simplify code generation.
      * Add `WriteBack` type that records per-mechanism ion usage metadata.
      * Add `write_back` implementation for C and CUDA printers that adds weighted concentration
        contributions to global concentration fields.
      * Extend `uses_ion` interface to provide information about which concentration fields are modified by mechanisms.
      * Update `update_ion_symbols` lambda that is responsible for adding metadata about interactions between mechanism fields and external ion species fields, creating a write-back when the mechanism field is a state variable or an indexed variable if it is a current/reversal potential, or else an error.
      * Add `test_ca.mod` mechanism that writes calcium ion concentration for testing purposes.
      * Add back-end callbacks that initialize concentration values.
      * Update `mechanism::uses_ion()` to return information regarding mechanism ion concentration updates.
      * Add `mechanism::write_back()` method.
      * Update stimulus mechanism specialization to use new mechanism interface.
      * Update `ion` type to calculate default concentration contributions in CVs where the concentration is only partially determined by mechanisms.
      * Update `fvm_multicell` to calculate the default ion concentration weights.
      * Add unit test for ion concentration weight determination.
      
      Fixes #373 
      fa7d99b6
  26. Nov 28, 2017
    • Sam Yates's avatar
      Tidy `modcc` driver, remove optimize flag. (#404) · 998ee724
      Sam Yates authored
      * Remove optimization option (use SIMD options for vectorization).
      * Remove arbor utility library dependencies from modcc (pending separation of utility lib from arbor lib source).
      * Split target (cpu, gpu) specification from vectorization architecture (avx2, avx512).
      * Remove `Options` singleton; replace with structure local to `modcc.cpp`.
      * Tidy `modcc` option parsing and main function; allow a single invocation of `modcc` to generate code for multiple backends.
      * Rename generated sources to include backend target in filename.
      * Always run a constant simplification pass on generated procedures.
      * Remove file i/o code from `Module` and `modcc` main function; move functionality to new functions in `io` namespace. (Note: in on-going mechanism revamp, other i/o utility code will reside in the `io` namespace and subdirectory.)
      * Remove classes `ConstantFolderVisitor` and `ExpressionClassifierVisitor` that are no longer used.
      * Modify CMakeLists.txt files, `backends/*/fvm.cpp` to reflect the new filenames of generated sources.
      * Small formatting changes in `modcc` source to reflect coding guidelines (incomplete).
      998ee724
  27. Sep 28, 2017
    • Sam Yates's avatar
      Rename NestMC references, names etc. to Arbor. (#363) · d9f38b2a
      Sam Yates authored
      * Use ARB_ and arb_ as variable prefixes in place of NMC_ and nmc_.
      * Replace references to 'NestMC' and 'NEST MC' to refer instead to Arbor.
      * Use 'arbor' as the sim name in generated validation data.
      * Reflow long-line paragraphs in `tests/ubench/README.md`.
      * Change names of CUDA mechanism and CUDA kernel libraries to include arbor name.
      d9f38b2a
  28. Sep 25, 2017
    • Ben Cumming's avatar
      Finish Seperable CUDA compilation (#356) · ddbece13
      Ben Cumming authored and Sam Yates's avatar Sam Yates committed
      Separate compilation for all CUDA code.
      
      * Move all CUDA kernels to their own .cu files, together with C++ function wrappers.
      * Compile all CUDA .cu files to a single static library.
      * Merge gpu and multicore backend validation tests.
      * Simply and clean up cruft from CMakeLists.txt files.
      ddbece13
  29. Sep 21, 2017
    • Ben Cumming's avatar
      Seperable compilation of mechanism kernels on GPU (#353) · 3c283219
      Ben Cumming authored and Sam Yates's avatar Sam Yates committed
      Separable compilation of the CUDA kernels generated by modcc from NMODL files.
      
      CMake scripts:
      * Update the `build_modules()` helper function to cleanly handle calls to modcc that generate multiple output files.
      * Add a new library target `gpu_mechanisms` for the separately compiled CUDA kernels and the implementation of their C wrappers.
      * Reduce verbosity of compilation messages.
      
      * Simplify mechanism C++ namespace use: move everything in nest::mc::mechanisms::gpu::_mechanism-name_ into `nest::mc::gpu`, and similarly for multicore mechanism implementations, ions.
      * Remove template parameters for `value_type` and `size_type` from all of the 
      mechanism implementations, and use `fvm_value_type` and `fvm_size_type` everywhere instead.
      
      modcc changes:
      * Modify `CUDAPrinter` to keep track of 3 text buffers, one each for 
        "implementation", "interface" and "implementation interface":
      * Write the CUDA implementation interface to `X_impl.hpp`, comprising the definition of the mechanism-specific 'X_ParamParck' struct used to pass function arguments to the CUDA kernels.
      * Write the CUDA kernels and C wrappers to `X_impl.cu`.
      * Write the public C++ mechanism interface (with calls to implementation wrappers) to `X.hpp`.
      * Modify modcc driver to support multiple generated output files.
      3c283219
  30. Jun 15, 2017
  31. Jun 14, 2017
  32. Mar 31, 2017
    • Sam Yates's avatar
      Add more general indirect access view. (#216) · ca328a21
      Sam Yates authored
      * Implement `indirect_view` for indexed access via `transform_view`.
      * Extend `transform_iterator` to permit non-const access to reference-returning functor results.
      * Replace use of `indexed_view` with `indirect_view`.
      * Fix missing cpu target for vectorized modcc outputs.
      ca328a21
  33. Mar 20, 2017
    • Vasileios Karakasis's avatar
      modcc: AVX512 vectorisation backend (#154) · c55d9d66
      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. 
      c55d9d66
  34. Mar 15, 2017
    • Sam Yates's avatar
      Allow explicit make of GPU mechanisms. (#192) · 195befaa
      Sam Yates authored
      When NMC_WITH_CUDA is off, still allow the generation
      of CUDA mechanisms with modcc by exposing the
      `build_all_gpu_mods` target; this can be performed
      independently of the presence (or otherwise) of a
      CUDA development environment.
      
      This eases development of GPU-related modcc tasks,
      as preliminary work can be performed and checked on
      machines without a CUDA environment.
      195befaa
  35. Mar 05, 2017
    • Sam Yates's avatar
      Add linear kinetic schemes to modcc. (#145) · 5846f90b
      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-facin...
      5846f90b
  36. Jan 12, 2017
    • John Biddiscombe's avatar
      CMake fixes (#137) · 71aa4b18
      John Biddiscombe authored
      * Fix CMakeLists to handle build as a subproject
      
      When several CMake generated projects are build together, it is common
      practice to have a 'superproject' CMakeLists that uses
        add_subdir(proj1)
        add_subdir(proj2)
        ...
      where each subproject is a self contained CMake based project
      (Example proj1=HPX, proj2=nestmc, proj3=another, ...)
      
      CMAKE_SOURCE_DIR always points to the top level directory which
      is the superproject dir in this case, whereas PROJECT_SOURCE_DIR
      always points to the root of the current project() in the CMakeLists
      so one shouod use PROJECT_SOURCE_DIR as this gets the relative paths
      correct.
      
      * Add option to turn off auto generation from *.mod files
      
      * Fix #134 : Change CMake WITH_OPTION to NMC_WITH_OPTION, compiler #define to NMC_HAVE_OPTION
      
      1) The user may select an option by saying NMC_WITH_XXX
      
      2) This may trigger CMake to use find_package(...) or setup some
      other variables. CMake can then set variable NMC_HAVE_XXX and add a
      what has actually been used.
      
      3) Code should use #ifdef NMC_HAVE_XXX to check for a feature
      
      Old CMake/define      New CMake                 Compiler #define
      ----------------      ---------                 ----------------
      THREADING_MODEL       NMC_THREAD_MODEL
          WITH_TBB          NMC_WITH_TBB              NMC_HAVE_TBB
          WITH_OMP          NMC_WITH_OMP              NMC_HAVE_OMP
          WITH_SERIAL       NMC_WITH_SERiAL           NMC_HAVE_SERIAL
      
      WITH_MPI              NMC_WITH_MPI              NMC_HAVE_MPI
      WITH_CUDA             NMC_WITH_CUDA             NMC_HAVE_CUDA
      WITH_GPU                                        NMC_HAVE_GPU
      WITH_ASSERTIONS       NMC_WITH_ASSERTIONS       NMC_HAVE_ASSERTIONS
      WITH_TRACE            NMC_WITH_TRACE            NMC_HAVE_TRACE
      WITH_PROFILING        NMC_WITH_PROFILING        NMC_HAVE_PROFILING
      
      Other user visible CMake vars
      -----------------------------
      VECTORIZE_TARGET            -> NMC_VECTORIZE_TARGET
      USE_OPTIIZED_KERNELS        -> NMC_USE_OPTIIZED_KERNELS
      BUILD_VALIDATION_DATA       -> NMC_BUILD_VALIDATION_DATA
      BUILD_JULIA_VALIDATION_DATA -> NMC_BUILD_JULIA_VALIDATION_DATA
      BUILD_NRN_VALIDATION_DATA   -> NMC_BUILD_NRN_VALIDATION_DATA
      VALIDATION_DATA_DIR         -> NMC_VALIDATION_DATA_DIR
      
      Variables such as NMC_THREADING_MODEL and NMC_VECTORIZE_TARGET now use
      enumerated cmake values so you can toggle between them in ccmake gui.
      SYSTEM_TYPE_CRAY/BGQ        -> NMC_SYSTEM_TYPE (Generic/Cray/BGQ)
      
      * Use generator expression for modcc path
      
      Some IDE's (like Xcode for example), override the CMake binary paths
      and add /Debug or /Release etc so rules that have hard coded paths
      to binaries will fail.
      71aa4b18
  37. Dec 20, 2016
    • 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
  38. Nov 15, 2016
    • Benjamin Cumming's avatar
      bugfix for missing mechanism paths · 0cc8c4c9
      Benjamin Cumming authored
      The mechansims/gpu and mechanisms/multicore paths were not being generated
      by CMake during configuration, and modcc was silently ignoring that it was
      not able to write to the nonexistant target paths.
      I have updated CMake to generate the missing gpu and multicore target paths.
      0cc8c4c9
  39. 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 algorithm `index_into_iterator` takes two ranges as inputs to make a range that lazily generates the index of sub into super set.
      
      ## backends
      
      - made a new path `src/backends/` for backend specific type and implementation code.
      - currently:
        - complete support for the `multicore` and `gpu` backends
        - `gpu` back end is not optimized or validated
      - the back end implementations are in `src/backends`
      - a single `backend` class, `nest::mc::{multicore,gpu}::backend`, is provides all backend specific type and implementation details fro each backend
        - storage containers
        - Hines matrix assembly for FVM method
        - Hines matrix solver
        - mechanism "factory"
      
      ## lowered fvm cells
      
      - removed `fvm_cell` because this can be modelled with an `fvm_multicell` with one cell.
      - refactored to use backend type and implementation from `fvm_policy`
      - use `std::vector` instead of containers in `nest::mc::memory::` where possible when building cells.
      
      ## memory library
      
      Refactor the "memory" library, making it much simpler and better integrated into the rest of the application. However, it is still far from perfect. The `Coordinator` approach needs to be improved, most likely by putting target-specific wisdom into pointers (which could obviate the need for a `const_array_view` type.
      1. renaming and moving
         - move from `vector/` to `src/memory`
         - move into the `nest::mc` namespace, i.e. all types and functions are now in `nest::mc::memory`
         - change from camel case nameing scheme to NestMC style naming.
      2. simplification
         - remove the CRTP cruft that was used to make operator overloading work for operations like copying from one range into another, and filling a range with a constant value. These have been replaced with `memory::fill()` and `memory::copy()` helper functions. This simplified the code _a lot_, and makes code clearer in user land.
         
         ```
         // before
         vec(0, 5) = other;
         // now
         memory::copy(other, vec(0, 5));
         ```
         - add some wrappers in `src/memory/wrappers.hpp` that help with making views. These are particularly useful for passing `std::vector` through interfaces that expect a view.
      
      ## debug backtraces
      
      Added stack traces for debugging.
      - support for OSX and Linux via libunwind
      - backtraces can be generated manually `nest::mc::util::backtrace().print()`
        - creates a new file and dumps trace into file
        - prints message to `stderr` with file name and instructions on how to analyse
      - backtraces are also automatically generated when an assertion `EXPECTS` statement fails
      - a python script in `scripts/print_backtrace` pretty prints the output with file name, line number and demangled symbols
      
      ## util simplification and consolidation
      
      The `src/util.hpp` file was removed
      - much of its contents were dead code and just removed
      - useful components like `pprintf` and `make_unique` were moved into the `src/utils` path in standalone files
      There was a lot of overlap between functionality provided in `src/memory/util.hpp` and existing functions/types in the `nest::mc::util` namespace. The `memory` implementations were removed, and their `nest::mc::util` counterparts used. There is still some work remaining, namely moving the rest of the `src/memory/util.hpp` into `src/util/...`
      97e17b18
  40. Oct 04, 2016