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
[MRG] Caching and small run preparation improvements #832
Merged
Merged
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
347620c
Make `CodeString`, `SingleEquation` and `Equations` comparable/hashable
mstimberg ea4e03f
Implement caching for state updates
mstimberg 1d286df
Cache subexpression substitution in equations
mstimberg b714416
Cache `make_statements`
mstimberg 12b1843
Use more conservative approach for caching regarding variables
mstimberg d4c3bdc
Small speed improvement for `sympy_to_str`
mstimberg c0e4850
Make `SympyNodeRenderer` emit sympy objects directly
mstimberg 88dc2ad
Cache `sympy_to_str` and `str_to_sympy`
mstimberg 011820d
Cache `CodeObject`
mstimberg a1bfddc
Translate variables to the namespace for every run (the same `CodeObj…
mstimberg fa200a9
Make hashable function more generic and avoid storing strong referenc…
mstimberg 05c9544
Fix handling of True/False for sympy on Python 3
mstimberg 6d16492
Use the `_hashable` function consistently
mstimberg a30371f
Store the variable references in a `CodeObject` as weak references
mstimberg 83ac3e7
Empty the `CodeObject`'s namespace after every run
mstimberg fdd50de
Hold strong references for dynamic function implementations to save t…
mstimberg 049a654
numpy: Translate `Function` objects to their implementation only when…
mstimberg 49eef8c
Allow weak references to the Cython spike queue
mstimberg 6803457
numpy's `rand`/`randn` functions cannot be weakly referenced directly…
mstimberg 402de76
Compare to `None` directly instead of checking for `NoneType` (not co…
mstimberg 5cff0ed
Revert commits related to `CodeObject` caching
mstimberg ca1dfb2
Cache `parse_statement`
mstimberg 3b34b53
Cache `CodeGenerator.translate`
mstimberg fb5d6d7
Use a description of `Variable` objects to decide whether they are su…
mstimberg 8633c7b
Cache `parse_string_equations`
mstimberg 38b4360
Avoid changing the underlying `_equations` dictionary of an `Equation…
mstimberg eea3189
Take dependencies into account when caching code
mstimberg ffde29e
Deal with the function namespace when converting from variables to na…
mstimberg dc1378e
Avoid filling up the logs with errors from "make clean"
mstimberg b6f9e1e
Use all variables' owners instead of the dependencies (otherwise, ind…
mstimberg 26c6229
Add the preferences to the cache key since they can influence the gen…
mstimberg 09f83c8
Add two tests for potential caching problems
mstimberg 3158274
Revert caching of `CodeGenerator.translate`
mstimberg 04b0310
Fix a minor display issue for equations
mstimberg 6d47a46
Fix a regression in `sympy_to_str`: function names where no longer tr…
mstimberg 280f8d7
Merge branch 'master' into stateupdate_caching
mstimberg ca0e8a1
Merge branch 'master' into stateupdate_caching
mstimberg a6d74b9
Move the caching code into a `cached` decorator
mstimberg a56484f
Introduce a general `_state_tuple` function for all `Variable` objects
mstimberg 407a0f8
Implement a general `_state_tuple` property for `SingleEquation` as well
mstimberg b070223
Remove unused function `replace_constants`
mstimberg 598a74d
Add two small test cases for parsing/str-to-sympy conversion
mstimberg 4298e47
Merge branch 'master' into stateupdate_caching
mstimberg f921573
Temporarily force use of Sphinx < 1.6.3
mstimberg 404779d
Move `_state_tuple` code into `CacheKey` mixin class
mstimberg File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
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.
Is the idea here that previously we looked for static arrays, but since the only way they can be accessed is by a function that we can just insert function namespaces instead?
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.
More or less: it is part of a fundamental change how function namespaces (most important use case is
TimedArray
) where added. Previously, we added them to the originalvariables
dictionary at some point. This screwed up caching, because thevariables
were used as part of the cache key earlier and therefore should not change. For this specific bit of code we therefore no longer search for those arrays as part of thevariables
dictionary, but explicitly add them from theFunction
.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.
OK!