NeuralEnsemble / PyNN

A Python package for simulator-independent specification of neuronal network models.
Other
276 stars 126 forks source link

Modification in convergent_connect to speed up the building of connections #694

Closed RCagnol closed 3 years ago

RCagnol commented 3 years ago

We noticed that since NEST 2.16, the nest GetConnections function takes a lot more time to run. As the GetConnections function is called in the PyNN function convergent_connect (in nest.projections) for connections with specific parameters other than delay and weight, this created a big slow down in our model during the building of the connections. That's why I modified this PyNN code to limit the call of the nest GetConnections function. We obtained a great speed up in our model during the building of connections (from 2 whole days to 45 minutes), and the new version of the code seems to pass all the PyNN tests. Hence I was thinking that sharing these modification could be maybe interesting for you.

In the code I wrote, the GetConnections function is called only if the common synapse properties have not been identified yet, otherwise all the connection parameters are set directly when calling the NEST Connect function, and not through the NEST SetStatus function. The exceptions to this are the parameter init_flag which produces a connection error (in the PyNN tests "test_create_with_homogeneous_common_properties" and "test_create_with_native_synapse") when passed in the GetConnections function as it apparently can't deal with boolean parameters, and the parameter "synapse_id" (in the two same PyNN tests, and in this case I can't really understand what's the problem) so the SetStatus function is used for these two parameters.

coveralls commented 3 years ago

Coverage Status

Coverage decreased (-51.6%) to 0.0% when pulling ed5de7e0dcd5f29b4f07b9ca2a15710e673c8ef2 on RCagnol:master into 002e36fa6438251e26fff3f6ea6b38c2aa853c30 on NeuralEnsemble:master.

apdavison commented 3 years ago

Hi @RCagnol thanks for these significant improvements. The PyNN system tests for NEST also seem to run much faster now!

I've made a few more changes following on from your PR. Please could you try the latest master branch and let me know how it works with Mozaik?

RCagnol commented 3 years ago

Hello @apdavison, I'm glad to hear that. I just tested your most recent changes on Mozaik and everything seems to works fine.