Skip to content

Add developer documentation for managers in NEST #3465

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
3813eaa
set up exhale breathe
jessica-mitchell Jan 25, 2023
23a5d97
remove xml
jessica-mitchell Feb 7, 2023
2b1cd57
try out exhale less files
jessica-mitchell Feb 7, 2023
a1d9132
adjust fulldoc conf
jessica-mitchell May 12, 2023
f371d5d
Merge branch 'master' into devdocs-html
jessica-mitchell May 12, 2023
ee84ed6
add doxygen xml files
jessica-mitchell May 23, 2023
2c6c7d0
comment out exhale, add jinja
jessica-mitchell May 23, 2023
c41967d
add python script to get class names, add rst jinja
jessica-mitchell May 23, 2023
ed5cb1e
modify doxygen config
jessica-mitchell May 23, 2023
c8b65eb
add border around classes and highlith titles cpp
jessica-mitchell May 25, 2023
b1420f8
update python script and outputfiles
jessica-mitchell May 25, 2023
59e629a
add conf for test case and update test files
jessica-mitchell May 25, 2023
d1921d0
add docs about workflow for cpp build docs
jessica-mitchell May 25, 2023
c0ef4cc
test io
jessica-mitchell Jun 13, 2023
5d5faa5
remove dot from doxyfile
jessica-mitchell Nov 8, 2023
bd864a2
typo
jessica-mitchell Aug 21, 2024
98182f7
Merge branch 'master' into devdocs-html
jessica-mitchell Aug 21, 2024
c9f4362
test various config
jessica-mitchell Aug 22, 2024
1a28d49
try to remove hard dependency for mermaid version
jessica-mitchell Mar 25, 2025
b003438
create manager pages in dev space
jessica-mitchell Mar 25, 2025
ebda1a4
add toc
jessica-mitchell Mar 25, 2025
d2e4fa1
Merge branch 'master' into devdocs-html
jessica-mitchell Mar 25, 2025
c1c77ca
update managers
jessica-mitchell Mar 27, 2025
e644417
fix up conf
jessica-mitchell Mar 27, 2025
271a8ca
add breathe
jessica-mitchell Mar 27, 2025
f198a6e
add text
jessica-mitchell Mar 31, 2025
ab9efac
modify manager text diagrams
jessica-mitchell Apr 2, 2025
5da9dfb
Merge branch 'master' into devdocs-html
jessica-mitchell Apr 8, 2025
e6c7db0
update manager docs - sp music in detail
jessica-mitchell Apr 10, 2025
c547886
remove superfluous files
jessica-mitchell Apr 10, 2025
b82c213
minor updates
jessica-mitchell Apr 10, 2025
bcf7c99
get doxygen to run on rtd
jessica-mitchell Apr 10, 2025
bc0acbc
update conf
jessica-mitchell Apr 10, 2025
c12a491
index manager pages
jessica-mitchell Apr 10, 2025
4418fad
undo changes to fulldoc
jessica-mitchell Apr 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,875 changes: 2,875 additions & 0 deletions doc/htmldoc/Doxyfile

Large diffs are not rendered by default.

24 changes: 19 additions & 5 deletions doc/htmldoc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
sys.path.append(pynest_dir)

# -- General configuration ------------------------------------------------
read_the_docs_build = os.environ.get("READTHEDOCS", None) == "True"

if read_the_docs_build:
subprocess.call("doxygen Doxyfile", shell=True)

source_suffix = ".rst"
master_doc = "index"
Expand All @@ -52,6 +56,7 @@
"sphinxcontrib.mermaid",
"sphinx.ext.mathjax",
"sphinx_carousel.carousel",
"breathe",
"sphinxcontrib.plantuml",
"add_button_notebook",
"IPython.sphinxext.ipython_console_highlighting",
Expand All @@ -67,6 +72,14 @@

autodoc_mock_imports = ["nest.pynestkernel", "nest.ll_api"]
mathjax_path = "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"

# Setup the breathe extension
breathe_projects = {"NEST Simulator": "./_doxygen/xml"}
breathe_default_project = "NEST Simulator"
breathe_domain_by_extension = {
"h": "cpp",
}

# Add any paths that contain templates here, relative to this directory.
templates_path = ["templates"]

Expand All @@ -93,10 +106,10 @@
copybutton_only_copy_prompt_lines = True

mermaid_output_format = "raw"
mermaid_version = "10.3.0"

# mermaid_version = "10.3.0"
# disable require js - mermaid doesn't work if require.js is loaded before it
nbsphinx_requirejs_path = ""

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
Expand Down Expand Up @@ -196,8 +209,9 @@
html_show_sphinx = False
html_show_copyright = False

# This way works for ReadTheDocs
# With this local 'make html' is broken!
# https://www.sphinx-doc.org/en/master/extdev/appapi.html#sphinx-core-events


github_doc_root = ""

intersphinx_mapping = {
Expand All @@ -210,7 +224,7 @@
"neat": ("https://nest-neat.readthedocs.io/en/latest/", None),
"neuromorph": ("https://electronicvisions.github.io/hbp-sp9-guidebook/", None),
"arbor": ("https://docs.arbor-sim.org/en/latest/", None),
"tvb": ("https://docs.thevirtualbrain.org/", None),
# "tvb": ("https://docs.thevirtualbrain.org/", None),
"extmod": ("https://nest-extension-module.readthedocs.io/en/latest/", None),
}

Expand Down
5 changes: 5 additions & 0 deletions doc/htmldoc/developer_space/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ Developer guides

* :ref:`vim_sli`

.. grid-item-card:: Managers in NEST

* :ref:`Understand how managers work <managers_dev>`

.. toctree::
:maxdepth: 1
:hidden:
Expand All @@ -123,3 +127,4 @@ Developer guides
templates/*
sli_docs/index
cppcomments
managers/index
13 changes: 13 additions & 0 deletions doc/htmldoc/developer_space/managers/connection_manager.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.. _connection_manager:

Connection Manager
==================


The ConnectionManager in NEST efficiently manages synaptic connections between neurons and devices using source-table
structures, supporting dynamic network modifications via structural plasticity and connection rules. It tracks
connection counts, handles parallel execution resizing, and ensures disabled connections are removed to maintain network
integrity.

.. doxygenclass:: nest::ConnectionManager
:members:
14 changes: 14 additions & 0 deletions doc/htmldoc/developer_space/managers/event_delivery_manager.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.. _event_delivery_manager:

Event Delivery Manager
======================

The EventDeliveryManager coordinates the delivery of events (e.g., spikes, data) between nodes in NEST simulations,
managing buffers and routing events across MPI processes for distributed computing.
It handles timing through moduli-based time slicing, optimizes communication via send/receive buffers, and ensures
accurate event delivery even for off-grid spikes and secondary events like data updates.
This manager is essential for maintaining simulation accuracy and scalability, particularly in large-scale parallel
simulations with complex event routing requirements.

.. doxygenclass:: nest::EventDeliveryManager
:members:
102 changes: 102 additions & 0 deletions doc/htmldoc/developer_space/managers/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
.. _managers_dev:

Managers in NEST
================

At the heart of NEST are various
managers, each responsible for specific aspects of the simulation process.


The ManagerInterface provides a common interface for all managers, defining standard methods and properties.

The KernelManager acts as the core, coordinating the other managers that specialize in different aspects of the
simulation.

:ref:`KernelManager <kernel_manager>` initializes all managers in dependency order:

- :ref:`nest::LoggingManager <logging_manager>`
- :ref:`nest::MPIManager <mpi_manager>`
- :ref:`nest::VPManager <vp_manager>`
- :ref:`nest::ModuleManager <module_manager>`
- :ref:`nest::RandomManager <random_manager>`
- :ref:`nest::SimulationManager <simulation_manager>`
- :ref:`nest::ModelRangeManager <modelrange_manager>`
- :ref:`nest::ConnectionManager <connection_manager>`
- :ref:`nest::SPManager <sp_manager>`
- :ref:`nest::EventDeliveryManager<event_delivery_manager>`
- :ref:`nest::IOManager <io_manager>`
- :ref:`nest::ModelManager <model_manager>`
- :ref:`nest::MUSICManager <music_manager>`
- :ref:`nest::NodeManager <node_manager>`



Main control flow
-----------------

1. **Initialization**:
- The Kernel Manager initializes the simulation environment, allocating resources and setting up initial configurations.
- The Simulation Manager sets up the simulation based on defined parameters.

2. **Node and Connection Setup**:
- The Node Manager creates and configures nodes.
- The Connection Manager establishes connections between nodes.

3. **Model Application**:
- The Model Manager loads and applies models to nodes and connections.
- The SP Manager applies synaptic plasticity rules as needed.

4. **Simulation Execution**:
- The Simulation Manager oversees the execution phase, with the Event Delivery Manager ensuring events are processed correctly.
- The MPI Manager handles parallel processing tasks if the simulation is distributed.

5. **Data Handling**:
- The IO Manager reads configuration files and writes simulation results.
- The Logging Manager captures diagnostic information for debugging.

6. **Cleanup**:
- The Simulation Manager ensures resources are cleaned up after the simulation completes.


Advanced Architectural Features
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- **Policy-based template pattern for manager customization**:
- The policy-based template pattern is used to customize specific manager behaviors, allowing developers to extend functionality without modifying core logic.

- **Thread-local storage for performance-critical components**:
- Thread-local storage is employed for performance-critical components to minimize contention and improve parallel execution efficiency.

- **Double dispatch pattern for event handling**:
- The double dispatch pattern is used for event handling, enabling dynamic and type-safe event processing across different node and connection types.

- **MPI-agnostic interfaces through manager abstraction**:
- MPI-agnostic interfaces are provided through manager abstraction, allowing the simulation to run seamlessly with or without MPI, enhancing flexibility and portability.

- **Multiple synchronization strategies**:

- **MPI_Barrier** is used for global synchronization to ensure all processes reach a certain point before proceeding.
- **OpenMP locks** are employed for shared memory parallelism to manage access to shared resources.
- **Atomic operations** are used for spike counter updates to ensure thread-safe increments without locks.
- **RAII patterns** are used for resource management to ensure proper acquisition and release of resources.



.. toctree::
:hidden:

connection_manager
event_delivery_manager
io_manager
mpi_manager
node_manager
music_manager
random_manager
sp_manager
vp_manager
logging_manager
kernel_manager
module_manager
modelrange_manager
simulation_manager
model_manager
14 changes: 14 additions & 0 deletions doc/htmldoc/developer_space/managers/io_manager.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.. _io_manager:

IO Manager
==========


The IOManager in NEST coordinates input/output operations, managing data paths, file prefixes, and file-overwrite
settings. It registers and routes data between recording/stimulation devices and their respective backends (e.g.,
handling file I/O for spike data or parameter logging). It ensures devices communicate with the correct backend while
deferring logging responsibilities to the LoggingManager.


.. doxygenclass:: nest::IOManager
:members:
14 changes: 14 additions & 0 deletions doc/htmldoc/developer_space/managers/kernel_manager.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.. _kernel_manager:

Kernel Manager
==============

The KernelManager in NEST manages the initialization and finalization of all simulation managers in a specific order to
resolve dependencies and ensure proper setup. It acts as a singleton, providing centralized control over configuration,
status queries, and simulation resets. Additionally, it tracks a fingerprint to detect changes and maintain consistency
across multiple runs.



.. doxygenclass:: nest::KernelManager
:members:
13 changes: 13 additions & 0 deletions doc/htmldoc/developer_space/managers/logging_manager.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.. _logging_manager:

Logging Manager
===============

The LoggingManager in NEST centralizes logging by filtering messages based on severity levels and delivering them to
registered clients, ensuring thread safety with OpenMP. It enforces proper parameter usage by checking dictionary
entries and supports customizable output through callback functions, such as console logging or external tools.



.. doxygenclass:: nest::LoggingManager
:members:
17 changes: 17 additions & 0 deletions doc/htmldoc/developer_space/managers/model_manager.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.. _model_manager:

Model Manager
=============


The ModelManager is responsible for managing node and connection models,
including their registration, copying, and configuration. It handles the initialization
and finalization of models, sets default parameters, and manages memory for node models.
The class also provides functionality for calibrating models and retrieving their status.
The code is designed to work in a multi-threaded environment, ensuring that
models are correctly managed across different threads. The ModelManager plays a crucial
role in the simulation framework by providing a centralized way to handle various models and their configurations.


.. doxygenclass:: nest::ModelManager
:members:
13 changes: 13 additions & 0 deletions doc/htmldoc/developer_space/managers/modelrange_manager.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.. _modelrange_manager:

ModelRange Manager
==================


The ModelRangeManager in NEST groups node IDs into contiguous ranges per model, enabling efficient model lookups via
binary search and minimizing storage by merging adjacent ranges. It tracks first/last node IDs and provides methods to
retrieve models for specific nodes, ensuring fast access during simulations.


.. doxygenclass:: nest::ModelRangeManager
:members:
13 changes: 13 additions & 0 deletions doc/htmldoc/developer_space/managers/module_manager.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.. _module_manager:

Module Manager
==============

The ModuleManager is responsible for managing dynamic modules. Its primary functions include initializing and finalizing
modules, loading and unloading them dynamically, and handling their status. The class ensures that modules can be
safely installed and reinitialized, and it manages the search path for dynamic libraries, making it an essential
component for extending the simulator's functionality with external modules.


.. doxygenclass:: nest::ModuleManager
:members:
12 changes: 12 additions & 0 deletions doc/htmldoc/developer_space/managers/mpi_manager.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.. _mpi_manager:

MPI manager
===========

The MPIManager in NEST manages MPI initialization and configuration checks to ensure proper setup for distributed
simulations. It facilitates inter-process communication using MPI functions such as Allgather and Allreduce, and
synchronizes processes with barriers. Additionally, it handles node-to-process mappings and enforces correct MPI usage
to prevent runtime errors.

.. doxygenclass:: nest::MPIManager
:members:
Loading
Loading