Skip to content

Support NEST 3.11 - #870

Open
apdavison wants to merge 2 commits into
NeuralEnsemble:masterfrom
apdavison:nest-3.11
Open

apdavison wants to merge 2 commits into
NeuralEnsemble:masterfrom
apdavison:nest-3.11

Conversation

@apdavison

@apdavison apdavison commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

NEST 3.11 changes the C++ synapse API: nest::Connection takes a second template parameter (the delay type, e.g. nest::TotalDelay), and check_connection() takes an additional syn_id argument. As a result, the pynn_extensions module (simple_stochastic_synapse, stochastic_stp_synapse) does not compile against NEST 3.11.

Here, we add a small header, nest_compat.h, which detects NEST ≥ 3.11 and provides a pynn::NestConnection<T> alias for the appropriate base class. check_connection() has a version for each API. NEST provides only a version string, not numeric version macros, so detection uses __has_include("delay_types.h"), a header introduced in 3.11. The extensions still build against earlier NEST versions.

In addition, since nest/nest-simulator#3533 (in 3.11rc2), NEST may reorder connections when simulating, so a SynapseCollection obtained before Simulate() returns mismatched data afterwards. Currently, Projection caches the result of GetConnections() and only refreshes it after new connections are created, so attributes read after a run can be attributed to the wrong connections. Here, we refresh the cache after every run, using a generation counter in place of the single global "stale" flag, which also ensures that every projection, not just the first one, refreshes its cache.

We also remove -Dwith-python=ON from the Makefile. The option no longer exists in NEST 3.11, which now treats unknown CMake options as errors. It defaulted to ON in earlier versions.

Tested with NEST 3.11.0rc2, NEURON 9.0.2, Brian2 2.11.0 and Arbor 0.12.2 on macOS (arm64): 958 passed, 2 failed. The two failures are in test/system/test_nest_nestml.py. Synapse code generated by NESTML 9.0.1 has the same incompatibility with the NEST 3.11 Connection API, so this needs fixing in NESTML. With NEST 3.10.0, the unit tests and the NEST system and scenario tests pass.

To build NEST 3.11.0rc2 with the Makefile without Boost installed, pass -Dwith-boost=OFF via EXTRA_CMAKE_ARGS (Boost is now enabled by default).

NEST 3.11 adds a delay-type template parameter to nest::Connection and a syn_id argument to check_connection(). NEST has no numeric version macros, so nest_compat.h detects 3.11+ by the presence of delay_types.h, which first appears in that release.

The with-python CMake option was removed in NEST 3.11, which now rejects unknown options; it defaulted to ON in earlier versions.

Verified that the extensions build and test_nest.py passes against both NEST 3.10.0 and 3.11.0rc1.
@coveralls

coveralls commented Dec 1, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 74.205% (+0.005%) from 74.2% — apdavison:nest-3.11 into NeuralEnsemble:master

Since NEST 3.11rc2 (nest/nest-simulator#3533), connections may be reordered when simulating, and a SynapseCollection obtained before Simulate() then returns the source of one connection with the target and parameters of another. Projection.get() therefore returned wrong weights after a run (test_scenario3 failed with NaN p-value).

The single global stale flag also meant that only the first projection to refresh its cache saw it; a generation counter fixes this too.
@apdavison apdavison changed the title Support NEST 3.11 in the PyNN NEST extensions Support NEST 3.11 Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants