Skip to content

Add OPF benchmark #2739

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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions perf/opf/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[deps]
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
Ipopt = "b6b21f68-93f8-5de0-b562-5493be1d77c9"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
PowerModels = "c36e90e8-916a-50a6-bd94-075b64ef4655"
Copy link
Member

Choose a reason for hiding this comment

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

These need compat

30 changes: 30 additions & 0 deletions perf/opf/opf.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
ROSETTA_OPF_DIR = "/home/blegat/git/rosetta-opf"
Copy link
Member

Choose a reason for hiding this comment

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

Can we use Downloads to download the file to a temp directory?

include(joinpath(ROSETTA_OPF_DIR, "jump.jl"))
model = opf_model(parse_data(joinpath(ROSETTA_OPF_DIR, "data/opf_warmup.m")))
Copy link
Member

Choose a reason for hiding this comment

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

It's not useful to test this one. You really need a much larger file to stress test the code paths.

import MathOptInterface as MOI
JuMP.optimize!(model)
ipopt = JuMP.unsafe_backend(model)
ipopt.nlp_model
ad = ipopt.nlp_data.evaluator
x = ipopt.inner.x
g = zeros(length(ipopt.nlp_data.constraint_bounds))
bench0(ad, x, g)
bench1(ad, x, g)
bench2(ad, x, g)

function bench0(ad, x, y)
@time MOI.eval_constraint(ad, g, x)
end

function bench1(ad, x, y)
J = @time MOI.jacobian_structure(ad)
V = zeros(length(J))
@time MOI.eval_constraint_jacobian(ad, V, x)
end

function bench2(ad, x, y)
J = @time MOI.hessian_lagrangian_structure(ad)
V = zeros(length(J))
σ = 1.0
@time MOI.eval_hessian_lagrangian(ad, V, x, σ, y)
end
Loading