-
Notifications
You must be signed in to change notification settings - Fork 391
Code re-organization for shorter build times (or taming the 96% troll) #2956
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
Conversation
jougs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What a heroic effort! 👏 🎉
I have added two inline comments that apply to all of the models changed here.
And one more thing: Could it be smart to change the function signature of register_*() to accept the name under which the model will be registered as an argument?
That way, the call to the function could decide what the name should be and the generator for the modelsmodule could be extended later on to support a modelset syntax like "iaf_psc_alpha -> standard_neuron"
Thanks 😊!
You are right, should not be hard to fix. |
|
@heplesser: can you maybe prioritize this? I'd love to have this in the module refactoring PR and time is running out... |
On it! |
jougs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many thanks for addressing my concerns. I wholeheartedly approve ;-)
terhorstd
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The register_* functions are an unnecessary trigger for the template instantiation which could also be achieved in a oneline declaration, but seeing the symmetry to the other "register" mechanisms could be OK here. These template considerations should go to into a different PR.
Thanks for fighting this troll! 👍
This PR re-organizes the way in which node and connection models are registered in modelsmodule. Up to now, compiling
modelsmodule.cpptriggers a large number of template instantiations and compiling this file alone takes about 112 seconds on my MacBook Pro with Apple Clang 15. This causes a noticeable wait during compilation around 96% complete. And this happens every time you touch the h-file for a single model. Experiments indicate that of the 112s, about 90s were spent on synapse models and 11s on node models. Even with allregister*calls commented out compiling the file took still about 9s—not really surprising given thatmodelsmodule.iiis some 166.000 lines long after all#includes have been handle (yes onehundredandsixtysixthousand).To avoid this single stumbling block, this PR ensures that each model forces its own template instantiation. It does to by declaring (in the h-file) and defining (in the cpp-file) a function
This function is then called from
multimeter.cpp. The function is not declared as a (static) method because some neuron models are templated classes themselves, so we need a method outside the class.Since there is now a specific function to register each model, I decided to call the function
register_<name>for all kind of models, with no distinction between nodes and synapses.I had to add cpp-files for all synapses which did not yet have one to have a compilation unit in which the respective templates can be instantiated.
I auto-generated the changes with an ipython notebook (you can find it accidentally commited a few commits back), so the placement of declarations and definitions might not be perfect but was dictated by what a reasonably simple parser could achieve.
So what is the outcome?
make -j128is down from about 5 minutes to about 3.5 minutes.touch iaf_psc_alpha.h: With current master, you will wait for about 2 minutes, with the change here you will be done after less than 20 seconds.Many files are changed here, but practically all files are changed in the same way.
I give this one high priority because it will make developers so much happier and more productive :).