-
Notifications
You must be signed in to change notification settings - Fork 0
feat(solver): significantly improve solver performance #103
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
base: main
Are you sure you want to change the base?
Conversation
perf(Solver): further improvements to solver
rohanku
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.
Left some basic comments, will need to take a more careful look at your unsafe code/null space logic.
.gitignore
Outdated
| *.tsbuildinfo | ||
|
|
||
| # Ignore timing files | ||
| *.txt |
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.
Don't want to exclude all txt files since they are sometimes useful (e.g. requirements.txt for Python), you can make your timing files have a .log suffix and exclude that.
Cargo.toml
Outdated
| geometry = { version = "0.7", registry = "substrate" } | ||
| enumify = { version = "0.2", registry = "substrate" } | ||
|
|
||
| [profile.release] |
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.
Remove this, don't want release to always be in debug mode.
core/compiler/.gitignore
Outdated
| build/ | ||
|
|
||
| # Ignore timing files | ||
| *.txt |
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.
Same as above.
| [dependencies] | ||
| derive-where = { version = "1", features = ["serde"] } | ||
| nalgebra = "0.34" | ||
| nalgebra = { version = "0.34", features = ["rayon"] } |
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.
Run cargo-udeps to make sure all these dependencies are being used.
core/compiler/Cargo.toml
Outdated
|
|
||
| [build-dependencies] | ||
| lrpar = { version = "0.13", features = ["serde"] } | ||
| #trying sparse |
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.
Remove comment.
core/compiler/src/solver.rs
Outdated
| { | ||
| let val = round(sol[(i as usize, 0)]); | ||
| self.solved_vars.insert(Var(i), val); | ||
| let mut var_map = vec![usize::MAX; n_vars]; //og matrix -> shrunk matrix |
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.
Remove/edit comments
core/compiler/src/solver.rs
Outdated
| use std::fs::OpenOptions; | ||
| use std::io::Write; | ||
|
|
||
| let time_str = format!( |
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.
Remove this or use tracing to log things (use the trace! macro).
core/compiler/src/solver.rs
Outdated
| }); | ||
| solver.solve(); | ||
| assert_relative_eq!(*solver.solved_vars.get(&x).unwrap(), 5., epsilon = EPSILON); | ||
| assert_relative_eq!(*solver.solved_vars.get(&y).unwrap(), 5., epsilon = EPSILON); |
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.
Why is this changed?
flamegraph.svg
Outdated
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.
Remove
package-lock.json
Outdated
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 is this for?
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 editor are you using? Seems like it's adding new lines to everything.
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.
Can you write some unit tests for the solver? We don't do any solver correctness checks in our "integration" tests.
No description provided.