Full Code of BlueBrain/CoreNeuron for AI

master 3a49f4b85a97 cached
246 files
1.3 MB
346.3k tokens
928 symbols
1 requests
Download .txt
Showing preview only (1,367K chars total). Download the full file or copy to clipboard to get everything.
Repository: BlueBrain/CoreNeuron
Branch: master
Commit: 3a49f4b85a97
Files: 246
Total size: 1.3 MB

Directory structure:
gitextract_m67oskuu/

├── .bbp-project.yaml
├── .clang-format.changes
├── .cmake-format.changes.yaml
├── .github/
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug_report.md
│   │   ├── config.yml
│   │   └── feature_request.md
│   ├── problem-matchers/
│   │   ├── address.json
│   │   ├── gcc.json
│   │   └── undefined.json
│   ├── pull_request_template.md
│   └── workflows/
│       ├── clang_cmake_format_check.yaml
│       ├── coreneuron-ci.yml
│       ├── coverage.yml
│       └── test-as-submodule.yml
├── .gitignore
├── .gitlab-ci.yml
├── .gitmodules
├── .readthedocs.yml
├── .sanitizers/
│   └── undefined.supp
├── AUTHORS.txt
├── CMake/
│   ├── AddHpcCodingConvSubmodule.cmake
│   ├── AddMod2cSubmodule.cmake
│   ├── AddNmodlSubmodule.cmake
│   ├── AddRandom123Submodule.cmake
│   ├── CrayPortability.cmake
│   ├── GitRevision.cmake
│   ├── MakefileBuildOptions.cmake
│   ├── OpenAccHelper.cmake
│   ├── TestScriptUtils.cmake
│   ├── config/
│   │   ├── CompilerFlagsHelpers.cmake
│   │   ├── ReleaseDebugAutoFlags.cmake
│   │   ├── SetRpath.cmake
│   │   └── TestHelpers.cmake
│   ├── coreneuron-config.cmake.in
│   └── packages/
│       ├── FindSphinx.cmake
│       ├── Findlikwid.cmake
│       ├── Findnmodl.cmake
│       └── Findreportinglib.cmake
├── CMakeLists.txt
├── LICENSE.txt
├── README.md
├── coreneuron/
│   ├── CMakeLists.txt
│   ├── apps/
│   │   ├── coreneuron.cpp
│   │   ├── corenrn_parameters.cpp
│   │   ├── corenrn_parameters.hpp
│   │   └── main1.cpp
│   ├── config/
│   │   ├── config.cpp.in
│   │   ├── config.h
│   │   ├── neuron_version.hpp.in
│   │   └── version_macros.hpp
│   ├── coreneuron.hpp
│   ├── engine.h.in
│   ├── gpu/
│   │   ├── nrn_acc_manager.cpp
│   │   └── nrn_acc_manager.hpp
│   ├── io/
│   │   ├── core2nrn_data_return.cpp
│   │   ├── core2nrn_data_return.hpp
│   │   ├── file_utils.cpp
│   │   ├── file_utils.hpp
│   │   ├── global_vars.cpp
│   │   ├── lfp.cpp
│   │   ├── lfp.hpp
│   │   ├── mech_report.cpp
│   │   ├── mech_report.h
│   │   ├── mem_layout_util.cpp
│   │   ├── mem_layout_util.hpp
│   │   ├── mk_mech.cpp
│   │   ├── nrn2core_data_init.cpp
│   │   ├── nrn2core_direct.h
│   │   ├── nrn_checkpoint.cpp
│   │   ├── nrn_checkpoint.hpp
│   │   ├── nrn_filehandler.cpp
│   │   ├── nrn_filehandler.hpp
│   │   ├── nrn_setup.cpp
│   │   ├── nrn_setup.hpp
│   │   ├── nrnsection_mapping.hpp
│   │   ├── output_spikes.cpp
│   │   ├── output_spikes.hpp
│   │   ├── phase1.cpp
│   │   ├── phase1.hpp
│   │   ├── phase2.cpp
│   │   ├── phase2.hpp
│   │   ├── prcellstate.cpp
│   │   ├── prcellstate.hpp
│   │   ├── reports/
│   │   │   ├── binary_report_handler.cpp
│   │   │   ├── binary_report_handler.hpp
│   │   │   ├── nrnreport.cpp
│   │   │   ├── nrnreport.hpp
│   │   │   ├── report_configuration_parser.cpp
│   │   │   ├── report_event.cpp
│   │   │   ├── report_event.hpp
│   │   │   ├── report_handler.cpp
│   │   │   ├── report_handler.hpp
│   │   │   ├── sonata_report_handler.cpp
│   │   │   └── sonata_report_handler.hpp
│   │   ├── setup_fornetcon.cpp
│   │   ├── setup_fornetcon.hpp
│   │   └── user_params.hpp
│   ├── mechanism/
│   │   ├── capac.cpp
│   │   ├── eion.cpp
│   │   ├── eion.hpp
│   │   ├── mech/
│   │   │   ├── cfile/
│   │   │   │   └── cabvars.h
│   │   │   ├── enginemech.cpp
│   │   │   ├── mod2c_core_thread.hpp
│   │   │   ├── mod_func.c.pl
│   │   │   └── modfile/
│   │   │       ├── exp2syn.mod
│   │   │       ├── expsyn.mod
│   │   │       ├── hh.mod
│   │   │       ├── netstim.mod
│   │   │       ├── passive.mod
│   │   │       ├── pattern.mod
│   │   │       ├── stim.mod
│   │   │       └── svclmp.mod
│   │   ├── mech_mapping.cpp
│   │   ├── mech_mapping.hpp
│   │   ├── mechanism.hpp
│   │   ├── membfunc.hpp
│   │   ├── patternstim.cpp
│   │   ├── register_mech.cpp
│   │   └── register_mech.hpp
│   ├── membrane_definitions.h
│   ├── mpi/
│   │   ├── core/
│   │   │   ├── nrnmpi.hpp
│   │   │   ├── nrnmpi_def_cinc.cpp
│   │   │   ├── nrnmpidec.cpp
│   │   │   └── resolve.cpp
│   │   ├── lib/
│   │   │   ├── mpispike.cpp
│   │   │   ├── nrnmpi.cpp
│   │   │   └── nrnmpi.hpp
│   │   ├── nrnmpi.h
│   │   ├── nrnmpidec.h
│   │   └── nrnmpiuse.h
│   ├── network/
│   │   ├── cvodestb.cpp
│   │   ├── have2want.h
│   │   ├── multisend.cpp
│   │   ├── multisend.hpp
│   │   ├── multisend_setup.cpp
│   │   ├── netcon.hpp
│   │   ├── netcvode.cpp
│   │   ├── netcvode.hpp
│   │   ├── netpar.cpp
│   │   ├── netpar.hpp
│   │   ├── partrans.cpp
│   │   ├── partrans.hpp
│   │   ├── partrans_setup.cpp
│   │   ├── tnode.hpp
│   │   ├── tqueue.cpp
│   │   ├── tqueue.hpp
│   │   └── tqueue.ipp
│   ├── nrnconf.h
│   ├── nrniv/
│   │   └── nrniv_decl.h
│   ├── nrnoc/
│   │   ├── md1redef.h
│   │   └── md2redef.h
│   ├── permute/
│   │   ├── balance.cpp
│   │   ├── cellorder.cpp
│   │   ├── cellorder.cu
│   │   ├── cellorder.hpp
│   │   ├── cellorder1.cpp
│   │   ├── cellorder2.cpp
│   │   ├── data_layout.cpp
│   │   ├── data_layout.hpp
│   │   ├── node_permute.cpp
│   │   └── node_permute.h
│   ├── sim/
│   │   ├── fadvance_core.cpp
│   │   ├── fast_imem.cpp
│   │   ├── fast_imem.hpp
│   │   ├── finitialize.cpp
│   │   ├── multicore.cpp
│   │   ├── multicore.hpp
│   │   ├── scopmath/
│   │   │   ├── abort.cpp
│   │   │   ├── crout_thread.hpp
│   │   │   ├── errcodes.h
│   │   │   ├── newton_struct.h
│   │   │   ├── newton_thread.cpp
│   │   │   ├── newton_thread.hpp
│   │   │   ├── sparse_thread.hpp
│   │   │   └── ssimplic_thread.hpp
│   │   ├── solve_core.cpp
│   │   └── treeset_core.cpp
│   └── utils/
│       ├── ivocvect.cpp
│       ├── ivocvect.hpp
│       ├── lpt.cpp
│       ├── lpt.hpp
│       ├── memory.cpp
│       ├── memory.h
│       ├── memory_utils.cpp
│       ├── memory_utils.h
│       ├── nrn_assert.h
│       ├── nrn_stats.cpp
│       ├── nrn_stats.h
│       ├── nrnmutdec.hpp
│       ├── nrnoc_aux.cpp
│       ├── nrnoc_aux.hpp
│       ├── nrntimeout.cpp
│       ├── offload.hpp
│       ├── profile/
│       │   └── profiler_interface.h
│       ├── progressbar/
│       │   ├── progressbar.cpp
│       │   └── progressbar.hpp
│       ├── randoms/
│       │   ├── nrnran123.cpp
│       │   └── nrnran123.h
│       ├── string_utils.cpp
│       ├── string_utils.h
│       ├── units.hpp
│       ├── utils.cpp
│       ├── utils.hpp
│       ├── utils_cuda.h
│       ├── vrecitem.h
│       └── vrecord.cpp
├── docs/
│   ├── Doxyfile.in
│   ├── DoxygenLayout.xml
│   ├── README.md
│   ├── _static/
│   │   └── custom.css
│   ├── conda_environment.yml
│   ├── conf.py
│   ├── docs_requirements.txt
│   ├── doxygen.rst
│   ├── footer.html
│   ├── index.rst
│   └── userdoc/
│       ├── BinaryFormat/
│       │   └── BinaryFormat.md
│       └── MemoryManagement/
│           └── bbcorepointer.md
├── extra/
│   ├── CMakeLists.txt
│   ├── instrumentation.tau
│   ├── nrnivmodl-core.in
│   └── nrnivmodl_core_makefile.in
└── tests/
    ├── CMakeLists.txt
    ├── integration/
    │   ├── CMakeLists.txt
    │   ├── README.md
    │   ├── integration_test.sh.in
    │   ├── reportinglib/
    │   │   ├── 1.check.in
    │   │   ├── 1.conf.in
    │   │   ├── 1.report
    │   │   ├── reporting_test.sh.in
    │   │   └── test_ref.out
    │   ├── ring/
    │   │   └── out.dat.ref
    │   └── ring_gap/
    │       ├── mod files/
    │       │   └── halfgap.mod
    │       └── out.dat.ref
    └── unit/
        ├── alignment/
        │   ├── CMakeLists.txt
        │   └── alignment.cpp
        ├── cmdline_interface/
        │   ├── CMakeLists.txt
        │   └── test_cmdline_interface.cpp
        ├── interleave_info/
        │   ├── CMakeLists.txt
        │   └── check_constructors.cpp
        ├── lfp/
        │   ├── CMakeLists.txt
        │   └── lfp.cpp
        ├── queueing/
        │   ├── CMakeLists.txt
        │   └── test_queueing.cpp
        └── solver/
            ├── CMakeLists.txt
            └── test_solver.cpp

================================================
FILE CONTENTS
================================================

================================================
FILE: .bbp-project.yaml
================================================
tools:
  ClangFormat:
    enable: True
    include:
      match:
      - coreneuron/.*\.((cu)|(h)|([chi]pp))$
  CMakeFormat:
    enable: True


================================================
FILE: .clang-format.changes
================================================
IndentCaseLabels: true
SortIncludes: false
StatementMacros: [nrn_pragma_acc, nrn_pragma_omp]


================================================
FILE: .cmake-format.changes.yaml
================================================
additional_commands:
  cpp_cc_build_time_copy:
    flags: ['NO_TARGET']
    kwargs:
      INPUT: '1'
      OUTPUT: '1'


================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.md
================================================
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the issue**
A clear and concise description of what the issue is.

**To Reproduce**
Steps to reproduce the behavior:
```bash
A simple script
```

**Expected behavior**
A clear and concise description of what you expected to happen.

**Logs**
If possible attach helpful logs related to the issue.
If there is an issue during build `CMakeError.log`, `CMakeOutput.log` or the output of `make VERBOSE=1` would be helpful.
Otherwise any error printed to the therminal.

**System (please complete the following information)**
 - OS: [e.g. Ubuntu 20.04]
 - Compiler: [e.g. PGI 20.9]
 - Version: [e.g. master branch]
 - Backend: [e.g. CPU]

**Additional context**
Add any other context about the problem here.


================================================
FILE: .github/ISSUE_TEMPLATE/config.yml
================================================
blank_issues_enabled: true


================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.md
================================================
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context about the feature request here.


================================================
FILE: .github/problem-matchers/address.json
================================================

{
    "problemMatcher": [
        {
            "owner": "asan-problem-matcher",
            "severity": "warning",
            "pattern": [
                {
                    "regexp": "^.*AddressSanitizer: (.*)$",
                    "message": 1
                }
            ]
        }
    ]
}


================================================
FILE: .github/problem-matchers/gcc.json
================================================
{
    "__comment": "Taken from vscode-cpptools's Extension/package.json gcc rule",
    "problemMatcher": [
        {
            "owner": "gcc-problem-matcher",
            "pattern": [
                {
                    "regexp": "^\\.\\./(.*):(\\d+):(\\d+):\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$",
                    "file": 1,
                    "line": 2,
                    "column": 3,
                    "severity": 4,
                    "message": 5
                }
            ]
        }
    ]
}


================================================
FILE: .github/problem-matchers/undefined.json
================================================
{
    "problemMatcher": [
        {
            "owner": "ubsan-problem-matcher",
            "severity": "warning",
            "pattern": [
                {
                    "regexp": "^.*\\/(src\\/.*):(\\d+):(\\d+): runtime error: (.*)$",
                    "file": 1,
                    "line": 2,
                    "column": 3,
                    "message": 4
                },
                {
                    "regexp": "^.*UndefinedBehaviorSanitizer:.*$"
                }
            ]
        }
    ]
}


================================================
FILE: .github/pull_request_template.md
================================================
**Description**

Please include a summary of the change and which issue is fixed or which feature is added.

- [ ] Issue 1 fixed
- [ ] Issue 2 fixed
- [ ] Feature 1 added
- [ ] Feature 2 added

Fixes # (issue)

**How to test this?**

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce if there is no integration test added with this PR. Please also list any relevant details for your test configuration

```bash
cmake ..
make -j8
nrnivmodl mod
./bin/nrnivmodl-core mod
./x86_64/special script.py
./x86_64/special-core --tstop=10 --datpath=coredat
```

**Test System**
 - OS: [e.g. Ubuntu 20.04]
 - Compiler: [e.g. PGI 20.9]
 - Version: [e.g. master branch]
 - Backend: [e.g. CPU]

**Use certain branches in CI pipelines.**
<!-- You can steer which versions of CoreNEURON dependencies will be used in
     the various CI pipelines (GitLab, test-as-submodule) here. Expressions are
     of the form PROJ_REF=VALUE, where PROJ is the relevant Spack package name,
     transformed to upper case and with hyphens replaced with underscores.
     REF may be BRANCH, COMMIT or TAG, with exceptions:
      - SPACK_COMMIT and SPACK_TAG are invalid (hpc/gitlab-pipelines limitation)
      - NEURON_COMMIT and NEURON_TAG are invalid (test-as-submodule limitation)
     These values for NEURON, nmodl and Spack are the defaults and are given
     for illustrative purposes; they can safely be removed.
-->
CI_BRANCHES:NEURON_BRANCH=master,NMODL_BRANCH=master,SPACK_BRANCH=develop


================================================
FILE: .github/workflows/clang_cmake_format_check.yaml
================================================
name: clang-cmake-format-check

concurrency:
  group: ${{ github.workflow }}#${{ github.ref }}
  cancel-in-progress: true

on:
    push:

jobs:
  build:
    name: clang-cmake-format-check
    runs-on: ubuntu-22.04
    steps:
        - name: Fetch repository
          uses: actions/checkout@v3
        - name: Fetch hpc-coding-conventions submodules
          shell: bash
          working-directory: ${{runner.workspace}}/CoreNeuron
          run: git submodule update --init --depth 1 -- CMake/hpc-coding-conventions
        - name: Run clang-format and cmake-format
          shell: bash
          working-directory: ${{runner.workspace}}/CoreNeuron
          run: CMake/hpc-coding-conventions/bin/format -v --dry-run


================================================
FILE: .github/workflows/coreneuron-ci.yml
================================================
name: CoreNEURON CI

concurrency:
  group: ${{ github.workflow }}#${{ github.ref }}
  cancel-in-progress: true

on:
  push:
    branches:
      - master
      - release/**
  pull_request:
    branches:
      - master
      - release/**

env:
  BUILD_TYPE: Release
  DEFAULT_PY_VERSION: 3.8
  MACOSX_DEPLOYMENT_TARGET: 11.0

jobs:
  ci:
    runs-on: ${{ matrix.os }}

    name: ${{ matrix.os }} - ${{ toJson(matrix.config) }})

    env:
      SDK_ROOT: $(xcrun --sdk macosx --show-sdk-path)

    strategy:
      matrix:
        os: [ubuntu-20.04, macOS-11]
        config:
          # Defaults: CORENRN_ENABLE_MPI=ON
          - {cmake_option: "-DCORENRN_ENABLE_MPI_DYNAMIC=ON", flag_warnings: ON}
          - {cmake_option: "-DCORENRN_ENABLE_MPI_DYNAMIC=ON -DCORENRN_ENABLE_SHARED=OFF"}
          - {cmake_option: "-DCORENRN_ENABLE_MPI=OFF"}
          - {use_nmodl: ON, py_version: 3.7}
          - {use_nmodl: ON}
        include:
          - os: ubuntu-20.04
            config:
              gcc_version: 10
          - os: ubuntu-20.04
            config:
              cmake_option: -DCORENRN_ENABLE_DEBUG_CODE=ON
              documentation: ON
          - os: ubuntu-22.04
            config:
              sanitizer: address
          - os: ubuntu-22.04
            config:
              flag_warnings: ON
              sanitizer: undefined
      fail-fast: false

    steps:

      - name: Install homebrew packages
        if: startsWith(matrix.os, 'macOS')
        run: |
          brew update
          brew install bison boost ccache coreutils flex ninja openmpi
          echo /usr/local/opt/flex/bin:/usr/local/opt/bison/bin >> $GITHUB_PATH
        shell: bash

      - name: Install apt packages
        if: startsWith(matrix.os, 'ubuntu')
        run: |
          sudo apt-get install bison ccache doxygen flex libboost-all-dev \
            libfl-dev libopenmpi-dev ninja-build openmpi-bin
        shell: bash

      - name: Install specific apt packages
        if: startsWith(matrix.os, 'ubuntu') && matrix.config.gcc_version
        run: |
          sudo apt-get install gcc-${{matrix.config.gcc_version}}
          echo CC="gcc-${{matrix.config.gcc_version}}" >> $GITHUB_ENV
          echo CXX="g++-${{matrix.config.gcc_version}}" >> $GITHUB_ENV
        shell: bash

      - name: Set up Python3
        uses: actions/setup-python@v4
        with:
          python-version: ${{ env.PYTHON_VERSION }}
        env:
          PYTHON_VERSION: ${{matrix.config.py_version || env.DEFAULT_PY_VERSION}}

      - name: Install NMODL dependencies
        if: ${{ matrix.config.use_nmodl == 'ON' }}
        run: |
          python3 -m pip install --upgrade pip jinja2 pyyaml pytest sympy

      - uses: actions/checkout@v3

      - name: Install documentation dependencies
        if: ${{matrix.config.documentation == 'ON'}}
        working-directory: ${{runner.workspace}}/CoreNeuron
        run: |
          sudo apt-get install doxygen
          python3 -m pip install --upgrade pip
          python3 -m pip install --upgrade -r docs/docs_requirements.txt

      - name: Register compiler warning problem matcher
        if: ${{matrix.config.flag_warnings == 'ON'}}
        run: echo "::add-matcher::.github/problem-matchers/gcc.json"

      - name: Register sanitizer problem matcher
        if: ${{matrix.config.sanitizer}}
        run: echo "::add-matcher::.github/problem-matchers/${{matrix.config.sanitizer}}.json"

      - name: Hash config dictionary
        run: |
          cat << EOF > matrix.json
          ${{toJSON(matrix.config)}}
          EOF
          echo matrix.config JSON:
          cat matrix.json
          echo -----
      
      # Workaround for https://github.com/actions/cache/issues/92
      - name: Checkout cache action
        uses: actions/checkout@v3
        with:
          repository: actions/cache
          ref: v3
          path: tmp/actions/cache
          
      - name: Make actions/cache@v3 run even on failure
        run: |
          sed -i'.bak' -e '/ post-if: /d' tmp/actions/cache/action.yml
          
      - name: Restore compiler cache
        uses: ./tmp/actions/cache
        with:
          path: |
            ${{runner.workspace}}/ccache
          key: ${{matrix.os}}-${{hashfiles('matrix.json')}}-${{github.ref}}-${{github.sha}}
          restore-keys: |
            ${{matrix.os}}-${{hashfiles('matrix.json')}}-${{github.ref}}-
            ${{matrix.os}}-${{hashfiles('matrix.json')}}-

      - name: Build and Test
        id: build-test
        shell: bash
        working-directory: ${{runner.workspace}}/CoreNeuron
        run:  |
          cmake_args=(${{matrix.config.cmake_option}})
          if [[ "${{ startsWith(matrix.os, 'macOS') }}" = "true" ]]; then
              cmake_args+=(-DCORENRN_ENABLE_OPENMP=OFF)
          else
              cmake_args+=(-DCORENRN_ENABLE_OPENMP=ON)
          fi

          if [[ "${{matrix.config.flag_warnings}}" == "ON" ]]; then
              cmake_args+=(-DCORENRN_EXTRA_CXX_FLAGS="-Wall")
          fi

          if [[ -n "${{matrix.config.sanitizer}}" ]]; then
              CC=$(command -v clang-14)
              CXX=$(command -v clang++-14)
              symbolizer_path=$(realpath $(command -v llvm-symbolizer-14))
              cmake_args+=(-DCMAKE_BUILD_TYPE=Custom \
                           -DCMAKE_C_FLAGS="-O1 -g -Wno-writable-strings" \
                           -DCMAKE_CXX_FLAGS="-O1 -g -Wno-writable-strings" \
                           -DLLVM_SYMBOLIZER_PATH="${symbolizer_path}" \
                           -DCORENRN_SANITIZERS=$(echo ${{matrix.config.sanitizer}} | sed -e 's/-/,/g'))
          else
              CC=${CC:-gcc}
              CXX=${CXX:-g++}
          fi
          
          echo "------- Build, Test and Install -------"
          mkdir build && cd build
          if [[ "$USE_NMODL" == "ON" ]]; then
              cmake_args+=(-DCORENRN_ENABLE_NMODL=ON "-DCORENRN_NMODL_FLAGS=sympy --analytic")
          fi
          cmake .. -G Ninja "${cmake_args[@]}" \
            -DCMAKE_C_COMPILER="${CC}" \
            -DCMAKE_C_COMPILER_LAUNCHER=ccache \
            -DCMAKE_CXX_COMPILER="${CXX}" \
            -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
            "-DCMAKE_INSTALL_PREFIX=${{runner.workspace}}/install" \
            -DPYTHON_EXECUTABLE=$(command -v python3)
          if ccache --version | grep -E '^ccache version 4\.(4|4\.1)$'
          then
            echo "------- Disable ccache direct mode -------"
            # https://github.com/ccache/ccache/issues/935
            export CCACHE_NODIRECT=1
          fi
          ccache -z
          # Older versions don't support -v (verbose)
          ccache -vs 2>/dev/null || ccache -s
          cmake --build . --parallel
          ccache -vs 2>/dev/null || ccache -s
          ctest -T Test --output-on-failure
          cmake --build . --target install
        env:
          CCACHE_BASEDIR: ${{runner.workspace}}/CoreNeuron
          CCACHE_DIR: ${{runner.workspace}}/ccache
          USE_NMODL: ${{matrix.config.use_nmodl}}

      - uses: actions/upload-artifact@v3
        with:
          name: ctest-results-${{hashfiles('matrix.json')}}-sanitizer
          path: ${{runner.workspace}}/CoreNeuron/build/Testing/*/Test.xml

      # This step will set up an SSH connection on tmate.io for live debugging.
      # To enable it, you have to:
      #   * add 'live-debug-ci' to your PR title
      #   * push something to your PR branch (note that just re-running the pipeline disregards the title update)
      - name: live debug session on failure (manual steps required, check `.github/workflows/coreneuron-ci.yml`)
        if: failure() && contains(github.event.pull_request.title, 'live-debug-ci')
        uses: mxschmitt/action-tmate@v3

      - name: Documentation
        if: ${{ startsWith(matrix.os, 'ubuntu') && matrix.config.documentation == 'ON' }}
        id: documentation
        working-directory: ${{runner.workspace}}/CoreNeuron/build
        run: |
          echo "------- Build Doxygen Documentation -------";
          cmake --build . --target docs
          echo "-------- Disable jekyll --------";
          pushd docs;
          touch .nojekyll;
          echo ::set-output name=status::done
          
      - name: Deploy 🚀
        uses: JamesIves/github-pages-deploy-action@v4
        if: steps.documentation.outputs.status == 'done' && github.ref == 'refs/heads/master'
        with:
          branch: gh-pages # The branch the action should deploy to.
          folder: ${{runner.workspace}}/CoreNeuron/build/docs  # The folder the action should deploy.
          single-commit: true #have a single commit on the deployment branch instead of maintaining the full history


================================================
FILE: .github/workflows/coverage.yml
================================================
name: Coverage

concurrency:
  group: ${{ github.workflow }}#${{ github.ref }}
  cancel-in-progress: true

on:
  push:
    branches:
      - master
      - release/**
  pull_request:
    branches:
      - master
      - release/**

env:
  CMAKE_BUILD_PARALLEL_LEVEL: 3

jobs:
  coverage:
    runs-on: ubuntu-20.04
    name: "Coverage Test"
    steps:
      - name: Install packages
        run: |
          sudo apt-get update
          sudo apt-get install bison doxygen flex lcov libboost-all-dev \
            libopenmpi-dev libfl-dev ninja-build openmpi-bin python3-dev \
            python3-pip
        shell: bash
      - uses: actions/checkout@v3
        with:
          fetch-depth: 2
      - name: Build and Test for Coverage
        id: build-test
        shell: bash
        working-directory: ${{runner.workspace}}/CoreNeuron
        run:  |
          mkdir build && cd build
          cmake .. -G Ninja \
            -DCMAKE_BUILD_TYPE=Debug \
            -DCMAKE_C_FLAGS="-coverage" \
            -DCMAKE_CXX_FLAGS="-coverage" \
            -DCORENRN_ENABLE_MPI=ON \
            -DCORENRN_ENABLE_DEBUG_CODE=ON
          cmake --build .
          (cd ..;  lcov --capture  --initial --directory . --no-external --output-file build/coverage-base.info)
          ctest --output-on-failure
          (cd ..; lcov --capture  --directory . --no-external --output-file build/coverage-run.info)
          lcov --add-tracefile coverage-base.info --add-tracefile coverage-run.info --output-file coverage-combined.info
          lcov --remove coverage-combined.info --output-file coverage.info "*/external/*"
          lcov --list coverage.info
      - name: Upload to codecov.io
        run: |
          # Download codecov script and perform integrity checks
          curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --import # One-time step 
          curl -Os https://uploader.codecov.io/latest/linux/codecov 
          curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM 
          curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig 
          gpg --verify codecov.SHA256SUM.sig codecov.SHA256SUM 
          shasum -a 256 -c codecov.SHA256SUM 
          chmod +x codecov 
          ./codecov -f build/coverage.info


================================================
FILE: .github/workflows/test-as-submodule.yml
================================================
name: NEURON submodule

concurrency:
  group: ${{ github.workflow }}#${{ github.ref }}
  cancel-in-progress: true

on:
  push:
    branches:
      - master
      - release/**
  pull_request:
    branches:
      - master
      - release/**

jobs:
  ci:
    name: ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        include:
          - os: ubuntu-20.04
            cores: 2
          - os: macOS-11
            cores: 3
      fail-fast: false
    env:
      CMAKE_BUILD_PARALLEL_LEVEL: ${{matrix.cores}}
      SDK_ROOT: $(xcrun --sdk macosx --show-sdk-path)

    steps:

      - name: Install homebrew packages
        if: startsWith(matrix.os, 'macOS')
        run: |
          brew install bison coreutils flex ninja openmpi
          python3 -m pip install --upgrade numpy pytest pytest-cov
          echo /usr/local/opt/flex/bin:/usr/local/opt/bison/bin >> $GITHUB_PATH
          echo "CC=gcc" >> $GITHUB_ENV
          echo "CXX=g++" >> $GITHUB_ENV

      - name: Install apt packages
        if: startsWith(matrix.os, 'ubuntu')
        run: |
          sudo apt-get update
          sudo apt-get install bison cython3 flex libfl-dev libopenmpi-dev \
            ninja-build openmpi-bin python3-dev
          python3 -m pip install --upgrade numpy pytest pytest-cov
          echo "CC=gcc" >> $GITHUB_ENV
          echo "CXX=g++" >> $GITHUB_ENV

      - name: Set NEURON branch
        id: vars
        env:
          GITHUB_PR_BODY: ${{ github.event.pull_request.body }}
        run: |
          nrn_branch=$(echo "${GITHUB_PR_BODY}" | grep "^CI_BRANCHES" \
                      | awk -F '[:,]{1}NEURON_BRANCH=' '{print $2}' \
                      | awk -F ',' '{print $1}')
          if [ -z "$nrn_branch" ]; then
              nrn_branch=master
          fi
          echo "Will use neuron branch: $nrn_branch"
          echo ::set-output name=neuron_branch::"${nrn_branch}"

      - uses: actions/checkout@v3
        name: Checkout NEURON
        with:
          path: nrn
          repository: neuronsimulator/nrn
          ref: ${{ steps.vars.outputs.neuron_branch }}

      - name: Update CoreNEURON submodule
        run: |
          cd ${GITHUB_WORKSPACE}/nrn
          coreneuron_sha=${{github.event.pull_request.head.sha}}
          if [[ -z ${coreneuron_sha} ]]; then
          # presumably we're running on a push event
          coreneuron_sha=${{github.sha}}
          fi
          echo "Using CoreNEURON SHA ${coreneuron_sha}"
          # https://stackoverflow.com/a/33575837
          git update-index --cacheinfo 160000,${coreneuron_sha},external/coreneuron
          git submodule update --init external/coreneuron
          echo "NEURON status"
          git status
          git log -n 1
          cd external/coreneuron
          echo "CoreNEURON status"
          git status
          git log -n 1

      - name: Configure NEURON
        run: |
          cd ${GITHUB_WORKSPACE}/nrn
          mkdir build install
          cd build
          # NEURON CMake assumes this is defined.
          export SHELL=$(command -v bash)
          openMP=" -DCORENRN_ENABLE_OPENMP=ON"
          if [[ "${{ startsWith(matrix.os, 'macOS') }}" = "true" ]]; then
            openMP=" -DCORENRN_ENABLE_OPENMP=OFF"
          fi
          cmake .. -G Ninja \
            -DCMAKE_BUILD_TYPE=RelWithDebInfo \
            -DCMAKE_INSTALL_PREFIX=../install \
            -DPYTHON_EXECUTABLE=$(command -v python3) \
            -DNRN_ENABLE_CORENEURON=ON \
            -DNRN_ENABLE_INTERVIEWS=OFF \
            -DNRN_ENABLE_RX3D=OFF \
            -DNRN_ENABLE_MPI_DYNAMIC=ON \
            -DNRN_ENABLE_TESTS=ON ${openMP}

      - name: Build NEURON
        run: |
          cd ${GITHUB_WORKSPACE}/nrn/build
          cmake --build . --parallel

      - name: Test NEURON
        run: |
          cd ${GITHUB_WORKSPACE}/nrn/build
          ctest --output-on-failure

      - name: Install NEURON
        run: |
          cd ${GITHUB_WORKSPACE}/nrn/build
          cmake --build . --target install

      # This step will set up an SSH connection on tmate.io for live debugging.
      # To enable it, you have to:
      #   * add 'live-debug-ci' to your PR title
      #   * push something to your PR branch (note that just re-running the pipeline disregards the title update)
      - name: live debug session on failure (manual steps required, check `.github/workflows/test-as-submodule.yml`)
        if: failure() && contains(github.event.pull_request.title, 'live-debug-ci')
        uses: mxschmitt/action-tmate@v3


================================================
FILE: .gitignore
================================================
cmake-build-debug*
*build*
spconfig.*
*~
.DS_Store
*.swp
*.srctrl*

# HPC coding conventions
.clang-format
.clang-tidy
.cmake-format.yaml
.pre-commit-config.yaml
.bbp-project-venv/


================================================
FILE: .gitlab-ci.yml
================================================
include:
  - project: hpc/gitlab-pipelines
    file:
      - spack-build-components.gitlab-ci.yml
      - github-project-pipelines.gitlab-ci.yml
    ref: '$GITLAB_PIPELINES_BRANCH'
  - project: hpc/gitlab-upload-logs
    file: enable-upload.yml

variables:
  NEURON_BRANCH:
    description: Branch of NEURON to build against CoreNEURON (NEURON_COMMIT and NEURON_TAG also possible)
    value: master
  NMODL_BRANCH:
    description: Branch of NMODL to build CoreNEURON against (NMODL_COMMIT and NMODL_TAG also possible)
    value: master
  SPACK_BRANCH:
    description: Branch of BlueBrain Spack to use for the CI pipeline
    value: develop
  SPACK_DEPLOYMENT_SUFFIX:
    description: Extra path component used when finding deployed software. Set to something like `pulls/1497` use software built for https://github.com/BlueBrain/spack/pull/1497. You probably want to set SPACK_BRANCH to the branch used in the relevant PR if you set this.
    value: ''

# Set up Spack
spack_setup:
  extends: .spack_setup_ccache
  variables:
    CORENEURON_COMMIT: ${CI_COMMIT_SHA}
    # Enable fetching GitHub PR descriptions and parsing them to find out what
    # branches to build of other projects.
    PARSE_GITHUB_PR_DESCRIPTIONS: "true"

simulation_stack:
  stage: .pre
  # Take advantage of GitHub PR description parsing in the spack_setup job.
  needs: [spack_setup]
  trigger:
    project: hpc/sim/blueconfigs
    # CoreNEURON CI status depends on the BlueConfigs CI status.
    strategy: depend
  variables:
    GITLAB_PIPELINES_BRANCH: $GITLAB_PIPELINES_BRANCH
    SPACK_ENV_FILE_URL: $SPACK_SETUP_COMMIT_MAPPING_URL

# Performance seems to be terrible when we get too many jobs on a single node.
.build:
  extends: [.spack_build]
  variables:
    bb5_ntasks: 2   # so we block 16 cores
    bb5_cpus_per_task: 8 # ninja -j {this}
    bb5_memory: 76G # ~16*384/80

.spack_intel:
  variables:
    SPACK_PACKAGE_COMPILER: intel
.spack_nvhpc:
  variables:
    SPACK_PACKAGE_COMPILER: nvhpc
.build_neuron:
  extends: [.build]
  timeout: two hours
  variables:
    bb5_duration: "2:00:00"
    SPACK_PACKAGE: neuron
    SPACK_PACKAGE_SPEC: +coreneuron+debug+tests~legacy-unit~rx3d model_tests=channel-benchmark,olfactory,tqperf-heavy
.gpu_node:
  variables:
    bb5_constraint: volta
    bb5_cpus_per_task: 2
.test_neuron:
  extends: [.ctest]
  variables:
    bb5_ntasks: 16
    bb5_memory: 76G # ~16*384/80

# Build NMODL once with GCC
build:nmodl:
  extends: [.build]
  variables:
    SPACK_PACKAGE: nmodl
    SPACK_PACKAGE_SPEC: ~legacy-unit
    SPACK_PACKAGE_COMPILER: gcc

# Build CoreNEURON
.build_coreneuron:
  extends: [.build]
  variables:
    SPACK_PACKAGE: coreneuron
    # NEURON depends on py-mpi4py, most of whose dependencies are pulled in by
    # nmodl%gcc, with the exception of MPI, which is pulled in by
    # coreneuron%{nvhpc,intel}. hpe-mpi is an external package anyway, so
    # setting its compiler is just changing how it is labelled in the
    # dependency graph and not changing which installation is used, but this
    # means that in the NEURON step an existing py-mpi4py%gcc can be used.
    # Otherwise a new py-mpi4py with hpe-mpi%{nvhpc,intel} will be built.
    # caliper: papi%nvhpc does not build; use the caliper from the deployment
    # TODO: fix this more robustly so we don't have to play so many games.
    SPACK_PACKAGE_DEPENDENCIES: ^hpe-mpi%gcc ^caliper%gcc+cuda cuda_arch=70

# TODO: improve coverage by switching an Intel build to be statically linked
# TODO: improve coverage by switching an Intel build to RelWithDebInfo
# TODO: improve coverage by enabling +openmp on an Intel build
build:coreneuron:mod2c:intel:shared:debug:
  extends: [.build_coreneuron, .spack_intel]
  variables:
    SPACK_PACKAGE_SPEC: +caliper~gpu~legacy-unit~nmodl~openmp+shared+tests~unified build_type=Debug

build:coreneuron:nmodl:intel:debug:legacy:
  extends: [.build_coreneuron, .spack_intel]
  needs: ["build:nmodl"]
  variables:
    SPACK_PACKAGE_SPEC: +caliper~gpu~legacy-unit+nmodl~openmp~shared~sympy+tests~unified build_type=Debug

# Disable caliper to improve coverage
build:coreneuron:nmodl:intel:shared:debug:
  extends: [.build_coreneuron, .spack_intel]
  needs: ["build:nmodl"]
  variables:
    SPACK_PACKAGE_DEPENDENCIES: ^hpe-mpi%gcc
    SPACK_PACKAGE_SPEC: ~caliper~gpu~legacy-unit+nmodl~openmp+shared+sympy+tests~unified build_type=Debug

# Not linked to a NEURON build+test job, see
# https://github.com/BlueBrain/CoreNeuron/issues/594
build:coreneuron:mod2c:nvhpc:acc:debug:unified:
  extends: [.build_coreneuron, .spack_nvhpc]
  variables:
    SPACK_PACKAGE_SPEC: +caliper+gpu~legacy-unit~nmodl+openmp~shared+tests+unified build_type=Debug

# Shared + OpenACC + OpenMP host threading has problems
build:coreneuron:mod2c:nvhpc:acc:shared:
  extends: [.build_coreneuron, .spack_nvhpc]
  variables:
    SPACK_PACKAGE_SPEC: +caliper+gpu~legacy-unit~nmodl~openmp+shared+tests~unified build_type=RelWithDebInfo

build:coreneuron:nmodl:nvhpc:acc:debug:legacy:
  extends: [.build_coreneuron, .spack_nvhpc]
  needs: ["build:nmodl"]
  variables:
    SPACK_PACKAGE_SPEC: +caliper+gpu~legacy-unit+nmodl~openmp~shared~sympy+tests~unified build_type=Debug

build:coreneuron:nmodl:nvhpc:acc:shared:
  extends: [.build_coreneuron, .spack_nvhpc]
  needs: ["build:nmodl"]
  variables:
    SPACK_PACKAGE_SPEC: +caliper+gpu~legacy-unit+nmodl~openmp+shared+sympy+tests~unified build_type=RelWithDebInfo

build:coreneuron:nmodl:nvhpc:omp:legacy:
  extends: [.build_coreneuron, .spack_nvhpc]
  needs: ["build:nmodl"]
  variables:
    SPACK_PACKAGE_SPEC: +caliper+gpu~legacy-unit+nmodl+openmp~shared~sympy+tests~unified build_type=RelWithDebInfo

build:coreneuron:nmodl:nvhpc:omp:debug:
  extends: [.build_coreneuron, .spack_nvhpc]
  needs: ["build:nmodl"]
  variables:
    SPACK_PACKAGE_SPEC: +caliper+gpu~legacy-unit+nmodl+openmp~shared+sympy+tests~unified build_type=Debug

# Build NEURON
build:neuron:mod2c:intel:shared:debug:
  extends: [.build_neuron, .spack_intel]
  needs: ["build:coreneuron:mod2c:intel:shared:debug"]

build:neuron:nmodl:intel:debug:legacy:
  extends: [.build_neuron, .spack_intel]
  needs: ["build:coreneuron:nmodl:intel:debug:legacy"]

build:neuron:nmodl:intel:shared:debug:
  extends: [.build_neuron, .spack_intel]
  needs: ["build:coreneuron:nmodl:intel:shared:debug"]

build:neuron:mod2c:nvhpc:acc:shared:
  extends: [.build_neuron, .spack_nvhpc]
  needs: ["build:coreneuron:mod2c:nvhpc:acc:shared"]

build:neuron:nmodl:nvhpc:acc:debug:legacy:
  extends: [.build_neuron, .spack_nvhpc]
  needs: ["build:coreneuron:nmodl:nvhpc:acc:debug:legacy"]

build:neuron:nmodl:nvhpc:acc:shared:
  extends: [.build_neuron, .spack_nvhpc]
  needs: ["build:coreneuron:nmodl:nvhpc:acc:shared"]

build:neuron:nmodl:nvhpc:omp:legacy:
  extends: [.build_neuron, .spack_nvhpc]
  needs: ["build:coreneuron:nmodl:nvhpc:omp:legacy"]

build:neuron:nmodl:nvhpc:omp:debug:
  extends: [.build_neuron, .spack_nvhpc]
  needs: ["build:coreneuron:nmodl:nvhpc:omp:debug"]

# Test CoreNEURON
test:coreneuron:mod2c:intel:shared:debug:
  extends: [.ctest]
  needs: ["build:coreneuron:mod2c:intel:shared:debug"]

test:coreneuron:nmodl:intel:debug:legacy:
  extends: [.ctest]
  needs: ["build:coreneuron:nmodl:intel:debug:legacy"]

test:coreneuron:nmodl:intel:shared:debug:
  extends: [.ctest]
  needs: ["build:coreneuron:nmodl:intel:shared:debug"]

test:coreneuron:mod2c:nvhpc:acc:debug:unified:
  extends: [.ctest, .gpu_node]
  needs: ["build:coreneuron:mod2c:nvhpc:acc:debug:unified"]

test:coreneuron:mod2c:nvhpc:acc:shared:
  extends: [.ctest, .gpu_node]
  needs: ["build:coreneuron:mod2c:nvhpc:acc:shared"]

test:coreneuron:nmodl:nvhpc:acc:debug:legacy:
  extends: [.ctest, .gpu_node]
  needs: ["build:coreneuron:nmodl:nvhpc:acc:debug:legacy"]

test:coreneuron:nmodl:nvhpc:acc:shared:
  extends: [.ctest, .gpu_node]
  needs: ["build:coreneuron:nmodl:nvhpc:acc:shared"]

test:coreneuron:nmodl:nvhpc:omp:legacy:
  extends: [.ctest, .gpu_node]
  needs: ["build:coreneuron:nmodl:nvhpc:omp:legacy"]

test:coreneuron:nmodl:nvhpc:omp:debug:
  extends: [.ctest, .gpu_node]
  needs: ["build:coreneuron:nmodl:nvhpc:omp:debug"]

# Test NEURON
test:neuron:mod2c:intel:shared:debug:
  extends: [.test_neuron]
  needs: ["build:neuron:mod2c:intel:shared:debug"]

test:neuron:nmodl:intel:debug:legacy:
  extends: [.test_neuron]
  needs: ["build:neuron:nmodl:intel:debug:legacy"]

test:neuron:nmodl:intel:shared:debug:
  extends: [.test_neuron]
  needs: ["build:neuron:nmodl:intel:shared:debug"]

test:neuron:mod2c:nvhpc:acc:shared:
  extends: [.test_neuron, .gpu_node]
  needs: ["build:neuron:mod2c:nvhpc:acc:shared"]

test:neuron:nmodl:nvhpc:acc:debug:legacy:
  extends: [.test_neuron, .gpu_node]
  needs: ["build:neuron:nmodl:nvhpc:acc:debug:legacy"]

test:neuron:nmodl:nvhpc:acc:shared:
  extends: [.test_neuron, .gpu_node]
  needs: ["build:neuron:nmodl:nvhpc:acc:shared"]

test:neuron:nmodl:nvhpc:omp:legacy:
  extends: [.test_neuron, .gpu_node]
  needs: ["build:neuron:nmodl:nvhpc:omp:legacy"]

test:neuron:nmodl:nvhpc:omp:debug:
  extends: [.test_neuron, .gpu_node]
  needs: ["build:neuron:nmodl:nvhpc:omp:debug"]


================================================
FILE: .gitmodules
================================================
[submodule "external/mod2c"]
  path = external/mod2c
  url = https://github.com/BlueBrain/mod2c
[submodule "external/CLI11"]
  path = external/CLI11
  url = https://github.com/CLIUtils/CLI11.git
[submodule "external/nmodl"]
  path = external/nmodl
  url = https://github.com/BlueBrain/nmodl
[submodule "external/Random123"]
	path = external/Random123
	url = https://github.com/BlueBrain/Random123.git
[submodule "CMake/hpc-coding-conventions"]
	path = CMake/hpc-coding-conventions
	url = https://github.com/BlueBrain/hpc-coding-conventions.git


================================================
FILE: .readthedocs.yml
================================================
version: 2

conda:
  environment: docs/conda_environment.yml

python:
  install:
    - requirements: docs/docs_requirements.txt


================================================
FILE: .sanitizers/undefined.supp
================================================
unsigned-integer-overflow:_philox4x32bumpkey(r123array2x32)
unsigned-integer-overflow:coreneuron::TNode::mkhash()
unsigned-integer-overflow:std::mersenne_twister_engine


================================================
FILE: AUTHORS.txt
================================================
Akiko Sato
Aleksandr Ovcharenko
Alessandro Cattabiani
Alexander Dietz
Alexandru Săvulescu
Antonio Bellotta
Baudouin Del Marmol
Bruno Magalhaes
Christos Kotsalos
Fabien Delalondre
Felix Schuermann (contributor)
Fernando Pereira
Francesco Cremonesi
Ioannis Magkanaris
James Gonzalo King
Jeremy Fouriaux
Jorge Blanco Alonso
Kai Langen
Michael Lee Hines
Nicolas Cornu
Olli Lupton
Omar Awile
Oren Amsalem
Pramod Shivaji Kumbhar (maintainer)
Sam Yates
Sergio Rivas-Gomez
Tapasweni Pathak
Weina Ji
viniciusdepadua


================================================
FILE: CMake/AddHpcCodingConvSubmodule.cmake
================================================
# =============================================================================
# Copyright (C) 2016-2021 Blue Brain Project
#
# See top-level LICENSE file for details.
# =============================================================================

include(FindPackageHandleStandardArgs)
find_package(FindPkgConfig QUIET)

find_path(
  HpcCodingConv_PROJ
  NAMES setup.cfg
  PATHS "${CORENEURON_PROJECT_SOURCE_DIR}/CMake/hpc-coding-conventions/")

find_package_handle_standard_args(HpcCodingConv REQUIRED_VARS HpcCodingConv_PROJ)

if(NOT HpcCodingConv_FOUND)
  find_package(Git 1.8.3 QUIET)
  if(NOT ${GIT_FOUND})
    message(FATAL_ERROR "git not found, clone repository with --recursive")
  endif()
  message(
    STATUS "Sub-module CMake/hpc-coding-conventions missing: running git submodule update --init")
  execute_process(
    COMMAND ${GIT_EXECUTABLE} submodule update --init --
            ${CORENEURON_PROJECT_SOURCE_DIR}/CMake/hpc-coding-conventions
    WORKING_DIRECTORY ${CORENEURON_PROJECT_SOURCE_DIR})
endif()


================================================
FILE: CMake/AddMod2cSubmodule.cmake
================================================
# =============================================================================
# Copyright (C) 2016-2021 Blue Brain Project
#
# See top-level LICENSE file for details.
# =============================================================================

find_package(FindPkgConfig QUIET)

find_path(
  MOD2C_PROJ
  NAMES CMakeLists.txt
  PATHS "${CORENEURON_PROJECT_SOURCE_DIR}/external/mod2c")

find_package_handle_standard_args(MOD2C REQUIRED_VARS MOD2C_PROJ)

if(NOT MOD2C_FOUND)
  find_package(Git 1.8.3 QUIET)
  if(NOT ${GIT_FOUND})
    message(FATAL_ERROR "git not found, clone repository with --recursive")
  endif()
  message(STATUS "Sub-module mod2c missing : running git submodule update --init --recursive")
  execute_process(
    COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive --
            ${CORENEURON_PROJECT_SOURCE_DIR}/external/mod2c
    WORKING_DIRECTORY ${CORENEURON_PROJECT_SOURCE_DIR})
else()
  message(STATUS "Using mod2c submodule from ${MOD2C_PROJ}")
endif()

add_subdirectory(${CORENEURON_PROJECT_SOURCE_DIR}/external/mod2c)


================================================
FILE: CMake/AddNmodlSubmodule.cmake
================================================
# =============================================================================
# Copyright (C) 2016-2021 Blue Brain Project
#
# See top-level LICENSE file for details.
# =============================================================================

find_package(FindPkgConfig QUIET)

find_path(
  NMODL_PROJ
  NAMES CMakeLists.txt
  PATHS "${CORENEURON_PROJECT_SOURCE_DIR}/external/nmodl")

find_package_handle_standard_args(NMODL REQUIRED_VARS NMODL_PROJ)

if(NOT NMODL_FOUND)
  find_package(Git 1.8.3 QUIET)
  if(NOT ${GIT_FOUND})
    message(FATAL_ERROR "git not found, clone repository with --recursive")
  endif()
  message(STATUS "Sub-module nmodl missing : running git submodule update --init")
  execute_process(
    COMMAND ${GIT_EXECUTABLE} submodule update --init --
            ${CORENEURON_PROJECT_SOURCE_DIR}/external/nmodl
    WORKING_DIRECTORY ${CORENEURON_PROJECT_SOURCE_DIR})
else()
  message(STATUS "Using nmodl submodule from ${NMODL_PROJ}")
endif()

add_subdirectory(${CORENEURON_PROJECT_SOURCE_DIR}/external/nmodl)


================================================
FILE: CMake/AddRandom123Submodule.cmake
================================================
# =============================================================================
# Copyright (C) 2016-2021 Blue Brain Project
#
# See top-level LICENSE file for details.
# =============================================================================

include(FindPackageHandleStandardArgs)
find_package(FindPkgConfig QUIET)

find_path(
  Random123_PROJ
  NAMES LICENSE
  PATHS "${CORENEURON_PROJECT_SOURCE_DIR}/external/Random123"
  NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)

find_package_handle_standard_args(Random123 REQUIRED_VARS Random123_PROJ)

if(NOT Random123_FOUND)
  find_package(Git 1.8.3 QUIET)
  if(NOT ${GIT_FOUND})
    message(FATAL_ERROR "git not found, clone repository with --recursive")
  endif()
  message(STATUS "Sub-module Random123 missing: running git submodule update --init --recursive")
  execute_process(
    COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive --
            ${CORENEURON_PROJECT_SOURCE_DIR}/external/Random123
    WORKING_DIRECTORY ${CORENEURON_PROJECT_SOURCE_DIR})
endif()


================================================
FILE: CMake/CrayPortability.cmake
================================================
# =============================================================================
# Copyright (C) 2016-2021 Blue Brain Project
#
# See top-level LICENSE file for details.
# =============================================================================

if(IS_DIRECTORY "/opt/cray")
  set(CRAY_SYSTEM TRUE)
endif()

if(CRAY_SYSTEM)
  # default build type is static for cray
  if(NOT DEFINED COMPILE_LIBRARY_TYPE)
    set(COMPILE_LIBRARY_TYPE "STATIC")
  endif()

  # Cray wrapper take care of everything!
  set(MPI_LIBRARIES "")
  set(MPI_C_LIBRARIES "")
  set(MPI_CXX_LIBRARIES "")

  # ~~~
  # instead of -rdynamic, cray wrapper needs either -dynamic or -static(default)
  # also cray compiler needs fPIC flag
  # ~~~
  if(COMPILE_LIBRARY_TYPE STREQUAL "SHARED")
    set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "-dynamic")
    # TODO: add Cray compiler flag configurations in CompilerFlagsHelpers.cmake
    if(CMAKE_C_COMPILER_IS_CRAY)
      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
    endif()

  else()
    set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
  endif()
else()
  # default is shared library
  if(NOT DEFINED COMPILE_LIBRARY_TYPE)
    set(COMPILE_LIBRARY_TYPE "SHARED")
  endif()
endif()


================================================
FILE: CMake/GitRevision.cmake
================================================
# =============================================================================
# Copyright (C) 2016-2021 Blue Brain Project
#
# See top-level LICENSE file for details.
# =============================================================================

# ~~~
# For now use simple approach to get version information as git is often
# avaialble on the machine where we are building from source
# ~~~

find_package(Git)

if(GIT_FOUND)
  # get last commit sha1
  execute_process(
    COMMAND ${GIT_EXECUTABLE} -c log.showSignature=false log -1 --format=%h
    WORKING_DIRECTORY ${CORENEURON_PROJECT_SOURCE_DIR}
    OUTPUT_VARIABLE GIT_REVISION_SHA1
    ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
  # get last commit date
  execute_process(
    COMMAND ${GIT_EXECUTABLE} -c log.showSignature=false show -s --format=%ci
    WORKING_DIRECTORY ${CORENEURON_PROJECT_SOURCE_DIR}
    OUTPUT_VARIABLE GIT_REVISION_DATE
    ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
  set(CN_GIT_REVISION "${GIT_REVISION_SHA1} (${GIT_REVISION_DATE})")
else()
  set(CN_GIT_REVISION "unknown")
endif()


================================================
FILE: CMake/MakefileBuildOptions.cmake
================================================
# =============================================================================
# Copyright (C) 2016-2022 Blue Brain Project
#
# See top-level LICENSE file for details.
# =============================================================================

# =============================================================================
# NMODL CLI options : common and backend specific
# =============================================================================
# ~~~
# if user pass arguments then use those as common arguments
# note that inlining is done by default
# ~~~
set(NMODL_COMMON_ARGS "passes --inline")

if(NOT "${CORENRN_NMODL_FLAGS}" STREQUAL "")
  string(APPEND NMODL_COMMON_ARGS " ${CORENRN_NMODL_FLAGS}")
endif()

set(NMODL_CPU_BACKEND_ARGS "host --c")
set(NMODL_ACC_BACKEND_ARGS "host --c acc --oacc")

# =============================================================================
# Construct the linker arguments that are used inside nrnivmodl-core (to build libcorenrnmech from
# libcoreneuron-core, libcoreneuron-cuda and mechanism object files) and inside nrnivmodl (to link
# NEURON's special against CoreNEURON's libcorenrnmech). These are stored in two global properties:
# CORENRN_LIB_LINK_FLAGS (used by NEURON/nrnivmodl to link special against CoreNEURON) and
# CORENRN_LIB_LINK_DEP_FLAGS (used by CoreNEURON/nrnivmodl-core to link libcorenrnmech.so).
# Conceptually: CORENRN_LIB_LINK_FLAGS = -lcorenrnmech $CORENRN_LIB_LINK_DEP_FLAGS
# =============================================================================
if(NOT CORENRN_ENABLE_SHARED)
  set_property(GLOBAL APPEND_STRING PROPERTY CORENRN_LIB_LINK_FLAGS " -Wl,--whole-archive")
endif()
set_property(GLOBAL APPEND_STRING PROPERTY CORENRN_LIB_LINK_FLAGS " -lcorenrnmech")
if(NOT CORENRN_ENABLE_SHARED)
  set_property(GLOBAL APPEND_STRING PROPERTY CORENRN_LIB_LINK_FLAGS " -Wl,--no-whole-archive")
endif()
# Essentially we "just" want to unpack the CMake dependencies of the `coreneuron-core` target into a
# plain string that we can bake into the Makefiles in both NEURON and CoreNEURON.
function(coreneuron_process_library_path library)
  get_filename_component(library_dir "${library}" DIRECTORY)
  if(NOT library_dir)
    # In case target is not a target but is just the name of a library, e.g. "dl"
    set_property(GLOBAL APPEND_STRING PROPERTY CORENRN_LIB_LINK_DEP_FLAGS " -l${library}")
  elseif("${library_dir}" MATCHES "^(/lib|/lib64|/usr/lib|/usr/lib64)$")
    # e.g. /usr/lib64/libpthread.so -> -lpthread TODO: consider using
    # https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_IMPLICIT_LINK_DIRECTORIES.html, or
    # dropping this special case entirely
    get_filename_component(libname ${library} NAME_WE)
    string(REGEX REPLACE "^lib" "" libname ${libname})
    set_property(GLOBAL APPEND_STRING PROPERTY CORENRN_LIB_LINK_DEP_FLAGS " -l${libname}")
  else()
    # It's a full path, include that on the line
    set_property(GLOBAL APPEND_STRING PROPERTY CORENRN_LIB_LINK_DEP_FLAGS
                                               " -Wl,-rpath,${library_dir} ${library}")
  endif()
endfunction()
function(coreneuron_process_target target)
  if(TARGET ${target})
    if(NOT target STREQUAL "coreneuron-core")
      # This is a special case: libcoreneuron-core.a is manually unpacked into .o files by the
      # nrnivmodl-core Makefile, so we do not want to also emit an -lcoreneuron-core argument.
      get_target_property(target_inc_dirs ${target} INTERFACE_INCLUDE_DIRECTORIES)
      if(target_inc_dirs)
        foreach(inc_dir_genex ${target_inc_dirs})
          string(GENEX_STRIP "${inc_dir_genex}" inc_dir)
          if(inc_dir)
            set_property(GLOBAL APPEND_STRING PROPERTY CORENRN_EXTRA_COMPILE_FLAGS " -I${inc_dir}")
          endif()
        endforeach()
      endif()
      get_target_property(target_imported ${target} IMPORTED)
      if(target_imported)
        # In this case we can extract the full path to the library
        get_target_property(target_location ${target} LOCATION)
        coreneuron_process_library_path(${target_location})
      else()
        # This is probably another of our libraries, like -lcoreneuron-cuda. We might need to add -L
        # and an RPATH later.
        set_property(GLOBAL APPEND_STRING PROPERTY CORENRN_LIB_LINK_DEP_FLAGS " -l${target}")
      endif()
    endif()
    get_target_property(target_libraries ${target} LINK_LIBRARIES)
    if(target_libraries)
      foreach(child_target ${target_libraries})
        coreneuron_process_target(${child_target})
      endforeach()
    endif()
    return()
  endif()
  coreneuron_process_library_path("${target}")
endfunction()
coreneuron_process_target(coreneuron-core)
get_property(CORENRN_LIB_LINK_DEP_FLAGS GLOBAL PROPERTY CORENRN_LIB_LINK_DEP_FLAGS)
set_property(GLOBAL APPEND_STRING PROPERTY CORENRN_LIB_LINK_FLAGS " ${CORENRN_LIB_LINK_DEP_FLAGS}")
# In static builds then NEURON uses dlopen(nullptr, ...) to look for the corenrn_embedded_run
# symbol, which comes from libcoreneuron-core.a and gets included in libcorenrnmech.
if(NOT CORENRN_ENABLE_SHARED)
  set_property(GLOBAL APPEND_STRING PROPERTY CORENRN_LIB_LINK_FLAGS " -rdynamic")
endif()
get_property(CORENRN_EXTRA_COMPILE_FLAGS GLOBAL PROPERTY CORENRN_EXTRA_COMPILE_FLAGS)
get_property(CORENRN_LIB_LINK_FLAGS GLOBAL PROPERTY CORENRN_LIB_LINK_FLAGS)

# Detect if --start-group and --end-group are valid linker arguments. These are typically needed
# when linking mutually-dependent .o files (or where we don't know the correct order) on Linux, but
# they are not needed *or* recognised by the macOS linker.
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.18)
  include(CheckLinkerFlag)
  check_linker_flag(CXX -Wl,--start-group CORENRN_CXX_LINKER_SUPPORTS_START_GROUP)
elseif(CMAKE_SYSTEM_NAME MATCHES Linux)
  # Assume that --start-group and --end-group are only supported on Linux
  set(CORENRN_CXX_LINKER_SUPPORTS_START_GROUP ON)
endif()
if(CORENRN_CXX_LINKER_SUPPORTS_START_GROUP)
  set(CORENEURON_LINKER_START_GROUP -Wl,--start-group)
  set(CORENEURON_LINKER_END_GROUP -Wl,--end-group)
endif()

# Things that used to be in CORENRN_LIB_LINK_FLAGS: -lrt -L${CMAKE_HOST_SYSTEM_PROCESSOR}
# -L${caliper_LIB_DIR} -l${CALIPER_LIB}

# =============================================================================
# Turn CORENRN_COMPILE_DEFS into a list of -DFOO[=BAR] options.
# =============================================================================
list(TRANSFORM CORENRN_COMPILE_DEFS PREPEND -D OUTPUT_VARIABLE CORENRN_COMPILE_DEF_FLAGS)

# =============================================================================
# Extra link flags that we need to include when linking libcorenrnmech.{a,so} in CoreNEURON but that
# do not need to be passed to NEURON to use when linking nrniv/special (why?)
# =============================================================================
string(JOIN " " CORENRN_COMMON_LDFLAGS ${CORENRN_LIB_LINK_DEP_FLAGS} ${CORENRN_EXTRA_LINK_FLAGS})
if(CORENRN_SANITIZER_LIBRARY_DIR)
  string(APPEND CORENRN_COMMON_LDFLAGS " -Wl,-rpath,${CORENRN_SANITIZER_LIBRARY_DIR}")
endif()
string(JOIN " " CORENRN_SANITIZER_ENABLE_ENVIRONMENT_STRING ${CORENRN_SANITIZER_ENABLE_ENVIRONMENT})

# =============================================================================
# compile flags : common to all backend
# =============================================================================
string(TOUPPER "${CMAKE_BUILD_TYPE}" _BUILD_TYPE)
string(
  JOIN
  " "
  CORENRN_CXX_FLAGS
  ${CMAKE_CXX_FLAGS}
  ${CMAKE_CXX_FLAGS_${_BUILD_TYPE}}
  ${CMAKE_CXX17_STANDARD_COMPILE_OPTION}
  ${NVHPC_ACC_COMP_FLAGS}
  ${NVHPC_CXX_INLINE_FLAGS}
  ${CORENRN_COMPILE_DEF_FLAGS}
  ${CORENRN_EXTRA_MECH_CXX_FLAGS}
  ${CORENRN_EXTRA_COMPILE_FLAGS})

# =============================================================================
# nmodl/mod2c related options : TODO
# =============================================================================
# name of nmodl/mod2c binary
get_filename_component(nmodl_name ${CORENRN_MOD2CPP_BINARY} NAME)
set(nmodl_binary_name ${nmodl_name})


================================================
FILE: CMake/OpenAccHelper.cmake
================================================
# =============================================================================
# Copyright (C) 2016-2021 Blue Brain Project
#
# See top-level LICENSE file for details.
# =============================================================================

# Helper to parse X.Y[.{anything] into X.Y
function(cnrn_parse_version FULL_VERSION)
  cmake_parse_arguments(PARSE_ARGV 1 CNRN_PARSE_VERSION "" "OUTPUT_MAJOR_MINOR" "")
  if(NOT "${CNRN_PARSE_VERSION_UNPARSED_ARGUMENTS}" STREQUAL "")
    message(
      FATAL_ERROR
        "cnrn_parse_version got unexpected arguments: ${CNRN_PARSE_VERSION_UNPARSED_ARGUMENTS}")
  endif()
  string(FIND ${FULL_VERSION} . first_dot)
  math(EXPR first_dot_plus_one "${first_dot}+1")
  string(SUBSTRING ${FULL_VERSION} ${first_dot_plus_one} -1 minor_and_later)
  string(FIND ${minor_and_later} . second_dot_relative)
  if(${first_dot} EQUAL -1 OR ${second_dot_relative} EQUAL -1)
    message(FATAL_ERROR "Failed to parse major.minor from ${FULL_VERSION}")
  endif()
  math(EXPR second_dot_plus_one "${first_dot}+${second_dot_relative}+1")
  string(SUBSTRING ${FULL_VERSION} 0 ${second_dot_plus_one} major_minor)
  set(${CNRN_PARSE_VERSION_OUTPUT_MAJOR_MINOR}
      ${major_minor}
      PARENT_SCOPE)
endfunction()

# =============================================================================
# Prepare compiler flags for GPU target
# =============================================================================
if(CORENRN_ENABLE_GPU)
  # Get the NVC++ version number for use in nrnivmodl_core_makefile.in
  cnrn_parse_version(${CMAKE_CXX_COMPILER_VERSION} OUTPUT_MAJOR_MINOR
                     CORENRN_NVHPC_MAJOR_MINOR_VERSION)
  # Enable cudaProfiler{Start,Stop}() behind the Instrumentor::phase... APIs
  list(APPEND CORENRN_COMPILE_DEFS CORENEURON_CUDA_PROFILING CORENEURON_ENABLE_GPU)
  # Plain C++ code in CoreNEURON may need to use CUDA runtime APIs for, for example, starting and
  # stopping profiling. This makes sure those headers can be found.
  include_directories(${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
  # cuda unified memory support
  if(CORENRN_ENABLE_CUDA_UNIFIED_MEMORY)
    list(APPEND CORENRN_COMPILE_DEFS CORENEURON_UNIFIED_MEMORY)
  endif()
  if(${CMAKE_VERSION} VERSION_LESS 3.17)
    # Hopefully we can drop this soon. Parse ${CMAKE_CUDA_COMPILER_VERSION} into a shorter X.Y
    # version without any patch version.
    if(NOT ${CMAKE_CUDA_COMPILER_ID} STREQUAL "NVIDIA")
      message(FATAL_ERROR "Unsupported CUDA compiler ${CMAKE_CUDA_COMPILER_ID}")
    endif()
    cnrn_parse_version(${CMAKE_CUDA_COMPILER_VERSION} OUTPUT_MAJOR_MINOR CORENRN_CUDA_VERSION_SHORT)
  else()
    # This is a lazy way of getting the major/minor versions separately without parsing
    # ${CMAKE_CUDA_COMPILER_VERSION}
    find_package(CUDAToolkit 9.0 REQUIRED)
    # Be a bit paranoid
    if(NOT ${CMAKE_CUDA_COMPILER_VERSION} STREQUAL ${CUDAToolkit_VERSION})
      message(
        FATAL_ERROR
          "CUDA compiler (${CMAKE_CUDA_COMPILER_VERSION}) and toolkit (${CUDAToolkit_VERSION}) versions are not the same!"
      )
    endif()
    set(CORENRN_CUDA_VERSION_SHORT "${CUDAToolkit_VERSION_MAJOR}.${CUDAToolkit_VERSION_MINOR}")
  endif()
  # -cuda links CUDA libraries and also seems to be important to make the NVHPC do the device code
  # linking. Without this, we had problems with linking between the explicit CUDA (.cu) device code
  # and offloaded OpenACC/OpenMP code. Using -cuda when compiling seems to improve error messages in
  # some cases, and to be recommended by NVIDIA. We pass -gpu=cudaX.Y to ensure that OpenACC/OpenMP
  # code is compiled with the same CUDA version as the explicit CUDA code.
  set(NVHPC_ACC_COMP_FLAGS "-cuda -gpu=cuda${CORENRN_CUDA_VERSION_SHORT}")
  # Combining -gpu=lineinfo with -O0 -g gives a warning: Conflicting options --device-debug and
  # --generate-line-info specified, ignoring --generate-line-info option
  if(CMAKE_BUILD_TYPE STREQUAL "Debug")
    string(APPEND NVHPC_ACC_COMP_FLAGS ",debug")
  else()
    string(APPEND NVHPC_ACC_COMP_FLAGS ",lineinfo")
  endif()
  # Make sure that OpenACC code is generated for the same compute capabilities as the explicit CUDA
  # code. Otherwise there may be confusing linker errors. We cannot rely on nvcc and nvc++ using the
  # same default compute capabilities as each other, particularly on GPU-less build machines.
  foreach(compute_capability ${CMAKE_CUDA_ARCHITECTURES})
    string(APPEND NVHPC_ACC_COMP_FLAGS ",cc${compute_capability}")
  endforeach()
  if(CORENRN_ACCELERATOR_OFFLOAD STREQUAL "OpenMP")
    # Enable OpenMP target offload to GPU and if both OpenACC and OpenMP directives are available
    # for a region then prefer OpenMP.
    list(APPEND CORENRN_COMPILE_DEFS CORENEURON_PREFER_OPENMP_OFFLOAD)
    string(APPEND NVHPC_ACC_COMP_FLAGS " -mp=gpu")
  elseif(CORENRN_ACCELERATOR_OFFLOAD STREQUAL "OpenACC")
    # Only enable OpenACC offload for GPU
    string(APPEND NVHPC_ACC_COMP_FLAGS " -acc")
  else()
    message(FATAL_ERROR "${CORENRN_ACCELERATOR_OFFLOAD} not supported with NVHPC compilers")
  endif()
  string(APPEND CMAKE_EXE_LINKER_FLAGS " ${NVHPC_ACC_COMP_FLAGS}")
  # Use `-Mautoinline` option to compile .cpp files generated from .mod files only. This is
  # especially needed when we compile with -O0 or -O1 optimisation level where we get link errors.
  # Use of `-Mautoinline` ensure that the necessary functions like `net_receive_kernel` are inlined
  # for OpenACC code generation.
  set(NVHPC_CXX_INLINE_FLAGS "-Mautoinline")
endif()

# =============================================================================
# Initialise global properties that will be used by NEURON to link with CoreNEURON
# =============================================================================
if(CORENRN_ENABLE_GPU)
  # CORENRN_LIB_LINK_FLAGS is the full set of flags needed to link against libcorenrnmech.so:
  # something like `-acc -lcorenrnmech ...`. CORENRN_NEURON_LINK_FLAGS only contains flags that need
  # to be used when linking the NEURON Python module to make sure it is able to dynamically load
  # libcorenrnmech.so.
  set_property(GLOBAL PROPERTY CORENRN_LIB_LINK_FLAGS "${NVHPC_ACC_COMP_FLAGS}")
  if(CORENRN_ENABLE_SHARED)
    # Because of
    # https://forums.developer.nvidia.com/t/dynamically-loading-an-openacc-enabled-shared-library-from-an-executable-compiled-with-nvc-does-not-work/210968
    # we have to tell NEURON to pass OpenACC flags when linking special, otherwise we end up with an
    # `nrniv` binary that cannot dynamically load CoreNEURON in shared-library builds.
    set_property(GLOBAL PROPERTY CORENRN_NEURON_LINK_FLAGS "${NVHPC_ACC_COMP_FLAGS}")
  endif()
endif()

# NEURON needs to have access to this when CoreNEURON is built as a submodule. If CoreNEURON is
# installed externally then this is set via coreneuron-config.cmake
set_property(GLOBAL PROPERTY CORENRN_ENABLE_SHARED ${CORENRN_ENABLE_SHARED})

if(CORENRN_HAVE_NVHPC_COMPILER)
  if(${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER_EQUAL 20.7)
    # https://forums.developer.nvidia.com/t/many-all-diagnostic-numbers-increased-by-1-from-previous-values/146268/3
    # changed the numbering scheme in newer versions. The following list is from a clean start 13
    # August 2021. It would clearly be nicer to apply these suppressions only to relevant files.
    # Examples of the suppressed warnings are given below.
    # ~~~
    # "include/Random123/array.h", warning #111-D: statement is unreachable
    # "include/Random123/features/sse.h", warning #550-D: variable "edx" was set but never used
    # ~~~
    set(CORENEURON_CXX_WARNING_SUPPRESSIONS --diag_suppress=111,550)
    # This one can be a bit more targeted
    # ~~~
    # "boost/test/unit_test_log.hpp", warning #612-D: overloaded virtual function "..." is only partially overridden in class "..."
    # ~~~
    set(CORENEURON_BOOST_UNIT_TEST_COMPILE_FLAGS --diag_suppress=612)
    # Extra suppressions for .cpp files translated from .mod files.
    # ~~~
    # "x86_64/corenrn/mod2c/pattern.cpp", warning #161-D: unrecognized #pragma
    # "x86_64/corenrn/mod2c/svclmp.cpp", warning #177-D: variable "..." was declared but never referenced
    # ~~~
    string(JOIN " " CORENEURON_TRANSLATED_CODE_COMPILE_FLAGS ${CORENEURON_CXX_WARNING_SUPPRESSIONS}
           --diag_suppress=161,177)
  endif()
endif()


================================================
FILE: CMake/TestScriptUtils.cmake
================================================
# =============================================================================
# Copyright (C) 2016-2021 Blue Brain Project
#
# See top-level LICENSE file for details.
# =============================================================================

# ~~~
# Utility functions for manipulating test labels and producing
# tests from scripts:
#
# 1. add_test_class(label [label2 ...])
#
#    Create a target with name test-label (or test-label-label2 etc.)
#    which runs only those tests possessing all of the supplied labels.
#
#
# 2. add_test_label(name label ...)
#
#    Add the given labels to the test 'name'.
#
#
# 3. add_test_script(name script interp)
#
#    Add a test 'name' that runs the given script, using the
#    interpreter 'interp'. If no interpreter is supplied,
#    the script will be run with /bin/sh.
#
#    Uses the following variables to customize the new test:
#    * TEST_LABEL, ${NAME}_TEST_LABEL
#          If defined, apply the label(s) in these variable to the
#          new test.
#    * TEST_ARGS, ${NAME}_TEST_ARGS
#          Additional arguments to pass to the script.
#          ${NAME}_TEST_ARGS takes priority over TEST_ARGS.
#    * TEST_ENVIRONMENT
#          Additional environment variables to define for the test;
#          added to test properties.
#    * TEST_PREFIX, ${NAME}_TEST_PREFIX
#          If defined, preface the interpreter with this prefix.
#          ${NAME}_TEST_PREFIX takes priority over TEST_PREFIX.
# ~~~

function(add_test_label NAME)
  set_property(
    TEST ${NAME}
    APPEND
    PROPERTY LABELS ${ARGN})
  # create test classes for each label
  foreach(L ${ARGN})
    add_test_class(${L})
  endforeach()
endfunction()

function(add_test_script NAME SCRIPT INTERP)
  set(RUN_PREFIX ${TEST_PREFIX})
  if(${NAME}_TEST_PREFIX)
    set(RUN_PREFIX ${${NAME}_TEST_PREFIX})
  endif()

  if(NOT INTERP)
    set(INTERP "/bin/sh")
  endif()

  set(RUN_ARGS ${TEST_ARGS})
  if(${NAME}_TEST_ARGS)
    set(RUN_ARGS ${${NAME}_TEST_ARGS})
  endif()

  set(SCRIPT_PATH "${SCRIPT}")
  if(NOT IS_ABSOLUTE "${SCRIPT_PATH}")
    set(SCRIPT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/${SCRIPT_PATH}")
  endif()

  add_test(
    NAME ${NAME}
    COMMAND ${RUN_PREFIX} ${INTERP} "${SCRIPT_PATH}" ${RUN_ARGS}
    WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")

  # Add test labels
  set(TEST_LABELS ${TEST_LABEL} ${${NAME}_TEST_LABEL})
  if(TEST_LABELS)
    add_test_label(${NAME} ${TEST_LABELS})
  endif()

  if(TEST_ENVIRONMENT)
    set_property(TEST ${NAME} PROPERTY ENVIRONMENT ${TEST_ENVIRONMENT})
  endif()
endfunction()

function(add_test_class)
  string(REPLACE ";" "-" TEST_SUFFIX "${ARGN}")
  string(REPLACE ";" "$$;-L;^" TEST_LOPTS "${ARGN}")

  if(NOT TARGET test-${TEST_SUFFIX})
    add_custom_target(
      "test-${TEST_SUFFIX}"
      COMMAND ${CMAKE_CTEST_COMMAND} -L ^${TEST_LOPTS}$$
      WORKING_DIRECTORY ${${PROJECT_NAME}_BINARY_DIR}
      COMMENT "Running all ${ARGN} tests")
  endif()
endfunction()


================================================
FILE: CMake/config/CompilerFlagsHelpers.cmake
================================================
# =============================================================================
# Copyright (C) 2016-2021 Blue Brain Project
#
# See top-level LICENSE file for details.
# =============================================================================

# ~~~
# CompilerFlagsHelpers.cmake
# set of Convenience functions for portable compiler flags
# ~~~

set(SUPPORTED_COMPILER_LANGUAGE_LIST "CXX")

# detect compiler
foreach(COMPILER_LANGUAGE ${SUPPORTED_COMPILER_LANGUAGE_LIST})
  if(CMAKE_${COMPILER_LANGUAGE}_COMPILER_ID STREQUAL "XL")
    set(CMAKE_${COMPILER_LANGUAGE}_COMPILER_IS_XLC ON)
  elseif(CMAKE_${COMPILER_LANGUAGE}_COMPILER_ID STREQUAL "Intel")
    set(CMAKE_${COMPILER_LANGUAGE}_COMPILER_IS_ICC ON)
  elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
    set(CMAKE_${COMPILER_LANGUAGE}_COMPILER_IS_MSVC)
  elseif(${CMAKE_${COMPILER_LANGUAGE}_COMPILER_ID} STREQUAL "Clang")
    set(CMAKE_${COMPILER_LANGUAGE}_COMPILER_IS_CLANG ON)
  elseif(CMAKE_${COMPILER_LANGUAGE}_COMPILER_ID STREQUAL "GNU")
    set(CMAKE_${COMPILER_LANGUAGE}_COMPILER_IS_GCC ON)
  elseif(CMAKE_${COMPILER_LANGUAGE}_COMPILER_ID STREQUAL "Cray")
    set(CMAKE_${COMPILER_LANGUAGE}_COMPILER_IS_CRAY ON)
  endif()
endforeach()

foreach(COMPILER_LANGUAGE ${SUPPORTED_COMPILER_LANGUAGE_LIST})
  # XLC compiler
  if(CMAKE_${COMPILER_LANGUAGE}_COMPILER_IS_XLC)
    # ~~~
    # XLC -qinfo=all is awfully verbose on any platforms that use the GNU STL
    # Enable by default only the relevant one
    # ~~~
    set(CMAKE_${COMPILER_LANGUAGE}_WARNING_ALL "-qformat=all -qinfo=lan:trx:ret:zea:cmp:ret")

    set(CMAKE_${COMPILER_LANGUAGE}_DEBUGINFO_FLAGS "-g")

    set(CMAKE_${COMPILER_LANGUAGE}_OPT_NONE "-O0")
    set(CMAKE_${COMPILER_LANGUAGE}_OPT_NORMAL "-O2")
    set(CMAKE_${COMPILER_LANGUAGE}_OPT_AGGRESSIVE "-O3")
    set(CMAKE_${COMPILER_LANGUAGE}_OPT_FASTEST "-O5")

    set(CMAKE_${COMPILER_LANGUAGE}_STACK_PROTECTION "-qstackprotect")

    set(CMAKE_${COMPILER_LANGUAGE}_POSITION_INDEPENDENT "-qpic=small")

    set(CMAKE_${COMPILER_LANGUAGE}_VECTORIZE "-qhot")
    set(ADDITIONAL_THREADSAFE_FLAGS "-qthreaded")
    set(IGNORE_UNKNOWN_PRAGMA_FLAGS "-qsuppress=1506-224")

    # Microsoft compiler
  elseif(CMAKE_${COMPILER_LANGUAGE}_COMPILER_IS_MSVC)

    set(CMAKE_${COMPILER_LANGUAGE}_DEBUGINFO_FLAGS "-Zi")

    set(CMAKE_${COMPILER_LANGUAGE}_OPT_NONE "")
    set(CMAKE_${COMPILER_LANGUAGE}_OPT_NORMAL "-O2")
    set(CMAKE_${COMPILER_LANGUAGE}_OPT_AGGRESSIVE "-O2")
    set(CMAKE_${COMPILER_LANGUAGE}_OPT_FASTEST "-O2")

    set(CMAKE_${COMPILER_LANGUAGE}_STACK_PROTECTION "-GS")

    # enable by default on MSVC
    set(CMAKE_${COMPILER_LANGUAGE}_POSITION_INDEPENDENT "")

    # GCC
  elseif(CMAKE_${COMPILER_LANGUAGE}_COMPILER_IS_GCC)

    set(CMAKE_${COMPILER_LANGUAGE}_WARNING_ALL "-Wall")
    set(CMAKE_${COMPILER_LANGUAGE}_DEBUGINFO_FLAGS "-g")

    set(CMAKE_${COMPILER_LANGUAGE}_OPT_NONE "-O0")
    set(CMAKE_${COMPILER_LANGUAGE}_OPT_NORMAL "-O2")
    set(CMAKE_${COMPILER_LANGUAGE}_OPT_AGGRESSIVE "-O3")
    set(CMAKE_${COMPILER_LANGUAGE}_OPT_FASTEST "-Ofast -march=native")

    set(CMAKE_${COMPILER_LANGUAGE}_STACK_PROTECTION "-fstack-protector")

    set(CMAKE_${COMPILER_LANGUAGE}_POSITION_INDEPENDENT "-fPIC")

    set(CMAKE_${COMPILER_LANGUAGE}_VECTORIZE "-ftree-vectorize")
    set(IGNORE_UNKNOWN_PRAGMA_FLAGS "-Wno-unknown-pragmas")

    if(CMAKE_${COMPILER_LANGUAGE}_COMPILER_VERSION VERSION_GREATER "4.7.0")
      set(CMAKE_${COMPILER_LANGUAGE}_LINK_TIME_OPT "-flto")
    endif()

    if((CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^ppc") OR (CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^power"
                                                       ))
      # ppc arch do not support -march= syntax
      set(CMAKE_${COMPILER_LANGUAGE}_GEN_NATIVE "-mcpu=native")
    else()
      set(CMAKE_${COMPILER_LANGUAGE}_GEN_NATIVE "-march=native")
    endif()

    # CLANG
  elseif(CMAKE_${COMPILER_LANGUAGE}_COMPILER_IS_CLANG)
    set(CMAKE_${COMPILER_LANGUAGE}_WARNING_ALL "-Wall")
    set(CMAKE_${COMPILER_LANGUAGE}_DEBUGINFO_FLAGS "-g")

    set(CMAKE_${COMPILER_LANGUAGE}_OPT_NONE "-O0")
    set(CMAKE_${COMPILER_LANGUAGE}_OPT_NORMAL "-O2")
    set(CMAKE_${COMPILER_LANGUAGE}_OPT_AGGRESSIVE "-O3")
    set(CMAKE_${COMPILER_LANGUAGE}_OPT_FASTEST "-Ofast -march=native")

    set(CMAKE_${COMPILER_LANGUAGE}_STACK_PROTECTION "-fstack-protector")
    set(CMAKE_${COMPILER_LANGUAGE}_POSITION_INDEPENDENT "-fPIC")

    # Force same ld behavior as when called from gcc --as-needed forces the linker to check whether
    # a dynamic library mentioned in the command line is actually needed by the objects being
    # linked. Symbols needed in shared objects are already linked when building that library.
    set(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
    set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed")

    # rest of the world
  else()
    set(CMAKE_${COMPILER_LANGUAGE}_WARNING_ALL "-Wall")
    set(CMAKE_${COMPILER_LANGUAGE}_DEBUGINFO_FLAGS "-g")

    set(CMAKE_${COMPILER_LANGUAGE}_OPT_NONE "-O0")
    set(CMAKE_${COMPILER_LANGUAGE}_OPT_NORMAL "-O2")
    set(CMAKE_${COMPILER_LANGUAGE}_OPT_AGGRESSIVE "-O3")
    set(CMAKE_${COMPILER_LANGUAGE}_OPT_FASTEST "-O3")

    set(CMAKE_${COMPILER_LANGUAGE}_STACK_PROTECTION "")
    set(CMAKE_${COMPILER_LANGUAGE}_POSITION_INDEPENDENT "-fPIC")
    set(CMAKE_${COMPILER_LANGUAGE}_VECTORIZE "")

    if(CMAKE_${COMPILER_LANGUAGE}_COMPILER_IS_ICC)
      # unknown compiler flags produce error on Cray and hence just set this for intel now
      set(IGNORE_UNKNOWN_PRAGMA_FLAGS "-Wno-unknown-pragmas")
      # Intel O3 is extreme
      set(CMAKE_${COMPILER_LANGUAGE}_OPT_AGGRESSIVE "-O2")
    endif()

    if(CMAKE_${COMPILER_LANGUAGE}_COMPILER_ID STREQUAL "PGI")
      set(CMAKE_${COMPILER_LANGUAGE}_WARNING_ALL "")
    endif()
  endif()

endforeach()

# ===============================================================================
# Allow undefined reference in shared library as mod files will be linked later
# ===============================================================================
if(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang" OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
  set(UNDEFINED_SYMBOLS_IGNORE_FLAG "-undefined dynamic_lookup")
  string(APPEND CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS " ${UNDEFINED_SYMBOLS_IGNORE_FLAG}")
  string(APPEND CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS " ${UNDEFINED_SYMBOLS_IGNORE_FLAG}")
endif()


================================================
FILE: CMake/config/ReleaseDebugAutoFlags.cmake
================================================
# =============================================================================
# Copyright (C) 2016-2021 Blue Brain Project
#
# See top-level LICENSE file for details.
# =============================================================================

# ~~~
# ReleaseDebugAutoFlags.cmake
# Release / Debug configuration helper
# ~~~

# default configuration
if(NOT CMAKE_BUILD_TYPE AND (NOT CMAKE_CONFIGURATION_TYPES))
  set(CMAKE_BUILD_TYPE
      RelWithDebInfo
      CACHE STRING "Choose the type of build." FORCE)
  message(STATUS "Setting build type to '${CMAKE_BUILD_TYPE}' as none was specified.")
endif()

# =============================================================================
# Different build types
# =============================================================================
# ~~~
# Debug : Optimized for debugging, include debug symbols
# Release : Release mode, no debuginfo
# RelWithDebInfo : Distribution mode, basic optimizations for potable code with debuginfos
# Fast : Maximum level of optimization. Target native architecture, not portable code
# ~~~

include(CompilerFlagsHelpers)

# ~~~
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_OPT_NORMAL}")
set(CMAKE_C_FLAGS_DEBUG
    "${CMAKE_C_DEBUGINFO_FLAGS}  ${CMAKE_C_OPT_NONE} ${CMAKE_C_STACK_PROTECTION}")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_DEBUGINFO_FLAGS}  ${CMAKE_C_OPT_NORMAL}")
set(CMAKE_C_FLAGS_FAST " ${CMAKE_C_OPT_FASTEST} ${CMAKE_C_LINK_TIME_OPT} ${CMAKE_C_GEN_NATIVE}")

set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_OPT_NORMAL}")
set(CMAKE_CXX_FLAGS_DEBUG
    "${CMAKE_CXX_DEBUGINFO_FLAGS}  ${CMAKE_CXX_OPT_NONE} ${CMAKE_CXX_STACK_PROTECTION}")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_DEBUGINFO_FLAGS}  ${CMAKE_CXX_OPT_NORMAL}")
set(CMAKE_CXX_FLAGS_FAST
    " ${CMAKE_CXX_OPT_FASTEST} ${CMAKE_CXX_LINK_TIME_OPT} ${CMAKE_CXX_GEN_NATIVE}")
# ~~~


================================================
FILE: CMake/config/SetRpath.cmake
================================================
# =============================================================================
# Copyright (C) 2016-2021 Blue Brain Project
#
# See top-level LICENSE file for details.
# =============================================================================

# enable @rpath in the install name for any shared library being built
set(CMAKE_MACOSX_RPATH 1)

# ~~~
# On platforms like bgq, xlc didn't like rpath with static build and similar
# issue was seen on Cray
# ~~~
if(NOT CRAY_SYSTEM)
  # use, i.e. don't skip the full RPATH for the build tree
  set(CMAKE_SKIP_BUILD_RPATH FALSE)

  # when building, don't use the install RPATH already but later on when installing
  set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)

  # ~~~
  # add the automatically determined parts of the RPATH which point to directories
  # outside the build tree to the install RPATH
  # ~~~
  set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

  set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib")

  # the RPATH to be used when installing, but only if it's not a system directory
  list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${LIB_INSTALL_DIR}" isSystemDir)
  if("${isSystemDir}" STREQUAL "-1")
    set(CMAKE_INSTALL_RPATH "${LIB_INSTALL_DIR}")
  endif("${isSystemDir}" STREQUAL "-1")
endif()


================================================
FILE: CMake/config/TestHelpers.cmake
================================================
# =============================================================================
# Copyright (C) 2016-2021 Blue Brain Project
#
# See top-level LICENSE file for details.
# =============================================================================

# ~~~
# TestHelpers.cmake
# set of Convenience functions for unit testing with cmake
# ~~~

# enable or disable detection of SLURM and MPIEXEC
option(AUTO_TEST_WITH_SLURM "Add srun as test prefix in a SLURM environment" TRUE)
option(AUTO_TEST_WITH_MPIEXEC "Add mpiexec as test prefix in a MPICH2/OpenMPI environment" TRUE)

# ~~~
# Basic SLURM support the prefix "srun" is added to any test in the environment/ For a
# slurm test execution, simply run "salloc [your_exec_parameters] ctest"
# ~~~
if(AUTO_TEST_WITH_SLURM)
  if(NOT DEFINED SLURM_SRUN_COMMAND)
    find_program(
      SLURM_SRUN_COMMAND
      NAMES "srun"
      HINTS "${SLURM_ROOT}/bin" QUIET)
  endif()

  if(SLURM_SRUN_COMMAND)
    set(TEST_EXEC_PREFIX_DEFAULT "${SLURM_SRUN_COMMAND}")
    set(TEST_MPI_EXEC_PREFIX_DEFAULT "${SLURM_SRUN_COMMAND}")
    set(TEST_MPI_EXEC_BIN_DEFAULT "${SLURM_SRUN_COMMAND}")
    set(TEST_WITH_SLURM ON)
  endif()

endif()

# Basic mpiexec support, will just forward mpiexec as prefix
if(AUTO_TEST_WITH_MPIEXEC AND NOT TEST_WITH_SLURM)
  if(NOT DEFINED MPIEXEC)
    find_program(
      MPIEXEC
      NAMES "mpiexec"
      HINTS "${MPI_ROOT}/bin")
  endif()

  if(MPIEXEC)
    set(TEST_MPI_EXEC_PREFIX_DEFAULT "${MPIEXEC}")
    set(TEST_MPI_EXEC_BIN_DEFAULT "${MPIEXEC}")
    set(TEST_WITH_MPIEXEC ON)
  endif()
endif()

# ~~~
# MPI executor program path without arguments used for testing.
# default: srun or mpiexec if found
# ~~~
set(TEST_MPI_EXEC_BIN
    "${TEST_MPI_EXEC_BIN_DEFAULT}"
    CACHE STRING "path of the MPI executor (mpiexec, mpirun) for test execution")

# ~~~
# Test execution prefix. Override this variable for any execution prefix required
# in clustered environment
#
# To specify manually a command with argument, e.g -DTEST_EXEC_PREFIX="/usr/bin/srun;-n;-4"
# for a srun execution with 4 nodes
#
# default: srun if found
# ~~~
set(TEST_EXEC_PREFIX
    "${TEST_EXEC_PREFIX_DEFAULT}"
    CACHE STRING "prefix command for the test executions")

# ~~~
# Test execution prefix specific for MPI programs.
#
# To specify manually a command with argument, use the cmake list syntax. e.g
# -DTEST_EXEC_PREFIX="/usr/bin/mpiexec;-n;-4" for an MPI execution with 4 nodes
#
# default: srun or mpiexec if found
# ~~~
set(TEST_MPI_EXEC_PREFIX
    "${TEST_MPI_EXEC_PREFIX_DEFAULT}"
    CACHE STRING "prefix command for the MPI test executions")


================================================
FILE: CMake/coreneuron-config.cmake.in
================================================
# =============================================================================
# Copyright (C) 2016-2022 Blue Brain Project
#
# See top-level LICENSE file for details.
# =============================================================================

# coreneuron-config.cmake - package configuration file

get_filename_component(CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH)

set(CORENRN_VERSION_MAJOR @PROJECT_VERSION_MAJOR@)
set(CORENRN_VERSION_MINOR @PROJECT_VERSION_MINOR@)
set(CORENRN_VERSION_PATCH @PROJECT_VERSION_PATCH@)
set(CORENRN_ENABLE_GPU @CORENRN_ENABLE_GPU@)
set(CORENRN_ENABLE_NMODL @CORENRN_ENABLE_NMODL@)
set(CORENRN_ENABLE_REPORTING @CORENRN_ENABLE_REPORTING@)
set(CORENRN_ENABLE_SHARED @CORENRN_ENABLE_SHARED@)
set(CORENRN_LIB_LINK_FLAGS "@CORENRN_LIB_LINK_FLAGS@")
set(CORENRN_NEURON_LINK_FLAGS "@CORENRN_NEURON_LINK_FLAGS@")

find_path(CORENEURON_INCLUDE_DIR "coreneuron/coreneuron.h" HINTS "${CONFIG_PATH}/../../include")
find_path(
  CORENEURON_LIB_DIR
  NAMES libcorenrnmech.a libcorenrnmech.so libcorenrnmech.dylib
  HINTS "${CONFIG_PATH}/../../lib")

include(${CONFIG_PATH}/coreneuron.cmake)


================================================
FILE: CMake/packages/FindSphinx.cmake
================================================
# =============================================================================
# Copyright (C) 2016-2021 Blue Brain Project
#
# See top-level LICENSE file for details.
# =============================================================================

find_program(
  SPHINX_EXECUTABLE
  NAMES sphinx-build
  DOC "/path/to/sphinx-build")

include(FindPackageHandleStandardArgs)

find_package_handle_standard_args(Sphinx "Failed to find sphinx-build executable" SPHINX_EXECUTABLE)


================================================
FILE: CMake/packages/Findlikwid.cmake
================================================
# =============================================================================
# Copyright (C) 2016-2021 Blue Brain Project
#
# See top-level LICENSE file for details.
# =============================================================================

# ~~~
# Findlikwid
# -------------
#
# Find likwid
#
# Find the likwid RRZE Performance Monitoring and Benchmarking Suite
#
# Using likwid:
#
# ::
#   set(LIKWID_DIR "" CACHE PATH "Path likwid performance monitoring and benchmarking suite")
#   find_package(likwid REQUIRED)
#   include_directories(${likwid_INCLUDE_DIRS})
#   target_link_libraries(foo ${likwid_LIBRARIES})
#
# This module sets the following variables:
#
# ::
#
#   likwid_FOUND     - set to true if the library is found
#   likwid_INCLUDE   - list of required include directories
#   likwid_LIBRARIES - list of required library directories
# ~~~

find_path(likwid_INCLUDE_DIRS "likwid.h" HINTS "${LIKWID_DIR}/include")
find_library(likwid_LIBRARIES likwid HINTS "${LIKWID_DIR}/lib")

# Checks 'REQUIRED', 'QUIET' and versions.
include(FindPackageHandleStandardArgs)

find_package_handle_standard_args(likwid REQUIRED_VARS likwid_INCLUDE_DIRS likwid_LIBRARIES)


================================================
FILE: CMake/packages/Findnmodl.cmake
================================================
# =============================================================================
# Copyright (C) 2016-2021 Blue Brain Project
#
# See top-level LICENSE file for details.
# =============================================================================

# ~~~
# Findnmodl
# -------------
#
# Find nmodl
#
# Find the nmodl Blue Brain HPC utils library
#
# Using nmodl:
#
# ::
#   set(CORENRN_NMODL_DIR "" CACHE PATH "Path to nmodl source-to-source compiler installation")
#   find_package(nmodl REQUIRED)
#   include_directories(${nmodl_INCLUDE_DIRS})
#   target_link_libraries(foo ${nmodl_LIBRARIES})
#
# This module sets the following variables:
#
# ::
#
#   nmodl_FOUND   - set to true if the library is found
#   nmodl_INCLUDE - list of required include directories
#   nmodl_BINARY  - the nmodl binary
# ~~~

# UNIX paths are standard, no need to write.
find_program(
  nmodl_BINARY
  NAMES nmodl${CMAKE_EXECUTABLE_SUFFIX}
  HINTS "${CORENRN_NMODL_DIR}/bin" QUIET)

find_path(nmodl_INCLUDE "nmodl/fast_math.hpp" HINTS "${CORENRN_NMODL_DIR}/include")
find_path(nmodl_PYTHONPATH "nmodl/__init__.py" HINTS "${CORENRN_NMODL_DIR}/lib")

# Checks 'REQUIRED', 'QUIET' and versions.
include(FindPackageHandleStandardArgs)

find_package_handle_standard_args(
  nmodl
  FOUND_VAR nmodl_FOUND
  REQUIRED_VARS nmodl_BINARY nmodl_INCLUDE nmodl_PYTHONPATH)


================================================
FILE: CMake/packages/Findreportinglib.cmake
================================================
# =============================================================================
# Copyright (C) 2016-2021 Blue Brain Project
#
# See top-level LICENSE file for details.
# =============================================================================

# ~~~
# Findreportinglib
# -------------
#
# Find reportinglib
#
# Find the reportinglib Blue Brain HPC utils library
#
# Using reportinglib:
#
# ::
#
#   find_package(reportinglib REQUIRED)
#   include_directories(${reportinglib_INCLUDE_DIRS})
#   target_link_libraries(foo ${reportinglib_LIBRARIES})
#
# This module sets the following variables:
#
# ::
#
#   reportinglib_FOUND - set to true if the library is found
#   reportinglib_INCLUDE_DIRS - list of required include directories
#   reportinglib_LIBRARIES - list of libraries to be linked
# ~~~

# UNIX paths are standard, no need to write.
find_path(reportinglib_INCLUDE_DIR reportinglib/Report.h)
find_library(reportinglib_LIBRARY reportinglib)
get_filename_component(reportinglib_LIB_DIR ${reportinglib_LIBRARY} DIRECTORY)
find_program(reportinglib_somaDump somaDump ${reportinglib_LIB_DIR}/../bin)

# Checks 'REQUIRED', 'QUIET' and versions.
include(FindPackageHandleStandardArgs)

find_package_handle_standard_args(
  reportinglib
  FOUND_VAR reportinglib_FOUND
  REQUIRED_VARS reportinglib_INCLUDE_DIR reportinglib_LIBRARY reportinglib_LIB_DIR)


================================================
FILE: CMakeLists.txt
================================================
# =============================================================================
# Copyright (c) 2016 - 2022 Blue Brain Project/EPFL
#
# See top-level LICENSE file for details.
# =============================================================================
cmake_minimum_required(VERSION 3.15 FATAL_ERROR)
# CoreNEURON's version jumped from 1.0 to 8.2.0 with the introduction of the NRN_VERSION_* macros
# for use in VERBATIM blocks. Starting from this version, the NEURON and CoreNEURON versions are
# locked together. A version has to be hardcoded here to handle the case that CoreNEURON is built
# standalone.
project(
  coreneuron
  VERSION 9.0.0
  LANGUAGES CXX)

# ~~~
# It is a bad idea having floating point versions, since macros cant handle them
# We therefore, have version as an int, which is pretty much standard
# ~~~
math(EXPR CORENEURON_VERSION_COMBINED
     "${coreneuron_VERSION_MAJOR} * 100 + ${coreneuron_VERSION_MINOR}")

# =============================================================================
# CMake common project settings
# =============================================================================
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_BUILD_TYPE
    RelWithDebInfo
    CACHE STRING "Empty or one of Debug, Release, RelWithDebInfo")

if(NOT "cxx_std_17" IN_LIST CMAKE_CXX_COMPILE_FEATURES)
  message(
    FATAL_ERROR
      "This compiler does not fully support C++17, choose a higher version or another compiler.")
endif()

# =============================================================================
# Settings to enable project as submodule
# =============================================================================
set(CORENEURON_PROJECT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
set(CORENEURON_PROJECT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(CORENEURON_AS_SUBPROJECT OFF)
if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
  set(CORENEURON_AS_SUBPROJECT ON)
  # Make these visible to the parent project (NEURON) so it can do some sanity checking.
  set_property(GLOBAL PROPERTY CORENRN_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
  set_property(GLOBAL PROPERTY CORENRN_VERSION_MINOR ${PROJECT_VERSION_MINOR})
  set_property(GLOBAL PROPERTY CORENRN_VERSION_PATCH ${PROJECT_VERSION_PATCH})
endif()
if(NOT DEFINED NRN_VERSION_MAJOR
   OR NOT DEFINED NRN_VERSION_MINOR
   OR NOT DEFINED NRN_VERSION_PATCH)
  if(CORENEURON_AS_SUBPROJECT)
    set(level WARNING)
  else()
    set(level STATUS)
  endif()
  # Typically in this case CoreNEURON is being built standalone. In this case NRN_VERSION_* macros
  # resolve to the CoreNEURON version, which is supposed to be moving in lockstep with the NEURON
  # version.
  set(NRN_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
  set(NRN_VERSION_MINOR ${PROJECT_VERSION_MINOR})
  set(NRN_VERSION_PATCH ${PROJECT_VERSION_PATCH})
  message(${level} "CoreNEURON could not determine the NEURON version, using the hardcoded "
          "${NRN_VERSION_MAJOR}.${NRN_VERSION_MINOR}.${NRN_VERSION_PATCH}")
endif()
# Regardless of whether we are being built as a submodule of NEURON, NRN_VERSION_{MAJOR,MINOR,PATCH}
# are now set to the version that we should claim compatibility with when compiling translated MOD
# files. Generate a header under a special `generated` prefix in the build directory, so that
# -I/path/to/src -I/path/to/build/generated is safe (headers from the source prefix are copied
# elsewhere under the build prefix, so there is scope for confusion)
configure_file(coreneuron/config/neuron_version.hpp.in
               generated/coreneuron/config/neuron_version.hpp)

# =============================================================================
# Include cmake modules path
# =============================================================================
list(APPEND CMAKE_MODULE_PATH ${CORENEURON_PROJECT_SOURCE_DIR}/CMake
     ${CORENEURON_PROJECT_SOURCE_DIR}/CMake/packages ${CORENEURON_PROJECT_SOURCE_DIR}/CMake/config)

# =============================================================================
# HPC Coding Conventions
# =============================================================================
set(CODING_CONV_PREFIX "CORENRN")
set(CORENRN_3RDPARTY_DIR "external")
include(AddHpcCodingConvSubmodule)
add_subdirectory(CMake/hpc-coding-conventions/cpp)

# =============================================================================
# Enable sanitizer support if the CORENRN_SANITIZERS variable is set
# =============================================================================
include(CMake/hpc-coding-conventions/cpp/cmake/sanitizers.cmake)
set(CORENRN_EXTRA_CXX_FLAGS
    ""
    CACHE STRING "Add extra compile flags for CoreNEURON sources")
separate_arguments(CORENRN_EXTRA_CXX_FLAGS)
set(CORENRN_EXTRA_MECH_CXX_FLAGS
    ""
    CACHE STRING "Add extra compile flags for translated mechanisms")
separate_arguments(CORENRN_EXTRA_MECH_CXX_FLAGS)
list(APPEND CORENRN_EXTRA_CXX_FLAGS ${CORENRN_SANITIZER_COMPILER_FLAGS})
list(APPEND CORENRN_EXTRA_MECH_CXX_FLAGS ${CORENRN_SANITIZER_COMPILER_FLAGS})
list(APPEND CORENRN_EXTRA_LINK_FLAGS ${CORENRN_SANITIZER_COMPILER_FLAGS})

# =============================================================================
# Include common cmake modules
# =============================================================================
include(CheckIncludeFiles)
include(ReleaseDebugAutoFlags)
include(CrayPortability)
include(SetRpath)
include(CTest)
include(AddRandom123Submodule)
include(GitRevision)

set(CORENRN_3RDPARTY_DIR external)
include(CMake/hpc-coding-conventions/cpp/cmake/3rdparty.cmake)
cpp_cc_git_submodule(CLI11 BUILD PACKAGE CLI11 REQUIRED)

# =============================================================================
# Build options
# =============================================================================
option(CORENRN_ENABLE_OPENMP "Build the CORE NEURON with OpenMP implementation" ON)
option(CORENRN_ENABLE_OPENMP_OFFLOAD "Prefer OpenMP target offload to OpenACC" ON)
option(CORENRN_ENABLE_TIMEOUT "Enable nrn_timeout implementation" ON)
option(CORENRN_ENABLE_REPORTING "Enable use of ReportingLib for soma reports" OFF)
option(CORENRN_ENABLE_MPI "Enable MPI-based execution" ON)
option(CORENRN_ENABLE_MPI_DYNAMIC "Enable dynamic MPI support" OFF)
option(CORENRN_ENABLE_HOC_EXP "Enable wrapping exp with hoc_exp()" OFF)
option(CORENRN_ENABLE_SPLAYTREE_QUEUING "Enable use of Splay tree for spike queuing" ON)
option(CORENRN_ENABLE_NET_RECEIVE_BUFFER "Enable event buffering in net_receive function" ON)
option(CORENRN_ENABLE_NMODL "Enable external nmodl source-to-source compiler" OFF)
option(CORENRN_ENABLE_CALIPER_PROFILING "Enable Caliper instrumentation" OFF)
option(CORENRN_ENABLE_LIKWID_PROFILING "Enable LIKWID instrumentation" OFF)
option(CORENRN_ENABLE_CUDA_UNIFIED_MEMORY "Enable CUDA unified memory support" OFF)
option(CORENRN_ENABLE_UNIT_TESTS "Enable unit tests execution" ON)
option(CORENRN_ENABLE_GPU "Enable GPU support using OpenACC or OpenMP" OFF)
option(CORENRN_ENABLE_SHARED "Enable shared library build" ON)
option(CORENRN_ENABLE_LEGACY_UNITS "Enable legacy FARADAY, R, etc" OFF)
option(CORENRN_ENABLE_PRCELLSTATE "Enable NRN_PRCELLSTATE debug feature" OFF)

set(CORENRN_NMODL_DIR
    ""
    CACHE PATH "Path to nmodl source-to-source compiler installation")
set(LIKWID_DIR
    ""
    CACHE PATH "Path to likwid performance analysis suite")

# Older CMake versions label NVHPC as PGI, newer ones label it as NVHPC.
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "PGI" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "NVHPC")
  set(CORENRN_HAVE_NVHPC_COMPILER ON)
else()
  set(CORENRN_HAVE_NVHPC_COMPILER OFF)
endif()

set(CORENRN_ACCELERATOR_OFFLOAD "Disabled")
if(CORENRN_ENABLE_GPU)
  # Older CMake versions than 3.15 have not been tested for GPU/CUDA/OpenACC support after
  # https://github.com/BlueBrain/CoreNeuron/pull/609.

  # Fail hard and early if we don't have the PGI/NVHPC compiler.
  if(NOT CORENRN_HAVE_NVHPC_COMPILER)
    message(
      FATAL_ERROR
        "GPU support is available via OpenACC using PGI/NVIDIA compilers."
        " Use NVIDIA HPC SDK with -DCMAKE_C_COMPILER=nvc -DCMAKE_CUDA_COMPILER=nvcc -DCMAKE_CXX_COMPILER=nvc++"
    )
  endif()

  # Set some sensible default CUDA architectures.
  if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
    set(CMAKE_CUDA_ARCHITECTURES 70 80)
    message(STATUS "Setting default CUDA architectures to ${CMAKE_CUDA_ARCHITECTURES}")
  endif()

  # See https://gitlab.kitware.com/cmake/cmake/-/issues/23081, this should not be needed according
  # to the CMake documentation, but it is not clear that any version behaves as documented.
  if(DEFINED CMAKE_CUDA_HOST_COMPILER)
    unset(ENV{CUDAHOSTCXX})
  endif()

  # Enable CUDA language support.
  enable_language(CUDA)

  # Prefer shared libcudart.so
  if(${CMAKE_VERSION} VERSION_LESS 3.17)
    # Ugly workaround from https://gitlab.kitware.com/cmake/cmake/-/issues/17559, remove when
    # possible
    if(CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES)
      list(REMOVE_ITEM CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES "cudart_static")
      list(REMOVE_ITEM CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES "cudadevrt")
      list(APPEND CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES "cudart")
    endif()
    if(CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES)
      list(REMOVE_ITEM CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES "cudart_static")
      list(REMOVE_ITEM CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES "cudadevrt")
      list(APPEND CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES "cudart")
    endif()
  else()
    # nvc++ -cuda implicitly links dynamically to libcudart.so. Setting this makes sure that CMake
    # does not add -lcudart_static and trigger errors due to mixed dynamic/static linkage.
    set(CMAKE_CUDA_RUNTIME_LIBRARY Shared)
  endif()

  # Patch CUDA_ARCHITECTURES support into older CMake versions
  if(${CMAKE_VERSION} VERSION_LESS 3.18)
    foreach(cuda_arch ${CMAKE_CUDA_ARCHITECTURES})
      string(
        APPEND CMAKE_CUDA_FLAGS
        " --generate-code=arch=compute_${cuda_arch},code=[compute_${cuda_arch},sm_${cuda_arch}]")
    endforeach()
  endif()

  # ~~~
  # Needed for the Eigen GPU support Warning suppression (Eigen GPU-related):
  # 3057 : Warning on ignoring __host__ annotation in some functions
  # 3085 : Warning on redeclaring a __host__ function as __host__ __device__
  # ~~~
  set(CMAKE_CUDA_FLAGS
      "${CMAKE_CUDA_FLAGS} --expt-relaxed-constexpr -Xcudafe --diag_suppress=3057,--diag_suppress=3085"
  )

  if(CORENRN_ENABLE_NMODL)
    # NMODL supports both OpenACC and OpenMP target offload
    if(CORENRN_ENABLE_OPENMP AND CORENRN_ENABLE_OPENMP_OFFLOAD)
      set(CORENRN_ACCELERATOR_OFFLOAD "OpenMP")
    else()
      set(CORENRN_ACCELERATOR_OFFLOAD "OpenACC")
    endif()
  else()
    # MOD2C only supports OpenACC offload
    set(CORENRN_ACCELERATOR_OFFLOAD "OpenACC")
  endif()
endif()

# =============================================================================
# Project version from git and project directories
# =============================================================================
set(CN_PROJECT_VERSION ${PROJECT_VERSION})

# generate file with version number from git and nrnunits.lib file path
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/coreneuron/config/config.cpp.in
               ${PROJECT_BINARY_DIR}/coreneuron/config/config.cpp @ONLY)

# =============================================================================
# Include cmake modules after cmake options
# =============================================================================
include(OpenAccHelper)

# =============================================================================
# Common dependencies
# =============================================================================
find_package(PythonInterp REQUIRED)
find_package(Perl REQUIRED)

# =============================================================================
# Common build options
# =============================================================================
# build mod files for coreneuron
list(APPEND CORENRN_COMPILE_DEFS CORENEURON_BUILD)
set(CMAKE_REQUIRED_QUIET TRUE)
check_include_files(malloc.h have_malloc_h)
if(have_malloc_h)
  list(APPEND CORENRN_COMPILE_DEFS HAVE_MALLOC_H)
endif()

# =============================================================================
# Build option specific compiler flags
# =============================================================================
if(CORENRN_ENABLE_NMODL)
  # We use Eigen for "small" matrices with thread-level parallelism handled at a higher level; tell
  # Eigen not to try to multithread internally
  list(APPEND CORENRN_COMPILE_DEFS EIGEN_DONT_PARALLELIZE)
endif()
if(CORENRN_HAVE_NVHPC_COMPILER)
  # PGI with llvm code generation doesn't have necessary assembly intrinsic headers
  list(APPEND CORENRN_COMPILE_DEFS EIGEN_DONT_VECTORIZE=1)
  if(NOT CORENRN_ENABLE_GPU AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER_EQUAL 21.11)
    # Random123 does not play nicely with NVHPC 21.11+'s detection of ABM features if it detects the
    # compiler to be PGI or NVHPC, see: https://github.com/BlueBrain/CoreNeuron/issues/724 and
    # https://github.com/DEShawResearch/random123/issues/6. In fact in GPU builds Random123
    # (mis)detects nvc++ as nvcc because we pass the -cuda option and we therefore avoid the
    # problem. If GPU support is disabled, we define R123_USE_INTRIN_H=0 to avoid the problem.
    list(APPEND CORENRN_COMPILE_DEFS R123_USE_INTRIN_H=0)
  endif()
  # CMake versions <3.19 used to add -A when using NVHPC/PGI, which makes the compiler excessively
  # pedantic. See https://gitlab.kitware.com/cmake/cmake/-/issues/20997.
  if(CMAKE_VERSION VERSION_LESS 3.19)
    list(REMOVE_ITEM CMAKE_CXX17_STANDARD_COMPILE_OPTION -A)
  endif()
endif()

if(CORENRN_ENABLE_SHARED)
  set(COMPILE_LIBRARY_TYPE "SHARED")
else()
  set(COMPILE_LIBRARY_TYPE "STATIC")
endif()

if(CORENRN_ENABLE_MPI)
  find_package(MPI REQUIRED)
  list(APPEND CORENRN_COMPILE_DEFS NRNMPI=1)
  # avoid linking to C++ bindings
  list(APPEND CORENRN_COMPILE_DEFS MPI_NO_CPPBIND=1)
  list(APPEND CORENRN_COMPILE_DEFS OMPI_SKIP_MPICXX=1)
  list(APPEND CORENRN_COMPILE_DEFS MPICH_SKIP_MPICXX=1)
else()
  list(APPEND CORENRN_COMPILE_DEFS NRNMPI=0)
  list(APPEND CORENRN_COMPILE_DEFS NRN_MULTISEND=0)
endif()

if(CORENRN_ENABLE_OPENMP)
  find_package(OpenMP QUIET)
  if(OPENMP_FOUND)
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS} ${ADDITIONAL_THREADSAFE_FLAGS}")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS} ${ADDITIONAL_THREADSAFE_FLAGS}")
  endif()
endif()

list(APPEND CORENRN_COMPILE_DEFS LAYOUT=0)

if(NOT CORENRN_ENABLE_HOC_EXP)
  list(APPEND CORENRN_COMPILE_DEFS DISABLE_HOC_EXP)
endif()

# splay tree required for net_move
if(CORENRN_ENABLE_SPLAYTREE_QUEUING)
  list(APPEND CORENRN_COMPILE_DEFS ENABLE_SPLAYTREE_QUEUING)
endif()

if(NOT CORENRN_ENABLE_NET_RECEIVE_BUFFER)
  list(APPEND CORENRN_COMPILE_DEFS NET_RECEIVE_BUFFERING=0)
endif()

if(NOT CORENRN_ENABLE_TIMEOUT)
  list(APPEND CORENRN_COMPILE_DEFS DISABLE_TIMEOUT)
endif()

if(CORENRN_ENABLE_REPORTING)
  find_package(reportinglib)
  find_package(sonata)
  find_program(H5DUMP_EXECUTABLE h5dump)

  if(reportinglib_FOUND)
    list(APPEND CORENRN_COMPILE_DEFS ENABLE_BIN_REPORTS)
    set(ENABLE_BIN_REPORTS_TESTS ON)
  else()
    set(reportinglib_INCLUDE_DIR "")
    set(reportinglib_LIBRARY "")
  endif()
  if(sonata_FOUND)
    if(TARGET sonata::sonata_report)
      list(APPEND CORENRN_COMPILE_DEFS ENABLE_SONATA_REPORTS)
      set(ENABLE_SONATA_REPORTS_TESTS ON)
    else()
      message(SEND_ERROR "SONATA library was found but without reporting support")
    endif()
  endif()

  if(NOT reportinglib_FOUND AND NOT sonata_FOUND)
    message(SEND_ERROR "Neither reportinglib nor SONATA libraries were found")
  endif()

  include_directories(${reportinglib_INCLUDE_DIR})
  include_directories(${sonatareport_INCLUDE_DIR})
endif()

if(CORENRN_ENABLE_LEGACY_UNITS)
  set(CORENRN_USE_LEGACY_UNITS 1)
else()
  set(CORENRN_USE_LEGACY_UNITS 0)
endif()
list(APPEND CORENRN_COMPILE_DEFS CORENEURON_USE_LEGACY_UNITS=${CORENRN_USE_LEGACY_UNITS})
# Propagate Legacy Units flag to backends.
set(MOD2C_ENABLE_LEGACY_UNITS
    ${CORENRN_ENABLE_LEGACY_UNITS}
    CACHE BOOL "" FORCE)
set(NMODL_ENABLE_LEGACY_UNITS
    ${CORENRN_ENABLE_LEGACY_UNITS}
    CACHE BOOL "" FORCE)

if(CORENRN_ENABLE_MPI_DYNAMIC)
  if(NOT CORENRN_ENABLE_MPI)
    message(FATAL_ERROR "Cannot enable dynamic mpi without mpi")
  endif()
  list(APPEND CORENRN_COMPILE_DEFS CORENEURON_ENABLE_MPI_DYNAMIC)
endif()

if(CORENRN_ENABLE_PRCELLSTATE)
  set(CORENRN_NRN_PRCELLSTATE 1)
else()
  set(CORENRN_NRN_PRCELLSTATE 0)
endif()
if(MINGW)
  list(APPEND CORENRN_COMPILE_DEFS MINGW)
endif()

# =============================================================================
# NMODL specific options
# =============================================================================
if(CORENRN_ENABLE_NMODL)
  find_package(nmodl)
  if(NOT "${CORENRN_NMODL_DIR}" STREQUAL "" AND NOT nmodl_FOUND)
    message(FATAL_ERROR "Cannot find NMODL in ${CORENRN_NMODL_DIR}")
  endif()
  if(nmodl_FOUND)
    set(CORENRN_MOD2CPP_BINARY ${nmodl_BINARY})
    set(CORENRN_MOD2CPP_INCLUDE ${nmodl_INCLUDE})
    # path to python interface
    set(ENV{PYTHONPATH} "${nmodl_PYTHONPATH}:$ENV{PYTHONPATH}")
    set(CORENRN_NMODL_PYTHONPATH $ENV{PYTHONPATH})
  else()
    set(NMODL_ENABLE_PYTHON_BINDINGS
        OFF
        CACHE BOOL "Disable NMODL python bindings")
    include(AddNmodlSubmodule)
    set(CORENRN_MOD2CPP_BINARY ${CMAKE_BINARY_DIR}/bin/nmodl${CMAKE_EXECUTABLE_SUFFIX})
    set(CORENRN_MOD2CPP_INCLUDE ${CMAKE_BINARY_DIR}/include)
    set(ENV{PYTHONPATH} "$ENV{PYTHONPATH}")
    set(nmodl_PYTHONPATH "${CMAKE_BINARY_DIR}/lib")
    set(CORENRN_NMODL_PYTHONPATH "${nmodl_PYTHONPATH}:$ENV{PYTHONPATH}")
    set(NMODL_TARGET_TO_DEPEND nmodl)
  endif()
  include_directories(${CORENRN_MOD2CPP_INCLUDE})
  # set correct arguments for nmodl for cpu/gpu target
  set(CORENRN_NMODL_FLAGS
      ""
      CACHE STRING "Extra NMODL options such as passes")
else()
  include(AddMod2cSubmodule)
  set(NMODL_TARGET_TO_DEPEND mod2c_core)
  set(CORENRN_MOD2CPP_BINARY ${CMAKE_BINARY_DIR}/bin/mod2c_core${CMAKE_EXECUTABLE_SUFFIX})
  set(CORENRN_MOD2CPP_INCLUDE ${CMAKE_BINARY_DIR}/include)
endif()

# =============================================================================
# Profiler/Instrumentation Options
# =============================================================================
if(CORENRN_ENABLE_CALIPER_PROFILING)
  find_package(caliper REQUIRED)
  list(APPEND CORENRN_COMPILE_DEFS CORENEURON_CALIPER)
  set(CORENRN_CALIPER_LIB caliper)
endif()

if(CORENRN_ENABLE_LIKWID_PROFILING)
  find_package(likwid REQUIRED)
  list(APPEND CORENRN_COMPILE_DEFS LIKWID_PERFMON)
  # TODO: avoid this part, probably by using some likwid CMake target
  include_directories(${likwid_INCLUDE_DIRS})
endif()

# enable debugging code with extra logs to stdout
if(CORENRN_ENABLE_DEBUG_CODE)
  list(APPEND CORENRN_COMPILE_DEFS CORENRN_DEBUG CHKPNTDEBUG CORENRN_DEBUG_QUEUE INTERLEAVE_DEBUG)
endif()

# =============================================================================
# Common CXX flags : ignore unknown pragma warnings
# =============================================================================
# Do not set this when building wheels. The nrnivmodl workflow means that we do not know what
# compiler will be invoked with these flags, so we have to use flags that are as generic as
# possible.
if(NOT DEFINED NRN_WHEEL_BUILD OR NOT NRN_WHEEL_BUILD)
  list(APPEND CORENRN_EXTRA_CXX_FLAGS "${IGNORE_UNKNOWN_PRAGMA_FLAGS}")
endif()

# Add the main source directory
add_subdirectory(coreneuron)

# Extract the various compiler option strings to use inside nrnivmodl-core. Sets the global property
# CORENRN_LIB_LINK_FLAGS, which contains the arguments that must be added to the link line for
# `special` to link against `libcorenrnmech.{a,so}`
include(MakefileBuildOptions)

# Generate the nrnivmodl-core script and makefile using the options from MakefileBuildOptions
add_subdirectory(extra)

if(CORENRN_ENABLE_UNIT_TESTS)
  add_subdirectory(tests)
endif()

# =============================================================================
# Install cmake modules
# =============================================================================
get_property(CORENRN_NEURON_LINK_FLAGS GLOBAL PROPERTY CORENRN_NEURON_LINK_FLAGS)
configure_file(CMake/coreneuron-config.cmake.in CMake/coreneuron-config.cmake @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/CMake/coreneuron-config.cmake" DESTINATION share/cmake)
install(EXPORT coreneuron DESTINATION share/cmake)

if(NOT CORENEURON_AS_SUBPROJECT)
  # =============================================================================
  # Setup Doxygen documentation
  # =============================================================================
  find_package(Doxygen QUIET)
  if(DOXYGEN_FOUND)
    # generate Doxyfile with correct source paths
    configure_file(${PROJECT_SOURCE_DIR}/docs/Doxyfile.in ${PROJECT_BINARY_DIR}/Doxyfile)
    add_custom_target(
      doxygen
      COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/Doxyfile
      WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
      COMMENT "Generating API documentation with Doxygen"
      VERBATIM)
  endif()

  # =============================================================================
  # Setup Sphinx documentation
  # =============================================================================
  find_package(Sphinx QUIET)
  if(SPHINX_FOUND)
    set(SPHINX_SOURCE ${PROJECT_SOURCE_DIR}/docs)
    set(SPHINX_BUILD ${PROJECT_BINARY_DIR}/docs/)

    add_custom_target(
      sphinx
      COMMAND ${SPHINX_EXECUTABLE} -b html ${SPHINX_SOURCE} ${SPHINX_BUILD}
      WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
      COMMENT "Generating documentation with Sphinx")
  endif()

  # =============================================================================
  # Build full docs
  # =============================================================================
  if(DOXYGEN_FOUND AND SPHINX_FOUND)
    add_custom_target(
      docs
      COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR} --target doxygen
      COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR} --target sphinx
      COMMENT "Generating full documentation")
  else()
    add_custom_target(
      docs
      VERBATIM
      COMMAND echo "Please install docs requirements (see docs/README.md)!"
      COMMENT "Documentation generation not possible!")
  endif()
endif()
# =============================================================================
# Build status
# =============================================================================
message(STATUS "")
message(STATUS "Configured CoreNEURON ${PROJECT_VERSION}")
message(STATUS "")
message(STATUS "You can now build CoreNEURON using:")
message(STATUS "  cmake --build . --parallel 8 [--target TARGET]")
message(STATUS "You might want to adjust the number of parallel build jobs for your system.")
message(STATUS "Some non-default targets you might want to build:")
message(STATUS "--------------------+--------------------------------------------------------")
message(STATUS " Target             |   Description")
message(STATUS "--------------------+--------------------------------------------------------")
message(STATUS "install             | Will install CoreNEURON to: ${CMAKE_INSTALL_PREFIX}")
message(STATUS "docs                | Build full docs. Calls targets: doxygen, sphinx")
message(STATUS "--------------------+--------------------------------------------------------")
message(STATUS " Build option       | Status")
message(STATUS "--------------------+--------------------------------------------------------")
message(STATUS "CXX COMPILER        | ${CMAKE_CXX_COMPILER}")
message(STATUS "COMPILE FLAGS       | ${CORENRN_CXX_FLAGS}")
message(STATUS "Build Type          | ${COMPILE_LIBRARY_TYPE}")
message(STATUS "MPI                 | ${CORENRN_ENABLE_MPI}")
if(CORENRN_ENABLE_MPI)
  message(STATUS "  DYNAMIC           | ${CORENRN_ENABLE_MPI_DYNAMIC}")
  if(CORENRN_ENABLE_MPI_DYNAMIC AND NRN_MPI_LIBNAME_LIST)
    # ~~~
    # for dynamic mpi, rely on neuron for list of libraries to build
    # this is to avoid cmake code duplication on the coreneuron side
    # ~~~
    list(LENGTH NRN_MPI_LIBNAME_LIST _num_mpi)
    math(EXPR num_mpi "${_num_mpi} - 1")
    foreach(val RANGE ${num_mpi})
      list(GET NRN_MPI_LIBNAME_LIST ${val} libname)
      list(GET NRN_MPI_INCLUDE_LIST ${val} include)
      message(STATUS "    LIBNAME         | core${libname}")
      message(STATUS "    INC             | ${include}")
    endforeach(val)
  else()
    message(STATUS "  INC               | ${MPI_CXX_INCLUDE_PATH}")
  endif()
endif()
message(STATUS "OpenMP              | ${CORENRN_ENABLE_OPENMP}")
message(STATUS "Use legacy units    | ${CORENRN_ENABLE_LEGACY_UNITS}")
message(STATUS "NMODL               | ${CORENRN_ENABLE_NMODL}")
if(CORENRN_ENABLE_NMODL)
  message(STATUS "  FLAGS             | ${CORENRN_NMODL_FLAGS}")
endif()
message(STATUS "MOD2CPP PATH        | ${CORENRN_MOD2CPP_BINARY}")
message(STATUS "GPU Support         | ${CORENRN_ENABLE_GPU}")
if(CORENRN_ENABLE_GPU)
  message(STATUS "  CUDA              | ${CUDAToolkit_LIBRARY_DIR}")
  message(STATUS "  Offload           | ${CORENRN_ACCELERATOR_OFFLOAD}")
  message(STATUS "  Unified Memory    | ${CORENRN_ENABLE_CUDA_UNIFIED_MEMORY}")
endif()
message(STATUS "Auto Timeout        | ${CORENRN_ENABLE_TIMEOUT}")
message(STATUS "Wrap exp()          | ${CORENRN_ENABLE_HOC_EXP}")
message(STATUS "SplayTree Queue     | ${CORENRN_ENABLE_SPLAYTREE_QUEUING}")
message(STATUS "NetReceive Buffer   | ${CORENRN_ENABLE_NET_RECEIVE_BUFFER}")
message(STATUS "Caliper             | ${CORENRN_ENABLE_CALIPER_PROFILING}")
message(STATUS "Likwid              | ${CORENRN_ENABLE_LIKWID_PROFILING}")
message(STATUS "Unit Tests          | ${CORENRN_ENABLE_UNIT_TESTS}")
message(STATUS "Reporting           | ${CORENRN_ENABLE_REPORTING}")
if(CORENRN_ENABLE_REPORTING)
  message(STATUS "  sonatareport_INC  | ${sonatareport_INCLUDE_DIR}")
  message(STATUS "  sonatareport_LIB  | ${sonatareport_LIBRARY}")
  message(STATUS "  reportinglib_INC  | ${reportinglib_INCLUDE_DIR}")
  message(STATUS "  reportinglib_LIB  | ${reportinglib_LIBRARY}")
endif()
message(STATUS "--------------+--------------------------------------------------------------")
message(STATUS " See documentation : https://github.com/BlueBrain/CoreNeuron/")
message(STATUS "--------------+--------------------------------------------------------------")
message(STATUS "")


================================================
FILE: LICENSE.txt
================================================
Copyright (c) 2016 - 2021 Blue Brain Project/EPFL
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
   this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
   may be used to endorse or promote products derived from this software
   without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.


================================================
FILE: README.md
================================================
 :bangbang:
 **NOTE:** The CoreNEURON is now [integrated within NEURON](https://github.com/neuronsimulator/nrn/tree/master/src/coreneuron) simulator at the source level and hence all the latest development happens under the main GitHub project [neuronsimulator/nrn](https://github.com/neuronsimulator/nrn). To use CoreNEURON, see the latest NEURON documentation under [nrn.readthedocs.io](https://nrn.readthedocs.io/en/latest/).:bangbang:

_______________________________________________________

![CoreNEURON CI](https://github.com/BlueBrain/CoreNeuron/workflows/CoreNEURON%20CI/badge.svg) [![codecov](https://codecov.io/gh/BlueBrain/CoreNeuron/branch/master/graph/badge.svg?token=mguTdBx93p)](https://codecov.io/gh/BlueBrain/CoreNeuron)

![CoreNEURON](docs/_static/bluebrain_coreneuron.jpg)


## Citation

If you would like to know more about CoreNEURON or would like to cite it, then use the following paper:

* Pramod Kumbhar, Michael Hines, Jeremy Fouriaux, Aleksandr Ovcharenko, James King, Fabien Delalondre and Felix Schürmann. CoreNEURON : An Optimized Compute Engine for the NEURON Simulator ([doi.org/10.3389/fninf.2019.00063](https://doi.org/10.3389/fninf.2019.00063))

## License
* See LICENSE.txt
* See [NEURON](https://github.com/neuronsimulator/nrn)


## Funding

CoreNEURON is developed in a joint collaboration between the Blue Brain Project and Yale University. This work is supported by funding to the Blue Brain Project, a research center of the École polytechnique fédérale de Lausanne (EPFL), from the Swiss government’s ETH Board of the Swiss Federal Institutes of Technology, NIH grant number R01NS11613 (Yale University), the European Union Seventh Framework Program (FP7/20072013) under grant agreement n◦ 604102 (HBP) and the European Union’s Horizon 2020 Framework Programme for Research and Innovation under Specific Grant Agreement n◦ 720270 (Human Brain Project SGA1), n◦ 785907 (Human Brain Project SGA2) and n◦ 945539 (Human Brain Project SGA3).

Copyright (c) 2016 - 2022 Blue Brain Project/EPFL


================================================
FILE: coreneuron/CMakeLists.txt
================================================
# =============================================================================
# Copyright (c) 2016 - 2022 Blue Brain Project/EPFL
#
# See top-level LICENSE file for details.
# =============================================================================

# Add compiler flags that should apply to all CoreNEURON targets, but which should not leak into
# other included projects.
add_compile_definitions(${CORENRN_COMPILE_DEFS})
add_compile_options(${CORENRN_EXTRA_CXX_FLAGS})
add_link_options(${CORENRN_EXTRA_LINK_FLAGS})

# put libraries (e.g. dll) in bin directory
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

# =============================================================================
# gather various source files
# =============================================================================
file(
  GLOB
  CORENEURON_CODE_FILES
  "apps/main1.cpp"
  "apps/corenrn_parameters.cpp"
  "gpu/nrn_acc_manager.cpp"
  "io/*.cpp"
  "io/reports/*.cpp"
  "mechanism/*.cpp"
  "mpi/core/nrnmpi_def_cinc.cpp"
  "network/*.cpp"
  "permute/*.cpp"
  "sim/*.cpp"
  "sim/scopmath/abort.cpp"
  "sim/scopmath/newton_thread.cpp"
  "utils/*.cpp"
  "utils/*/*.c"
  "utils/*/*.cpp")
set(MPI_LIB_FILES "mpi/lib/mpispike.cpp" "mpi/lib/nrnmpi.cpp")
if(CORENRN_ENABLE_MPI)
  # Building these requires -ldl, which is only added if MPI is enabled.
  list(APPEND CORENEURON_CODE_FILES "mpi/core/resolve.cpp" "mpi/core/nrnmpidec.cpp")
endif()
file(COPY ${CORENEURON_PROJECT_SOURCE_DIR}/external/Random123/include/Random123
     DESTINATION ${CMAKE_BINARY_DIR}/include)
list(APPEND CORENEURON_CODE_FILES ${PROJECT_BINARY_DIR}/coreneuron/config/config.cpp)

set(ENGINEMECH_CODE_FILE "mechanism/mech/enginemech.cpp")

# for external mod files we need to generate modl_ref function in mod_func.c
set(MODFUNC_PERL_SCRIPT "mechanism/mech/mod_func.c.pl")

set(NMODL_UNITS_FILE "${CMAKE_BINARY_DIR}/share/mod2c/nrnunits.lib")

# =============================================================================
# Copy files that are required by nrnivmodl-core to the build tree at build time.
# =============================================================================
cpp_cc_build_time_copy(
  INPUT "${CMAKE_CURRENT_SOURCE_DIR}/${MODFUNC_PERL_SCRIPT}"
  OUTPUT "${CMAKE_BINARY_DIR}/share/coreneuron/mod_func.c.pl"
  NO_TARGET)
cpp_cc_build_time_copy(
  INPUT "${CMAKE_CURRENT_SOURCE_DIR}/${ENGINEMECH_CODE_FILE}"
  OUTPUT "${CMAKE_BINARY_DIR}/share/coreneuron/enginemech.cpp"
  NO_TARGET)
set(nrnivmodl_core_dependencies "${CMAKE_BINARY_DIR}/share/coreneuron/mod_func.c.pl"
                                "${CMAKE_BINARY_DIR}/share/coreneuron/enginemech.cpp")
# Set up build rules that copy builtin mod files from
# {source}/coreneuron/mechanism/mech/modfile/*.mod to {build_dir}/share/modfile/
file(GLOB builtin_modfiles
     "${CORENEURON_PROJECT_SOURCE_DIR}/coreneuron/mechanism/mech/modfile/*.mod")
foreach(builtin_modfile ${builtin_modfiles})
  # Construct the path in the build directory.
  get_filename_component(builtin_modfile_name "${builtin_modfile}" NAME)
  set(modfile_build_path "${CMAKE_BINARY_DIR}/share/modfile/${builtin_modfile_name}")
  # Create a build rule to copy the modfile there.
  cpp_cc_build_time_copy(
    INPUT "${builtin_modfile}"
    OUTPUT "${modfile_build_path}"
    NO_TARGET)
  list(APPEND nrnivmodl_core_dependencies "${modfile_build_path}")
endforeach()
add_custom_target(coreneuron-copy-nrnivmodl-core-dependencies ALL
                  DEPENDS ${nrnivmodl_core_dependencies})
# Store the build-tree modfile paths in a cache variable; these are an implicit dependency of
# nrnivmodl-core.
set(CORENEURON_BUILTIN_MODFILES
    "${nrnivmodl_core_dependencies}"
    CACHE STRING "List of builtin modfiles that nrnivmodl-core implicitly depends on" FORCE)

# =============================================================================
# coreneuron GPU library
# =============================================================================
if(CORENRN_ENABLE_GPU)
  # ~~~
  # artificial cells and some other cpp files (using Random123) should be compiled
  # without OpenACC to avoid use of GPU Random123 streams
  # OL210813: this shouldn't be needed anymore, but it may have a small performance benefit
  # ~~~
  set(OPENACC_EXCLUDED_FILES
      ${CMAKE_CURRENT_BINARY_DIR}/netstim.cpp
      ${CMAKE_CURRENT_BINARY_DIR}/netstim_inhpoisson.cpp
      ${CMAKE_CURRENT_BINARY_DIR}/pattern.cpp
      ${CMAKE_CURRENT_SOURCE_DIR}/io/nrn_setup.cpp
      ${CMAKE_CURRENT_SOURCE_DIR}/io/setup_fornetcon.cpp
      ${CMAKE_CURRENT_SOURCE_DIR}/io/corenrn_data_return.cpp
      ${CMAKE_CURRENT_SOURCE_DIR}/io/global_vars.cpp)

  set_source_files_properties(${OPENACC_EXCLUDED_FILES} PROPERTIES COMPILE_FLAGS
                                                                   "-DDISABLE_OPENACC")
  # Only compile the explicit CUDA implementation of the Hines solver in GPU builds. Because of
  # https://forums.developer.nvidia.com/t/cannot-dynamically-load-a-shared-library-containing-both-openacc-and-cuda-code/210972
  # this cannot be included in the same shared library as the rest of the OpenACC code.
  set(CORENEURON_CUDA_FILES ${CMAKE_CURRENT_SOURCE_DIR}/permute/cellorder.cu)

  # Eigen functions cannot be called directly from OpenACC regions, but Eigen is sort-of compatible
  # with being compiled as CUDA code. Because of
  # https://forums.developer.nvidia.com/t/cannot-dynamically-load-a-shared-library-containing-both-openacc-and-cuda-code/210972
  # this has to mean `nvc++ -cuda` rather than `nvcc`. We explicitly instantiate Eigen functions for
  # different matrix sizes in partial_piv_lu.cpp (with CUDA attributes but without OpenACC or OpenMP
  # annotations) and dispatch to these from a wrapper in partial_piv_lu.h that does have
  # OpenACC/OpenMP annotations.
  if(CORENRN_ENABLE_NMODL AND EXISTS ${CORENRN_MOD2CPP_INCLUDE}/partial_piv_lu/partial_piv_lu.cpp)
    list(APPEND CORENEURON_CODE_FILES ${CORENRN_MOD2CPP_INCLUDE}/partial_piv_lu/partial_piv_lu.cpp)
    if(CORENRN_ENABLE_GPU
       AND CORENRN_HAVE_NVHPC_COMPILER
       AND CMAKE_BUILD_TYPE STREQUAL "Debug")
      # In this case OpenAccHelper.cmake passes -gpu=debug, which makes these Eigen functions
      # extremely slow. Downgrade that to -gpu=lineinfo for this file.
      set_source_files_properties(${CORENRN_MOD2CPP_INCLUDE}/partial_piv_lu/partial_piv_lu.cpp
                                  PROPERTIES COMPILE_FLAGS "-gpu=lineinfo,nodebug -O1")
    endif()
  endif()
endif()

# =============================================================================
# create libraries
# =============================================================================

# name of coreneuron mpi objects or dynamic library
set(CORENRN_MPI_LIB_NAME
    "corenrn_mpi"
    CACHE INTERNAL "")

# for non-dynamic mpi mode just build object files
if(CORENRN_ENABLE_MPI AND NOT CORENRN_ENABLE_MPI_DYNAMIC)
  add_library(${CORENRN_MPI_LIB_NAME} OBJECT ${MPI_LIB_FILES})
  target_include_directories(
    ${CORENRN_MPI_LIB_NAME} PRIVATE ${MPI_INCLUDE_PATH} ${CORENEURON_PROJECT_SOURCE_DIR}
                                    ${CORENEURON_PROJECT_BINARY_DIR}/generated)
  target_link_libraries(${CORENRN_MPI_LIB_NAME} ${CORENRN_CALIPER_LIB})
  set_property(TARGET ${CORENRN_MPI_LIB_NAME} PROPERTY POSITION_INDEPENDENT_CODE ON)
  set(CORENRN_MPI_OBJ $<TARGET_OBJECTS:${CORENRN_MPI_LIB_NAME}>)
endif()

# Library containing the bulk of the non-mechanism CoreNEURON code. This is always created and
# installed as a static library, and then the nrnivmodl-core workflow extracts the object files from
# it and does one of the following:
#
# * shared build: creates libcorenrnmech.so from these objects plus those from the translated MOD
#   files
# * static build: creates a (temporary, does not get installed) libcorenrnmech.a from these objects
#   plus those from the translated MOD files, then statically links that into special-core
#   (nrniv-core)
#
# This scheme means that both core and mechanism .o files are linked in a single step, which is
# important for GPU linking. It does, however, mean that the core code is installed twice, once in
# libcoreneuron-core.a and once in libcorenrnmech.so (shared) or nrniv-core (static). In a GPU
# build, libcoreneuron-cuda.{a,so} is also linked to provide the CUDA implementation of the Hines
# solver. This cannot be included in coreneuron-core because of this issue:
# https://forums.developer.nvidia.com/t/cannot-dynamically-load-a-shared-library-containing-both-openacc-and-cuda-code/210972
add_library(coreneuron-core STATIC ${CORENEURON_CODE_FILES} ${CORENRN_MPI_OBJ})
if(CORENRN_ENABLE_GPU)
  set(coreneuron_cuda_target coreneuron-cuda)
  add_library(coreneuron-cuda ${COMPILE_LIBRARY_TYPE} ${CORENEURON_CUDA_FILES})
  target_link_libraries(coreneuron-core PUBLIC coreneuron-cuda)
endif()

foreach(target coreneuron-core ${coreneuron_cuda_target})
  target_include_directories(${target} PRIVATE ${CORENEURON_PROJECT_SOURCE_DIR}
                                               ${CORENEURON_PROJECT_BINARY_DIR}/generated)
endforeach()

# we can link to MPI libraries in non-dynamic-mpi build
if(CORENRN_ENABLE_MPI AND NOT CORENRN_ENABLE_MPI_DYNAMIC)
  target_link_libraries(coreneuron-core PUBLIC ${MPI_CXX_LIBRARIES})
endif()

# ~~~
# main coreneuron library needs to be linked to libdl.so
# only in case of dynamic mpi build. But on old system
# like centos7, we saw mpich library require explici
# link to libdl.so. See
#   https://github.com/neuronsimulator/nrn-build-ci/pull/51
# ~~~
target_link_libraries(coreneuron-core PUBLIC ${CMAKE_DL_LIBS})

# this is where we handle dynamic mpi library build
if(CORENRN_ENABLE_MPI AND CORENRN_ENABLE_MPI_DYNAMIC)
  # store mpi library targets that will be built
  list(APPEND corenrn_mpi_targets "")

  # ~~~
  # if coreneuron is built as a submodule of neuron then check if NEURON has created
  # list of libraries that needs to be built. We use neuron cmake variables here because
  # we don't need to duplicate CMake code into coreneuron (we want to have unified cmake
  # project soon). In the absense of neuron just build a single library libcorenrn_mpi.
  # This is mostly used for the testing.
  # ~~~
  if(NOT CORENEURON_AS_SUBPROJECT)
    add_library(${CORENRN_MPI_LIB_NAME} SHARED ${MPI_LIB_FILES})
    target_link_libraries(${CORENRN_MPI_LIB_NAME} ${MPI_CXX_LIBRARIES})
    target_include_directories(
      ${CORENRN_MPI_LIB_NAME} PRIVATE ${MPI_INCLUDE_PATH} ${CORENEURON_PROJECT_SOURCE_DIR}
                                      ${CORENEURON_PROJECT_BINARY_DIR}/generated)
    set_property(TARGET ${CORENRN_MPI_LIB_NAME} PROPERTY POSITION_INDEPENDENT_CODE ON)
    list(APPEND corenrn_mpi_targets ${CORENRN_MPI_LIB_NAME})
  else()
    # ~~~
    # from neuron we know how many different libraries needs to be built, their names
    # include paths to be used for building shared libraries. Iterate through those
    # and build separate library for each MPI distribution. For example, following
    # libraries are created:
    # - libcorenrn_mpich.so
    # - libcorenrn_ompi.so
    # - libcorenrn_mpt.so
    # ~~~
    list(LENGTH NRN_MPI_LIBNAME_LIST _num_mpi)
    math(EXPR num_mpi "${_num_mpi} - 1")
    foreach(val RANGE ${num_mpi})
      list(GET NRN_MPI_INCLUDE_LIST ${val} include)
      list(GET NRN_MPI_LIBNAME_LIST ${val} libname)

      add_library(core${libname}_lib SHARED ${MPI_LIB_FILES})
      target_link_libraries(core${libname}_lib ${CORENRN_CALIPER_LIB})
      target_include_directories(
        core${libname}_lib
        PUBLIC ${include}
        PRIVATE ${CORENEURON_PROJECT_SOURCE_DIR} ${CORENEURON_PROJECT_BINARY_DIR}/generated)

      # ~~~
      # TODO: somehow mingw requires explicit linking. This needs to be verified
      # when we will test coreneuron on windows.
      # ~~~
      if(MINGW) # type msmpi only
        add_dependencies(core${libname}_lib coreneuron-core)
        target_link_libraries(core${libname}_lib ${MPI_C_LIBRARIES} coreneuron-core)
      endif()
      set_property(TARGET core${libname}_lib PROPERTY OUTPUT_NAME core${libname})
      list(APPEND corenrn_mpi_targets "core${libname}_lib")
    endforeach(val)
  endif()

  set_target_properties(
    ${corenrn_mpi_targets}
    PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
               LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
               POSITION_INDEPENDENT_CODE ON)
  install(TARGETS ${corenrn_mpi_targets} DESTINATION lib)
endif()

# Suppress some compiler warnings.
target_compile_options(coreneuron-core PRIVATE ${CORENEURON_CXX_WARNING_SUPPRESSIONS})
target_link_libraries(coreneuron-core PUBLIC ${reportinglib_LIBRARY} ${sonatareport_LIBRARY}
                                             ${CORENRN_CALIPER_LIB} ${likwid_LIBRARIES})

# TODO: fix adding a dependency of coreneuron-core on CLI11::CLI11 when CLI11 is a submodule. Right
# now this doesn't work because the CLI11 targets are not exported/installed but coreneuron-core is.
get_target_property(CLI11_HEADER_DIRECTORY CLI11::CLI11 INTERFACE_INCLUDE_DIRECTORIES)
target_include_directories(
  coreneuron-core SYSTEM PRIVATE ${CLI11_HEADER_DIRECTORY}
                                 ${CORENEURON_PROJECT_SOURCE_DIR}/external/Random123/include)

# See: https://en.cppreference.com/w/cpp/filesystem#Notes
if(CMAKE_CXX_COMPILER_IS_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.1)
  target_link_libraries(coreneuron-core PUBLIC stdc++fs)
endif()

if(CORENRN_ENABLE_GPU)
  # nrnran123.cpp uses Boost.Pool in GPU builds if it's available.
  find_package(Boost QUIET)
  if(Boost_FOUND)
    message(STATUS "Boost found, enabling use of memory pools for Random123...")
    target_include_directories(coreneuron-core SYSTEM PRIVATE ${Boost_INCLUDE_DIRS})
    target_compile_definitions(coreneuron-core PRIVATE CORENEURON_USE_BOOST_POOL)
  endif()
endif()

set_target_properties(
  coreneuron-core ${coreneuron_cuda_target}
  PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
             LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
             POSITION_INDEPENDENT_CODE ${CORENRN_ENABLE_SHARED})
cpp_cc_configure_sanitizers(TARGET coreneuron-core ${coreneuron_cuda_target} ${corenrn_mpi_targets})

# =============================================================================
# create special-core with halfgap.mod for tests
# =============================================================================
set(modfile_directory "${CORENEURON_PROJECT_SOURCE_DIR}/tests/integration/ring_gap/mod files")
file(GLOB modfiles "${modfile_directory}/*.mod")

# We have to link things like unit tests against this because some "core" .cpp files refer to
# symbols in the translated versions of default .mod files
set(nrniv_core_prefix "${CMAKE_BINARY_DIR}/bin/${CMAKE_SYSTEM_PROCESSOR}")
set(corenrn_mech_library
    "${nrniv_core_prefix}/${CMAKE_${COMPILE_LIBRARY_TYPE}_LIBRARY_PREFIX}corenrnmech${CMAKE_${COMPILE_LIBRARY_TYPE}_LIBRARY_SUFFIX}"
)
set(output_binaries "${nrniv_core_prefix}/special-core" "${corenrn_mech_library}")

add_custom_command(
  OUTPUT ${output_binaries}
  DEPENDS coreneuron-core ${NMODL_TARGET_TO_DEPEND} ${modfiles} ${CORENEURON_BUILTIN_MODFILES}
  COMMAND ${CMAKE_BINARY_DIR}/bin/nrnivmodl-core -b ${COMPILE_LIBRARY_TYPE} -m
          ${CORENRN_MOD2CPP_BINARY} -p 4 "${modfile_directory}"
  WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin
  COMMENT "Running nrnivmodl-core with halfgap.mod")
add_custom_target(nrniv-core ALL DEPENDS ${output_binaries})

# Build a target representing the libcorenrnmech.so that is produced under bin/x86_64, which
# executables such as the unit tests must link against
add_library(builtin-libcorenrnmech SHARED IMPORTED)
add_dependencies(builtin-libcorenrnmech nrniv-core)
set_target_properties(builtin-libcorenrnmech PROPERTIES IMPORTED_LOCATION "${corenrn_mech_library}")

if(CORENRN_ENABLE_GPU)
  separate_arguments(CORENRN_ACC_FLAGS UNIX_COMMAND "${NVHPC_ACC_COMP_FLAGS}")
  target_compile_options(coreneuron-core PRIVATE ${CORENRN_ACC_FLAGS})
endif()

# Create an extra target for use by NEURON when CoreNEURON is being built as a submodule. NEURON
# tests will depend on this, so it must in turn depend on everything that is needed to run nrnivmodl
# -coreneuron.
add_custom_target(coreneuron-for-tests)
add_dependencies(coreneuron-for-tests coreneuron-core ${NMODL_TARGET_TO_DEPEND})
# Create an extra target for internal use that unit tests and so on can depend on.
# ${corenrn_mech_library} is libcorenrnmech.{a,so}, which contains both the compiled default
# mechanisms and the content of libcoreneuron-core.a.
add_library(coreneuron-all INTERFACE)
target_link_libraries(coreneuron-all INTERFACE builtin-libcorenrnmech)
# Also copy the dependencies of libcoreneuron-core as interface dependencies of this new target
# (example: ${corenrn_mech_library} will probably depend on MPI, so when the unit tests link against
# ${corenrn_mech_library} they need to know to link against MPI too).
get_target_property(coreneuron_core_deps coreneuron-core LINK_LIBRARIES)
if(coreneuron_core_deps)
  foreach(dep ${coreneuron_core_deps})
    target_link_libraries(coreneuron-all INTERFACE ${dep})
  endforeach()
endif()

# Make headers avail to build tree
configure_file(engine.h.in ${CMAKE_BINARY_DIR}/include/coreneuron/engine.h @ONLY)

file(
  GLOB_RECURSE main_headers
  RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
  *.h *.hpp)

configure_file("${CORENEURON_PROJECT_BINARY_DIR}/generated/coreneuron/config/neuron_version.hpp"
               "${CMAKE_BINARY_DIR}/include/coreneuron/config/neuron_version.hpp" COPYONLY)
foreach(header ${main_headers})
  configure_file("${header}" "${CMAKE_BINARY_DIR}/include/coreneuron/${header}" COPYONLY)
endforeach()

configure_file("utils/profile/profiler_interface.h"
               ${CMAKE_BINARY_DIR}/include/coreneuron/nrniv/profiler_interface.h COPYONLY)

# main program required for building special-core
file(COPY apps/coreneuron.cpp DESTINATION ${CMAKE_BINARY_DIR}/share/coreneuron)

# =============================================================================
# Install main targets
# =============================================================================

# coreneuron main libraries
install(
  TARGETS coreneuron-core ${coreneuron_cuda_target}
  EXPORT coreneuron
  LIBRARY DESTINATION lib
  ARCHIVE DESTINATION lib
  INCLUDES
  DESTINATION $<INSTALL_INTERFACE:include>)

# headers and some standalone code files for nrnivmodl-core
install(
  DIRECTORY ${CMAKE_BINARY_DIR}/include/coreneuron
  DESTINATION include/
  FILES_MATCHING
  PATTERN "*.h*"
  PATTERN "*.ipp")
install(FILES ${MODFUNC_PERL_SCRIPT} ${ENGINEMECH_CODE_FILE} DESTINATION share/coreneuron)

# copy mod2c/nmodl for nrnivmodl-core
install(PROGRAMS ${CORENRN_MOD2CPP_BINARY} DESTINATION bin)

if(NOT CORENRN_ENABLE_NMODL)
  install(FILES ${NMODL_UNITS_FILE} DESTINATION share/mod2c)
endif()

# install nrniv-core app
install(
  PROGRAMS ${CMAKE_BINARY_DIR}/bin/${CMAKE_HOST_SYSTEM_PROCESSOR}/special-core
  DESTINATION bin
  RENAME nrniv-core)
install(FILES apps/coreneuron.cpp DESTINATION share/coreneuron)

# install mechanism library in shared library builds, if we're linking statically then there is no
# need
if(CORENRN_ENABLE_SHARED)
  install(FILES ${corenrn_mech_library} DESTINATION lib)
endif()

# install random123 and nmodl headers
install(DIRECTORY ${CMAKE_BINARY_DIR}/include/ DESTINATION include)

# install mod files
install(DIRECTORY ${CMAKE_BINARY_DIR}/share/modfile DESTINATION share)


================================================
FILE: coreneuron/apps/coreneuron.cpp
================================================
/*
# =============================================================================
# Copyright (c) 2016 - 2021 Blue Brain Project/EPFL
#
# See top-level LICENSE file for details.
# =============================================================================.
*/

#include <coreneuron/engine.h>
#include "coreneuron/utils/profile/profiler_interface.h"

int main(int argc, char** argv) {
    coreneuron::Instrumentor::init_profile();
    auto solve_core_result = solve_core(argc, argv);
    coreneuron::Instrumentor::finalize_profile();
    return solve_core_result;
}


================================================
FILE: coreneuron/apps/corenrn_parameters.cpp
================================================
/*
# =============================================================================
# Copyright (c) 2016 - 2022 Blue Brain Project/EPFL
#
# See top-level LICENSE file for details.
# =============================================================================.
*/
#include "coreneuron/apps/corenrn_parameters.hpp"

#include <CLI/CLI.hpp>

namespace coreneuron {

extern std::string cnrn_version();

corenrn_parameters::corenrn_parameters()
    : m_app{std::make_unique<CLI::App>("CoreNeuron - Optimised Simulator Engine for NEURON.")} {
    auto& app = *m_app;
    app.set_config("--read-config", "", "Read parameters from ini file", false)
        ->check(CLI::ExistingFile);
    app.add_option("--write-config",
                   this->writeParametersFilepath,
                   "Write parameters to this file",
                   false);

    app.add_flag(
        "--mpi",
        this->mpi_enable,
        "Enable MPI. In order to initialize MPI environment this argument must be specified.");
    app.add_option("--mpi-lib",
                   this->mpi_lib,
                   "CoreNEURON MPI library to load for dynamic MPI support",
                   false);
    app.add_flag("--gpu", this->gpu, "Activate GPU computation.");
    app.add_option("--dt",
                   this->dt,
                   "Fixed time step. The default value is set by defaults.dat or is 0.025.",
                   true)
        ->check(CLI::Range(-1'000., 1e9));
    app.add_option("-e, --tstop", this->tstop, "Stop Time in ms.")->check(CLI::Range(0., 1e9));
    app.add_flag("--show");
    app.add_set(
        "--verbose",
        this->verbose,
        {verbose_level::NONE, verbose_level::ERROR, verbose_level::INFO, verbose_level::DEBUG_INFO},
        "Verbose level: 0 = NONE, 1 = ERROR, 2 = INFO, 3 = DEBUG. Default is INFO");
    app.add_flag("--model-stats",
                 this->model_stats,
                 "Print number of instances of each mechanism and detailed memory stats.");

    auto sub_gpu = app.add_option_group("GPU", "Commands relative to GPU.");
    sub_gpu
        ->add_option("-W, --nwarp",
                     this->nwarp,
                     "Number of warps to execute in parallel the Hines solver. Each warp solves a "
                     "group of cells. (Only used with cell permute 2)",
                     true)
        ->check(CLI::Range(0, 1'000'000));
    sub_gpu
        ->add_option("-R, --cell-permute",
                     this->cell_interleave_permute,
                     "Cell permutation: 0 No permutation; 1 optimise node adjacency; 2 optimize "
                     "parent adjacency.",
                     true)
        ->check(CLI::Range(0, 2));
    sub_gpu->add_flag("--cuda-interface",
                      this->cuda_interface,
                      "Activate CUDA branch of the code.");
    sub_gpu->add_option("-n, --num-gpus", this->num_gpus, "Number of gpus to use per node.");

    auto sub_input = app.add_option_group("input", "Input dataset options.");
    sub_input->add_option("-d, --datpath", this->datpath, "Path containing CoreNeuron data files.")
        ->check(CLI::ExistingDirectory);
    sub_input->add_option("-f, --filesdat", this->filesdat, "Name for the distribution file.", true)
        ->check(CLI::ExistingFile);
    sub_input
        ->add_option("-p, --pattern",
                     this->patternstim,
                     "Apply patternstim using the specified spike file.")
        ->check(CLI::ExistingFile);
    sub_input
        ->add_option("-s, --seed", this->seed, "Initialization seed for random number generator.")
        ->check(CLI::Range(0, 100'000'000));
    sub_input
        ->add_option("-v, --voltage",
                     this->voltage,
                     "Initial voltage used for nrn_finitialize(1, v_init). If 1000, then "
                     "nrn_finitialize(0,...).")
        ->check(CLI::Range(-1e9, 1e9));
    sub_input->add_option("--report-conf", this->reportfilepath, "Reports configuration file.")
        ->check(CLI::ExistingFile);
    sub_input
        ->add_option("--restore",
                     this->restorepath,
                     "Restore simulation from provided checkpoint directory.")
        ->check(CLI::ExistingDirectory);

    auto sub_parallel = app.add_option_group("parallel", "Parallel processing options.");
    sub_parallel->add_flag("-c, --threading",
                           this->threading,
                           "Parallel threads. The default is serial threads.");
    sub_parallel->add_flag("--skip-mpi-finalize",
                           this->skip_mpi_finalize,
                           "Do not call mpi finalize.");

    auto sub_spike = app.add_option_group("spike", "Spike exchange options.");
    sub_spike
        ->add_option("--ms-phases", this->ms_phases, "Number of multisend phases, 1 or 2.", true)
        ->check(CLI::Range(1, 2));
    sub_spike
        ->add_option("--ms-subintervals",
                     this->ms_subint,
                     "Number of multisend subintervals, 1 or 2.",
                     true)
        ->check(CLI::Range(1, 2));
    sub_spike->add_flag("--multisend",
                        this->multisend,
                        "Use Multisend spike exchange instead of Allgather.");
    sub_spike
        ->add_option("--spkcompress",
                     this->spkcompress,
                     "Spike compression. Up to ARG are exchanged during MPI_Allgather.",
                     true)
        ->check(CLI::Range(0, 100'000));
    sub_spike->add_flag("--binqueue", this->binqueue, "Use bin queue.");

    auto sub_config = app.add_option_group("config", "Config options.");
    sub_config->add_option("-b, --spikebuf", this->spikebuf, "Spike buffer size.", true)
        ->check(CLI::Range(0, 2'000'000'000));
    sub_config
        ->add_option("-g, --prcellgid",
                     this->prcellgid,
                     "Output prcellstate information for the gid NUMBER.")
        ->check(CLI::Range(-1, 2'000'000'000));
    sub_config->add_option("-k, --forwardskip", this->forwardskip, "Forwardskip to TIME")
        ->check(CLI::Range(0., 1e9));
    sub_config
        ->add_option(
            "-l, --celsius",
            this->celsius,
            "Temperature in degC. The default value is set in defaults.dat or else is 34.0.",
            true)
        ->check(CLI::Range(-1000., 1000.));
    sub_config
        ->add_option("--mindelay",
                     this->mindelay,
                     "Maximum integration interval (likely reduced by minimum NetCon delay).",
                     true)
        ->check(CLI::Range(0., 1e9));
    sub_config
        ->add_option("--report-buffer-size",
                     this->report_buff_size,
                     "Size in MB of the report buffer.")
        ->check(CLI::Range(1, 128));

    auto sub_output = app.add_option_group("output", "Output configuration.");
    sub_output->add_option("-i, --dt_io", this->dt_io, "Dt of I/O.", true)
        ->check(CLI::Range(-1000., 1e9));
    sub_output->add_option("-o, --outpath",
                           this->outpath,
                           "Path to place output data files.",
                           true);
    sub_output->add_option("--checkpoint",
                           this->checkpointpath,
                           "Enable checkpoint and specify directory to store related files.");

    app.add_flag("-v, --version", this->show_version, "Show version information and quit.");

    CLI::retire_option(app, "--show");
}

// Implementation in .cpp file where CLI types are complete.
corenrn_parameters::~corenrn_parameters() = default;

std::string corenrn_parameters::config_to_str(bool default_also, bool write_description) const {
    return m_app->config_to_str(default_also, write_description);
}

void corenrn_parameters::reset() {
    static_cast<corenrn_parameters_data&>(*this) = corenrn_parameters_data{};
    m_app->clear();
}

void corenrn_parameters::parse(int argc, char** argv) {
    try {
        m_app->parse(argc, argv);
        if (verbose == verbose_level::NONE) {
            nrn_nobanner_ = 1;
        }
    } catch (const CLI::ExtrasError& e) {
        // in case of parsing errors, show message with exception
        std::cerr << "CLI parsing error, see nrniv-core --help for more information. \n"
                  << std::endl;
        m_app->exit(e);
        throw e;
    } catch (const CLI::ParseError& e) {
        // use --help is also ParseError; in this case exit by showing all options
        m_app->exit(e);
        exit(0);
    }

#ifndef CORENEURON_ENABLE_GPU
    if (gpu) {
        std::cerr
            << "Error: GPU support was not enabled at build time but GPU execution was requested."
            << std::endl;
        exit(42);
    }
#endif

    // is user has asked for version info, print it and exit
    if (show_version) {
        std::cout << "CoreNEURON Version : " << cnrn_version() << std::endl;
        exit(0);
    }
};

std::ostream& operator<<(std::ostream& os, const corenrn_parameters& corenrn_param) {
    os << "GENERAL PARAMETERS" << std::endl
       << "--mpi=" << (corenrn_param.mpi_enable ? "true" : "false") << std::endl
       << "--mpi-lib=" << corenrn_param.mpi_lib << std::endl
       << "--gpu=" << (corenrn_param.gpu ? "true" : "false") << std::endl
       << "--dt=" << corenrn_param.dt << std::endl
       << "--tstop=" << corenrn_param.tstop << std::endl
       << std::endl
       << "GPU" << std::endl
       << "--nwarp=" << corenrn_param.nwarp << std::endl
       << "--cell-permute=" << corenrn_param.cell_interleave_permute << std::endl
       << "--cuda-interface=" << (corenrn_param.cuda_interface ? "true" : "false") << std::endl
       << std::endl
       << "INPUT PARAMETERS" << std::endl
       << "--voltage=" << corenrn_param.voltage << std::endl
       << "--seed=" << corenrn_param.seed << std::endl
       << "--datpath=" << corenrn_param.datpath << std::endl
       << "--filesdat=" << corenrn_param.filesdat << std::endl
       << "--pattern=" << corenrn_param.patternstim << std::endl
       << "--report-conf=" << corenrn_param.reportfilepath << std::endl
       << std::left << std::setw(15) << "--restore=" << corenrn_param.restorepath << std::endl
       << std::endl
       << "PARALLEL COMPUTATION PARAMETERS" << std::endl
       << "--threading=" << (corenrn_param.threading ? "true" : "false") << std::endl
       << "--skip_mpi_finalize=" << (corenrn_param.skip_mpi_finalize ? "true" : "false")
       << std::endl
       << std::endl
       << "SPIKE EXCHANGE" << std::endl
       << "--ms_phases=" << corenrn_param.ms_phases << std::endl
       << "--ms_subintervals=" << corenrn_param.ms_subint << std::endl
       << "--multisend=" << (corenrn_param.multisend ? "true" : "false") << std::endl
       << "--spk_compress=" << corenrn_param.spkcompress << std::endl
       << "--binqueue=" << (corenrn_param.binqueue ? "true" : "false") << std::endl
       << std::endl
       << "CONFIGURATION" << std::endl
       << "--spikebuf=" << corenrn_param.spikebuf << std::endl
       << "--prcellgid=" << corenrn_param.prcellgid << std::endl
       << "--forwardskip=" << corenrn_param.forwardskip << std::endl
       << "--celsius=" << corenrn_param.celsius << std::endl
       << "--mindelay=" << corenrn_param.mindelay << std::endl
       << "--report-buffer-size=" << corenrn_param.report_buff_size << std::endl
       << std::endl
       << "OUTPUT PARAMETERS" << std::endl
       << "--dt_io=" << corenrn_param.dt_io << std::endl
       << "--outpath=" << corenrn_param.outpath << std::endl
       << "--checkpoint=" << corenrn_param.checkpointpath << std::endl;

    return os;
}

corenrn_parameters corenrn_param;
int nrn_nobanner_{0};

}  // namespace coreneuron


================================================
FILE: coreneuron/apps/corenrn_parameters.hpp
================================================
/*
# =============================================================================
# Copyright (c) 2016 - 2022 Blue Brain Project/EPFL
#
# See top-level LICENSE file for details.
# =============================================================================.
*/
#pragma once
#include <memory>
#include <ostream>
#include <string>

/**
 * \class corenrn_parameters
 * \brief Parses and contains Command Line parameters for Core Neuron
 *
 * This structure contains all the parameters that CoreNeuron fetches
 * from the Command Line. It uses the CLI11 libraries to parse these parameters
 * and saves them in an internal public structure. Each parameter can be
 * accessed or written freely. By default the constructor instantiates a
 * CLI11 object and initializes it for CoreNeuron use.
 * This object is freely accessible from any point of the program.
 * An ostream method is also provided to print out all the parameters that
 * CLI11 parse.
 * Please keep in mind that, due to the nature of the subcommands in CLI11,
 * the command line parameters for subcategories NEED to be come before the relative
 * parameter. e.g. --mpi --gpu gpu --nwarp
 * Also single dash long options are not supported anymore (-mpi -> --mpi).
 */

namespace CLI {
struct App;
}

namespace coreneuron {

struct corenrn_parameters_data {
    enum verbose_level : std::uint32_t {
        NONE = 0,
        ERROR = 1,
        INFO = 2,
        DEBUG_INFO = 3,
        DEFAULT = INFO
    };

    static constexpr int report_buff_size_default = 4;

    unsigned spikebuf = 100'000;           /// Internal buffer used on every rank for spikes
    int prcellgid = -1;                    /// Gid of cell for prcellstate
    unsigned ms_phases = 2;                /// Number of multisend phases, 1 or 2
    unsigned ms_subint = 2;                /// Number of multisend interval. 1 or 2
    unsigned spkcompress = 0;              /// Spike Compression
    unsigned cell_interleave_permute = 0;  /// Cell interleaving permutation
    unsigned nwarp = 65536;  /// Number of warps to balance for cell_interleave_permute == 2
    unsigned num_gpus = 0;   /// Number of gpus to use per node
    unsigned report_buff_size = report_buff_size_default;  /// Size in MB of the report buffer.
    int seed = -1;  /// Initialization seed for random number generator (int)

    bool mpi_enable = false;         /// Enable MPI flag.
    bool skip_mpi_finalize = false;  /// Skip MPI finalization
    bool multisend = false;          /// Use Multisend spike exchange instead of Allgather.
    bool threading = false;          /// Enable pthread/openmp
    bool gpu = false;                /// Enable GPU computation.
    bool cuda_interface = false;     /// Enable CUDA interface (default is the OpenACC interface).
                                  /// Branch of the code is executed through CUDA kernels instead of
                                  /// OpenACC regions.
    bool binqueue = false;  /// Use bin queue.

    bool show_version = false;  /// Print version and exit.

    bool model_stats = false;  /// Print mechanism counts and model size after initialization

    verbose_level verbose{verbose_level::DEFAULT};  /// Verbosity-level

    double tstop = 100;        /// Stop time of simulation in msec
    double dt = -1000.0;       /// Timestep to use in msec
    double dt_io = 0.1;        /// I/O timestep to use in msec
    double dt_report;          /// I/O timestep to use in msec for reports
    double celsius = -1000.0;  /// Temperature in degC.
    double voltage = -65.0;    /// Initial voltage used for nrn_finitialize(1, v_init).
    double forwardskip = 0.;   /// Forward skip to TIME.
    double mindelay = 10.;     /// Maximum integration interval (likely reduced by minimum NetCon
                               /// delay).

    std::string patternstim;             /// Apply patternstim using the specified spike file.
    std::string datpath = ".";           /// Directory path where .dat files
    std::string outpath = ".";           /// Directory where spikes will be written
    std::string filesdat = "files.dat";  /// Name of file containing list of gids dat files read in
    std::string restorepath;             /// Restore simulation from provided checkpoint directory.
    std::string reportfilepath;          /// Reports configuration file.
    std::string checkpointpath;  /// Enable checkpoint and specify directory to store related files.
    std::string writeParametersFilepath;  /// Write parameters to this file
    std::string mpi_lib;                  /// Name of CoreNEURON MPI library to load dynamically.
};

struct corenrn_parameters: corenrn_parameters_data {
    corenrn_parameters();   /// Constructor that initializes the CLI11 app.
    ~corenrn_parameters();  /// Destructor defined in .cpp where CLI11 types are complete.

    void parse(int argc, char* argv[]);  /// Runs the CLI11_PARSE macro.

    /** @brief Reset all parameters to their default values.
     *
     *  Unfortunately it is awkward to support `x = corenrn_parameters{}`
     *  because `app` holds pointers to members of `corenrn_parameters`.
     */
    void reset();

    inline bool is_quiet() {
        return verbose == verbose_level::NONE;
    }

    /** @brief Return a string summarising the current parameter values.
     *
     * This forwards to the CLI11 method of the same name. Returns a string that
     * could be read in as a config of the current values of the App.
     *
     * @param default_also Include any defaulted arguments.
     * @param write_description Include option descriptions and the App description.
     */
    std::string config_to_str(bool default_also = false, bool write_description = false) const;

  private:
    // CLI app that performs CLI parsing. std::unique_ptr avoids having to
    // include CLI11 headers from CoreNEURON headers, and therefore avoids
    // CoreNEURON having to install CLI11 when using it from a submodule.
    std::unique_ptr<CLI::App> m_app;
};

std::ostream& operator<<(std::ostream& os,
                         const corenrn_parameters& corenrn_param);  /// Printing method.

extern corenrn_parameters corenrn_param;  /// Declaring global corenrn_parameters object for this
                                          /// instance of CoreNeuron.
extern int nrn_nobanner_;                 /// Global no banner setting

}  // namespace coreneuron


================================================
FILE: coreneuron/apps/main1.cpp
================================================
/*
# =============================================================================
# Copyright (c) 2016 - 2022 Blue Brain Project/EPFL
#
# See top-level LICENSE file for details.
# =============================================================================.
*/

/**
 * @file main1.cpp
 * @date 26 Oct 2014
 * @brief File containing main driver routine for CoreNeuron
 */

#include <cstring>
#include <climits>
#include <dlfcn.h>
#include <memory>
#include <vector>

#include "coreneuron/config/config.h"
#include "coreneuron/utils/randoms/nrnran123.h"
#include "coreneuron/nrnconf.h"
#include "coreneuron/sim/fast_imem.hpp"
#include "coreneuron/sim/multicore.hpp"
#include "coreneuron/mpi/nrnmpi.h"
#include "coreneuron/nrniv/nrniv_decl.h"
#include "coreneuron/mechanism/register_mech.hpp"
#include "coreneuron/io/output_spikes.hpp"
#include "coreneuron/io/nrn_checkpoint.hpp"
#include "coreneuron/utils/memory_utils.h"
#include "coreneuron/apps/corenrn_parameters.hpp"
#include "coreneuron/io/prcellstate.hpp"
#include "coreneuron/utils/nrn_stats.h"
#include "coreneuron/io/reports/nrnreport.hpp"
#include "coreneuron/io/reports/binary_report_handler.hpp"
#include "coreneuron/io/reports/report_handler.hpp"
#include "coreneuron/io/reports/sonata_report_handler.hpp"
#include "coreneuron/gpu/nrn_acc_manager.hpp"
#include "coreneuron/utils/profile/profiler_interface.h"
#include "coreneuron/network/partrans.hpp"
#include "coreneuron/network/multisend.hpp"
#include "coreneuron/io/nrn_setup.hpp"
#include "coreneuron/io/file_utils.hpp"
#include "coreneuron/io/nrn2core_direct.h"
#include "coreneuron/io/core2nrn_data_return.hpp"
#include "coreneuron/utils/utils.hpp"

extern "C" {
const char* corenrn_version() {
    return coreneuron::bbcore_write_version;
}

// the CORENEURON_USE_LEGACY_UNITS determined by CORENRN_ENABLE_LEGACY_UNITS
bool corenrn_units_use_legacy() {
    return CORENEURON_USE_LEGACY_UNITS;
}

void (*nrn2core_part2_clean_)();

/**
 * If "export OMP_NUM_THREADS=n" is not set then omp by default sets
 * the number of threads equal to the number of cores on this node.
 * If there are a number of mpi processes on this node as well, things
 * can go very slowly as there are so many more threads than cores.
 * Assume the NEURON users pc.nthread() is well chosen if
 * OMP_NUM_THREADS is not set.
 */
void set_openmp_threads(int nthread) {
#if defined(_OPENMP)
    if (!getenv("OMP_NUM_THREADS")) {
        omp_set_num_threads(nthread);
    }
#endif
}

/**
 * Convert char* containing arguments from neuron to char* argv[] for
 * coreneuron command line argument parser.
 */
char* prepare_args(int& argc, char**& argv, int use_mpi, const char* mpi_lib, const char* arg) {
    // first construct all arguments as string
    std::string args(arg);
    args.insert(0, " coreneuron ");
    args.append(" --skip-mpi-finalize ");
    if (use_mpi) {
        args.append(" --mpi ");
    }

    // if neuron has passed name of MPI library then add it to CLI
    std::string corenrn_mpi_lib{mpi_lib};
    if (!corenrn_mpi_lib.empty()) {
        args.append(" --mpi-lib ");
        corenrn_mpi_lib += " ";
        args.append(corenrn_mpi_lib);
    }

    // we can't modify string with strtok, make copy
    char* first = strdup(args.c_str());
    const char* sep = " ";

    // first count the no of argument
    char* token = strtok(first, sep);
    argc = 0;
    while (token) {
        token = strtok(nullptr, sep);
        argc++;
    }
    free(first);

    // now build char*argv
    argv = new char*[argc];
    first = strdup(args.c_str());
    token = strtok(first, sep);
    for (int i = 0; token; i++) {
        argv[i] = token;
        token = strtok(nullptr, sep);
    }

    // return actual data to be freed
    return first;
}
}

namespace coreneuron {
void call_prcellstate_for_prcellgid(int prcellgid, int compute_gpu, int is_init);

// bsize = 0 then per step transfer
// bsize > 1 then full trajectory save into arrays.
void get_nrn_trajectory_requests(int bsize) {
    if (nrn2core_get_trajectory_requests_) {
        for (int tid = 0; tid < nrn_nthread; ++tid) {
            NrnThread& nt = nrn_threads[tid];
            int n_pr;
            int n_trajec;
            int* types;
            int* indices;
            void** vpr;
            double** varrays;
            double** pvars;

            // bsize is passed by reference, the return value will determine if
            // per step return or entire trajectory return.
            (*nrn2core_get_trajectory_requests_)(
                tid, bsize, n_pr, vpr, n_trajec, types, indices, pvars, varrays);
            delete_trajectory_requests(nt);
            if (n_trajec) {
                TrajectoryRequests* tr = new TrajectoryRequests;
                nt.trajec_requests = tr;
                tr->bsize = bsize;
                tr->n_pr = n_pr;
                tr->n_trajec = n_trajec;
                tr->vsize = 0;
                tr->vpr = vpr;
                tr->gather = new double*[n_trajec];
                tr->varrays = varrays;
                tr->scatter = pvars;
                for (int i = 0; i < n_trajec; ++i) {
                    tr->gather[i] = stdindex2ptr(types[i], indices[i], nt);
                }
                delete[] types;
                delete[] indices;
            }
        }
    }
}

void nrn_init_and_load_data(int argc,
                            char* argv[],
                            CheckPoints& checkPoints,
                            bool is_mapping_needed,
                            bool run_setup_cleanup) {
#if defined(NRN_FEEXCEPT)
    nrn_feenableexcept();
#endif

    /// profiler like tau/vtune : do not measure from begining
    Instrumentor::stop_profile();

    // memory footprint after mpi initialisation
    if (!corenrn_param.is_quiet()) {
        report_mem_usage("After MPI_Init");
    }

    // initialise default coreneuron parameters
    initnrn();

    // set global variables
    // precedence is: set by user, globals.dat, 34.0
    celsius = corenrn_param.celsius;

#if CORENEURON_ENABLE_GPU
    if (!corenrn_param.gpu && corenrn_param.cell_interleave_permute == 2) {
        fprintf(stderr,
                "compiled with CORENEURON_ENABLE_GPU does not allow the combination of "
                "--cell-permute=2 and "
                "missing --gpu\n");
        exit(1);
    }
    if (!corenrn_param.gpu && corenrn_param.cuda_interface) {
        fprintf(stderr,
                "compiled with OpenACC/CUDA does not allow the combination of --cuda-interface and "
                "missing --gpu\n");
        exit(1);
    }
#endif

// if multi-threading enabled, make sure mpi library supports it
#if NRNMPI
    if (corenrn_param.mpi_enable && corenrn_param.threading) {
        nrnmpi_check_threading_support();
    }
#endif

    // full path of files.dat file
    std::string filesdat(corenrn_param.datpath + "/" + corenrn_param.filesdat);

    // read the global variable names and set their values from globals.dat
    set_globals(corenrn_param.datpath.c_str(), (corenrn_param.seed >= 0), corenrn_param.seed);

    // set global variables for start time, timestep and temperature
    if (!corenrn_embedded) {
        t = checkPoints.restore_time();
    }

    if (corenrn_param.dt != -1000.) {  // command line arg highest precedence
        dt = corenrn_param.dt;
    } else if (dt == -1000.) {  // not on command line and no dt in globals.dat
        dt = 0.025;             // lowest precedence
    }

    corenrn_param.dt = dt;

    rev_dt = (int) (1. / dt);

    if (corenrn_param.celsius != -1000.) {  // command line arg highest precedence
        celsius = corenrn_param.celsius;
    } else if (celsius == -1000.) {  // not on command line and no celsius in globals.dat
        celsius = 34.0;              // lowest precedence
    }

    corenrn_param.celsius = celsius;

    // create net_cvode instance
    mk_netcvode();

    // One part done before call to nrn_setup. Other part after.

    if (!corenrn_param.patternstim.empty()) {
        nrn_set_extra_thread0_vdata();
    }

    if (!corenrn_param.is_quiet()) {
        report_mem_usage("Before nrn_setup");
    }

    // set if need to interleave cells
    interleave_permute_type = corenrn_param.cell_interleave_permute;
    cellorder_nwarp = corenrn_param.nwarp;
    use_solve_interleave = corenrn_param.cell_interleave_permute;

    if (corenrn_param.gpu && interleave_permute_type == 0) {
        if (nrnmpi_myid == 0) {
            printf(
                " WARNING : GPU execution requires --cell-permute type 1 or 2. Setting it to 1.\n");
        }
        interleave_permute_type = 1;
        use_solve_interleave = true;
    }

    // multisend options
    use_multisend_ = corenrn_param.multisend ? 1 : 0;
    n_multisend_interval = corenrn_param.ms_subint;
    use_phase2_ = (corenrn_param.ms_phases == 2) ? 1 : 0;

    // reading *.dat files and setting up the data structures, setting mindelay
    nrn_setup(filesdat.c_str(),
              is_mapping_needed,
              checkPoints,
              run_setup_cleanup,
              corenrn_param.datpath.c_str(),
              checkPoints.get_restore_path().c_str(),
              &corenrn_param.mindelay);

    // Allgather spike compression and  bin queuing.
    nrn_use_bin_queue_ = corenrn_param.binqueue;
    int spkcompress = corenrn_param.spkcompress;
    nrnmpi_spike_compress(spkcompress, (spkcompress ? true : false), use_multisend_);

    if (!corenrn_param.is_quiet()) {
        report_mem_usage("After nrn_setup ");
    }

    // Invoke PatternStim
    if (!corenrn_param.patternstim.empty()) {
        nrn_mkPatternStim(corenrn_param.patternstim.c_str(), corenrn_param.tstop);
    }

    /// Setting the timeout
    nrn_set_timeout(200.);

    // show all configuration parameters for current run
    if (nrnmpi_myid == 0 && !corenrn_param.is_quiet()) {
        std::cout << corenrn_param << std::endl;
        std::cout << " Start time (t) = " << t << std::endl << std::endl;
    }

    // allocate buffer for mpi communication
    mk_spikevec_buffer(corenrn_param.spikebuf);

    if (!corenrn_param.is_quiet()) {
        report_mem_usage("After mk_spikevec_buffer");
    }

    // In direct mode there are likely trajectory record requests
    // to allow processing in NEURON after simulation by CoreNEURON
    if (corenrn_embedded) {
        // arg is additional vector size required (how many items will be
        // written to the double*) but NEURON can instead
        // specify that returns will be on a per time step basis.
        get_nrn_trajectory_requests(int((corenrn_param.tstop - t) / corenrn_param.dt) + 2);

        // In direct mode, CoreNEURON has exactly the behavior of
        // ParallelContext.psolve(tstop). Ie a sequence of such calls
        // without an intervening h.finitialize() continues from the end
        // of the previous call. I.e., all initial state, including
        // the event queue has been set up in NEURON. And, at the end
        // all final state, including the event queue will be sent back
        // to NEURON. Here there is some first time only
        // initialization and queue transfer.
        direct_mode_initialize();
        clear_spike_vectors();  // PreSyn send already recorded by NEURON
        (*nrn2core_part2_clean_)();
    }

    if (corenrn_param.gpu) {
        // Copy nrnthreads to device only after all the data are passed from NEURON and the
        // nrnthreads on CPU are properly set up
        setup_nrnthreads_on_device(nrn_threads, nrn_nthread);
    }

    if (corenrn_embedded) {
        // Run nrn_init of mechanisms only to allocate any extra data needed on the GPU after
        // nrnthreads are properly set up on the GPU
        allocate_data_in_mechanism_nrn_init();
    }

    if (corenrn_param.gpu) {
        if (nrn_have_gaps) {
            nrn_partrans::copy_gap_indices_to_device();
        }
    }

    // call prcellstate for prcellgid
    call_prcellstate_for_prcellgid(corenrn_param.prcellgid, corenrn_param.gpu, 1);
}

void call_prcellstate_for_prcellgid(int prcellgid, int compute_gpu, int is_init) {
    char prcellname[1024];
#ifdef ENABLE_CUDA
    const char* prprefix = "cu";
#else
    const char* prprefix = "acc";
#endif

    if (prcellgid >= 0) {
        if (compute_gpu) {
            if (is_init)
                sprintf(prcellname, "%s_gpu_init", prprefix);
            else
                sprintf(prcellname, "%s_gpu_t%f", prprefix, t);
        } else {
            if (is_init)
                strcpy(prcellname, "cpu_init");
            else
                sprintf(prcellname, "cpu_t%f", t);
        }
        update_nrnthreads_on_host(nrn_threads, nrn_nthread);
        prcellstate(prcellgid, prcellname);
    }
}

/* perform forwardskip and call prcellstate for prcellgid */
void handle_forward_skip(double forwardskip, int prcellgid) {
    double savedt = dt;
    double savet = t;

    dt = forwardskip * 0.1;
    t = -1e9;
    dt2thread(-1.);

    for (int step = 0; step < 10; ++step) {
        nrn_fixed_step_minimal();
    }

    if (prcellgid >= 0) {
        prcellstate(prcellgid, "fs");
    }

    dt = savedt;
    t = savet;
    dt2thread(-1.);

    // clear spikes generated during forward skip (with negative time)
    clear_spike_vectors();
}

std::string cnrn_version() {
    return version::to_string();
}


static void trajectory_return() {
    if (nrn2core_trajectory_return_) {
        for (int tid = 0; tid < nrn_nthread; ++tid) {
            NrnThread& nt = nrn_threads[tid];
            TrajectoryRequests* tr = nt.trajec_requests;
            if (tr && tr->varrays) {
                (*nrn2core_trajectory_return_)(tid, tr->n_pr, tr->bsize, tr->vsize, tr->vpr, nt._t);
            }
        }
    }
}

std::unique_ptr<ReportHandler> create_report_handler(const ReportConfiguration& config,
                                                     const SpikesInfo& spikes_info) {
    std::unique_ptr<ReportHandler> report_handler;
    if (config.format == "Bin") {
        report_handler = std::make_unique<BinaryReportHandler>();
    } else if (config.format == "SONATA") {
        report_handler = std::make_unique<SonataReportHandler>(spikes_info);
    } else {
        if (nrnmpi_myid == 0) {
            printf(" WARNING : Report name '%s' has unknown format: '%s'.\n",
                   config.name.data(),
                   config.format.data());
        }
        return nullptr;
    }
    return report_handler;
}

}  // namespace coreneuron

/// The following high-level functions are marked as "extern C"
/// for compat with C, namely Neuron mod files.
/// They split the previous solve_core so that intermediate init of external mechanisms can occur.
/// See mech/corenrnmech.cpp for the new all-in-one solve_core (not compiled into the coreneuron
/// lib since with nrnivmodl-core we have 'future' external mechanisms)

using namespace coreneuron;

#if NRNMPI && defined(CORENEURON_ENABLE_MPI_DYNAMIC)
static void* load_dynamic_mpi(const std::string& libname) {
    dlerror();
    void* handle = dlopen(libname.c_str(), RTLD_NOW | RTLD_GLOBAL);
    const char* error = dlerror();
    if (error) {
        std::string err_msg = std::string("Could not open dynamic MPI library: ") + error + "\n";
        throw std::runtime_error(err_msg);
    }
    return handle;
}
#endif

extern "C" void mk_mech_init(int argc, char** argv) {
    // reset all parameters to their default values
    corenrn_param.reset();

    // read command line parameters and parameter config files
    corenrn_param.parse(argc, argv);

#if NRNMPI
    if (corenrn_param.mpi_enable) {
#ifdef CORENEURON_ENABLE_MPI_DYNAMIC
        // coreneuron rely on neuron to detect mpi library distribution and
        // the name of the library itself. Make sure the library name is specified
        // via CLI option.
        if (corenrn_param.mpi_lib.empty()) {
            throw std::runtime_error(
                "For dynamic MPI support you must pass '--mpi-lib "
                "/path/libcorenrnmpi_<name>.<suffix>` argument!\n");
        }

        // neuron can call coreneuron multiple times and hence we do not
        // want to initialize/load mpi library multiple times
        static bool mpi_lib_loaded = false;
        if (!mpi_lib_loaded) {
            auto mpi_handle = load_dynamic_mpi(corenrn_param.mpi_lib);
            mpi_manager().resolve_symbols(mpi_handle);
            mpi_lib_loaded = true;
        }
#endif
        auto ret = nrnmpi_init(&argc, &argv, corenrn_param.is_quiet());
        nrnmpi_numprocs = ret.numprocs;
        nrnmpi_myid = ret.myid;
    }
#endif

#ifdef CORENEURON_ENABLE_GPU
    if (corenrn_param.gpu) {
        init_gpu();
        cnrn_target_copyin(&celsius);
        cnrn_target_copyin(&pi);
        cnrn_target_copyin(&secondorder);
        nrnran123_initialise_global_state_on_device();
    }
#endif

    if (!corenrn_param.writeParametersFilepath.empty()) {
        std::ofstream out(corenrn_param.writeParametersFilepath, std::ios::trunc);
        out << corenrn_param.config_to_str(false, false);
        out.close();
    }

    // reads mechanism information from bbcore_mech.dat
    mk_mech((corenrn_param.datpath).c_str());
}

extern "C" int run_solve_core(int argc, char** argv) {
    Instrumentor::phase_begin("main");

    std::vector<ReportConfiguration> configs;
    std::vector<std::unique_ptr<ReportHandler>> report_handlers;
    SpikesInfo spikes_info;
    bool reports_needs_finalize = false;

    if (!corenrn_param.is_quiet()) {
        report_mem_usage("After mk_mech");
    }

    // Create outpath if it does not exist
    if (nrnmpi_myid == 0) {
        mkdir_p(corenrn_param.outpath.c_str());
    }

    if (!corenrn_param.reportfilepath.empty()) {
        configs = create_report_configurations(corenrn_param.reportfilepath,
                                               corenrn_param.outpath,
                                               spikes_info);
        reports_needs_finalize = !configs.empty();
    }

    CheckPoints checkPoints{corenrn_param.checkpointpath, corenrn_param.restorepath};

    // initializationa and loading functions moved to separate
    {
        Instrumentor::phase p("load-model");
        nrn_init_and_load_data(argc, argv, checkPoints, !configs.empty());
    }

    std::string output_dir = corenrn_param.outpath;

    if (nrnmpi_myid == 0) {
        mkdir_p(output_dir.c_str());
    }
#if NRNMPI
    if (corenrn_param.mpi_enable) {
        nrnmpi_barrier();
    }
#endif
    bool compute_gpu = corenrn_param.gpu;

    nrn_pragma_acc(update device(celsius, secondorder, pi) if (compute_gpu))
    nrn_pragma_omp(target update to(celsius, secondorder, pi) if (compute_gpu))
    {
        double v = corenrn_param.voltage;
        double dt = corenrn_param.dt;
        double delay = corenrn_param.mindelay;
        double tstop = corenrn_param.tstop;

        if (tstop < t && nrnmpi_myid == 0) {
            printf("Error: Stop time (%lf) < Start time (%lf), restoring from checkpoint? \n",
                   tstop,
                   t);
            abort();
        }

        // TODO : if some ranks are empty then restore will go in deadlock
        // phase (as some ranks won't have restored anything and hence return
        // false in checkpoint_initialize
        if (!corenrn_embedded && !checkPoints.initialize()) {
            nrn_finitialize(v != 1000., v);
        }

        if (!corenrn_param.is_quiet()) {
            report_mem_usage("After nrn_finitialize");
        }

        // register all reports into reportinglib
        double min_report_dt = INT_MAX;
        for (size_t i = 0; i < configs.size(); i++) {
            std::unique_ptr<ReportHandler> report_handler = create_report_handler(configs[i],
                                                                                  spikes_info);
            if (report_handler) {
                report_handler->create_report(configs[i], dt, tstop, delay);
                report_handlers.push_back(std::move(report_handler));
            }
            if (configs[i].report_dt < min_report_dt) {
                min_report_dt = configs[i].report_dt;
            }
        }
        // Set the buffer size if is not the default value. Otherwise use report.conf on
        // register_report
        if (corenrn_param.report_buff_size != corenrn_param.report_buff_size_default) {
            set_report_buffer_size(corenrn_param.report_buff_size);
        }

        if (!configs.empty()) {
            setup_report_engine(min_report_dt, delay);
            configs.clear();
        }

        // call prcellstate for prcellgid
        call_prcellstate_for_prcellgid(corenrn_param.prcellgid, compute_gpu, 0);

        // handle forwardskip
        if (corenrn_param.forwardskip > 0.0) {
            Instrumentor::phase p("handle-forward-skip");
            handle_forward_skip(corenrn_param.forwardskip, corenrn_param.prcellgid);
        }

        /// Solver execution
        Instrumentor::start_profile();
        Instrumentor::phase_begin("simulation");
        BBS_netpar_solve(corenrn_param.tstop);
        Instrumentor::phase_end("simulation");
        Instrumentor::stop_profile();

        // update cpu copy of NrnThread from GPU
        update_nrnthreads_on_host(nrn_threads, nrn_nthread);

        // direct mode and full trajectory gathering on CoreNEURON, send back.
        if (corenrn_embedded) {
            trajectory_return();
        }

        // Report global cell statistics
        if (!corenrn_param.is_quiet()) {
            report_cell_stats();
        }

        // prcellstate after end of solver
        call_prcellstate_for_prcellgid(corenrn_param.prcellgid, compute_gpu, 0);
    }

    // write spike information to outpath
    {
        Instrumentor::phase p("output-spike");
        output_spikes(output_dir.c_str(), spikes_info);
    }

    // copy weights back to NEURON NetCon
    if (nrn2core_all_weights_return_) {
        // first update weights from gpu
        update_weights_from_gpu(nrn_threads, nrn_nthread);

        // store weight pointers
        std::vector<double*> weights(nrn_nthread, nullptr);

        // could be one thread more (empty) than in NEURON but does not matter
        for (int i = 0; i < nrn_nthread; ++i) {
            weights[i] = nrn_threads[i].weights;
        }
        (*nrn2core_all_weights_return_)(weights);
    }

    core2nrn_data_return();

    {
        Instrumentor::phase p("checkpoint");
        checkPoints.write_checkpoint(nrn_threads, nrn_nthread);
    }

    // must be done after checkpoint (to avoid deleting events)
    if (reports_needs_finalize) {
        finalize_report();
    }

    // cleanup threads on GPU
    if (corenrn_param.gpu) {
        delete_nrnthreads_on_device(nrn_threads, nrn_nthread);
        if (nrn_have_gaps) {
            nrn_partrans::delete_gap_indices_from_device();
        }
        nrnran123_destroy_global_state_on_device();
        cnrn_target_delete(&secondorder);
        cnrn_target_delete(&pi);
        cnrn_target_delete(&celsius);
    }

    // Cleaning the memory
    nrn_cleanup();

    // tau needs to resume profile
    Instrumentor::start_profile();

// mpi finalize
#if NRNMPI
    if (corenrn_param.mpi_enable && !corenrn_param.skip_mpi_finalize) {
        nrnmpi_finalize();
    }
#endif

    Instrumentor::phase_end("main");

    return 0;
}


================================================
FILE: coreneuron/config/config.cpp.in
================================================
/*
# =============================================================================
# Copyright (c) 2016 - 2021 Blue Brain Project/EPFL
#
# See top-level LICENSE file for details.
# =============================================================================
*/

#include "coreneuron/config/config.h"

/// Git version of the project
const std::string coreneuron::version::GIT_REVISION = "@CN_GIT_REVISION@";

/// CoreNEURON version
const std::string coreneuron::version::CORENEURON_VERSION = "@CN_PROJECT_VERSION@";


================================================
FILE: coreneuron/config/config.h
================================================
/*
# =============================================================================
# Copyright (c) 2016 - 2021 Blue Brain Project/EPFL
#
# See top-level LICENSE file for details.
# =============================================================================
*/

#pragma once

/**
 * \dir
 * \brief Global project configurations
 *
 * \file
 * \brief Version information
 */

#include <string>

namespace coreneuron {

/**
 * \brief Project version information
 */
struct version {
    /// git revision id
    static const std::string GIT_REVISION;

    /// project tagged version in the cmake
    static const std::string CORENEURON_VERSION;

    /// return version string (version + git id) as a string
    static std::string to_string() {
        return CORENEURON_VERSION + " " + GIT_REVISION;
    }
};

}  // namespace coreneuron


================================================
FILE: coreneuron/config/neuron_version.hpp.in
================================================
/*
# =============================================================================
# Copyright (c) 2022 Blue Brain Project/EPFL
#
# See top-level LICENSE file for details.
# =============================================================================
*/
#pragma once

// This is the CoreNEURON analogue of nrnsemanticversion.h in NEURON. Hopefully
// the duplication can go away soon.
#define NRN_VERSION_MAJOR @NRN_VERSION_MAJOR@
#define NRN_VERSION_MINOR @NRN_VERSION_MINOR@
#define NRN_VERSION_PATCH @NRN_VERSION_PATCH@


================================================
FILE: coreneuron/config/version_macros.hpp
================================================
/*
# =============================================================================
# Copyright (c) 2022 Blue Brain Project/EPFL
#
# See top-level LICENSE file for details.
# =============================================================================
*/
#pragma once

// This is the CoreNEURON analogue of nrnversionmacros.h in NEURON. Hopefully
// the duplication can go away soon.
#include "coreneuron/config/neuron_version.hpp"
#define NRN_VERSION_INT(maj, min, pat)  (10000 * maj + 100 * min + pat)
#define NRN_VERSION                     NRN_VERSION_INT(NRN_VERSION_MAJOR, NRN_VERSION_MINOR, NRN_VERSION_PATCH)
#define NRN_VERSION_EQ(maj, min, pat)   (NRN_VERSION == NRN_VERSION_INT(maj, min, pat))
#define NRN_VERSION_NE(maj, min, pat)   (NRN_VERSION != NRN_VERSION_INT(maj, min, pat))
#define NRN_VERSION_GT(maj, min, pat)   (NRN_VERSION > NRN_VERSION_INT(maj, min, pat))
#define NRN_VERSION_LT(maj, min, pat)   (NRN_VERSION < NRN_VERSION_INT(maj, min, pat))
#define NRN_VERSION_GTEQ(maj, min, pat) (NRN_VERSION >= NRN_VERSION_INT(maj, min, pat))
#define NRN_VERSION_LTEQ(maj, min, pat) (NRN_VERSION <= NRN_VERSION_INT(maj, min, pat))

// 8.2.0 is significant because all versions >=8.2.0 should contain definitions
// of these macros, and doing #ifndef NRN_VERSION_GTEQ_8_2_0 is a more
// descriptive way of writing #if defined(NRN_VERSION_GTEQ). Testing for 8.2.0
// is likely to be a common pattern when adapting MOD file VERBATIM blocks for
// C++ compatibility.
#if NRN_VERSION_GTEQ(8, 2, 0)
#define NRN_VERSION_GTEQ_8_2_0
#endif


================================================
FILE: coreneuron/coreneuron.hpp
================================================
/*
# =============================================================================
# Copyright (c) 2016 - 2021 Blue Brain Project/EPFL
#
# See top-level LICENSE file for details.
# =============================================================================.
*/
#pragma once

/***
 * Includes all headers required to communicate and run all methods
 * described in CoreNEURON, neurox, and mod2c C-generated mechanisms
 * functions.
 **/


#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string.h>
#include <vector>
#include <array>

#include "coreneuron/utils/randoms/nrnran123.h"     //Random Number Generator
#include "coreneuron/sim/scopmath/newton_struct.h"  //Newton Struct
#include "coreneuron/membrane_definitions.h"        //static definitions
#include "coreneuron/mechanism/mechanism.hpp"       //Memb_list and mechs info

#include "coreneuron/utils/memory.h"  //Memory alignments and padding
#include "coreneuron/nrnconf.h"
#include "coreneuron/sim/multicore.hpp"
#include "coreneuron/mechanism/mech_mapping.hpp"

namespace coreneuron {

// from nrnoc/capac.c
extern void nrn_init_capacitance(NrnThread*, Memb_list*, int);
extern void nrn_cur_capacitance(NrnThread* _nt, Memb_list* ml, int type);
extern void nrn_alloc_capacitance(double* data, Datum* pdata, int type);

// from nrnoc/eion.c
extern void nrn_init_ion(NrnThread*, Memb_list*, int);
extern void nrn_cur_ion(NrnThread* _nt, Memb_list* ml, int type);
extern void nrn_alloc_ion(double* data, Datum* pdata, int type);
extern void second_order_cur(NrnThread* _nt, int secondorder);

using DependencyTable = std::vector<std::vector<int>>;

/**
 * A class representing the CoreNEURON state, holding pointers to the various data structures
 *
 * The pointers to "global" data such as the NrnThread, Memb_list and Memb_func data structures
 * are managed here. they logically share their lifetime and runtime scope with instances of
 * this class.
 */
class CoreNeuron {
    /**
     * map if mech is a point process
     * In the future only a field of Mechanism class
     */
    std::vector<char> pnt_map; /* so prop_free can know its a point mech*/

    /** Vector mapping the types (IDs) of different mechanisms of mod files between NEURON and
     * CoreNEURON
     */
    std::vector<int> different_mechanism_type;

    /**
     * dependency helper filled by calls to hoc_register_dparam_semantics
     * used when nrn_mech_depend is called
     * vector-of-vector DS. First idx is the mech, second idx is the dependent mech.
     */
    DependencyTable ion_write_dependency;

    std::vector<Memb_func> memb_funcs;

    /**
     * Net send / Net receive
     * only used in CoreNEURON for book keeping synapse mechs, should go into CoreNEURON class
     */
    std::vector<std::pair<NetBufReceive_t, int>> net_buf_receive;
    std::vector<int> net_buf_send_type;

    /**
     * before-after-blocks from nmodl are registered here as function pointers
     */
    std::array<BAMech*, BEFORE_AFTER_SIZE> bamech;

    /**
     * Internal lookup tables. Number of float and int variables in each mechanism and memory layout
     * future --> mech class
     */
    std::vector<int> nrn_prop_param_size;
    std::vector<int> nrn_prop_dparam_size;
    std::vector<int> nrn_mech_data_layout; /* 1 AoS (default), 0 SoA */
    /* array is parallel to memb_func. All are 0 except 1 for ARTIFICIAL_CELL */
    std::vector<short> nrn_artcell_qindex;
    std::vector<bool> nrn_is_artificial;

    /**
     * Net Receive function pointer lookup tables
     */
    std::vector<pnt_receive_t> pnt_receive; /* for synaptic events. */
    std::vector<pnt_receive_t> pnt_receive_init;
    std::vector<short> pnt_receive_size;

    /**
     * Holds function pointers for WATCH callback
     */
    std::vector<nrn_watch_check_t> nrn_watch_check;

    /**
     * values are type numbers of mechanisms which do net_send call
     * related to NMODL net_event()
     *
     */
    std::vector<int> nrn_has_net_event;

    /**
     * inverse of nrn_has_net_event_ maps the values of nrn_has_net_event_ to the index of
     * ptntype2presyn
     */
    std::vector<int> pnttype2presyn;


    std::vector<bbcore_read_t> nrn_bbcore_read;
    std::vector<bbcore_write_t> nrn_bbcore_write;

  public:
    auto& get_memb_funcs() {
        return memb_funcs;
    }

    auto& get_memb_func(size_t idx) {
        return memb_funcs[idx];
    }

    auto& get_different_mechanism_type() {
        return different_mechanism_type;
    }

    auto& get_pnt_map() {
        return pnt_map;
    }

    auto& get_ion_write_dependency() {
        return ion_write_dependency;
    }

    auto& get_net_buf_receive() {
        return net_buf_receive;
    }

    auto& get_net_buf_send_type() {
        return net_buf_send_type;
    }

    auto& get_bamech() {
        return bamech;
    }

    auto& get_prop_param_size() {
        return nrn_prop_param_size;
    }

    auto& get_prop_dparam_size() {
        return nrn_prop_dparam_size;
    }

    auto& get_mech_data_layout() {
        return nrn_mech_data_layout;
    }

    auto& get_is_artificial() {
        return nrn_is_artificial;
    }

    auto& get_artcell_qindex() {
        return nrn_artcell_qindex;
    }

    auto& get_pnt_receive() {
        return pnt_receive;
    }

    auto& get_pnt_receive_init() {
        return pnt_receive_init;
    }

    auto& get_pnt_receive_size() {
        return pnt_receive_size;
    }

    auto& get_watch_check() {
        return nrn_watch_check;
    }

    auto& get_has_net_event() {
        return nrn_has_net_event;
    }

    auto& get_pnttype2presyn() {
        return pnttype2presyn;
    }

    auto& get_bbcore_read() {
        return nrn_bbcore_read;
    }

    auto& get_bbcore_write() {
        return nrn_bbcore_write;
    }
};

extern CoreNeuron corenrn;

}  // namespace coreneuron


================================================
FILE: coreneuron/engine.h.in
================================================
/*
# =============================================================================
# Copyright (c) 2016 - 2021 Blue Brain Project/EPFL
#
# See top-level LICENSE file for details.
# =============================================================================
*/

#pragma once

// Use MAJOR.MINOR for public version
#define CORENEURON_VERSION @CORENEURON_VERSION_COMBINED@

#ifdef __cplusplus
extern "C" {
#endif

/// All-in-one initialization of mechanisms and solver
extern int solve_core(int argc, char** argv);

/// Initialize mechanisms
extern void mk_mech_init(int argc, char** argv);
/// Run core solver
extern int run_solve_core(int argc, char** argv);

#ifdef __cplusplus
}
#endif


================================================
FILE: coreneuron/gpu/nrn_acc_manager.cpp
================================================
/*
# =============================================================================
# Copyright (c) 2016 - 2022 Blue Brain Project/EPFL
#
# See top-level LICENSE file for details.
# =============================================================================
*/

#include <queue>
#include <utility>

#include "coreneuron/apps/corenrn_parameters.hpp"
#include "coreneuron/gpu/nrn_acc_manager.hpp"
#include "coreneuron/sim/multicore.hpp"
#include "coreneuron/network/netcon.hpp"
#include "coreneuron/nrniv/nrniv_decl.h"
#include "coreneuron/utils/vrecitem.h"
#include "coreneuron/utils/profile/profiler_interface.h"
#include "coreneuron/permute/cellorder.hpp"
#include "coreneuron/permute/data_layout.hpp"
#include "coreneuron/sim/scopmath/newton_struct.h"
#include "coreneuron/coreneuron.hpp"
#include "coreneuron/utils/nrnoc_aux.hpp"
#include "coreneuron/mpi/nrnmpidec.h"
#include "coreneuron/utils/utils.hpp"

#ifdef CRAYPAT
#include <pat_api.h>
#endif

#if defined(CORENEURON_ENABLE_GPU) && defined(CORENEURON_PREFER_OPENMP_OFFLOAD) && defined(_OPENMP)
#include <cuda_runtime_api.h>
#endif

#if __has_include(<cxxabi.h>)
#define USE_CXXABI
#include <cxxabi.h>
#include <memory>
#include <string>
#endif

#ifdef CORENEURON_ENABLE_PRESENT_TABLE
#include <cassert>
#include <cstddef>
#include <iostream>
#include <map>
#include <shared_mutex>
namespace {
struct present_table_value {
    std::size_t ref_count{}, size{};
    std::byte* dev_ptr{};
};
std::map<std::byte const*, present_table_value> present_table;
std::shared_mutex present_table_mutex;
}  // namespace
#endif

namespace {
/** @brief Try to demangle a type name, return the mangled name on failure.
 */
std::string cxx_demangle(const char* mangled) {
#ifdef USE_CXXABI
    int status{};
    // Note that the third argument to abi::__cxa_demangle returns the length of
    // the allocated buffer, which may be larger than strlen(demangled) + 1.
    std::unique_ptr<char, decltype(free)*> demangled{
        abi::__cxa_demangle(mangled, nullptr, nullptr, &status), free};
    return status ? mangled : demangled.get();
#else
    return mangled;
#endif
}
bool cnrn_target_debug_output_enabled() {
    const char* env = std::getenv("CORENEURON_GPU_DEBUG");
    if (!env) {
        return false;
    }
    std::string env_s{env};
    if (env_s == "1") {
        return true;
    } else if (env_s == "0") {
        return false;
    } else {
        throw std::runtime_error("CORENEURON_GPU_DEBUG must be set to 0 or 1 (got " + env_s + ")");
    }
}
bool cnrn_target_enable_debug{cnrn_target_debug_output_enabled()};
}  // namespace

namespace coreneuron {
extern InterleaveInfo* interleave_info;
void nrn_ion_global_map_copyto_device();
void nrn_ion_global_map_delete_from_device();
void nrn_VecPlay_copyto_device(NrnThread* nt, void** d_vecplay);
void nrn_VecPlay_delete_from_device(NrnThread* nt);

void cnrn_target_copyin_debug(std::string_view file,
                              int line,
                              std::size_t sizeof_T,
                              std::type_info const& typeid_T,
                              void const* h_ptr,
                              std::size_t len,
                              void* d_ptr) {
    if (!cnrn_target_enable_debug) {
        return;
    }
    std::cerr << file << ':' << line << ": cnrn_target_copyin<" << cxx_demangle(typeid_T.name())
              << ">(" << h_ptr << ", " << len << " * " << sizeof_T << " = " << len * sizeof_T
              << ") -> " << d_ptr << std::endl;
}
void cnrn_target_delete_debug(std::string_view file,
                              int line,
                              std::size_t sizeof_T,
                              std::type_info const& typeid_T,
                              void const* h_ptr,
                              std::size_t len) {
    if (!cnrn_target_enable_debug) {
        return;
    }
    std::cerr << file << ':' << line << ": cnrn_target_delete<" << cxx_demangle(typeid_T.name())
              << ">(" << h_ptr << ", " << len << " * " << sizeof_T << " = " << len * sizeof_T << ')'
              << std::endl;
}
void cnrn_target_deviceptr_debug(std::string_view file,
                                 int line,
                                 std::type_info const& typeid_T,
                                 void const* h_ptr,
                                 void* d_ptr) {
    if (!cnrn_target_enable_debug) {
        return;
    }
    std::cerr << file << ':' << line << ": cnrn_target_deviceptr<" << cxx_demangle(typeid_T.name())
              << ">(" << h_ptr << ") -> " << d_ptr << std::endl;
}
void cnrn_target_is_present_debug(std::string_view file,
                                  int line,
                                  std::type_info const& typeid_T,
                                  void const* h_ptr,
                                  void* d_ptr) {
    if (!cnrn_target_enable_debug) {
        return;
    }
    std::cerr << file << ':' << line << ": cnrn_target_is_present<" << cxx_demangle(typeid_T.name())
              << ">(" << h_ptr << ") -> " << d_ptr << std::endl;
}
void cnrn_target_memcpy_to_device_debug(std::string_view file,
                                        int line,
                                        std::size_t sizeof_T,
                                        std::type_info const& typeid_T,
                                        void const* h_ptr,
                                        std::size_t len,
                                        void* d_ptr) {
    if (!cnrn_target_enable_debug) {
        return;
    }
    std::cerr << file << ':' << line << ": cnrn_target_memcpy_to_device<"
              << cxx_demangle(typeid_T.name()) << ">(" << d_ptr << ", " << h_ptr << ", " << len
              << " * " << sizeof_T << " = " << len * sizeof_T << ')' << std::endl;
}

#ifdef CORENEURON_ENABLE_PRESENT_TABLE
std::pair<void*, bool> cnrn_target_deviceptr_impl(bool must_be_present_or_null, void const* h_ptr) {
    if (!h_ptr) {
        return {nullptr, false};
    }
    // Concurrent calls to this method are safe, but they must be serialised
    // w.r.t. calls to the cnrn_target_*_update_present_table methods.
    std::shared_lock _{present_table_mutex};
    if (present_table.empty()) {
        return {nullptr, must_be_present_or_null};
    }
    // prev(first iterator greater than h_ptr or last if not found) gives the first iterator less
    // than or equal to h_ptr
    auto const iter = std::prev(std::upper_bound(
        present_table.begin(), present_table.end(), h_ptr, [](void const* hp, auto const& entry) {
            return hp < entry.first;
        }));
    if (iter == present_table.end()) {
        return {nullptr, must_be_present_or_null};
    }
    std::byte const* const h_byte_ptr{static_cast<std::byte const*>(h_ptr)};
    std::byte const* const h_start_of_block{iter->first};
    std::size_t const block_size{iter->second.size};
    std::byte* const d_start_of_block{iter->second.dev_ptr};
    bool const is_present{h_byte_ptr < h_start_of_block + block_size};
    if (!is_present) {
        return {nullptr, must_be_present_or_null};
    }
    return {d_start_of_block + (h_byte_ptr - h_start_of_block), false};
}

void cnrn_target_copyin_update_present_table(void const* h_ptr, void* d_ptr, std::size_t len) {
    if (!h_ptr) {
        assert(!d_ptr);
        return;
    }
    std::lock_guard _{present_table_mutex};
    // TODO include more pedantic overlap checking?
    present_table_value new_val{};
    new_val.size = len;
    new_val.ref_count = 1;
    new_val.dev_ptr = static_cast<std::byte*>(d_ptr);
    auto const [iter, inserted] = present_table.emplace(static_cast<std::byte const*>(h_ptr),
                                                        std::move(new_val));
    if (!inserted) {
        // Insertion didn't occur because h_ptr was already in the present table
        assert(iter->second.size == len);
        assert(iter->second.dev_ptr == new_val.dev_ptr);
        ++(iter->second.ref_count);
    }
}
void cnrn_target_delete_update_present_table(void const* h_ptr, std::size_t len) {
    if (!h_ptr) {
        return;
    }
    std::lock_guard _{present_table_mutex};
    auto const iter = present_table.find(static_cast<std::byte const*>(h_ptr));
    assert(iter != present_table.end());
    assert(iter->second.size == len);
    --(iter->second.ref_count);
    if (iter->second.ref_count == 0) {
        present_table.erase(iter);
    }
}
#endif

int cnrn_target_get_num_devices() {
#if defined(CORENEURON_ENABLE_GPU) && !defined(CORENEURON_PREFER_OPENMP_OFFLOAD) && \
    defined(_OPENACC)
    // choose nvidia GPU by default
    acc_device_t device_type = acc_device_nvidia;
    // check how many gpu devices available per node
    return acc_get_num_devices(device_type);
#elif defined(CORENEURON_ENABLE_GPU) && defined(CORENEURON_PREFER_OPENMP_OFFLOAD) && \
    defined(_OPENMP)
    return omp_get_num_devices();
#else
    throw std::runtime_error(
        "cnrn_target_get_num_devices() not implemented without OpenACC/OpenMP and gpu build");
#endif
}

void cnrn_target_set_default_device(int device_num) {
#if defined(CORENEURON_ENABLE_GPU) && !defined(CORENEURON_PREFER_OPENMP_OFFLOAD) && \
    defined(_OPENACC)
    acc_set_device_num(device_num, acc_device_nvidia);
#elif defined(CORENEURON_ENABLE_GPU) && defined(CORENEURON_PREFER_OPENMP_OFFLOAD) && \
    defined(_OPENMP)
    omp_set_default_device(device_num);
    // It seems that with NVHPC 21.9 then only setting the default OpenMP device
    // is not enough: there were errors on some nodes when not-the-0th GPU was
    // used. These seemed to be related to the NMODL instance structs, which are
    // allocated using cudaMallocManaged.
    auto const cuda_code = cudaSetDevice(device_num);
    assert(cuda_code == cudaSuccess);
#else
    throw std::runtime_error(
        "cnrn_target_set_default_device() not implemented without OpenACC/OpenMP and gpu build");
#endif
}

#ifdef CORENEURON_ENABLE_GPU
#ifndef CORENEURON_UNIFIED_MEMORY
static Memb_list* copy_ml_to_device(const Memb_list* ml, int type) {
    // As we never run code for artificial cell inside GPU we don't copy it.
    int is_art = corenrn.get_is_artificial()[type];
    if (is_art) {
        return nullptr;
    }

    auto d_ml = cnrn_target_copyin(ml);

    if (ml->global_variables) {
        assert(ml->global_variables_size);
        void* d_inst = cnrn_target_copyin(static_cast<std::byte*>(ml->global_variables),
                                          ml->global_variables_size);
        cnrn_target_memcpy_to_device(&(d_ml->global_variables), &d_inst);
    }


    int n = ml->nodecount;
    int szp = corenrn.get_prop_param_size()[type];
    int szdp = corenrn.get_prop_dparam_size()[type];

    double* dptr = cnrn_target_deviceptr(ml->data);
    cnrn_target_memcpy_to_device(&(d_ml->data), &(dptr));


    int* d_nodeindices = cnrn_target_copyin(ml->nodeindices, n);
    cnrn_target_memcpy_to_device(&(d_ml->nodeindices), &d_nodeindices);

    if (szdp) {
        int pcnt = nrn_soa_padded_size(n, SOA_LAYOUT) * szdp;
        int* d_pdata = cnrn_target_copyin(ml->pdata, pcnt);
        cnrn_target_memcpy_to_device(&(d_ml->pdata), &d_pdata);
    }

    int ts = corenrn.get_memb_funcs()[type].thread_size_;
    if (ts) {
        ThreadDatum* td = cnrn_target_copyin(ml->_thread, ts);
        cnrn_target_memcpy_to_device(&(d_ml->_thread), &td);
    }

    // net_receive buffer associated with mechanism
    NetReceiveBuffer_t* nrb = ml->_net_receive_buffer;

    // if net receive buffer exist for mechanism
    if (nrb) {
        NetReceiveBuffer_t* d_nrb = cnrn_target_copyin(nrb);
        cnrn_target_memcpy_to_device(&(d_ml->_net_receive_buffer), &d_nrb);

        int* d_pnt_index = cnrn_target_copyin(nrb->_pnt_index, nrb->_size);
        cnrn_target_memcpy_to_device(&(d_nrb->_pnt_index), &d_pnt_index);

        int* d_weight_index = cnrn_target_copyin(nrb->_weight_index, nrb->_size);
        cnrn_target_memcpy_to_device(&(d_nrb->_weight_index), &d_weight_index);

        double* d_nrb_t = cnrn_target_copyin(nrb->_nrb_t, nrb->_size);
        cnrn_target_memcpy_to_device(&(d_nrb->_nrb_t), &d_nrb_t);

        double* d_nrb_flag = cnrn_target_copyin(nrb->_nrb_flag, nrb->_size);
        cnrn_target_memcpy_to_device(&(d_nrb->_nrb_flag), &d_nrb_flag);

        int* d_displ = cnrn_target_copyin(nrb->_displ, nrb->_size + 1);
        cnrn_target_memcpy_to_device(&(d_nrb->_displ), &d_displ);

        int* d_nrb_index = cnrn_target_copyin(nrb->_nrb_index, nrb->_size);
        cnrn_target_memcpy_to_device(&(d_nrb->_nrb_index), &d_nrb_index);
    }

    /* copy NetSendBuffer_t on to GPU */
    NetSendBuffer_t* nsb = ml->_net_send_buffer;

    if (nsb) {
        NetSendBuffer_t* d_nsb;
        int* d_iptr;
        double* d_dptr;

        d_nsb = cnrn_target_copyin(nsb);
        cnrn_target_memcpy_to_device(&(d_ml->_net_send_buffer), &d_nsb);

        d_iptr = cnrn_target_copyin(nsb->_sendtype, nsb->_size);
        cnrn_target_memcpy_to_device(&(d_nsb->_sendtype), &d_iptr);

        d_iptr = cnrn_target_copyin(nsb->_vdata_index, nsb->_size);
        cnrn_target_memcpy_to_device(&(d_nsb->_vdata_index), &d_iptr);

        d_iptr = cnrn_target_copyin(nsb->_pnt_index, nsb->_size);
        cnrn_target_memcpy_to_device(&(d_nsb->_pnt_index), &d_iptr);

        d_iptr = cnrn_target_copyin(nsb->_weight_index, nsb->_size);
        cnrn_target_memcpy_to_device(&(d_nsb->_weight_index), &d_iptr);

        d_dptr = cnrn_target_copyin(nsb->_nsb_t, nsb->_size);
        cnrn_target_memcpy_to_device(&(d_nsb->_nsb_t), &d_dptr);

        d_dptr = cnrn_target_copyin(nsb->_nsb_flag, nsb->_size);
        cnrn_target_memcpy_to_device(&(d_nsb->_nsb_flag), &d_dptr);
    }

    return d_ml;
}
#endif

static void update_ml_on_host(const Memb_list* ml, int type) {
    int is_art = corenrn.get_is_artificial()[type];
    if (is_art) {
        // Artificial mechanisms such as PatternStim and IntervalFire
        // are not copied onto the GPU. They should not, therefore, be
        // updated from the GPU.
        return;
    }

    int n = ml->nodecount;
    int szp = corenrn.get_prop_param_size()[type];
    int szdp = corenrn.get_prop_dparam_size()[type];

    int pcnt = nrn_soa_padded_size(n, SOA_LAYOUT) * szp;

    nrn_pragma_acc(update self(ml->data[:pcnt], ml->nodeindices[:n]))
    nrn_pragma_omp(target update from(ml->data[:pcnt], ml->nodeindices[:n]))

    int dpcnt = nrn_soa_padded_size(n, SOA_LAYOUT) * szdp;
    nrn_pragma_acc(update self(ml->pdata[:dpcnt]) if (szdp))
    nrn_pragma_omp(target update from(ml->pdata[:dpcnt]) if (szdp))

    auto nrb = ml->_net_receive_buffer;

    // clang-format off
    nrn_pragma_acc(update self(nrb->_cnt,
                               nrb->_size,
                               nrb->_pnt_offset,
                               nrb->_displ_cnt,
                               nrb->_pnt_index[:nrb->_size],
                               nrb->_weight_index[:nrb->_size],
                               nrb->_displ[:nrb->_size + 1],
                               nrb->_nrb_index[:nrb->_size])
                          if (nrb != nullptr))
    nrn_pragma_omp(target update from(nrb->_cnt,
                                      nrb->_size,
                                      nrb->_pnt_offset,
                                      nrb->_displ_cnt,
                                      nrb->_pnt_index[:nrb->_size],
                                      nrb->_weight_index[:nrb->_size],
                                      nrb->_displ[:nrb->_size + 1],
                                      nrb->_nrb_index[:nrb->_size])
                                 if (nrb != nullptr))
    // clang-format on
}

static void delete_ml_from_device(Memb_list* ml, int type) {
    int is_art = corenrn.get_is_artificial()[type];
    if (is_art) {
        return;
    }
    // Cleanup the net send buffer if it exists
    {
        NetSendBuffer_t* nsb{ml->_net_send_buffer};
        if (nsb) {
            cnrn_t
Download .txt
gitextract_m67oskuu/

├── .bbp-project.yaml
├── .clang-format.changes
├── .cmake-format.changes.yaml
├── .github/
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug_report.md
│   │   ├── config.yml
│   │   └── feature_request.md
│   ├── problem-matchers/
│   │   ├── address.json
│   │   ├── gcc.json
│   │   └── undefined.json
│   ├── pull_request_template.md
│   └── workflows/
│       ├── clang_cmake_format_check.yaml
│       ├── coreneuron-ci.yml
│       ├── coverage.yml
│       └── test-as-submodule.yml
├── .gitignore
├── .gitlab-ci.yml
├── .gitmodules
├── .readthedocs.yml
├── .sanitizers/
│   └── undefined.supp
├── AUTHORS.txt
├── CMake/
│   ├── AddHpcCodingConvSubmodule.cmake
│   ├── AddMod2cSubmodule.cmake
│   ├── AddNmodlSubmodule.cmake
│   ├── AddRandom123Submodule.cmake
│   ├── CrayPortability.cmake
│   ├── GitRevision.cmake
│   ├── MakefileBuildOptions.cmake
│   ├── OpenAccHelper.cmake
│   ├── TestScriptUtils.cmake
│   ├── config/
│   │   ├── CompilerFlagsHelpers.cmake
│   │   ├── ReleaseDebugAutoFlags.cmake
│   │   ├── SetRpath.cmake
│   │   └── TestHelpers.cmake
│   ├── coreneuron-config.cmake.in
│   └── packages/
│       ├── FindSphinx.cmake
│       ├── Findlikwid.cmake
│       ├── Findnmodl.cmake
│       └── Findreportinglib.cmake
├── CMakeLists.txt
├── LICENSE.txt
├── README.md
├── coreneuron/
│   ├── CMakeLists.txt
│   ├── apps/
│   │   ├── coreneuron.cpp
│   │   ├── corenrn_parameters.cpp
│   │   ├── corenrn_parameters.hpp
│   │   └── main1.cpp
│   ├── config/
│   │   ├── config.cpp.in
│   │   ├── config.h
│   │   ├── neuron_version.hpp.in
│   │   └── version_macros.hpp
│   ├── coreneuron.hpp
│   ├── engine.h.in
│   ├── gpu/
│   │   ├── nrn_acc_manager.cpp
│   │   └── nrn_acc_manager.hpp
│   ├── io/
│   │   ├── core2nrn_data_return.cpp
│   │   ├── core2nrn_data_return.hpp
│   │   ├── file_utils.cpp
│   │   ├── file_utils.hpp
│   │   ├── global_vars.cpp
│   │   ├── lfp.cpp
│   │   ├── lfp.hpp
│   │   ├── mech_report.cpp
│   │   ├── mech_report.h
│   │   ├── mem_layout_util.cpp
│   │   ├── mem_layout_util.hpp
│   │   ├── mk_mech.cpp
│   │   ├── nrn2core_data_init.cpp
│   │   ├── nrn2core_direct.h
│   │   ├── nrn_checkpoint.cpp
│   │   ├── nrn_checkpoint.hpp
│   │   ├── nrn_filehandler.cpp
│   │   ├── nrn_filehandler.hpp
│   │   ├── nrn_setup.cpp
│   │   ├── nrn_setup.hpp
│   │   ├── nrnsection_mapping.hpp
│   │   ├── output_spikes.cpp
│   │   ├── output_spikes.hpp
│   │   ├── phase1.cpp
│   │   ├── phase1.hpp
│   │   ├── phase2.cpp
│   │   ├── phase2.hpp
│   │   ├── prcellstate.cpp
│   │   ├── prcellstate.hpp
│   │   ├── reports/
│   │   │   ├── binary_report_handler.cpp
│   │   │   ├── binary_report_handler.hpp
│   │   │   ├── nrnreport.cpp
│   │   │   ├── nrnreport.hpp
│   │   │   ├── report_configuration_parser.cpp
│   │   │   ├── report_event.cpp
│   │   │   ├── report_event.hpp
│   │   │   ├── report_handler.cpp
│   │   │   ├── report_handler.hpp
│   │   │   ├── sonata_report_handler.cpp
│   │   │   └── sonata_report_handler.hpp
│   │   ├── setup_fornetcon.cpp
│   │   ├── setup_fornetcon.hpp
│   │   └── user_params.hpp
│   ├── mechanism/
│   │   ├── capac.cpp
│   │   ├── eion.cpp
│   │   ├── eion.hpp
│   │   ├── mech/
│   │   │   ├── cfile/
│   │   │   │   └── cabvars.h
│   │   │   ├── enginemech.cpp
│   │   │   ├── mod2c_core_thread.hpp
│   │   │   ├── mod_func.c.pl
│   │   │   └── modfile/
│   │   │       ├── exp2syn.mod
│   │   │       ├── expsyn.mod
│   │   │       ├── hh.mod
│   │   │       ├── netstim.mod
│   │   │       ├── passive.mod
│   │   │       ├── pattern.mod
│   │   │       ├── stim.mod
│   │   │       └── svclmp.mod
│   │   ├── mech_mapping.cpp
│   │   ├── mech_mapping.hpp
│   │   ├── mechanism.hpp
│   │   ├── membfunc.hpp
│   │   ├── patternstim.cpp
│   │   ├── register_mech.cpp
│   │   └── register_mech.hpp
│   ├── membrane_definitions.h
│   ├── mpi/
│   │   ├── core/
│   │   │   ├── nrnmpi.hpp
│   │   │   ├── nrnmpi_def_cinc.cpp
│   │   │   ├── nrnmpidec.cpp
│   │   │   └── resolve.cpp
│   │   ├── lib/
│   │   │   ├── mpispike.cpp
│   │   │   ├── nrnmpi.cpp
│   │   │   └── nrnmpi.hpp
│   │   ├── nrnmpi.h
│   │   ├── nrnmpidec.h
│   │   └── nrnmpiuse.h
│   ├── network/
│   │   ├── cvodestb.cpp
│   │   ├── have2want.h
│   │   ├── multisend.cpp
│   │   ├── multisend.hpp
│   │   ├── multisend_setup.cpp
│   │   ├── netcon.hpp
│   │   ├── netcvode.cpp
│   │   ├── netcvode.hpp
│   │   ├── netpar.cpp
│   │   ├── netpar.hpp
│   │   ├── partrans.cpp
│   │   ├── partrans.hpp
│   │   ├── partrans_setup.cpp
│   │   ├── tnode.hpp
│   │   ├── tqueue.cpp
│   │   ├── tqueue.hpp
│   │   └── tqueue.ipp
│   ├── nrnconf.h
│   ├── nrniv/
│   │   └── nrniv_decl.h
│   ├── nrnoc/
│   │   ├── md1redef.h
│   │   └── md2redef.h
│   ├── permute/
│   │   ├── balance.cpp
│   │   ├── cellorder.cpp
│   │   ├── cellorder.cu
│   │   ├── cellorder.hpp
│   │   ├── cellorder1.cpp
│   │   ├── cellorder2.cpp
│   │   ├── data_layout.cpp
│   │   ├── data_layout.hpp
│   │   ├── node_permute.cpp
│   │   └── node_permute.h
│   ├── sim/
│   │   ├── fadvance_core.cpp
│   │   ├── fast_imem.cpp
│   │   ├── fast_imem.hpp
│   │   ├── finitialize.cpp
│   │   ├── multicore.cpp
│   │   ├── multicore.hpp
│   │   ├── scopmath/
│   │   │   ├── abort.cpp
│   │   │   ├── crout_thread.hpp
│   │   │   ├── errcodes.h
│   │   │   ├── newton_struct.h
│   │   │   ├── newton_thread.cpp
│   │   │   ├── newton_thread.hpp
│   │   │   ├── sparse_thread.hpp
│   │   │   └── ssimplic_thread.hpp
│   │   ├── solve_core.cpp
│   │   └── treeset_core.cpp
│   └── utils/
│       ├── ivocvect.cpp
│       ├── ivocvect.hpp
│       ├── lpt.cpp
│       ├── lpt.hpp
│       ├── memory.cpp
│       ├── memory.h
│       ├── memory_utils.cpp
│       ├── memory_utils.h
│       ├── nrn_assert.h
│       ├── nrn_stats.cpp
│       ├── nrn_stats.h
│       ├── nrnmutdec.hpp
│       ├── nrnoc_aux.cpp
│       ├── nrnoc_aux.hpp
│       ├── nrntimeout.cpp
│       ├── offload.hpp
│       ├── profile/
│       │   └── profiler_interface.h
│       ├── progressbar/
│       │   ├── progressbar.cpp
│       │   └── progressbar.hpp
│       ├── randoms/
│       │   ├── nrnran123.cpp
│       │   └── nrnran123.h
│       ├── string_utils.cpp
│       ├── string_utils.h
│       ├── units.hpp
│       ├── utils.cpp
│       ├── utils.hpp
│       ├── utils_cuda.h
│       ├── vrecitem.h
│       └── vrecord.cpp
├── docs/
│   ├── Doxyfile.in
│   ├── DoxygenLayout.xml
│   ├── README.md
│   ├── _static/
│   │   └── custom.css
│   ├── conda_environment.yml
│   ├── conf.py
│   ├── docs_requirements.txt
│   ├── doxygen.rst
│   ├── footer.html
│   ├── index.rst
│   └── userdoc/
│       ├── BinaryFormat/
│       │   └── BinaryFormat.md
│       └── MemoryManagement/
│           └── bbcorepointer.md
├── extra/
│   ├── CMakeLists.txt
│   ├── instrumentation.tau
│   ├── nrnivmodl-core.in
│   └── nrnivmodl_core_makefile.in
└── tests/
    ├── CMakeLists.txt
    ├── integration/
    │   ├── CMakeLists.txt
    │   ├── README.md
    │   ├── integration_test.sh.in
    │   ├── reportinglib/
    │   │   ├── 1.check.in
    │   │   ├── 1.conf.in
    │   │   ├── 1.report
    │   │   ├── reporting_test.sh.in
    │   │   └── test_ref.out
    │   ├── ring/
    │   │   └── out.dat.ref
    │   └── ring_gap/
    │       ├── mod files/
    │       │   └── halfgap.mod
    │       └── out.dat.ref
    └── unit/
        ├── alignment/
        │   ├── CMakeLists.txt
        │   └── alignment.cpp
        ├── cmdline_interface/
        │   ├── CMakeLists.txt
        │   └── test_cmdline_interface.cpp
        ├── interleave_info/
        │   ├── CMakeLists.txt
        │   └── check_constructors.cpp
        ├── lfp/
        │   ├── CMakeLists.txt
        │   └── lfp.cpp
        ├── queueing/
        │   ├── CMakeLists.txt
        │   └── test_queueing.cpp
        └── solver/
            ├── CMakeLists.txt
            └── test_solver.cpp
Download .txt
SYMBOL INDEX (928 symbols across 146 files)

FILE: coreneuron/apps/coreneuron.cpp
  function main (line 12) | int main(int argc, char** argv) {

FILE: coreneuron/apps/corenrn_parameters.cpp
  type coreneuron (line 12) | namespace coreneuron {

FILE: coreneuron/apps/corenrn_parameters.hpp
  type CLI (line 31) | namespace CLI {
    type App (line 32) | struct App
  type coreneuron (line 35) | namespace coreneuron {
    type corenrn_parameters_data (line 37) | struct corenrn_parameters_data {
      type verbose_level (line 38) | enum verbose_level : std::uint32_t {
    type corenrn_parameters (line 96) | struct corenrn_parameters: corenrn_parameters_data {
      method is_quiet (line 109) | inline bool is_quiet() {

FILE: coreneuron/apps/main1.cpp
  function corenrn_units_use_legacy (line 55) | bool corenrn_units_use_legacy() {
  function set_openmp_threads (line 69) | void set_openmp_threads(int nthread) {
  type coreneuron (line 125) | namespace coreneuron {
    function get_nrn_trajectory_requests (line 130) | void get_nrn_trajectory_requests(int bsize) {
    function nrn_init_and_load_data (line 168) | void nrn_init_and_load_data(int argc,
    function call_prcellstate_for_prcellgid (line 358) | void call_prcellstate_for_prcellgid(int prcellgid, int compute_gpu, in...
    function handle_forward_skip (line 384) | void handle_forward_skip(double forwardskip, int prcellgid) {
    function cnrn_version (line 408) | std::string cnrn_version() {
    function trajectory_return (line 413) | static void trajectory_return() {
    function create_report_handler (line 425) | std::unique_ptr<ReportHandler> create_report_handler(const ReportConfi...
  function mk_mech_init (line 466) | void mk_mech_init(int argc, char** argv) {
  function run_solve_core (line 520) | int run_solve_core(int argc, char** argv) {

FILE: coreneuron/config/config.h
  function namespace (line 21) | namespace coreneuron {

FILE: coreneuron/coreneuron.hpp
  type coreneuron (line 34) | namespace coreneuron {
    class CoreNeuron (line 56) | class CoreNeuron {

FILE: coreneuron/gpu/nrn_acc_manager.cpp
  type present_table_value (line 49) | struct present_table_value {
  function cxx_demangle (line 61) | std::string cxx_demangle(const char* mangled) {
  function cnrn_target_debug_output_enabled (line 73) | bool cnrn_target_debug_output_enabled() {
  type coreneuron (line 90) | namespace coreneuron {
    function cnrn_target_copyin_debug (line 97) | void cnrn_target_copyin_debug(std::string_view file,
    function cnrn_target_delete_debug (line 111) | void cnrn_target_delete_debug(std::string_view file,
    function cnrn_target_deviceptr_debug (line 124) | void cnrn_target_deviceptr_debug(std::string_view file,
    function cnrn_target_is_present_debug (line 135) | void cnrn_target_is_present_debug(std::string_view file,
    function cnrn_target_memcpy_to_device_debug (line 146) | void cnrn_target_memcpy_to_device_debug(std::string_view file,
    function cnrn_target_deviceptr_impl (line 162) | std::pair<void*, bool> cnrn_target_deviceptr_impl(bool must_be_present...
    function cnrn_target_copyin_update_present_table (line 192) | void cnrn_target_copyin_update_present_table(void const* h_ptr, void* ...
    function cnrn_target_delete_update_present_table (line 212) | void cnrn_target_delete_update_present_table(void const* h_ptr, std::s...
    function cnrn_target_get_num_devices (line 227) | int cnrn_target_get_num_devices() {
    function cnrn_target_set_default_device (line 243) | void cnrn_target_set_default_device(int device_num) {
    function Memb_list (line 264) | static Memb_list* copy_ml_to_device(const Memb_list* ml, int type) {
    function update_ml_on_host (line 365) | static void update_ml_on_host(const Memb_list* ml, int type) {
    function delete_ml_from_device (line 411) | static void delete_ml_from_device(Memb_list* ml, int type) {
    function setup_nrnthreads_on_device (line 466) | void setup_nrnthreads_on_device(NrnThread* threads, int nthreads) {
    function copy_ivoc_vect_to_device (line 784) | void copy_ivoc_vect_to_device(const IvocVect& from, IvocVect& to) {
    function delete_ivoc_vect_from_device (line 800) | void delete_ivoc_vect_from_device(IvocVect& vec) {
    function realloc_net_receive_buffer (line 811) | void realloc_net_receive_buffer(NrnThread* nt, Memb_list* ml) {
    type comp (line 879) | struct comp {
    function net_receive_buffer_order (line 888) | static void net_receive_buffer_order(NetReceiveBuffer_t* nrb) {
    function update_net_receive_buffer (line 928) | void update_net_receive_buffer(NrnThread* nt) {
    function update_net_send_buffer_on_host (line 974) | void update_net_send_buffer_on_host(NrnThread* nt, NetSendBuffer_t* ns...
    function update_nrnthreads_on_host (line 1012) | void update_nrnthreads_on_host(NrnThread* threads, int nthreads) {
    function update_weights_from_gpu (line 1112) | void update_weights_from_gpu(NrnThread* threads, int nthreads) {
    function delete_nrnthreads_on_device (line 1151) | void delete_nrnthreads_on_device(NrnThread* threads, int nthreads) {
    function nrn_newtonspace_copyto_device (line 1248) | void nrn_newtonspace_copyto_device(NewtonSpace* ns) {
    function nrn_newtonspace_delete_from_device (line 1290) | void nrn_newtonspace_delete_from_device(NewtonSpace* ns) {
    function nrn_sparseobj_copyto_device (line 1309) | void nrn_sparseobj_copyto_device(SparseObj* so) {
    function nrn_sparseobj_delete_from_device (line 1392) | void nrn_sparseobj_delete_from_device(SparseObj* so) {
    function nrn_ion_global_map_copyto_device (line 1417) | void nrn_ion_global_map_copyto_device() {
    function nrn_ion_global_map_delete_from_device (line 1430) | void nrn_ion_global_map_delete_from_device() {
    function init_gpu (line 1441) | void init_gpu() {
    function nrn_VecPlay_copyto_device (line 1479) | void nrn_VecPlay_copyto_device(NrnThread* nt, void** d_vecplay) {
    function nrn_VecPlay_delete_from_device (line 1512) | void nrn_VecPlay_delete_from_device(NrnThread* nt) {

FILE: coreneuron/gpu/nrn_acc_manager.hpp
  type coreneuron (line 10) | namespace coreneuron {
    type Memb_list (line 11) | struct Memb_list
    type NrnThread (line 12) | struct NrnThread
    type NetSendBuffer_t (line 13) | struct NetSendBuffer_t

FILE: coreneuron/io/core2nrn_data_return.cpp
  type coreneuron (line 45) | namespace coreneuron {
    function inverse_permute_copy (line 50) | static void inverse_permute_copy(size_t n, double* permuted_src, doubl...
    function soa2aos_inverse_permute_copy (line 66) | static void soa2aos_inverse_permute_copy(size_t n,
    function soa2aos_unpermuted_copy (line 89) | static void soa2aos_unpermuted_copy(size_t n, int sz, int stride, doub...
    function aos2aos_copy (line 104) | static void aos2aos_copy(size_t n, int sz, double* src, double** dest) {
    function core2nrn_corepointer (line 114) | static void core2nrn_corepointer(int tid, NrnThreadMembList* tml) {
    function core2nrn_data_return (line 217) | void core2nrn_data_return() {
    function core2nrn_watch (line 287) | static void core2nrn_watch() {
    function core2nrn_vecplay (line 329) | void core2nrn_vecplay() {
    function core2nrn_PreSyn_flag (line 381) | static void core2nrn_PreSyn_flag(NrnThread& nt) {
    function nrn2core_PreSyn_flag_receive (line 399) | void nrn2core_PreSyn_flag_receive(int tid) {
    function clear_inv_perm_for_selfevent_targets (line 432) | static void clear_inv_perm_for_selfevent_targets() {
    function core2nrn_tqueue_item (line 443) | static bool core2nrn_tqueue_item(TQItem* q, SelfEventWeightMap& sewm, ...
    function core2nrn_tqueue (line 522) | void core2nrn_tqueue(NrnThread& nt) {

FILE: coreneuron/io/core2nrn_data_return.hpp
  type coreneuron (line 11) | namespace coreneuron {

FILE: coreneuron/io/file_utils.cpp
  function mkdir_p (line 20) | int mkdir_p(const char* path) {

FILE: coreneuron/io/global_vars.cpp
  type coreneuron (line 25) | namespace coreneuron {
    function hoc_register_var (line 31) | void hoc_register_var(DoubScal* ds, DoubVec* dv, VoidFunc*) {
    function set_globals (line 43) | void set_globals(const char* path, bool cli_global_seed, int cli_globa...

FILE: coreneuron/io/lfp.cpp
  type coreneuron (line 9) | namespace coreneuron {
    type lfputils (line 10) | namespace lfputils {
      function line_source_lfp_factor (line 12) | double line_source_lfp_factor(const Point3D& e_pos,

FILE: coreneuron/io/lfp.hpp
  type coreneuron (line 10) | namespace coreneuron {
    type lfputils (line 12) | namespace lfputils {
      function dot (line 18) | inline double dot(const Point3D& p1, const Point3D& p2) {
      function norm (line 22) | inline double norm(const Point3D& p1) {
      function Point3D (line 26) | inline Point3D barycenter(const Point3D& p1, const Point3D& p2) {
      function Point3D (line 30) | inline Point3D paxpy(const Point3D& p1, const double alpha, const Po...
      function point_source_lfp_factor (line 42) | inline double point_source_lfp_factor(const Point3D& e_pos,
    type LFPCalculatorType (line 66) | enum LFPCalculatorType { LineSource, PointSource }
    type LFPCalculator (line 72) | struct LFPCalculator {

FILE: coreneuron/io/mech_report.cpp
  type coreneuron (line 17) | namespace coreneuron {
    function write_mech_report (line 19) | void write_mech_report() {

FILE: coreneuron/io/mech_report.h
  function namespace (line 13) | namespace coreneuron {

FILE: coreneuron/io/mem_layout_util.cpp
  type coreneuron (line 11) | namespace coreneuron {
    function nrn_soa_padded_size (line 15) | int nrn_soa_padded_size(int cnt, int layout) {
    function nrn_soa_byte_align (line 20) | size_t nrn_soa_byte_align(size_t size) {
    function nrn_i_layout (line 32) | int nrn_i_layout(int icnt, int cnt, int isz, int sz, int layout) {
    function nrn_param_layout (line 52) | int nrn_param_layout(int i, int mtype, Memb_list* ml) {

FILE: coreneuron/io/mem_layout_util.hpp
  type coreneuron (line 14) | namespace coreneuron {

FILE: coreneuron/io/mk_mech.cpp
  type coreneuron (line 28) | namespace coreneuron {
    function mk_mech (line 43) | void mk_mech(const char* datpath) {
    function mk_mech (line 68) | static void mk_mech() {
    function mk_mech (line 80) | static void mk_mech(std::istream& s) {
    function nrn_get_mechtype (line 138) | int nrn_get_mechtype(const char* name) {

FILE: coreneuron/io/nrn2core_data_init.cpp
  type coreneuron (line 22) | namespace coreneuron {
    function direct_mode_initialize (line 50) | void direct_mode_initialize() {
    function vec_play_activate (line 98) | void vec_play_activate() {
    function setup_type2semantics (line 136) | static void setup_type2semantics() {
    function nrn2core_tqueue (line 154) | static void nrn2core_tqueue() {
    function watch_datum_indices (line 301) | void watch_datum_indices(int type, int& first, int& last) {
    function watch_activate_clear (line 318) | void watch_activate_clear() {
    function nrn2core_transfer_watch_condition (line 356) | void nrn2core_transfer_watch_condition(int tid,
    function nrn2core_patstim_share_info (line 419) | void nrn2core_patstim_share_info() {
  type NrnCoreTransferEvents (line 120) | struct NrnCoreTransferEvents {
  type coreneuron (line 127) | namespace coreneuron {
    function direct_mode_initialize (line 50) | void direct_mode_initialize() {
    function vec_play_activate (line 98) | void vec_play_activate() {
    function setup_type2semantics (line 136) | static void setup_type2semantics() {
    function nrn2core_tqueue (line 154) | static void nrn2core_tqueue() {
    function watch_datum_indices (line 301) | void watch_datum_indices(int type, int& first, int& last) {
    function watch_activate_clear (line 318) | void watch_activate_clear() {
    function nrn2core_transfer_watch_condition (line 356) | void nrn2core_transfer_watch_condition(int tid,
    function nrn2core_patstim_share_info (line 419) | void nrn2core_patstim_share_info() {

FILE: coreneuron/io/nrn_checkpoint.cpp
  type coreneuron (line 29) | namespace coreneuron {
    function nrn_original_aos_index (line 93) | static int nrn_original_aos_index(int etype, int ix, NrnThread& nt, in...
    function T (line 619) | T* CheckPoints::soa2aos(T* data, int cnt, int sz, int layout, int* per...

FILE: coreneuron/io/nrn_checkpoint.hpp
  type coreneuron (line 13) | namespace coreneuron {
    type NrnThread (line 14) | struct NrnThread
    class FileHandler (line 15) | class FileHandler
    class CheckPoints (line 17) | class CheckPoints {
      method get_save_path (line 20) | std::string get_save_path() const {
      method get_restore_path (line 23) | std::string get_restore_path() const {
      method should_save (line 26) | bool should_save() const {
      method should_restore (line 29) | bool should_restore() const {
    type Memb_list_chkpnt (line 78) | struct Memb_list_chkpnt {
    type NrnThreadChkpnt (line 87) | struct NrnThreadChkpnt {

FILE: coreneuron/io/nrn_filehandler.cpp
  type coreneuron (line 13) | namespace coreneuron {
    type stat (line 21) | struct stat

FILE: coreneuron/io/nrn_filehandler.hpp
  type coreneuron (line 18) | namespace coreneuron {
    class FileHandler (line 32) | class FileHandler {
      method FileHandler (line 46) | FileHandler(const FileHandler&) = delete;
      method FileHandler (line 47) | FileHandler& operator=(const FileHandler&) = delete;
      method FileHandler (line 50) | FileHandler()
      method fail (line 60) | bool fail() const {
      method checkpoint (line 70) | int checkpoint() const {
      method checkpoint (line 75) | void checkpoint(int c) {
      method record_checkpoint (line 80) | void record_checkpoint() {
      method restore_checkpoint (line 85) | void restore_checkpoint() {
      method read_mapping_info (line 113) | int read_mapping_info(T* mapinfo) {
      type parse_action (line 140) | enum parse_action { read, seek }
      method T (line 159) | inline T* parse_array(T* p, size_t count, parse_action flag) {
      method T (line 181) | inline T* read_array(T* p, size_t count) {
      method T (line 187) | inline T* read_array(size_t count) {
      method read_vector (line 192) | inline std::vector<T> read_vector(size_t count) {
      method write_array (line 203) | void write_array(T* p, size_t nb_elements) {
      method write_array (line 214) | void write_array(T* p,
      method FileHandler (line 241) | FileHandler& operator<<(const T& scalar) {
      method write_checkpoint (line 252) | void write_checkpoint() {

FILE: coreneuron/io/nrn_setup.cpp
  type coreneuron (line 151) | namespace coreneuron {
    function nrn_read_filesdat (line 171) | void nrn_read_filesdat(int& ngrp, int*& grp, const char* filesdat) {
    function netpar_tid_gid2ps (line 225) | void netpar_tid_gid2ps(int tid, int gid, PreSyn** ps, InputPreSyn** ps...
    function determine_inputpresyn (line 248) | void determine_inputpresyn() {
    function nrn_setup_cleanup (line 391) | void nrn_setup_cleanup() {
    function nrn_setup (line 401) | void nrn_setup(const char* filesdat,
    function setup_ThreadData (line 570) | void setup_ThreadData(NrnThread& nt) {
    function read_phasegap (line 588) | void read_phasegap(NrnThread& nt, UserParams& userParams) {
    function nrn_inverse_i_layout (line 669) | void nrn_inverse_i_layout(int i, int& icnt, int cnt, int& isz, int sz,...
    function nrn_cleanup_ion_map (line 696) | void nrn_cleanup_ion_map() {
    function delete_fornetcon_info (line 705) | void delete_fornetcon_info(NrnThread& nt) {
    function nrn_cleanup (line 714) | void nrn_cleanup() {
    function delete_trajectory_requests (line 899) | void delete_trajectory_requests(NrnThread& nt) {
    function read_phase1 (line 917) | void read_phase1(NrnThread& nt, UserParams& userParams) {
    function read_phase2 (line 924) | void read_phase2(NrnThread& nt, UserParams& userParams) {
    function read_phase3 (line 935) | void read_phase3(NrnThread& nt, UserParams& userParams) {
    function memb_list_size (line 989) | size_t memb_list_size(NrnThreadMembList* tml, bool include_data) {
    function output_presyn_size (line 1023) | size_t output_presyn_size(void) {
    function input_presyn_size (line 1035) | size_t input_presyn_size(void) {
    function model_size (line 1047) | size_t model_size(bool detailed_report) {

FILE: coreneuron/io/nrn_setup.hpp
  type coreneuron (line 19) | namespace coreneuron {
    type coreneuron (line 49) | namespace coreneuron {
      type phase (line 53) | enum phase { one = 1, two, three, gap }
      function phase_wrapper (line 147) | inline static void phase_wrapper(UserParams& userParams, int direct ...

FILE: coreneuron/io/nrnsection_mapping.hpp
  type coreneuron (line 18) | namespace coreneuron {
    type SecMapping (line 33) | struct SecMapping {
      method SecMapping (line 40) | SecMapping() = default;
      method SecMapping (line 42) | explicit SecMapping(std::string s)
      method num_sections (line 46) | size_t num_sections() const noexcept {
      method num_segments (line 51) | size_t num_segments() const {
      method add_segment (line 58) | void add_segment(int sec, int seg) {
    type CellMapping (line 69) | struct CellMapping {
      method CellMapping (line 76) | CellMapping(int g)
      method num_sections (line 80) | int num_sections() const {
      method num_segments (line 90) | int num_segments() const {
      method size (line 100) | size_t size() const noexcept {
      method add_sec_map (line 105) | void add_sec_map(SecMapping* s) {
      method SecMapping (line 110) | SecMapping* get_seclist_mapping(const std::string& name) const {
      method get_seclist_segment_count (line 122) | size_t get_seclist_segment_count(const std::string& name) const {
      method get_seclist_section_count (line 131) | size_t get_seclist_section_count(const std::string& name) const {
    type NrnThreadMappingInfo (line 152) | struct NrnThreadMappingInfo {
      method size (line 157) | size_t size() const {
      method CellMapping (line 171) | CellMapping* get_cell_mapping(int gid) const {
      method add_cell_mapping (line 181) | void add_cell_mapping(CellMapping* c) {

FILE: coreneuron/io/output_spikes.cpp
  function all_spikes_return (line 38) | static bool all_spikes_return(std::vector<double>& spiketvec, std::vecto...
  type coreneuron (line 43) | namespace coreneuron {
    function mk_spikevec_buffer (line 50) | void mk_spikevec_buffer(int sz) {
    function spikevec_lock (line 59) | void spikevec_lock() {
    function spikevec_unlock (line 63) | void spikevec_unlock() {
    function local_spikevec_sort (line 67) | static void local_spikevec_sort(std::vector<double>& isvect,
    function sort_spikes (line 95) | static void sort_spikes(std::vector<double>& spikevec_time, std::vecto...
    function output_spike_populations (line 157) | void output_spike_populations(const SpikesInfo& spikes_info) {
    function output_spikes_parallel (line 200) | static void output_spikes_parallel(const char* outpath, const SpikesIn...
    function output_spikes_serial (line 253) | static void output_spikes_serial(const char* outpath) {
    function output_spikes (line 279) | void output_spikes(const char* outpath, const SpikesInfo& spikes_info) {
    function clear_spike_vectors (line 296) | void clear_spike_vectors() {
    function validation (line 305) | void validation(std::vector<std::pair<double, int>>& res) {

FILE: coreneuron/io/output_spikes.hpp
  type coreneuron (line 15) | namespace coreneuron {

FILE: coreneuron/io/phase1.cpp
  type coreneuron (line 24) | namespace coreneuron {

FILE: coreneuron/io/phase1.hpp
  type coreneuron (line 16) | namespace coreneuron {
    type NrnThread (line 18) | struct NrnThread
    class Phase1 (line 20) | class Phase1 {

FILE: coreneuron/io/phase2.cpp
  type coreneuron (line 87) | namespace coreneuron {
    function mech_data_layout_transform (line 89) | inline void mech_data_layout_transform(T* data, int cnt, int sz, int l...

FILE: coreneuron/io/phase2.hpp
  type coreneuron (line 17) | namespace coreneuron {
    type NrnThread (line 18) | struct NrnThread
    type NrnThreadMembList (line 19) | struct NrnThreadMembList
    type Memb_func (line 20) | struct Memb_func
    type Memb_list (line 21) | struct Memb_list
    type NrnThreadChkpnt (line 22) | struct NrnThreadChkpnt
    class Phase2 (line 24) | class Phase2 {
      type EventTypeBase (line 33) | struct EventTypeBase {
      type NetConType_ (line 36) | struct NetConType_: public EventTypeBase {
      type SelfEventType_ (line 39) | struct SelfEventType_: public EventTypeBase {
      type PreSynType_ (line 47) | struct PreSynType_: public EventTypeBase {
      type NetParEvent_ (line 50) | struct NetParEvent_: public EventTypeBase {}
      type PlayRecordEventType_ (line 51) | struct PlayRecordEventType_: public EventTypeBase {
      type VecPlayContinuous_ (line 56) | struct VecPlayContinuous_ {
      type TML (line 111) | struct TML {

FILE: coreneuron/io/prcellstate.cpp
  type coreneuron (line 22) | namespace coreneuron {
    function permute (line 28) | static int permute(int i, NrnThread& nt) {
    function inv_permute (line 32) | static int inv_permute(int i, NrnThread& nt) {
    function ml_permute (line 46) | static int ml_permute(int i, Memb_list* ml) {
    function pr_memb (line 52) | static void pr_memb(int type, Memb_list* ml, int* cellnodes, NrnThread...
    function pr_netcon (line 86) | static void pr_netcon(NrnThread& nt, FILE* f) {
    function pr_realcell (line 199) | static void pr_realcell(PreSyn& ps, NrnThread& nt, FILE* f) {
    function prcellstate (line 271) | int prcellstate(int gid, const char* suffix) {

FILE: coreneuron/io/prcellstate.hpp
  type coreneuron (line 11) | namespace coreneuron {

FILE: coreneuron/io/reports/binary_report_handler.cpp
  type coreneuron (line 14) | namespace coreneuron {
    function create_soma_extra (line 27) | static void create_soma_extra(const CellMapping& mapping, std::array<i...
    function create_compartment_extra (line 33) | static void create_compartment_extra(const CellMapping& mapping, std::...
    function create_custom_extra (line 41) | static void create_custom_extra(const CellMapping& mapping, std::array...

FILE: coreneuron/io/reports/binary_report_handler.hpp
  type coreneuron (line 19) | namespace coreneuron {
    class BinaryReportHandler (line 21) | class BinaryReportHandler: public ReportHandler {

FILE: coreneuron/io/reports/nrnreport.cpp
  type coreneuron (line 31) | namespace coreneuron {
    function nrn_flush_reports (line 36) | void nrn_flush_reports(double t) {
    function setup_report_engine (line 53) | void setup_report_engine(double dt_report, double mindelay) {
    function set_report_buffer_size (line 69) | void set_report_buffer_size(int n) {
    function finalize_report (line 79) | void finalize_report() {

FILE: coreneuron/io/reports/nrnreport.hpp
  type coreneuron (line 26) | namespace coreneuron {
    type SummationReport (line 28) | struct SummationReport {
    type SummationReportMapping (line 37) | struct SummationReportMapping {
    type SpikesInfo (line 42) | struct SpikesInfo {
    type TargetType (line 59) | enum class TargetType {
    type ReportType (line 73) | enum ReportType {
    type SectionType (line 83) | enum SectionType { Cell, Soma, Axon, Dendrite, Apical, All }
    type ReportConfiguration (line 85) | struct ReportConfiguration {

FILE: coreneuron/io/reports/report_configuration_parser.cpp
  type coreneuron (line 26) | namespace coreneuron {
    function parse_filter_string (line 32) | void parse_filter_string(const std::string& filter, ReportConfiguratio...
    function register_target_type (line 57) | void register_target_type(ReportConfiguration& report, ReportType repo...
    function create_report_configurations (line 106) | std::vector<ReportConfiguration> create_report_configurations(const st...

FILE: coreneuron/io/reports/report_event.cpp
  type coreneuron (line 20) | namespace coreneuron {

FILE: coreneuron/io/reports/report_event.hpp
  type coreneuron (line 19) | namespace coreneuron {
    type VarWithMapping (line 22) | struct VarWithMapping {
      method VarWithMapping (line 25) | VarWithMapping(int id_, double* v_)
    class ReportEvent (line 33) | class ReportEvent: public DiscreteEvent {

FILE: coreneuron/io/reports/report_handler.cpp
  type coreneuron (line 14) | namespace coreneuron {
    function intersection_gids (line 17) | std::vector<T> intersection_gids(const NrnThread& nt, std::vector<T>& ...
    function getSectionTypeStr (line 121) | std::string getSectionTypeStr(SectionType type) {
    function register_sections_to_report (line 140) | void register_sections_to_report(const SecMapping* sections,
    function VarsToReport (line 166) | VarsToReport ReportHandler::get_section_vars_to_report(const NrnThread...
    function VarsToReport (line 208) | VarsToReport ReportHandler::get_summation_vars_to_report(
    function VarsToReport (line 299) | VarsToReport ReportHandler::get_synapse_vars_to_report(

FILE: coreneuron/io/reports/report_handler.hpp
  type coreneuron (line 18) | namespace coreneuron {
    class ReportHandler (line 20) | class ReportHandler {

FILE: coreneuron/io/reports/sonata_report_handler.cpp
  type coreneuron (line 18) | namespace coreneuron {

FILE: coreneuron/io/reports/sonata_report_handler.hpp
  type coreneuron (line 16) | namespace coreneuron {
    class SonataReportHandler (line 18) | class SonataReportHandler: public ReportHandler {
      method SonataReportHandler (line 20) | SonataReportHandler(const SpikesInfo& spikes_info)

FILE: coreneuron/io/setup_fornetcon.cpp
  type coreneuron (line 16) | namespace coreneuron {
    function setup_fornetcon_info (line 77) | void setup_fornetcon_info(NrnThread& nt) {

FILE: coreneuron/io/setup_fornetcon.hpp
  type coreneuron (line 13) | namespace coreneuron {

FILE: coreneuron/io/user_params.hpp
  type coreneuron (line 11) | namespace coreneuron {
    class CheckPoints (line 13) | class CheckPoints
    type UserParams (line 18) | struct UserParams {
      method UserParams (line 19) | UserParams(int ngroup_,

FILE: coreneuron/mechanism/capac.cpp
  type coreneuron (line 20) | namespace coreneuron {
    function capacitance_reg (line 31) | void capacitance_reg(void) {
    function nrn_jacob_capacitance (line 58) | void nrn_jacob_capacitance(NrnThread* _nt, Memb_list* ml, int /* type ...
    function nrn_init_capacitance (line 83) | void nrn_init_capacitance(NrnThread* _nt, Memb_list* ml, int /* type *...
    function nrn_cur_capacitance (line 101) | void nrn_cur_capacitance(NrnThread* _nt, Memb_list* ml, int /* type */) {
    function nrn_alloc_capacitance (line 130) | void nrn_alloc_capacitance(double* data, Datum* pdata, int type) {
    function nrn_div_capacity (line 136) | void nrn_div_capacity(NrnThread* _nt, Memb_list* ml, int type) {
    function nrn_mul_capacity (line 157) | void nrn_mul_capacity(NrnThread* _nt, Memb_list* ml, int type) {

FILE: coreneuron/mechanism/eion.cpp
  type coreneuron (line 22) | namespace coreneuron {
    function nrn_is_ion (line 46) | int nrn_is_ion(int type) {
    function nrn_ion_charge (line 59) | double nrn_ion_charge(int type) {
    function ion_reg (line 63) | void ion_reg(const char* name, double valence) {
    function nrn_nernst_coef (line 196) | double nrn_nernst_coef(int type) {
    function nrn_cur_ion (line 202) | void nrn_cur_ion(NrnThread* nt, Memb_list* ml, int type) {
    function nrn_init_ion (line 232) | void nrn_init_ion(NrnThread* nt, Memb_list* ml, int type) {
    function nrn_alloc_ion (line 270) | void nrn_alloc_ion(double* p, Datum* ppvar, int _type) {
    function second_order_cur (line 274) | void second_order_cur(NrnThread* _nt, int secondorder) {

FILE: coreneuron/mechanism/eion.hpp
  type coreneuron (line 13) | namespace coreneuron {

FILE: coreneuron/mechanism/mech/cfile/cabvars.h
  function namespace (line 9) | namespace coreneuron {

FILE: coreneuron/mechanism/mech/enginemech.cpp
  type coreneuron (line 21) | namespace coreneuron {
    function modl_reg (line 31) | void modl_reg() {}
  function solve_core (line 46) | int solve_core(int argc, char** argv) {
  function corenrn_embedded_run (line 79) | int corenrn_embedded_run(int nthread,

FILE: coreneuron/mechanism/mech/mod2c_core_thread.hpp
  type coreneuron (line 15) | namespace coreneuron {
    type Elm (line 28) | struct Elm {
      type Elm (line 32) | struct Elm
      type Elm (line 33) | struct Elm
      type Elm (line 34) | struct Elm
      type Elm (line 35) | struct Elm
    type Item (line 38) | struct Item {
    type SparseObj (line 47) | struct SparseObj {            /* all the state information */
    function euler_thread (line 74) | int euler_thread(int neqn, int* var, int* der, F fun, _threadargsproto...
    function derivimplicit_thread (line 86) | int derivimplicit_thread(int n, int* slist, int* dlist, F fun, _thread...

FILE: coreneuron/mechanism/mech_mapping.cpp
  type coreneuron (line 18) | namespace coreneuron {
    type cmp_str (line 23) | struct cmp_str {
    function set_an_offset (line 35) | static void set_an_offset(int mech_id, const char* variable_name, int ...
    function register_all_variables_offsets (line 58) | void register_all_variables_offsets(int mech_id, SerializedNames varia...

FILE: coreneuron/mechanism/mech_mapping.hpp
  type coreneuron (line 28) | namespace coreneuron {
    type Memb_list (line 29) | struct Memb_list

FILE: coreneuron/mechanism/mechanism.hpp
  type coreneuron (line 16) | namespace coreneuron {
    type ThreadDatum (line 20) | struct ThreadDatum {
    type Point_process (line 35) | struct Point_process {
    type NetReceiveBuffer_t (line 41) | struct NetReceiveBuffer_t {
      method size_of_object (line 53) | size_t size_of_object() {
    type NetSendBuffer_t (line 62) | struct NetSendBuffer_t: MemoryManaged {
      method NetSendBuffer_t (line 73) | NetSendBuffer_t(int size)
      method size_of_object (line 88) | size_t size_of_object() {
      method grow (line 104) | void grow() {
      method grow_buf (line 122) | void grow_buf(T** buf, int size, int new_size) {
    type Memb_list (line 131) | struct Memb_list {

FILE: coreneuron/mechanism/membfunc.hpp
  type coreneuron (line 17) | namespace coreneuron {
    type NrnThread (line 21) | struct NrnThread
    type Memb_func (line 32) | struct Memb_func {
    type BAMech (line 73) | struct BAMech {
      type BAMech (line 76) | struct BAMech
    function ktf (line 126) | constexpr double ktf(double celsius) {
    function nrn_nernst (line 131) | constexpr double nrn_nernst(double ci, double co, double z, double cel...
    function nrn_wrote_conc (line 143) | constexpr void nrn_wrote_conc(int type,
    function nrn_ghk (line 160) | inline double nrn_ghk(double v, double ci, double co, double z, double...
    type DoubScal (line 177) | struct DoubScal {
    type DoubVec (line 181) | struct DoubVec {
    type VoidFunc (line 186) | struct VoidFunc {

FILE: coreneuron/mechanism/patternstim.cpp
  type coreneuron (line 28) | namespace coreneuron {
    function nrn_set_extra_thread0_vdata (line 48) | void nrn_set_extra_thread0_vdata() {
    function nrn_mkPatternStim (line 60) | void nrn_mkPatternStim(const char* fname, double tstop) {
    function read_raster_file (line 100) | size_t read_raster_file(const char* fname, double** tvec, int** gidvec...
    function NrnThreadMembList (line 140) | static NrnThreadMembList* alloc_nrn_thread_memb(NrnThread* nt, int typ...
    function Point_process (line 178) | Point_process* nrn_artcell_instantiate(const char* mechname) {

FILE: coreneuron/mechanism/register_mech.cpp
  type coreneuron (line 20) | namespace coreneuron {
    function hoc_reg_bbcore_read (line 29) | void hoc_reg_bbcore_read(int type, bbcore_read_t f) {
    function hoc_reg_bbcore_write (line 35) | void hoc_reg_bbcore_write(int type, bbcore_write_t f) {
    function add_nrn_has_net_event (line 42) | void add_nrn_has_net_event(int type) {
    function add_nrn_fornetcons (line 54) | void add_nrn_fornetcons(int type, int indx) {
    function add_nrn_artcell (line 65) | void add_nrn_artcell(int type, int qi) {
    function set_pnt_receive (line 74) | void set_pnt_receive(int type,
    function alloc_mech (line 86) | void alloc_mech(int memb_func_size_) {
    function initnrn (line 102) | void initnrn() {
    function register_mech (line 112) | int register_mech(const char** m,
    function nrn_writes_conc (line 163) | void nrn_writes_conc(int type, int /* unused */) {
    function _nrn_layout_reg (line 176) | void _nrn_layout_reg(int type, int layout) {
    function hoc_register_net_receive_buffering (line 180) | void hoc_register_net_receive_buffering(NetBufReceive_t f, int type) {
    function hoc_register_net_send_buffering (line 184) | void hoc_register_net_send_buffering(int type) {
    function hoc_register_watch_check (line 188) | void hoc_register_watch_check(nrn_watch_check_t nwc, int type) {
    function hoc_register_prop_size (line 192) | void hoc_register_prop_size(int type, int psize, int dpsize) {
    function hoc_register_dparam_semantics (line 207) | void hoc_register_dparam_semantics(int type, int ix, const char* name) {
    function ion_write_depend (line 259) | static void ion_write_depend(int type, int etype) {
    function depend_append (line 273) | static int depend_append(int idep, int* dependencies, int deptype, int...
    function nrn_mech_depend (line 294) | int nrn_mech_depend(int type, int* dependencies) {
    function register_constructor (line 317) | void register_constructor(mod_f_t c) {
    function register_destructor (line 321) | void register_destructor(mod_f_t d) {
    function point_reg_helper (line 325) | int point_reg_helper(const Symbol* s2) {
    function point_register_mech (line 339) | int point_register_mech(const char** m,
    function _modl_cleanup (line 367) | void _modl_cleanup() {}
    function state_discontinuity (line 371) | void state_discontinuity(int /* i */, double* pd, double d) {
    function hoc_reg_ba (line 378) | void hoc_reg_ba(int mt, mod_f_t f, int type) {
    function _nrn_thread_reg0 (line 419) | void _nrn_thread_reg0(int i, void (*f)(ThreadDatum*)) {
    function _nrn_thread_reg1 (line 426) | void _nrn_thread_reg1(int i, void (*f)(ThreadDatum*)) {
    function _nrn_thread_table_reg (line 433) | void _nrn_thread_table_reg(int i, thread_table_check_t f) {
    function _nrn_setdata_reg (line 440) | void _nrn_setdata_reg(int i, void (*call)(double*, Datum*)) {

FILE: coreneuron/mechanism/register_mech.hpp
  type coreneuron (line 10) | namespace coreneuron {

FILE: coreneuron/mpi/core/nrnmpi.hpp
  type coreneuron (line 3) | namespace coreneuron {

FILE: coreneuron/mpi/core/nrnmpi_def_cinc.cpp
  type coreneuron (line 9) | namespace coreneuron {

FILE: coreneuron/mpi/core/nrnmpidec.cpp
  type coreneuron (line 11) | namespace coreneuron {

FILE: coreneuron/mpi/core/resolve.cpp
  type coreneuron (line 5) | namespace coreneuron {

FILE: coreneuron/mpi/lib/mpispike.cpp
  type coreneuron (line 22) | namespace coreneuron {
    function nrnmpi_spike_initialize (line 37) | void nrnmpi_spike_initialize() {
    function make_spikebuf_type (line 58) | static void make_spikebuf_type() {
    function wait_before_spike_exchange (line 78) | void wait_before_spike_exchange() {
    function nrnmpi_spike_exchange_impl (line 82) | int nrnmpi_spike_exchange_impl(int* nin,
    function nrnmpi_spike_exchange_compressed_impl (line 177) | int nrnmpi_spike_exchange_compressed_impl(int localgid_size,
    function nrnmpi_int_allmax_impl (line 242) | int nrnmpi_int_allmax_impl(int x) {
    function nrnmpi_int_alltoall_impl (line 248) | extern void nrnmpi_int_alltoall_impl(int* s, int* r, int n) {
    function nrnmpi_int_alltoallv_impl (line 252) | extern void nrnmpi_int_alltoallv_impl(const int* s,
    function nrnmpi_dbl_alltoallv_impl (line 261) | extern void nrnmpi_dbl_alltoallv_impl(double* s,
    function nrnmpi_int_allgather_impl (line 272) | void nrnmpi_int_allgather_impl(int* s, int* r, int n) {
    function nrnmpi_dbl_allmin_impl (line 276) | double nrnmpi_dbl_allmin_impl(double x) {
    function nrnmpi_dbl_allmax_impl (line 282) | double nrnmpi_dbl_allmax_impl(double x) {
    function nrnmpi_barrier_impl (line 288) | void nrnmpi_barrier_impl() {
    function nrnmpi_dbl_allreduce_impl (line 292) | double nrnmpi_dbl_allreduce_impl(double x, int type) {
    function nrnmpi_dbl_allreduce_vec_impl (line 306) | void nrnmpi_dbl_allreduce_vec_impl(double* src, double* dest, int cnt,...
    function nrnmpi_long_allreduce_vec_impl (line 320) | void nrnmpi_long_allreduce_vec_impl(long* src, long* dest, int cnt, in...
    function nrnmpi_multisend_comm_impl (line 338) | void nrnmpi_multisend_comm_impl() {
    function nrnmpi_multisend_impl (line 344) | void nrnmpi_multisend_impl(NRNMPI_Spike* spk, int n, int* hosts) {
    function nrnmpi_multisend_single_advance_impl (line 352) | int nrnmpi_multisend_single_advance_impl(NRNMPI_Spike* spk) {
    function nrnmpi_multisend_conserve_impl (line 362) | int nrnmpi_multisend_conserve_impl(int nsend, int nrecv) {

FILE: coreneuron/mpi/lib/nrnmpi.cpp
  type coreneuron (line 21) | namespace coreneuron {
    function nrn_fatal_error (line 30) | static void nrn_fatal_error(const char* msg) {
    function nrnmpi_init_ret_t (line 37) | nrnmpi_init_ret_t nrnmpi_init_impl(int* pargc, char*** pargv, bool is_...
    function nrnmpi_finalize_impl (line 75) | void nrnmpi_finalize_impl(void) {
    function nrnmpi_check_threading_support_impl (line 86) | void nrnmpi_check_threading_support_impl() {
    function nrnmpi_initialized_impl (line 96) | bool nrnmpi_initialized_impl() {
    function nrnmpi_abort_impl (line 102) | void nrnmpi_abort_impl(int errcode) {
    function nrnmpi_wtime_impl (line 106) | double nrnmpi_wtime_impl() {
    function nrnmpi_local_rank_impl (line 117) | int nrnmpi_local_rank_impl() {
    function nrnmpi_local_size_impl (line 135) | int nrnmpi_local_size_impl() {
    function nrnmpi_write_file_impl (line 160) | void nrnmpi_write_file_impl(const std::string& filename, const char* b...

FILE: coreneuron/mpi/lib/nrnmpi.hpp
  type coreneuron (line 4) | namespace coreneuron {

FILE: coreneuron/mpi/nrnmpi.h
  function namespace (line 22) | namespace coreneuron {
  function namespace (line 30) | namespace coreneuron {
  function mpi_manager_t (line 51) | inline mpi_manager_t& mpi_manager() {
  function mpi_function_base (line 56) | struct mpi_function_base {

FILE: coreneuron/mpi/nrnmpidec.h
  function namespace (line 18) | namespace coreneuron {

FILE: coreneuron/network/cvodestb.cpp
  type coreneuron (line 19) | namespace coreneuron {
    function deliver_net_events (line 24) | void deliver_net_events(NrnThread* nt) {
    function nrn_deliver_events (line 32) | void nrn_deliver_events(NrnThread* nt) {
    function clear_event_queue (line 47) | void clear_event_queue() {
    function init_net_events (line 53) | void init_net_events() {
    function nrn_play_init (line 72) | void nrn_play_init() {
    function fixed_play_continuous (line 81) | void fixed_play_continuous(NrnThread* nt) {

FILE: coreneuron/network/have2want.h
  function default_rendezvous (line 55) | static int default_rendezvous(HAVEWANT_t key) {
  function rendezvous_rank_get (line 83) | static void rendezvous_rank_get(HAVEWANT_t* data,

FILE: coreneuron/network/multisend.cpp
  type coreneuron (line 52) | namespace coreneuron {
    type Phase2Buffer (line 80) | struct Phase2Buffer {
    class Multisend_ReceiveBuffer (line 87) | class Multisend_ReceiveBuffer {
    function nrn_multisend_send (line 125) | void nrn_multisend_send(PreSyn* ps, double t, NrnThread* nt) {
    function multisend_send_phase2 (line 150) | static void multisend_send_phase2(InputPreSyn* ps, int gid, double t) {
    function nrn_multisend_init (line 322) | void nrn_multisend_init() {
    function multisend_advance (line 339) | static int multisend_advance() {
    function nrn_multisend_advance (line 357) | void nrn_multisend_advance() {
    function nrn_multisend_receive (line 367) | void nrn_multisend_receive(NrnThread* nt) {
    function nrn_multisend_cleanup (line 419) | void nrn_multisend_cleanup() {
    function nrn_multisend_setup (line 433) | void nrn_multisend_setup() {

FILE: coreneuron/network/multisend.hpp
  type coreneuron (line 12) | namespace coreneuron {
    class PreSyn (line 17) | class PreSyn
    type NrnThread (line 18) | struct NrnThread

FILE: coreneuron/network/multisend_setup.cpp
  type coreneuron (line 36) | namespace coreneuron {
    function celldebug (line 42) | static void celldebug(const char* p, T& map) {
    function alltoalldebug (line 55) | static void alltoalldebug(const char* p,
    function celldebug (line 84) | static void celldebug(const char*, T&) {}
    function alltoalldebug (line 85) | static void alltoalldebug(const char*,
    function phase1debug (line 95) | void phase1debug(int* targets_phase1) {
    function phase2debug (line 112) | void phase2debug(int* targets_phase2) {
    function newoffset (line 134) | static std::vector<int> newoffset(const std::vector<int>& acnt) {
    function all2allv_helper (line 142) | static std::pair<std::vector<int>, std::vector<int>> all2allv_helper(c...
    function all2allv_int (line 163) | static std::pair<std::vector<int>, std::vector<int>> all2allv_int(cons...
    class TarList (line 190) | class TarList {
    function random_init (line 229) | static void random_init(int i) {
    function get_random (line 235) | static unsigned int get_random() {
    function random_delete (line 240) | static void random_delete() {
    function iran (line 247) | static int iran(int i1, int i2) {
    function phase2organize (line 257) | static void phase2organize(TarList* tl) {
    function nrn_multisend_setup_targets (line 304) | void nrn_multisend_setup_targets(bool use_phase2, int*& targets_phase1...
    function fill_multisend_lists (line 329) | static void fill_multisend_lists(bool use_phase2,
    function setup_target_lists (line 442) | static std::vector<int> setup_target_lists(bool use_phase2) {

FILE: coreneuron/network/netcon.hpp
  type coreneuron (line 17) | namespace coreneuron {
    class PreSyn (line 18) | class PreSyn
      method PreSyn (line 117) | PreSyn() = default;
      method type (line 121) | virtual int type() const override {
    class InputPreSyn (line 19) | class InputPreSyn
      method InputPreSyn (line 137) | InputPreSyn() = default;
      method type (line 141) | virtual int type() const override {
    class TQItem (line 20) | class TQItem
    type NrnThread (line 21) | struct NrnThread
    type Point_process (line 22) | struct Point_process
    class NetCvode (line 23) | class NetCvode
    type DiscreteEvent (line 33) | struct DiscreteEvent {
      method DiscreteEvent (line 34) | DiscreteEvent() = default;
      method type (line 38) | virtual int type() const {
      method require_checkpoint (line 41) | virtual bool require_checkpoint() {
    class NetCon (line 47) | class NetCon: public DiscreteEvent {
      method NetCon (line 60) | NetCon() = default;
      method type (line 64) | virtual int type() const override {
    class SelfEvent (line 70) | class SelfEvent: public DiscreteEvent {
      method SelfEvent (line 77) | SelfEvent() = default;
      method type (line 80) | virtual int type() const override {
    class ConditionEvent (line 90) | class ConditionEvent: public DiscreteEvent {
      method ConditionEvent (line 93) | ConditionEvent() = default;
      method value (line 96) | virtual double value(NrnThread*) {
    class PreSyn (line 104) | class PreSyn: public ConditionEvent {
      method PreSyn (line 117) | PreSyn() = default;
      method type (line 121) | virtual int type() const override {
    class InputPreSyn (line 132) | class InputPreSyn: public DiscreteEvent {
      method InputPreSyn (line 137) | InputPreSyn() = default;
      method type (line 141) | virtual int type() const override {
    class NetParEvent (line 149) | class NetParEvent: public DiscreteEvent {
      method type (line 158) | virtual int type() const override {

FILE: coreneuron/network/netcvode.cpp
  type coreneuron (line 29) | namespace coreneuron {
    function mk_netcvode (line 41) | void mk_netcvode() {
    function nrn_errno_check (line 49) | static int nrn_errno_check(int type) {
    function net_sem_from_gpu (line 59) | void net_sem_from_gpu(int sendtype,
    function net_send (line 77) | void net_send(void** v, int weight_index_, Point_process* pnt, double ...
    function artcell_net_send (line 103) | void artcell_net_send(void** v, int weight_index_, Point_process* pnt,...
    function net_event (line 107) | void net_event(Point_process* pnt, double time) {
    function interthread_enqueue (line 138) | void interthread_enqueue(NrnThread* nt) {
    function nrn_p_construct (line 175) | void nrn_p_construct() {
    function TQItem (line 198) | TQItem* NetCvode::bin_event(double td, DiscreteEvent* db, NrnThread* n...
    function TQItem (line 216) | TQItem* NetCvode::event(double td, DiscreteEvent* db, NrnThread* nt) {
    function net_move (line 296) | void net_move(void** v, Point_process* pnt, double tt) {
    function artcell_net_move (line 310) | void artcell_net_move(void** v, Point_process* pnt, double tt) {
    function ncs2nrn_integrate (line 488) | void ncs2nrn_integrate(double tstop) {
    function pscheck (line 509) | static bool pscheck(double var, double thresh, int* flag) {

FILE: coreneuron/network/netcvode.hpp
  type coreneuron (line 26) | namespace coreneuron {
    type DiscreteEvent (line 35) | struct DiscreteEvent
    class NetCvode (line 36) | class NetCvode
      method eps (line 71) | static double eps(double x) {
    type InterThreadEvent (line 41) | struct InterThreadEvent {
    class NetCvodeThreadData (line 46) | class NetCvodeThreadData {
    class NetCvode (line 59) | class NetCvode {
      method eps (line 71) | static double eps(double x) {

FILE: coreneuron/network/netpar.cpp
  type coreneuron (line 35) | namespace coreneuron {
    class PreSyn (line 51) | class PreSyn
    class InputPreSyn (line 52) | class InputPreSyn
    function alloc_mpi_space (line 96) | static void alloc_mpi_space() {
    function sppk (line 133) | inline static void sppk(unsigned char* c, int gid) {
    function spupk (line 139) | inline static int spupk(unsigned char* c) {
    function nrn_outputevent (line 148) | void nrn_outputevent(unsigned char localgid, double firetime) {
    function nrn2ncs_outputevent (line 167) | void nrn2ncs_outputevent(int gid, double firetime) {
    function nrn_need_npe (line 221) | static bool nrn_need_npe() {
    function nrn_spike_exchange_init (line 238) | void nrn_spike_exchange_init() {
    function nrn_spike_exchange (line 309) | void nrn_spike_exchange(NrnThread* nt) {
    function nrn_spike_exchange_compressed (line 378) | void nrn_spike_exchange_compressed(NrnThread* nt) {
    function mk_localgid_rep (line 501) | static void mk_localgid_rep() {
    function nrn_fake_fire (line 578) | void nrn_fake_fire(int gid, double spiketime, int fake_out) {
    function nrn_set_timeout (line 598) | int nrn_set_timeout(int timeout) {
    function BBS_netpar_solve (line 604) | void BBS_netpar_solve(double tstop) {
    function set_mindelay (line 643) | double set_mindelay(double maxdelay) {
    function nrnmpi_spike_compress (line 753) | int nrnmpi_spike_compress(int nspike, bool gid_compress, int xchng_met...
  type coreneuron (line 50) | namespace coreneuron {
    class PreSyn (line 51) | class PreSyn
    class InputPreSyn (line 52) | class InputPreSyn
    function alloc_mpi_space (line 96) | static void alloc_mpi_space() {
    function sppk (line 133) | inline static void sppk(unsigned char* c, int gid) {
    function spupk (line 139) | inline static int spupk(unsigned char* c) {
    function nrn_outputevent (line 148) | void nrn_outputevent(unsigned char localgid, double firetime) {
    function nrn2ncs_outputevent (line 167) | void nrn2ncs_outputevent(int gid, double firetime) {
    function nrn_need_npe (line 221) | static bool nrn_need_npe() {
    function nrn_spike_exchange_init (line 238) | void nrn_spike_exchange_init() {
    function nrn_spike_exchange (line 309) | void nrn_spike_exchange(NrnThread* nt) {
    function nrn_spike_exchange_compressed (line 378) | void nrn_spike_exchange_compressed(NrnThread* nt) {
    function mk_localgid_rep (line 501) | static void mk_localgid_rep() {
    function nrn_fake_fire (line 578) | void nrn_fake_fire(int gid, double spiketime, int fake_out) {
    function nrn_set_timeout (line 598) | int nrn_set_timeout(int timeout) {
    function BBS_netpar_solve (line 604) | void BBS_netpar_solve(double tstop) {
    function set_mindelay (line 643) | double set_mindelay(double maxdelay) {
    function nrnmpi_spike_compress (line 753) | int nrnmpi_spike_compress(int nspike, bool gid_compress, int xchng_met...

FILE: coreneuron/network/netpar.hpp
  type coreneuron (line 14) | namespace coreneuron {

FILE: coreneuron/network/partrans.cpp
  type coreneuron (line 20) | namespace coreneuron {
    function nrnmpi_v_transfer (line 35) | void nrnmpi_v_transfer() {
    function nrnthread_v_transfer (line 108) | void nrnthread_v_transfer(NrnThread* _nt) {

FILE: coreneuron/network/partrans.hpp
  type coreneuron (line 23) | namespace coreneuron {
    type Memb_list (line 24) | struct Memb_list
    type nrn_partrans (line 30) | namespace nrn_partrans {
      type TransferThreadData (line 78) | struct TransferThreadData {
    type nrn_partrans (line 104) | namespace nrn_partrans {
      type TransferThreadData (line 78) | struct TransferThreadData {
  type SetupTransferInfo (line 94) | struct SetupTransferInfo {
  type coreneuron (line 103) | namespace coreneuron {
    type Memb_list (line 24) | struct Memb_list
    type nrn_partrans (line 30) | namespace nrn_partrans {
      type TransferThreadData (line 78) | struct TransferThreadData {
    type nrn_partrans (line 104) | namespace nrn_partrans {
      type TransferThreadData (line 78) | struct TransferThreadData {

FILE: coreneuron/network/partrans_setup.cpp
  type coreneuron (line 20) | namespace coreneuron {
    class SidInfo (line 25) | class SidInfo {
  type coreneuron (line 43) | namespace coreneuron {
    class SidInfo (line 25) | class SidInfo {

FILE: coreneuron/network/tnode.hpp
  type coreneuron (line 14) | namespace coreneuron {
    class TNode (line 15) | class TNode
    class TNode (line 23) | class TNode {

FILE: coreneuron/network/tqueue.cpp
  type coreneuron (line 17) | namespace coreneuron {
    function TQItem (line 85) | TQItem* BinQ::dequeue() {
    function TQItem (line 93) | TQItem* BinQ::first() {
    function TQItem (line 101) | TQItem* BinQ::next(TQItem* q) {
    function spinit (line 180) | void spinit(SPTREE* q) {
    function SPBLK (line 197) | SPBLK* spenq(SPBLK* n, SPTREE* q) {
    function SPBLK (line 325) | SPBLK* spdeq(SPBLK** np) /* pointer to a node pointer */
    function splay (line 402) | void splay(SPBLK* n, SPTREE* q) {
    function SPBLK (line 503) | SPBLK* sphead(SPTREE* q) {
    function spdelete (line 532) | void spdelete(SPBLK* n, SPTREE* q) {

FILE: coreneuron/network/tqueue.hpp
  type coreneuron (line 36) | namespace coreneuron {
    class TQItem (line 39) | class TQItem
    type SPTREE (line 47) | struct SPTREE {
    type DiscreteEvent (line 68) | struct DiscreteEvent
    class TQItem (line 69) | class TQItem {
    type less_time (line 81) | struct less_time {
    class BinQ (line 88) | class BinQ {
      method shift (line 93) | void shift(double tt) {
      method TQItem (line 100) | TQItem* top() {
      method tbin (line 104) | double tbin() {
    type container (line 120) | enum container { spltree, pq_que }
    class TQueue (line 123) | class TQueue {
      method TQItem (line 128) | inline TQItem* least() {
      method TQItem (line 133) | inline TQItem* dequeue_bin() {
      method shift_bin (line 136) | inline void shift_bin(double _t_) {
      method TQItem (line 140) | inline TQItem* top() {
      type qtype (line 153) | enum qtype { enq = 0, spike, ite, deq }
      method least_t_nolock (line 156) | double least_t_nolock() {
      method TQPair (line 171) | TQPair make_TQPair(TQItem* p) {

FILE: coreneuron/nrnconf.h
  function namespace (line 19) | namespace coreneuron {

FILE: coreneuron/nrniv/nrniv_decl.h
  function namespace (line 14) | namespace coreneuron {

FILE: coreneuron/permute/balance.cpp
  type coreneuron (line 23) | namespace coreneuron {
    function warpcmp (line 27) | bool warpcmp(const TNode* a, const TNode* b) {
    function warp_balance (line 43) | size_t warp_balance(size_t ncell, VecTNode& nodevec) {

FILE: coreneuron/permute/cellorder.cpp
  type coreneuron (line 27) | namespace coreneuron {
    function InterleaveInfo (line 66) | InterleaveInfo& InterleaveInfo::operator=(const InterleaveInfo& info) {
    function create_interleave_info (line 96) | void create_interleave_info() {
    function destroy_interleave_info (line 101) | void destroy_interleave_info() {
    function print_quality2 (line 110) | static void print_quality2(int iwarp, InterleaveInfo& ii, int* p) {
    function print_quality1 (line 175) | static void print_quality1(int iwarp, InterleaveInfo& ii, int ncell, i...
    function warp_balance (line 243) | static void warp_balance(int ith, InterleaveInfo& ii) {
    function mk_cell_indices (line 414) | void mk_cell_indices() {
    function triang_interleaved (line 438) | static void triang_interleaved(NrnThread* nt,
    function bksub_interleaved (line 461) | static void bksub_interleaved(NrnThread* nt,
    function triang_interleaved2 (line 482) | static void triang_interleaved2(NrnThread* nt, int icore, int ncycle, ...
    function bksub_interleaved2 (line 526) | static void bksub_interleaved2(NrnThread* nt,
    function solve_interleaved2 (line 566) | void solve_interleaved2(int ith) {

FILE: coreneuron/permute/cellorder.hpp
  type coreneuron (line 13) | namespace coreneuron {
    class InterleaveInfo (line 41) | class InterleaveInfo
      method InterleaveInfo (line 52) | InterleaveInfo() = default;
    class InterleaveInfo (line 50) | class InterleaveInfo: public MemoryManaged {
      method InterleaveInfo (line 52) | InterleaveInfo() = default;
    function copy_array (line 111) | void copy_array(T*& dest, T* src, size_t n) {
    function copy_align_array (line 118) | void copy_align_array(T*& dest, T* src, size_t n) {

FILE: coreneuron/permute/cellorder1.cpp
  type coreneuron (line 24) | namespace coreneuron {
    function tnode_earlier (line 30) | static bool tnode_earlier(TNode* a, TNode* b) {
    function ptr_tnode_earlier (line 44) | static bool ptr_tnode_earlier(TNode* a, TNode* b) {
    function quality (line 110) | static void quality(VecTNode& nodevec, size_t max = 32) {
    function level_from_root (line 203) | size_t level_from_root(VecTNode& nodevec) {
    function level_from_leaf (line 218) | size_t level_from_leaf(VecTNode& nodevec) {
    function set_cellindex (line 242) | static void set_cellindex(int ncell, VecTNode& nodevec) {
    function set_groupindex (line 261) | static void set_groupindex(VecTNode& nodevec) {
    function ident_statistic (line 276) | static void ident_statistic(VecTNode& nodevec, size_t ncell) {
    function check (line 375) | void check(VecTNode& nodevec) {
    function prtree (line 402) | void prtree(VecTNode& nodevec) {
    function tree_analysis (line 428) | void tree_analysis(int* parent, int nnode, int ncell, VecTNode& nodeve...
    function interleave_comp (line 451) | static bool interleave_comp(TNode* a, TNode* b) {
    function node_interleave_order (line 472) | void node_interleave_order(int ncell, VecTNode& nodevec) {
    function admin1 (line 499) | static void admin1(int ncell,
    function stride_length (line 563) | static size_t stride_length(size_t begin, size_t end, VecTNode& nodeve...
    function admin2 (line 601) | static void admin2(int ncell,

FILE: coreneuron/permute/cellorder2.cpp
  type coreneuron (line 24) | namespace coreneuron {
    function chklevel (line 30) | void chklevel(VTN& level, size_t nident = 8) {}
    function sortlevel_cmp (line 37) | static bool sortlevel_cmp(TNode* a, TNode* b) {
    function sortlevel (line 64) | static void sortlevel(VTN& level) {
    function set_treenode_order (line 73) | static void set_treenode_order(VVTN& levels) {
    function g32 (line 86) | static size_t g32(TNode* nd) {
    function is_parent_race (line 90) | static bool is_parent_race(TNode* nd) {  // vitiating
    function is_parent_race2 (line 102) | static bool is_parent_race2(TNode* nd) {  // vitiating
    function is_child_race (line 113) | static bool is_child_race(TNode* nd) {  // potentially handleable by a...
    function is_child_race2 (line 132) | static bool is_child_race2(TNode* nd) {  // potentially handleable by ...
    function dist2child (line 153) | size_t dist2child(TNode* nd) {
    function move_range (line 167) | static void move_range(size_t start, size_t length, size_t dst, std::v...
    function move_nodes (line 181) | static void move_nodes(size_t start, size_t length, size_t dst, VTN& n...
    function need2move (line 202) | static size_t need2move(TNode* nd) {
    function how_many_warpsize_groups_have_only_leaves (line 207) | static void how_many_warpsize_groups_have_only_leaves(VTN& nodes) {
    function pr_race_situation (line 225) | static void pr_race_situation(VTN& nodes) {
    function next_leaf (line 254) | static size_t next_leaf(TNode* nd, VTN& nodes) {
    function checkrace (line 265) | static void checkrace(TNode* nd, VTN& nodes) {
    function eliminate_race (line 273) | static bool eliminate_race(TNode* nd, size_t d, VTN& nodes, TNode* loo...
    function eliminate_prace (line 296) | static void eliminate_prace(TNode* nd, VTN& nodes) {
    function eliminate_crace (line 309) | static void eliminate_crace(TNode* nd, VTN& nodes) {
    function question2 (line 325) | static void question2(VVTN& levels) {
    function analyze (line 405) | static void analyze(VVTN& levels) {
    function prgroupsize (line 429) | void prgroupsize(VVVTN& groups) {
    function final_nodevec_cmp (line 442) | static bool final_nodevec_cmp(TNode* a, TNode* b) {
    function set_nodeindex (line 454) | static void set_nodeindex(VecTNode& nodevec) {
    function group_order2 (line 460) | void group_order2(VecTNode& nodevec, size_t groupsize, size_t ncell) {

FILE: coreneuron/permute/data_layout.cpp
  type coreneuron (line 15) | namespace coreneuron {
    function get_data_index (line 19) | int get_data_index(int node_index, int variable_index, int mtype, Memb...

FILE: coreneuron/permute/data_layout.hpp
  type coreneuron (line 13) | namespace coreneuron {
    type Memb_list (line 14) | struct Memb_list

FILE: coreneuron/permute/node_permute.cpp
  type coreneuron (line 96) | namespace coreneuron {
    function permute (line 98) | void permute(T* data, int cnt, int sz, int layout, int* p) {
    function invert_permute (line 139) | static void invert_permute(int* p, int n) {
    function full_search (line 162) | static int full_search(NrnThread& nt, double* pd) {
    function type_of_ntdata (line 186) | int type_of_ntdata(NrnThread& nt, int i, bool reset) {
    function update_pdata_values (line 212) | static void update_pdata_values(Memb_list* ml, int type, NrnThread& nt) {
    function node_permute (line 337) | void node_permute(int* vec, int n, int* permute) {
    function permute_ptr (line 345) | void permute_ptr(int* vec, int n, int* p) {
    function permute_data (line 349) | void permute_data(double* vec, int n, int* p) {
    function permute_ml (line 353) | void permute_ml(Memb_list* ml, int type, NrnThread& nt) {
    function nrn_index_permute (line 363) | int nrn_index_permute(int ix, int type, Memb_list* ml) {
    function pr (line 384) | static void pr(const char* s, int* x, int n) {
    function pr (line 392) | static void pr(const char* s, double* x, int n) {
    function nrn_index_sort_cmp (line 405) | static bool nrn_index_sort_cmp(const std::pair<int, int>& a, const std...
    function permute_nodeindices (line 431) | void permute_nodeindices(Memb_list* ml, int* p) {

FILE: coreneuron/permute/node_permute.h
  function namespace (line 13) | namespace coreneuron {

FILE: coreneuron/sim/fadvance_core.cpp
  type coreneuron (line 27) | namespace coreneuron {
    class ProgressBar (line 34) | class ProgressBar final {
      method ProgressBar (line 41) | ProgressBar(int nsteps)
      method update (line 49) | void update(int step, double time) {
      method step (line 56) | void step(double time) {
    function dt2thread (line 70) | void dt2thread(double adt) { /* copied from nrnoc/fadvance.c */
    function nrn_fixed_step_minimal (line 91) | void nrn_fixed_step_minimal() { /* not so minimal anymore with gap jun...
    function nrn_fixed_single_steps_minimal (line 128) | void nrn_fixed_single_steps_minimal(int total_sim_steps, double tstop) {

FILE: coreneuron/sim/fast_imem.cpp
  type coreneuron (line 15) | namespace coreneuron {
    function fast_imem_free (line 21) | void fast_imem_free() {
    function nrn_fast_imem_alloc (line 32) | void nrn_fast_imem_alloc() {
    function nrn_calc_fast_imem (line 44) | void nrn_calc_fast_imem(NrnThread* nt) {
    function nrn_calc_fast_imem_init (line 62) | void nrn_calc_fast_imem_init(NrnThread* nt) {

FILE: coreneuron/sim/fast_imem.hpp
  type coreneuron (line 13) | namespace coreneuron {

FILE: coreneuron/sim/finitialize.cpp
  type coreneuron (line 17) | namespace coreneuron {
    function allocate_data_in_mechanism_nrn_init (line 21) | void allocate_data_in_mechanism_nrn_init() {
    function nrn_finitialize (line 40) | void nrn_finitialize(int setv, double v) {

FILE: coreneuron/sim/multicore.cpp
  type coreneuron (line 51) | namespace coreneuron {
    function NrnThreadMembList (line 64) | NrnThreadMembList* create_tml(NrnThread& nt,
    function nrn_threads_create (line 102) | void nrn_threads_create(int n) {
    function nrn_threads_free (line 125) | void nrn_threads_free() {
    function nrn_mk_table_check (line 133) | void nrn_mk_table_check() {
    function nrn_thread_table_check (line 168) | void nrn_thread_table_check() {

FILE: coreneuron/sim/multicore.hpp
  type coreneuron (line 20) | namespace coreneuron {
    class NetCon (line 21) | class NetCon
    class PreSyn (line 22) | class PreSyn
    type NrnThreadMembList (line 32) | struct NrnThreadMembList { /* patterned after CvMembList in cvodeobj.h */
    type NrnThreadBAList (line 46) | struct NrnThreadBAList {
    type NrnFastImem (line 52) | struct NrnFastImem {
    type TrajectoryRequests (line 57) | struct TrajectoryRequests {
    type PreSynHelper (line 71) | struct PreSynHelper {
    type NrnThread (line 75) | struct NrnThread: public MemoryManaged {
    function nrn_multithread_job (line 161) | void nrn_multithread_job(F&& job, Args&&... args) {
    function at_time (line 198) | constexpr int at_time(NrnThread* nt, double te) {

FILE: coreneuron/sim/scopmath/abort.cpp
  type coreneuron (line 32) | namespace coreneuron {
    function abort_run (line 33) | int abort_run(int code) {

FILE: coreneuron/sim/scopmath/crout_thread.hpp
  type coreneuron (line 16) | namespace coreneuron {
    function nrn_crout_thread (line 40) | inline int nrn_crout_thread(NewtonSpace* ns, int n, double** a, int* p...
    function nrn_scopmath_solve_thread (line 127) | inline void nrn_scopmath_solve_thread(int n,

FILE: coreneuron/sim/scopmath/errcodes.h
  function namespace (line 13) | namespace coreneuron {

FILE: coreneuron/sim/scopmath/newton_struct.h
  function namespace (line 11) | namespace coreneuron {

FILE: coreneuron/sim/scopmath/newton_thread.cpp
  type coreneuron (line 14) | namespace coreneuron {
    function NewtonSpace (line 15) | NewtonSpace* nrn_cons_newtonspace(int n, int n_instance) {
    function nrn_destroy_newtonspace (line 29) | void nrn_destroy_newtonspace(NewtonSpace* ns) {

FILE: coreneuron/sim/scopmath/newton_thread.hpp
  type coreneuron (line 20) | namespace coreneuron {
    type detail (line 27) | namespace detail {
      function nrn_buildjacobian_thread (line 45) | void nrn_buildjacobian_thread(NewtonSpace* ns,
    function nrn_newton_thread (line 101) | inline int nrn_newton_thread(NewtonSpace* ns,

FILE: coreneuron/sim/scopmath/sparse_thread.hpp
  type coreneuron (line 16) | namespace coreneuron {
    type scopmath (line 17) | namespace scopmath {
      type sparse (line 18) | namespace sparse {
        function delete_item (line 20) | inline void delete_item(Item* item) {
        function linkitem (line 28) | inline void linkitem(Item* item, Item* ii) {
        function insert (line 35) | inline void insert(SparseObj* so, Item* item) {
        function increase_order (line 51) | inline void increase_order(SparseObj* so, unsigned row) {
        function Elm (line 71) | Elm* getelm(SparseObj* so, unsigned row, unsigned col, Elm* new_el...
        function List (line 188) | inline List* newlist() {
        function freelist (line 196) | inline void freelist(List* list) {
        function check_assert (line 205) | inline void check_assert(SparseObj* so) {
        function re_link (line 233) | inline void re_link(SparseObj* so, unsigned i) {
        function free_elm (line 294) | inline void free_elm(SparseObj* so) {
        function init_minorder (line 302) | inline void init_minorder(SparseObj* so) {
        function reduce_order (line 334) | inline void reduce_order(SparseObj* so, unsigned row) {
        function get_next_pivot (line 345) | inline void get_next_pivot(SparseObj* so, unsigned i) {
        function initeqn (line 379) | inline void initeqn(SparseObj* so, unsigned maxeqn) {
        function spar_minorder (line 416) | inline void spar_minorder(SparseObj* so) {
        function init_coef_list (line 426) | inline void init_coef_list(SparseObj* so, int _iml) {
        function subrow (line 440) | inline void subrow(SparseObj* so, Elm* pivot, Elm* rowsub, int _im...
        function bksub (line 453) | inline void bksub(SparseObj* so, int _iml) {
        function matsol (line 466) | inline int matsol(SparseObj* so, int _iml) {
        function create_coef_list (line 487) | void create_coef_list(SparseObj* so, int n, SPFUN fun, _threadargs...
    function sparse_thread (line 561) | int sparse_thread(SparseObj* so,
    function _cvode_sparse_thread (line 608) | int _cvode_sparse_thread(void** vpr, int n, int* x, SPFUN fun, _thread...
    function _nrn_destroy_sparseobj_thread (line 628) | inline void _nrn_destroy_sparseobj_thread(SparseObj* so) {

FILE: coreneuron/sim/scopmath/ssimplic_thread.hpp
  type coreneuron (line 11) | namespace coreneuron {
    function check_state (line 17) | static int check_state(int n, int* s, _threadargsproto_) {
    function _ss_sparse_thread (line 30) | int _ss_sparse_thread(SparseObj* so,
    function _ss_derivimplicit_thread (line 67) | int _ss_derivimplicit_thread(int n, int* slist, int* dlist, DIFUN fun,...

FILE: coreneuron/sim/solve_core.cpp
  type coreneuron (line 12) | namespace coreneuron {
    function nrn_solve_minimal (line 18) | void nrn_solve_minimal(NrnThread* _nt) {
    function triang (line 32) | static void triang(NrnThread* _nt) {
    function bksub (line 54) | static void bksub(NrnThread* _nt) {

FILE: coreneuron/sim/treeset_core.cpp
  type coreneuron (line 17) | namespace coreneuron {
    function nrn_rhs (line 23) | static void nrn_rhs(NrnThread* _nt) {
    function nrn_lhs (line 117) | static void nrn_lhs(NrnThread* _nt) {

FILE: coreneuron/utils/ivocvect.cpp
  type coreneuron (line 12) | namespace coreneuron {
    function IvocVect (line 13) | IvocVect* vector_new(int n) {
    function vector_capacity (line 16) | int vector_capacity(IvocVect* v) {
    function IvocVect (line 26) | IvocVect* vector_new1(int n) {
    function vector_capacity (line 31) | int vector_capacity(void* v) {

FILE: coreneuron/utils/ivocvect.hpp
  type coreneuron (line 16) | namespace coreneuron {
    class fixed_vector (line 18) | class fixed_vector {
      method fixed_vector (line 24) | fixed_vector() = default;
      method fixed_vector (line 26) | fixed_vector(size_t n)
      method fixed_vector (line 31) | fixed_vector(const fixed_vector& vec) = delete;
      method fixed_vector (line 32) | fixed_vector& operator=(const fixed_vector& vec) = delete;
      method fixed_vector (line 33) | fixed_vector(fixed_vector&& vec)
      method fixed_vector (line 38) | fixed_vector& operator=(fixed_vector&& vec) {
      method T (line 49) | const T& operator[](int i) const {
      method T (line 52) | T& operator[](int i) {
      method T (line 57) | T* data(void) const {
      method T (line 62) | T* data(void) {
      method size (line 67) | size_t size() const {

FILE: coreneuron/utils/lpt.cpp
  function lpt (line 25) | std::vector<std::size_t> lpt(std::size_t nbag, std::vector<std::size_t>&...
  function load_balance (line 69) | double load_balance(std::vector<size_t>& v) {

FILE: coreneuron/utils/memory.cpp
  type coreneuron (line 17) | namespace coreneuron {
    function gpu_enabled (line 18) | bool gpu_enabled() {
    function deallocate_unified (line 44) | void deallocate_unified(void* ptr, std::size_t num_bytes) {

FILE: coreneuron/utils/memory.h
  function namespace (line 24) | namespace coreneuron {
  function alloc_memory (line 122) | inline void alloc_memory(void*& pointer, size_t num_bytes, size_t /*alig...
  function calloc_memory (line 126) | inline void calloc_memory(void*& pointer, size_t num_bytes, size_t /*ali...
  function free_memory (line 131) | inline void free_memory(void* pointer) {
  function class (line 142) | class MemoryManaged {
  function class (line 172) | class MemoryManaged {
  function alloc_memory (line 178) | inline void alloc_memory(void*& pointer, size_t num_bytes, size_t alignm...
  function calloc_memory (line 191) | inline void calloc_memory(void*& pointer, size_t num_bytes, size_t align...
  function free_memory (line 196) | inline void free_memory(void* pointer) {
  function namespace (line 202) | namespace coreneuron {

FILE: coreneuron/utils/memory_utils.cpp
  type coreneuron (line 42) | namespace coreneuron {
    function nrn_mallinfo (line 43) | double nrn_mallinfo(void) {
    function report_mem_usage (line 79) | void report_mem_usage(const char* message, bool all_ranks) {

FILE: coreneuron/utils/memory_utils.h
  function namespace (line 19) | namespace coreneuron {

FILE: coreneuron/utils/nrn_assert.h
  function abortf (line 24) | static void abortf(const char* fmt, ...) {

FILE: coreneuron/utils/nrn_stats.cpp
  type coreneuron (line 27) | namespace coreneuron {
    function report_cell_stats (line 30) | void report_cell_stats() {

FILE: coreneuron/utils/nrn_stats.h
  function namespace (line 17) | namespace coreneuron {

FILE: coreneuron/utils/nrnmutdec.hpp
  class OMP_Mutex (line 14) | class OMP_Mutex {
    method OMP_Mutex (line 17) | OMP_Mutex() {
    method OMP_Mutex (line 27) | OMP_Mutex(const OMP_Mutex&) = delete;
    method OMP_Mutex (line 28) | OMP_Mutex& operator=(const OMP_Mutex&) = delete;
    method OMP_Mutex (line 31) | OMP_Mutex(const OMP_Mutex&&) = delete;
    method OMP_Mutex (line 32) | OMP_Mutex& operator=(const OMP_Mutex&&) = delete;
    method lock (line 35) | void lock() {
    method unlock (line 39) | void unlock() {
    method try_lock (line 44) | bool try_lock() {
    method OMP_Mutex (line 58) | OMP_Mutex() = default;
    method OMP_Mutex (line 64) | OMP_Mutex(const OMP_Mutex&) = delete;
    method OMP_Mutex (line 65) | OMP_Mutex& operator=(const OMP_Mutex&) = delete;
    method OMP_Mutex (line 68) | OMP_Mutex(const OMP_Mutex&&) = delete;
    method OMP_Mutex (line 69) | OMP_Mutex& operator=(const OMP_Mutex&&) = delete;
    method lock (line 72) | void lock() {}
    method unlock (line 74) | void unlock() {}
    method try_lock (line 77) | bool try_lock() {
  class OMP_Mutex (line 55) | class OMP_Mutex {
    method OMP_Mutex (line 17) | OMP_Mutex() {
    method OMP_Mutex (line 27) | OMP_Mutex(const OMP_Mutex&) = delete;
    method OMP_Mutex (line 28) | OMP_Mutex& operator=(const OMP_Mutex&) = delete;
    method OMP_Mutex (line 31) | OMP_Mutex(const OMP_Mutex&&) = delete;
    method OMP_Mutex (line 32) | OMP_Mutex& operator=(const OMP_Mutex&&) = delete;
    method lock (line 35) | void lock() {
    method unlock (line 39) | void unlock() {
    method try_lock (line 44) | bool try_lock() {
    method OMP_Mutex (line 58) | OMP_Mutex() = default;
    method OMP_Mutex (line 64) | OMP_Mutex(const OMP_Mutex&) = delete;
    method OMP_Mutex (line 65) | OMP_Mutex& operator=(const OMP_Mutex&) = delete;
    method OMP_Mutex (line 68) | OMP_Mutex(const OMP_Mutex&&) = delete;
    method OMP_Mutex (line 69) | OMP_Mutex& operator=(const OMP_Mutex&&) = delete;
    method lock (line 72) | void lock() {}
    method unlock (line 74) | void unlock() {}
    method try_lock (line 77) | bool try_lock() {

FILE: coreneuron/utils/nrnoc_aux.cpp
  type coreneuron (line 18) | namespace coreneuron {
    function nrn_exit (line 30) | void nrn_exit(int err) {
    function hoc_execerror (line 39) | void hoc_execerror(const char* s1, const char* s2) {
    function hoc_warning (line 44) | void hoc_warning(const char* s1, const char* s2) {
    function freevector (line 52) | void freevector(double* p) {
    function freematrix (line 66) | void freematrix(double** matrix) {
    function hoc_malchk (line 83) | void hoc_malchk(void) {}
    function hoc_Exp (line 109) | double hoc_Exp(double x) {
    function check_bbcore_write_version (line 128) | void check_bbcore_write_version(const char* version) {

FILE: coreneuron/utils/nrnoc_aux.hpp
  type coreneuron (line 14) | namespace coreneuron {

FILE: coreneuron/utils/nrntimeout.cpp
  type coreneuron (line 23) | namespace coreneuron {
    function nrn_timeout (line 26) | void nrn_timeout(int seconds) {}
    type itimerval (line 32) | struct itimerval
    type sigaction (line 33) | struct sigaction
    function timed_out (line 35) | static void timed_out(int sig) {
    function nrn_timeout (line 50) | void nrn_timeout(int seconds) {

FILE: coreneuron/utils/offload.hpp
  type coreneuron (line 28) | namespace coreneuron {
    function T (line 71) | T* cnrn_target_deviceptr_or_present(std::string_view file,
    function T (line 110) | T* cnrn_target_copyin(std::string_view file, int line, const T* h_ptr,...
    function cnrn_target_delete (line 132) | void cnrn_target_delete(std::string_view file, int line, T* h_ptr, std...
    function cnrn_target_memcpy_to_device (line 150) | void cnrn_target_memcpy_to_device(std::string_view file,
    function cnrn_target_update_on_device (line 175) | void cnrn_target_update_on_device(std::string_view file,

FILE: coreneuron/utils/profile/profiler_interface.h
  function start_profile (line 94) | inline static void start_profile() {

FILE: coreneuron/utils/progressbar/progressbar.cpp
  type progressbar_time_components (line 46) | struct progressbar_time_components {
  function progressbar (line 60) | progressbar* progressbar_new_with_format(const char* label, unsigned lon...
  function progressbar (line 88) | progressbar* progressbar_new(const char* label, unsigned long max) {
  function progressbar_update_label (line 92) | void progressbar_update_label(progressbar* bar, const char* label) {
  function progressbar_free (line 99) | void progressbar_free(progressbar* bar) {
  function progressbar_update (line 110) | void progressbar_update(progressbar* bar, unsigned long value, double t) {
  function progressbar_inc (line 149) | void progressbar_inc(progressbar* bar, double t) {
  function progressbar_write_char (line 153) | static void progressbar_write_char(FILE* file, const int ch, const size_...
  function progressbar_max (line 159) | static int progressbar_max(int x, int y) {
  function get_screen_width (line 163) | static unsigned int get_screen_width(void) {
  function progressbar_bar_width (line 167) | static int progressbar_bar_width(int screen_width, int label_length) {
  function progressbar_label_width (line 172) | static int progressbar_label_width(int screen_width, int label_length, i...
  function progressbar_remaining_seconds (line 183) | static int progressbar_remaining_seconds(const progressbar* bar) {
  function progressbar_time_components (line 192) | static progressbar_time_components progressbar_calc_time_components(int ...
  function progressbar_draw (line 202) | static void progressbar_draw(const progressbar* bar) {
  function progressbar_finish (line 245) | void progressbar_finish(progressbar* bar) {

FILE: coreneuron/utils/progressbar/progressbar.hpp
  type progressbar (line 21) | struct progressbar {

FILE: coreneuron/utils/randoms/nrnran123.cpp
  type random123_allocate_unified (line 44) | struct random123_allocate_unified {
    method free (line 54) | static void free(char* const block) {
  function philox4x32_key_t (line 92) | __attribute__((noinline)) philox4x32_key_t& global_state() {
  function CORENRN_HOST_DEVICE (line 97) | CORENRN_HOST_DEVICE philox4x32_ctr_t
  type coreneuron (line 102) | namespace coreneuron {
    function nrnran123_instance_count (line 103) | std::size_t nrnran123_instance_count() {
    function nrnran123_get_globalindex (line 108) | uint32_t nrnran123_get_globalindex() {
    function nrnran123_set_globalindex (line 113) | void nrnran123_set_globalindex(uint32_t gix) {
    function nrnran123_initialise_global_state_on_device (line 146) | void nrnran123_initialise_global_state_on_device() {
    function nrnran123_destroy_global_state_on_device (line 154) | void nrnran123_destroy_global_state_on_device() {
    function nrnran123_State (line 168) | nrnran123_State* nrnran123_newstream3(uint32_t id1,
    function nrnran123_deletestream (line 201) | void nrnran123_deletestream(nrnran123_State* s, bool use_unified_memor...

FILE: coreneuron/utils/randoms/nrnran123.h
  function namespace (line 53) | namespace coreneuron {
  function nrnran123_state_size (line 82) | inline std::size_t nrnran123_state_size() {
  function nrnran123_State (line 91) | inline nrnran123_State* nrnran123_newstream(
  function nrnran123_getseq (line 101) | constexpr void nrnran123_getseq(nrnran123_State* s, uint32_t* seq, char*...
  function nrnran123_getids (line 105) | constexpr void nrnran123_getids(nrnran123_State* s, uint32_t* id1, uint3...
  function nrnran123_getids3 (line 109) | constexpr void nrnran123_getids3(nrnran123_State* s, uint32_t* id1, uint...
  function rval (line 118) | uint32_t rval{s->r.v[int{which++}]};
  function nrnran123_uint2dbl (line 128) | constexpr double nrnran123_uint2dbl(uint32_t u) {
  function nrnran123_dblpick (line 136) | inline double nrnran123_dblpick(nrnran123_State* s) {
  function nrnran123_setseq (line 141) | inline void nrnran123_setseq(nrnran123_State* s, uint32_t seq, char whic...
  function nrnran123_negexp (line 152) | inline double nrnran123_negexp(nrnran123_State* s) {
  function u2 (line 161) | double u2{nrnran123_dblpick(s)};
  function y (line 166) | double y{std::sqrt((-2. * std::log(w)) / w)};

FILE: coreneuron/utils/string_utils.cpp
  function strcat_at_pos (line 11) | unsigned strcat_at_pos(char* dest, unsigned start_position, char* src, u...

FILE: coreneuron/utils/units.hpp
  type coreneuron (line 9) | namespace coreneuron {
    type units (line 10) | namespace units {
      type detail (line 27) | namespace detail {

FILE: coreneuron/utils/utils.cpp
  type coreneuron (line 12) | namespace coreneuron {
    function nrn_abort (line 13) | [[noreturn]] void nrn_abort(int errcode) {
    function nrn_wtime (line 22) | double nrn_wtime() {

FILE: coreneuron/utils/utils.hpp
  type coreneuron (line 15) | namespace coreneuron {
    function nrn_fatal_error (line 18) | void nrn_fatal_error(const char* msg, Args&&... args) {

FILE: coreneuron/utils/vrecitem.h
  function namespace (line 13) | namespace coreneuron {

FILE: coreneuron/utils/vrecord.cpp
  type coreneuron (line 16) | namespace coreneuron {
    function NrnThread (line 23) | NrnThread* PlayRecordEvent::thread() {
    function nrn_pragma_omp (line 113) | nrn_pragma_omp(target if(nt->compute_gpu))

FILE: tests/unit/alignment/alignment.cpp
  type data (line 18) | struct data {
  function BOOST_AUTO_TEST_CASE (line 37) | BOOST_AUTO_TEST_CASE(padding_simd) {
  function BOOST_AUTO_TEST_CASE_TEMPLATE (line 102) | BOOST_AUTO_TEST_CASE_TEMPLATE(memory_alignment_simd_false, T, chunk_defa...
  function BOOST_AUTO_TEST_CASE_TEMPLATE (line 123) | BOOST_AUTO_TEST_CASE_TEMPLATE(memory_alignment_simd_true, T, chunk_data_...

FILE: tests/unit/cmdline_interface/test_cmdline_interface.cpp
  function BOOST_AUTO_TEST_CASE (line 17) | BOOST_AUTO_TEST_CASE(cmdline_interface) {

FILE: tests/unit/interleave_info/check_constructors.cpp
  function BOOST_AUTO_TEST_CASE (line 15) | BOOST_AUTO_TEST_CASE(interleave_info_test) {

FILE: tests/unit/lfp/lfp.cpp
  function integral (line 20) | double integral(F f, double a, double b, int n) {
  function BOOST_AUTO_TEST_CASE (line 30) | BOOST_AUTO_TEST_CASE(LFP_PointSource_LineSource) {

FILE: tests/unit/queueing/test_queueing.cpp
  function BOOST_AUTO_TEST_CASE (line 20) | BOOST_AUTO_TEST_CASE(priority_queue_nq_dq) {
  function BOOST_AUTO_TEST_CASE (line 50) | BOOST_AUTO_TEST_CASE(tqueue_ordered_test) {
  function BOOST_AUTO_TEST_CASE (line 76) | BOOST_AUTO_TEST_CASE(tqueue_move_nolock) {}
  function BOOST_AUTO_TEST_CASE (line 78) | BOOST_AUTO_TEST_CASE(tqueue_remove) {}
  function BOOST_AUTO_TEST_CASE (line 80) | BOOST_AUTO_TEST_CASE(threaddata_interthread_send) {

FILE: tests/unit/solver/test_solver.cpp
  type SolverData (line 28) | struct SolverData {
  type SolverImplementation (line 36) | enum struct SolverImplementation {
  type ToyModelConfig (line 66) | struct ToyModelConfig {
  type SetupThreads (line 77) | struct SetupThreads {
    method SetupThreads (line 78) | SetupThreads(SolverImplementation impl, ToyModelConfig config = {}) {
    method dump_solver_data (line 211) | auto dump_solver_data() {
    method solve (line 247) | void solve() {
    method NrnThread (line 253) | NrnThread* begin() const {
    method NrnThread (line 256) | NrnThread* end() const {
  function solve_and_dump (line 262) | auto solve_and_dump(Args&&... args) {
  function active_implementations (line 268) | auto active_implementations() {
  function compare_solver_data (line 283) | void compare_solver_data(
  function compare_all_active_implementations (line 311) | auto compare_all_active_implementations(Args&&... args) {
  function random_config (line 363) | auto random_config() {
Condensed preview — 246 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,380K chars).
[
  {
    "path": ".bbp-project.yaml",
    "chars": 142,
    "preview": "tools:\n  ClangFormat:\n    enable: True\n    include:\n      match:\n      - coreneuron/.*\\.((cu)|(h)|([chi]pp))$\n  CMakeFor"
  },
  {
    "path": ".clang-format.changes",
    "chars": 93,
    "preview": "IndentCaseLabels: true\nSortIncludes: false\nStatementMacros: [nrn_pragma_acc, nrn_pragma_omp]\n"
  },
  {
    "path": ".cmake-format.changes.yaml",
    "chars": 119,
    "preview": "additional_commands:\n  cpp_cc_build_time_copy:\n    flags: ['NO_TARGET']\n    kwargs:\n      INPUT: '1'\n      OUTPUT: '1'\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "chars": 817,
    "preview": "---\nname: Bug report\nabout: Create a report to help us improve\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n**Describe the i"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/config.yml",
    "chars": 27,
    "preview": "blank_issues_enabled: true\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.md",
    "chars": 580,
    "preview": "---\nname: Feature request\nabout: Suggest an idea for this project\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n**Is your fea"
  },
  {
    "path": ".github/problem-matchers/address.json",
    "chars": 303,
    "preview": "\n{\n    \"problemMatcher\": [\n        {\n            \"owner\": \"asan-problem-matcher\",\n            \"severity\": \"warning\",\n   "
  },
  {
    "path": ".github/problem-matchers/gcc.json",
    "chars": 521,
    "preview": "{\n    \"__comment\": \"Taken from vscode-cpptools's Extension/package.json gcc rule\",\n    \"problemMatcher\": [\n        {\n   "
  },
  {
    "path": ".github/problem-matchers/undefined.json",
    "chars": 527,
    "preview": "{\n    \"problemMatcher\": [\n        {\n            \"owner\": \"ubsan-problem-matcher\",\n            \"severity\": \"warning\",\n   "
  },
  {
    "path": ".github/pull_request_template.md",
    "chars": 1520,
    "preview": "**Description**\n\nPlease include a summary of the change and which issue is fixed or which feature is added.\n\n- [ ] Issue"
  },
  {
    "path": ".github/workflows/clang_cmake_format_check.yaml",
    "chars": 721,
    "preview": "name: clang-cmake-format-check\n\nconcurrency:\n  group: ${{ github.workflow }}#${{ github.ref }}\n  cancel-in-progress: tru"
  },
  {
    "path": ".github/workflows/coreneuron-ci.yml",
    "chars": 8717,
    "preview": "name: CoreNEURON CI\n\nconcurrency:\n  group: ${{ github.workflow }}#${{ github.ref }}\n  cancel-in-progress: true\n\non:\n  pu"
  },
  {
    "path": ".github/workflows/coverage.yml",
    "chars": 2269,
    "preview": "name: Coverage\n\nconcurrency:\n  group: ${{ github.workflow }}#${{ github.ref }}\n  cancel-in-progress: true\n\non:\n  push:\n "
  },
  {
    "path": ".github/workflows/test-as-submodule.yml",
    "chars": 4548,
    "preview": "name: NEURON submodule\n\nconcurrency:\n  group: ${{ github.workflow }}#${{ github.ref }}\n  cancel-in-progress: true\n\non:\n "
  },
  {
    "path": ".gitignore",
    "chars": 181,
    "preview": "cmake-build-debug*\n*build*\nspconfig.*\n*~\n.DS_Store\n*.swp\n*.srctrl*\n\n# HPC coding conventions\n.clang-format\n.clang-tidy\n."
  },
  {
    "path": ".gitlab-ci.yml",
    "chars": 9120,
    "preview": "include:\n  - project: hpc/gitlab-pipelines\n    file:\n      - spack-build-components.gitlab-ci.yml\n      - github-project"
  },
  {
    "path": ".gitmodules",
    "chars": 544,
    "preview": "[submodule \"external/mod2c\"]\n  path = external/mod2c\n  url = https://github.com/BlueBrain/mod2c\n[submodule \"external/CLI"
  },
  {
    "path": ".readthedocs.yml",
    "chars": 128,
    "preview": "version: 2\n\nconda:\n  environment: docs/conda_environment.yml\n\npython:\n  install:\n    - requirements: docs/docs_requireme"
  },
  {
    "path": ".sanitizers/undefined.supp",
    "chars": 169,
    "preview": "unsigned-integer-overflow:_philox4x32bumpkey(r123array2x32)\nunsigned-integer-overflow:coreneuron::TNode::mkhash()\nunsign"
  },
  {
    "path": "AUTHORS.txt",
    "chars": 507,
    "preview": "Akiko Sato\nAleksandr Ovcharenko\nAlessandro Cattabiani\nAlexander Dietz\nAlexandru Săvulescu\nAntonio Bellotta\nBaudouin Del "
  },
  {
    "path": "CMake/AddHpcCodingConvSubmodule.cmake",
    "chars": 1025,
    "preview": "# =============================================================================\n# Copyright (C) 2016-2021 Blue Brain Pro"
  },
  {
    "path": "CMake/AddMod2cSubmodule.cmake",
    "chars": 1062,
    "preview": "# =============================================================================\n# Copyright (C) 2016-2021 Blue Brain Pro"
  },
  {
    "path": "CMake/AddNmodlSubmodule.cmake",
    "chars": 1038,
    "preview": "# =============================================================================\n# Copyright (C) 2016-2021 Blue Brain Pro"
  },
  {
    "path": "CMake/AddRandom123Submodule.cmake",
    "chars": 1076,
    "preview": "# =============================================================================\n# Copyright (C) 2016-2021 Blue Brain Pro"
  },
  {
    "path": "CMake/CrayPortability.cmake",
    "chars": 1247,
    "preview": "# =============================================================================\n# Copyright (C) 2016-2021 Blue Brain Pro"
  },
  {
    "path": "CMake/GitRevision.cmake",
    "chars": 1075,
    "preview": "# =============================================================================\n# Copyright (C) 2016-2021 Blue Brain Pro"
  },
  {
    "path": "CMake/MakefileBuildOptions.cmake",
    "chars": 8065,
    "preview": "# =============================================================================\n# Copyright (C) 2016-2022 Blue Brain Pro"
  },
  {
    "path": "CMake/OpenAccHelper.cmake",
    "chars": 8336,
    "preview": "# =============================================================================\n# Copyright (C) 2016-2021 Blue Brain Pro"
  },
  {
    "path": "CMake/TestScriptUtils.cmake",
    "chars": 2956,
    "preview": "# =============================================================================\n# Copyright (C) 2016-2021 Blue Brain Pro"
  },
  {
    "path": "CMake/config/CompilerFlagsHelpers.cmake",
    "chars": 6367,
    "preview": "# =============================================================================\n# Copyright (C) 2016-2021 Blue Brain Pro"
  },
  {
    "path": "CMake/config/ReleaseDebugAutoFlags.cmake",
    "chars": 1837,
    "preview": "# =============================================================================\n# Copyright (C) 2016-2021 Blue Brain Pro"
  },
  {
    "path": "CMake/config/SetRpath.cmake",
    "chars": 1259,
    "preview": "# =============================================================================\n# Copyright (C) 2016-2021 Blue Brain Pro"
  },
  {
    "path": "CMake/config/TestHelpers.cmake",
    "chars": 2600,
    "preview": "# =============================================================================\n# Copyright (C) 2016-2021 Blue Brain Pro"
  },
  {
    "path": "CMake/coreneuron-config.cmake.in",
    "chars": 1120,
    "preview": "# =============================================================================\n# Copyright (C) 2016-2022 Blue Brain Pro"
  },
  {
    "path": "CMake/packages/FindSphinx.cmake",
    "chars": 478,
    "preview": "# =============================================================================\n# Copyright (C) 2016-2021 Blue Brain Pro"
  },
  {
    "path": "CMake/packages/Findlikwid.cmake",
    "chars": 1178,
    "preview": "# =============================================================================\n# Copyright (C) 2016-2021 Blue Brain Pro"
  },
  {
    "path": "CMake/packages/Findnmodl.cmake",
    "chars": 1343,
    "preview": "# =============================================================================\n# Copyright (C) 2016-2021 Blue Brain Pro"
  },
  {
    "path": "CMake/packages/Findreportinglib.cmake",
    "chars": 1359,
    "preview": "# =============================================================================\n# Copyright (C) 2016-2021 Blue Brain Pro"
  },
  {
    "path": "CMakeLists.txt",
    "chars": 26636,
    "preview": "# =============================================================================\n# Copyright (c) 2016 - 2022 Blue Brain P"
  },
  {
    "path": "LICENSE.txt",
    "chars": 1512,
    "preview": "Copyright (c) 2016 - 2021 Blue Brain Project/EPFL\nAll rights reserved.\n\nRedistribution and use in source and binary form"
  },
  {
    "path": "README.md",
    "chars": 2031,
    "preview": " :bangbang:\n **NOTE:** The CoreNEURON is now [integrated within NEURON](https://github.com/neuronsimulator/nrn/tree/mast"
  },
  {
    "path": "coreneuron/CMakeLists.txt",
    "chars": 19479,
    "preview": "# =============================================================================\n# Copyright (c) 2016 - 2022 Blue Brain P"
  },
  {
    "path": "coreneuron/apps/coreneuron.cpp",
    "chars": 568,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/apps/corenrn_parameters.cpp",
    "chars": 11817,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2022 Blue Brai"
  },
  {
    "path": "coreneuron/apps/corenrn_parameters.hpp",
    "chars": 6407,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2022 Blue Brai"
  },
  {
    "path": "coreneuron/apps/main1.cpp",
    "chars": 23410,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2022 Blue Brai"
  },
  {
    "path": "coreneuron/config/config.cpp.in",
    "chars": 516,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/config/config.h",
    "chars": 835,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/config/neuron_version.hpp.in",
    "chars": 524,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2022 Blue Brain Proje"
  },
  {
    "path": "coreneuron/config/version_macros.hpp",
    "chars": 1543,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2022 Blue Brain Proje"
  },
  {
    "path": "coreneuron/coreneuron.hpp",
    "chars": 5847,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/engine.h.in",
    "chars": 689,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/gpu/nrn_acc_manager.cpp",
    "chars": 60770,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2022 Blue Brai"
  },
  {
    "path": "coreneuron/gpu/nrn_acc_manager.hpp",
    "chars": 875,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2022 Blue Brai"
  },
  {
    "path": "coreneuron/io/core2nrn_data_return.cpp",
    "chars": 23034,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/io/core2nrn_data_return.hpp",
    "chars": 689,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/io/file_utils.cpp",
    "chars": 1269,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/io/file_utils.hpp",
    "chars": 518,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/io/global_vars.cpp",
    "chars": 5799,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/io/lfp.cpp",
    "chars": 5729,
    "preview": "#include \"coreneuron/io/lfp.hpp\"\n#include \"coreneuron/apps/corenrn_parameters.hpp\"\n\n#include <cmath>\n#include <limits>\n#"
  },
  {
    "path": "coreneuron/io/lfp.hpp",
    "chars": 6019,
    "preview": "#pragma once\n\n#include <array>\n#include <vector>\n\n#include \"coreneuron/mpi/nrnmpi.h\"\n#include \"coreneuron/nrnconf.h\"\n#in"
  },
  {
    "path": "coreneuron/io/mech_report.cpp",
    "chars": 2679,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/io/mech_report.h",
    "chars": 409,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/io/mem_layout_util.cpp",
    "chars": 2209,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/io/mem_layout_util.hpp",
    "chars": 1249,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/io/mk_mech.cpp",
    "chars": 4743,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/io/nrn2core_data_init.cpp",
    "chars": 18860,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2022 Blue Brai"
  },
  {
    "path": "coreneuron/io/nrn2core_direct.h",
    "chars": 5454,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/io/nrn_checkpoint.cpp",
    "chars": 31028,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/io/nrn_checkpoint.hpp",
    "chars": 3176,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2022 Blue Brai"
  },
  {
    "path": "coreneuron/io/nrn_filehandler.cpp",
    "chars": 2699,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/io/nrn_filehandler.hpp",
    "chars": 7814,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/io/nrn_setup.cpp",
    "chars": 45358,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/io/nrn_setup.hpp",
    "chars": 4865,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2022 Blue Brai"
  },
  {
    "path": "coreneuron/io/nrnsection_mapping.hpp",
    "chars": 5270,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/io/output_spikes.cpp",
    "chars": 11060,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/io/output_spikes.hpp",
    "chars": 748,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/io/phase1.cpp",
    "chars": 4237,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/io/phase1.hpp",
    "chars": 752,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/io/phase2.cpp",
    "chars": 50439,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2022 Blue Brai"
  },
  {
    "path": "coreneuron/io/phase2.hpp",
    "chars": 3874,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2022 Blue Brai"
  },
  {
    "path": "coreneuron/io/prcellstate.cpp",
    "chars": 10996,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/io/prcellstate.hpp",
    "chars": 383,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/io/reports/binary_report_handler.cpp",
    "chars": 4372,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/io/reports/binary_report_handler.hpp",
    "chars": 1487,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/io/reports/nrnreport.cpp",
    "chars": 2579,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2022 Blue Brai"
  },
  {
    "path": "coreneuron/io/reports/nrnreport.hpp",
    "chars": 4192,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/io/reports/report_configuration_parser.cpp",
    "chars": 6852,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/io/reports/report_event.cpp",
    "chars": 3521,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/io/reports/report_event.hpp",
    "chars": 1583,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/io/reports/report_handler.cpp",
    "chars": 16165,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/io/reports/report_handler.hpp",
    "chars": 2567,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/io/reports/sonata_report_handler.cpp",
    "chars": 3693,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/io/reports/sonata_report_handler.hpp",
    "chars": 1456,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/io/setup_fornetcon.cpp",
    "chars": 7565,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/io/setup_fornetcon.hpp",
    "chars": 487,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/io/user_params.hpp",
    "chars": 1388,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/mechanism/capac.cpp",
    "chars": 5648,
    "preview": "/***\n  THIS FILE IS AUTO GENERATED DONT MODIFY IT.\n ***/\n/*\n# =========================================================="
  },
  {
    "path": "coreneuron/mechanism/eion.cpp",
    "chars": 10898,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2022 Blue Brai"
  },
  {
    "path": "coreneuron/mechanism/eion.hpp",
    "chars": 449,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/mechanism/mech/cfile/cabvars.h",
    "chars": 931,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/mechanism/mech/enginemech.cpp",
    "chars": 3542,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/mechanism/mech/mod2c_core_thread.hpp",
    "chars": 3723,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2022 Blue Brai"
  },
  {
    "path": "coreneuron/mechanism/mech/mod_func.c.pl",
    "chars": 1135,
    "preview": "#!/usr/bin/perl\n#\n# =============================================================================\n# Copyright (c) 2016 -"
  },
  {
    "path": "coreneuron/mechanism/mech/modfile/exp2syn.mod",
    "chars": 1681,
    "preview": "COMMENT\nTwo state kinetic scheme synapse described by rise time tau1,\nand decay time constant tau2. The normalized peak "
  },
  {
    "path": "coreneuron/mechanism/mech/modfile/expsyn.mod",
    "chars": 404,
    "preview": "NEURON {\n\tPOINT_PROCESS ExpSyn\n\tRANGE tau, e, i\n\tNONSPECIFIC_CURRENT i\n}\n\nUNITS {\n\t(nA) = (nanoamp)\n\t(mV) = (millivolt)\n"
  },
  {
    "path": "coreneuron/mechanism/mech/modfile/hh.mod",
    "chars": 3039,
    "preview": "TITLE hh.mod   squid sodium, potassium, and leak channels\n \nCOMMENT\n This is the original Hodgkin-Huxley treatment for t"
  },
  {
    "path": "coreneuron/mechanism/mech/modfile/netstim.mod",
    "chars": 10638,
    "preview": ": $Id: netstim.mod 2212 2008-09-08 14:32:26Z hines $\n: comments at end\n\n: the Random idiom has been extended to support "
  },
  {
    "path": "coreneuron/mechanism/mech/modfile/passive.mod",
    "chars": 274,
    "preview": "TITLE passive membrane channel\n\nUNITS {\n\t(mV) = (millivolt)\n\t(mA) = (milliamp)\n\t(S) = (siemens)\n}\n\nNEURON {\n\tSUFFIX pas\n"
  },
  {
    "path": "coreneuron/mechanism/mech/modfile/pattern.mod",
    "chars": 2942,
    "preview": ": The spikeout pairs (t, gid) resulting from a parallel network simulation\n: can become the stimulus for any single cpu "
  },
  {
    "path": "coreneuron/mechanism/mech/modfile/stim.mod",
    "chars": 710,
    "preview": "COMMENT\nSince this is an electrode current, positive values of i depolarize the cell\nand in the presence of the extracel"
  },
  {
    "path": "coreneuron/mechanism/mech/modfile/svclmp.mod",
    "chars": 2472,
    "preview": "TITLE svclmp.mod\nCOMMENT\nSingle electrode Voltage clamp with three levels.\nClamp is on at time 0, and off at time\ndur1+d"
  },
  {
    "path": "coreneuron/mechanism/mech_mapping.cpp",
    "chars": 2419,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/mechanism/mech_mapping.hpp",
    "chars": 1485,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/mechanism/mechanism.hpp",
    "chars": 4731,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/mechanism/membfunc.hpp",
    "chars": 8548,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2022 Blue Brai"
  },
  {
    "path": "coreneuron/mechanism/patternstim.cpp",
    "chars": 9069,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/mechanism/register_mech.cpp",
    "chars": 14588,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/mechanism/register_mech.hpp",
    "chars": 843,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/membrane_definitions.h",
    "chars": 1892,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/mpi/core/nrnmpi.hpp",
    "chars": 116,
    "preview": "#pragma once\n\nnamespace coreneuron {\nextern int nrnmpi_numprocs;\nextern int nrnmpi_myid;\n}  // namespace coreneuron\n"
  },
  {
    "path": "coreneuron/mpi/core/nrnmpi_def_cinc.cpp",
    "chars": 386,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/mpi/core/nrnmpidec.cpp",
    "chars": 3675,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/mpi/core/resolve.cpp",
    "chars": 733,
    "preview": "#include <dlfcn.h>\n#include <sstream>\n#include \"../nrnmpi.h\"\n\nnamespace coreneuron {\n// Those functions are part of a me"
  },
  {
    "path": "coreneuron/mpi/lib/mpispike.cpp",
    "chars": 11628,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/mpi/lib/nrnmpi.cpp",
    "chars": 5518,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/mpi/lib/nrnmpi.hpp",
    "chars": 226,
    "preview": "#pragma once\n\n// This file contains functions that does not go outside of the mpi library\nnamespace coreneuron {\nextern "
  },
  {
    "path": "coreneuron/mpi/nrnmpi.h",
    "chars": 2540,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/mpi/nrnmpidec.h",
    "chars": 6398,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/mpi/nrnmpiuse.h",
    "chars": 1000,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/network/cvodestb.cpp",
    "chars": 2478,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/network/have2want.h",
    "chars": 10270,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/network/multisend.cpp",
    "chars": 14158,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/network/multisend.hpp",
    "chars": 814,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2022 Blue Brai"
  },
  {
    "path": "coreneuron/network/multisend_setup.cpp",
    "chars": 25522,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/network/netcon.hpp",
    "chars": 4732,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/network/netcvode.cpp",
    "chars": 21611,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2022 Blue Brai"
  },
  {
    "path": "coreneuron/network/netcvode.hpp",
    "chars": 2343,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/network/netpar.cpp",
    "chars": 26447,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2022 Blue Brai"
  },
  {
    "path": "coreneuron/network/netpar.hpp",
    "chars": 503,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/network/partrans.cpp",
    "chars": 7183,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2022 Blue Brai"
  },
  {
    "path": "coreneuron/network/partrans.hpp",
    "chars": 4642,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/network/partrans_setup.cpp",
    "chars": 10067,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/network/tnode.hpp",
    "chars": 3872,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/network/tqueue.cpp",
    "chars": 16342,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/network/tqueue.hpp",
    "chars": 4622,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2022 Blue Brai"
  },
  {
    "path": "coreneuron/network/tqueue.ipp",
    "chars": 6921,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2022 Blue Brai"
  },
  {
    "path": "coreneuron/nrnconf.h",
    "chars": 1399,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2022 Blue Brai"
  },
  {
    "path": "coreneuron/nrniv/nrniv_decl.h",
    "chars": 2765,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/nrnoc/md1redef.h",
    "chars": 977,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/nrnoc/md2redef.h",
    "chars": 578,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/permute/balance.cpp",
    "chars": 3436,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/permute/cellorder.cpp",
    "chars": 22859,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/permute/cellorder.cu",
    "chars": 4644,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/permute/cellorder.hpp",
    "chars": 4566,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/permute/cellorder1.cpp",
    "chars": 21558,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2022 Blue Brai"
  },
  {
    "path": "coreneuron/permute/cellorder2.cpp",
    "chars": 16041,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/permute/data_layout.cpp",
    "chars": 873,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/permute/data_layout.hpp",
    "chars": 469,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/permute/node_permute.cpp",
    "chars": 16140,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/permute/node_permute.h",
    "chars": 969,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/sim/fadvance_core.cpp",
    "chars": 12850,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2022 Blue Brai"
  },
  {
    "path": "coreneuron/sim/fast_imem.cpp",
    "chars": 2695,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/sim/fast_imem.hpp",
    "chars": 1069,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/sim/finitialize.cpp",
    "chars": 4163,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/sim/multicore.cpp",
    "chars": 6615,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/sim/multicore.hpp",
    "chars": 7994,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/sim/scopmath/abort.cpp",
    "chars": 2976,
    "preview": "/******************************************************************************\n *\n * File: abort.c\n *\n * Copyright (c) "
  },
  {
    "path": "coreneuron/sim/scopmath/crout_thread.hpp",
    "chars": 7878,
    "preview": "/*\n# =============================================================================\n# Originally crout.c from SCoP librar"
  },
  {
    "path": "coreneuron/sim/scopmath/errcodes.h",
    "chars": 2172,
    "preview": "/*\n# =============================================================================\n# Originally errcodes.h from SCoP lib"
  },
  {
    "path": "coreneuron/sim/scopmath/newton_struct.h",
    "chars": 720,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2022 Blue Brai"
  },
  {
    "path": "coreneuron/sim/scopmath/newton_thread.cpp",
    "chars": 1352,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2022 Blue Brai"
  },
  {
    "path": "coreneuron/sim/scopmath/newton_thread.hpp",
    "chars": 7691,
    "preview": "/*\n# =============================================================================\n# Originally newton.c from SCoP libra"
  },
  {
    "path": "coreneuron/sim/scopmath/sparse_thread.hpp",
    "chars": 21537,
    "preview": "/*\n# =============================================================================\n# Originally sparse.c from SCoP libra"
  },
  {
    "path": "coreneuron/sim/scopmath/ssimplic_thread.hpp",
    "chars": 2066,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2022 Blue Brai"
  },
  {
    "path": "coreneuron/sim/solve_core.cpp",
    "chars": 2664,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/sim/treeset_core.cpp",
    "chars": 6611,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/utils/ivocvect.cpp",
    "chars": 877,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/utils/ivocvect.hpp",
    "chars": 1840,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2022 Blue Brai"
  },
  {
    "path": "coreneuron/utils/lpt.cpp",
    "chars": 2151,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/utils/lpt.hpp",
    "chars": 503,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/utils/memory.cpp",
    "chars": 1768,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/utils/memory.h",
    "chars": 7565,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2022 Blue Brai"
  },
  {
    "path": "coreneuron/utils/memory_utils.cpp",
    "chars": 4122,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/utils/memory_utils.h",
    "chars": 1036,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/utils/nrn_assert.h",
    "chars": 924,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/utils/nrn_stats.cpp",
    "chars": 3191,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/utils/nrn_stats.h",
    "chars": 645,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/utils/nrnmutdec.hpp",
    "chars": 1604,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/utils/nrnoc_aux.cpp",
    "chars": 3369,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/utils/nrnoc_aux.hpp",
    "chars": 1013,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/utils/nrntimeout.cpp",
    "chars": 2113,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/utils/offload.hpp",
    "chars": 8644,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2022 Blue Brai"
  },
  {
    "path": "coreneuron/utils/profile/profiler_interface.h",
    "chars": 8827,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/utils/progressbar/progressbar.cpp",
    "chars": 8722,
    "preview": "/**\n * \\file\n * \\author Trevor Fountain\n * \\author Johannes Buchner\n * \\author Erik Garrison\n * \\date 2010-2014\n * \\copy"
  },
  {
    "path": "coreneuron/utils/progressbar/progressbar.hpp",
    "chars": 3660,
    "preview": "/**\n * \\file\n * \\author Trevor Fountain\n * \\author Johannes Buchner\n * \\author Erik Garrison\n * \\date 2010-2014\n * \\copy"
  },
  {
    "path": "coreneuron/utils/randoms/nrnran123.cpp",
    "chars": 7633,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2022 Blue Brai"
  },
  {
    "path": "coreneuron/utils/randoms/nrnran123.h",
    "chars": 5837,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2022 Blue Brai"
  },
  {
    "path": "coreneuron/utils/string_utils.cpp",
    "chars": 517,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  },
  {
    "path": "coreneuron/utils/string_utils.h",
    "chars": 1090,
    "preview": "/*\n# =============================================================================\n# Copyright (c) 2016 - 2021 Blue Brai"
  }
]

// ... and 46 more files (download for full content)

About this extraction

This page contains the full source code of the BlueBrain/CoreNeuron GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 246 files (1.3 MB), approximately 346.3k tokens, and a symbol index with 928 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!