-
Notifications
You must be signed in to change notification settings - Fork 30
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
Extract common subexpressions #1852
Conversation
Add option to extract common subexpressions during code generation (at the model function level, not added to `w`). Disabled by default, can be enabled via environment variable `AMICI_EXTRACT_CSE=1`. For large models, this may significantly reduce file size and speed up compilation. Downside: The resulting files are hard to read / debug. With my test model (SBML import, 2 processes, sequential compilation with clang14, -O2): | | before | after | |-----------------|----------------|----------------| | import time | 160 min (100%) | 164 min (103%) | | code size | 89 MB (100%) | 27 MB (30%) | | compile time | 169 min (100%) | 90 min (53%) | | compile RAM | 7.49 GB (100%) | 1.18 GB (16%) |
Codecov Report
@@ Coverage Diff @@
## develop #1852 +/- ##
===========================================
+ Coverage 76.27% 76.68% +0.41%
===========================================
Files 74 74
Lines 12851 13551 +700
===========================================
+ Hits 9802 10392 +590
- Misses 3049 3159 +110
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
👍 Please document usage of environment variable. Maybe it makes sense to introduce a dedicated doc page that lists and explains all available environment variables?
Oh, and maybe add a test that runs cse on a nontrivial testcase? |
SonarCloud Quality Gate failed. |
Benchmarking in #1852 was done with `cse(..., ignore=None)`. Turns out, passing symbols to ignore makes things 1000x slower. Here we toposort the original and extracted expressions together, instead of ignoring any dependent-symbols.
Benchmarking in #1852 was done with `cse(..., ignore=None)`. Turns out, passing symbols to ignore makes things 1000x slower. Here we toposort the original and extracted expressions together, instead of ignoring any dependent symbols.
Add option to extract common subexpressions during code generation (at the model function level, not added to
w
).Disabled by default, can be enabled via environment variable
AMICI_EXTRACT_CSE=1
.For large models, this may significantly reduce file size and speed up compilation.
Downside: The resulting files are hard to read / debug.
With my test model (SBML import, 2 processes, sequential compilation with clang14, -O2):
(*) lowest out of 20 identical simulations using ASA