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

Remove out-dated precompile.jl and simplify compile_workload #3871

Merged
merged 4 commits into from
Nov 6, 2024

Conversation

odow
Copy link
Member

@odow odow commented Nov 5, 2024

There's no point compiling methods for MockOptimzer, and we now use a concrete CachingOptimizer type. If solvers need better recompilation, they can now do it in their package.

As examples, see:

src/JuMP.jl Outdated Show resolved Hide resolved
Copy link

codecov bot commented Nov 6, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 99.00%. Comparing base (b016cdd) to head (0ba2749).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
src/JuMP.jl 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3871      +/-   ##
==========================================
+ Coverage   98.80%   99.00%   +0.19%     
==========================================
  Files          44       43       -1     
  Lines        6038     6026      -12     
==========================================
  Hits         5966     5966              
+ Misses         72       60      -12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@odow
Copy link
Member Author

odow commented Nov 6, 2024

I didn't think this would regress, but it did:

(hgh_precompile) pkg> st
Status `/private/tmp/hgh_precompile/Project.toml`
  [87dc4568] HiGHS v1.11.0
  [4076af6c] JuMP v1.23.3

julia> @time using JuMP, HiGHS
  1.836396 seconds (1.14 M allocations: 80.307 MiB, 2.01% gc time, 0.91% compilation time)

julia> @time begin
         model = Model(HiGHS.Optimizer)
         set_silent(model)
         @variable(model, x >= 0)
         @variable(model, 0 <= y <= 3)
         @objective(model, Min, 12x + 20y)
         @constraint(model, c1, 6x + 8y >= 100)
         @constraint(model, c2, 7x + 12y >= 120)
         optimize!(model)
       end
  0.122040 seconds (77.83 k allocations: 5.237 MiB, 95.64% compilation time)

to

(hgh_precompile) pkg> st
Status `/private/tmp/hgh_precompile/Project.toml`
  [87dc4568] HiGHS v1.11.0
  [4076af6c] JuMP v1.23.3 `https://github.com/jump-dev/JuMP.jl.git#od/precompile`

julia> @time using JuMP, HiGHS
  1.868888 seconds (1.14 M allocations: 79.608 MiB, 1.94% gc time, 0.88% compilation time)

julia> @time begin
         model = Model(HiGHS.Optimizer)
         set_silent(model)
         @variable(model, x >= 0)
         @variable(model, 0 <= y <= 3)
         @objective(model, Min, 12x + 20y)
         @constraint(model, c1, 6x + 8y >= 100)
         @constraint(model, c2, 7x + 12y >= 120)
         optimize!(model)
       end
  0.333175 seconds (201.20 k allocations: 13.715 MiB, 98.47% compilation time)

@odow
Copy link
Member Author

odow commented Nov 6, 2024

With jump-dev/HiGHS.jl#249 this is back to

julia> @time using JuMP, HiGHS
  1.942927 seconds (1.17 M allocations: 81.800 MiB, 1.32% gc time, 0.92% compilation time)

julia> @time begin
           model = Model(HiGHS.Optimizer)
           set_silent(model)
           @variable(model, x >= 0)
           @variable(model, 0 <= y <= 3)
           @objective(model, Min, 12x + 20y)
           @constraint(model, c1, 6x + 8y >= 100)
           @constraint(model, c2, 7x + 12y >= 120)
           optimize!(model)
       end
  0.093417 seconds (45.31 k allocations: 2.997 MiB, 94.63% compilation time)

@odow
Copy link
Member Author

odow commented Nov 6, 2024

At the start of the year it was (https://jump.dev/milestones/2024/01/30/jump_year_in_review/)

julia> @time using JuMP, HiGHS
  2.645880 seconds (1.17 M allocations: 82.527 MiB, 4.00% gc time, 0.85% compilation time)

julia> @time begin
         model = Model(HiGHS.Optimizer)
         set_silent(model)
         @variable(model, x >= 0)
         @variable(model, 0 <= y <= 3)
         @objective(model, Min, 12x + 20y)
         @constraint(model, c1, 6x + 8y >= 100)
         @constraint(model, c2, 7x + 12y >= 120)
         optimize!(model)
       end
  0.214786 seconds (241.91 k allocations: 16.071 MiB, 97.47% compilation time: 45% of which was recompilation)

so this is nice progress.

src/JuMP.jl Outdated Show resolved Hide resolved
src/JuMP.jl Outdated Show resolved Hide resolved
@odow
Copy link
Member Author

odow commented Nov 6, 2024

For posterity, my other script was:

using SnoopCompileCore
using JuMP, HiGHS
tinf = @snoop_inference begin
    model = Model(HiGHS.Optimizer)
    set_silent(model)
    @variable(model, x >= 0)
    @variable(model, 0 <= y <= 3)
    @objective(model, Min, 12x + 20y)
    @constraint(model, c1, 6x + 8y >= 100)
    @constraint(model, c2, 7x + 12y >= 120)
    optimize!(model)
end;
using SnoopCompile, ProfileView
fg = flamegraph(tinf)
ProfileView.view(fg)

@odow odow merged commit cb441df into master Nov 6, 2024
10 of 11 checks passed
@odow odow deleted the od/precompile branch November 6, 2024 04:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant