Fix connection generator code to work with PyNEST-NG#3784
Draft
jessica-mitchell wants to merge 2 commits intonest:mainfrom
Draft
Fix connection generator code to work with PyNEST-NG#3784jessica-mitchell wants to merge 2 commits intonest:mainfrom
jessica-mitchell wants to merge 2 commits intonest:mainfrom
Conversation
Contributor
|
Solving this will be more complicated, since we need to figure out how to interface It turns out that our CSA tests have not run for a long time in the CI, they are always skipped because either CSA or libneurosim is not properly installed. |
Contributor
Author
|
OK should i Just close this one then? |
Contributor
Leave it open, it contains some useful information. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a solution found by Claude code.
csa_example.py and csa_spatial_example.py both worked in Docker container with these modifications
The following text and code changes were done with AI:
pynest/pynestkernel_aux.hconngenmodule.hinclude; replaceDatum*-returningCYTHON_unpackConnectionGeneratorDatumwithCYTHON_insertConnectionGeneratorthat storesshared_ptr<ConnectionGenerator>into aboost::anyDictionary slotpynest/nestkernel_api.pxdcdef externdeclarations forCYTHON_isConnectionGeneratorandCYTHON_insertConnectionGeneratorpynest/nestkernel_api.pyxelif CYTHON_isConnectionGeneratorbranch inpydict_to_Dictionarybefore theAttributeErrorfallthroughpynest/CMakeLists.txt${LIBNEUROSIM_LIBRARIES}tonestkernel_apilink librariesnestkernel/conn_builder_conngen.cppparams_mapindices aslongnotsize_t;static_casttosize_tFix: ConnectionGenerator (libneurosim/CSA) support in pynest-ng
Background
When pynest-ng (Cython) was merged into
main, the ConnectionGeneratorintegration from the old SWIG-based pynest was not fully ported. There are
three distinct problems:
Problem 1 —
pynestkernel_aux.hexists but is broken and unusedThe file
pynest/pynestkernel_aux.hwas carried over from the SWIG era butwas never wired into pynest-ng. It has two bugs that make it unusable as-is:
Bug A — includes a module that no longer exists:
This line causes a compile error if the header is ever included while
HAVE_LIBNEUROSIMis defined.Bug B — returns
Datum*, which is incompatible with pynest-ng:pynest-ng does not use the SLI
Datumtype. All values are stored inboost::anyfields inside aDictionary. A function returningDatum*cannotbe used to insert a ConnectionGenerator into a pynest-ng Dictionary.
Problem 2 —
pydict_to_Dictionaryhas no ConnectionGenerator branchnestkernel_api.pyxfalls through toraise AttributeErrorfor any type itdoes not recognise.
pynestkernel_aux.his not included and its macros arenever called:
Problem 3 —
conn_builder_conngen.cppreadsparams_mapassize_tboost::anyrequires an exact type match.pydict_to_Dictionarystores Pythonintvalues aslong, but the conngen builder reads them assize_t:Reproducer
With NEST built with
libneurosimsupport:The existing test suite in
testsuite/pytests/connect/test_connect_conngen.pycovers all four conngenscenarios and serves as the regression suite for this fix.