Skip to content
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

Added precompilation for nonnegative least squares #809

Merged
merged 3 commits into from
Aug 29, 2024

Conversation

aris-mav
Copy link
Contributor

Please refer to discourse post:
https://discourse.julialang.org/t/excessively-long-ttfx-with-optimization-and-optimizationoptimjl/118457/7

Checklist

  • Appropriate tests were added
  • Any code changes were done in a way that does not break public API
  • All documentation related to code changes were updated
  • The new code follows the
    contributor guidelines, in particular the SciML Style Guide and
    COLPRAC.
  • Any new documentation only uses public API

Additional context

Add any other context about the problem here.

@ChrisRackauckas
Copy link
Member

Note that if you really just need NonlinearLeastSquaresProblem, the things in NonlinearSolve.jl will be faster. We need to document that better.

@aris-mav aris-mav changed the title Added precompilation for nonlinear least squares Added precompilation for nonnegative least squares Aug 24, 2024
@aris-mav
Copy link
Contributor Author

Note that if you really just need NonlinearLeastSquaresProblem, the things in NonlinearSolve.jl will be faster. We need to document that better.

Thanks for the suggestion.
Note that in this case I made a slight mistake in the commit title, although the contents seem alrght.
The keyword should be nonnegative instead of nonliear (although I reckon the constraint would also make it nonlinear in a sense, if I'm not wrong).

Copy link
Member

@ChrisRackauckas ChrisRackauckas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to update the project toml

@aris-mav
Copy link
Contributor Author

Need to update the project toml

Just updated it, sorry forgot to do that previously.

@ChrisRackauckas
Copy link
Member

Looks good. @Vaibhavdixit02 is that a failure on master?

@Vaibhavdixit02
Copy link
Member

@arismavridis could you post the flamegraphs you had put on discourse here as well. Will merge this soon but wanted to get a better understanding of the improvements, also did you run timings for the example you had that triggered this?

@Vaibhavdixit02 Vaibhavdixit02 merged commit 9c4f74d into SciML:master Aug 29, 2024
23 of 26 checks passed
@aris-mav
Copy link
Contributor Author

This is the precompilation for 4x4 matrix:
https://github.com/user-attachments/assets/82b91bf7-f702-4977-8a5d-dfa4d5ef9340

and this is for 35x35 (with 4x4 already precompiled):
https://github.com/user-attachments/assets/09ab6acf-2f94-40c9-aca2-d4add7c1f870

As for timings, do you mean before and after precompilation?
If so, these would be :

@time solve_problem(rand(10,100),rand(10))  #1st run
95.392393 seconds (7.30 M allocations: 638.607 MiB, 0.29% gc time, 99.61% compilation time)

@time solve_problem(rand(10,100),rand(10))  #2nd run
1.916750 seconds (334.38 k allocations: 819.706 MiB, 1.86% gc time).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants