Skip to content

Commit

Permalink
fix benchmarks on julia 1.11
Browse files Browse the repository at this point in the history
  • Loading branch information
frapac committed Dec 14, 2024
1 parent 304386c commit 4df225e
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 14 deletions.
4 changes: 2 additions & 2 deletions HybridKKT.jl/benchmarks/COPS/benchmark.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

using Comonicon
import Comonicon
using COPSBenchmark

include(joinpath(@__DIR__, "..", "common.jl"))
Expand Down Expand Up @@ -100,7 +100,7 @@ function run_benchmark(bench_solver, instances, ntrials; use_gpu=false, options.
return results
end

@main function main(;
Comonicon.@main function main(;
solver="all",
verbose::Bool=false,
quick::Bool=false,
Expand Down
4 changes: 2 additions & 2 deletions HybridKKT.jl/benchmarks/OPF/benchmark.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


using Comonicon
import Comonicon

include(joinpath(@__DIR__, "..", "common.jl"))
include(joinpath(@__DIR__, "model.jl"))
Expand Down Expand Up @@ -213,7 +213,7 @@ function run_benchmark(benchmark, cases, ntrials; use_gpu=false, options...)
return results
end

@main function main(;
Comonicon.@main function main(;
solver="all",
verbose::Bool=false,
quick::Bool=false,
Expand Down
4 changes: 2 additions & 2 deletions HybridKKT.jl/benchmarks/OPF/benchmark_kkt.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

using Comonicon
import Comonicon

include(joinpath(@__DIR__, "..", "common.jl"))
include(joinpath(@__DIR__, "model.jl"))
Expand Down Expand Up @@ -42,7 +42,7 @@ function benchmark_kkt(solver, ntrials)
)
end

@main function main(;
Comonicon.@main function main(;
case="pglib_opf_case78484_epigrids.m",
ntrials::Int=3,
gamma::Float64=1e7,
Expand Down
4 changes: 2 additions & 2 deletions HybridKKT.jl/benchmarks/OPF/benchmark_linear_solvers.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

using Comonicon
import Comonicon

include(joinpath(@__DIR__, "..", "common.jl"))
include(joinpath(@__DIR__, "model.jl"))
Expand Down Expand Up @@ -84,7 +84,7 @@ function benchmark_cholmod(K, ntrials)
)
end

@main function main(;
Comonicon.@main function main(;
case="pglib_opf_case78484_epigrids.m",
ntrials::Int=10,
gamma::Float64=1e7
Expand Down
4 changes: 2 additions & 2 deletions HybridKKT.jl/benchmarks/OPF/hybrid_convergence.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

using Comonicon
import Comonicon

include(joinpath(@__DIR__, "..", "common.jl"))
include(joinpath(@__DIR__, "model.jl"))
Expand Down Expand Up @@ -31,7 +31,7 @@ function solve_hybrid(nlp, gamma; options...)
)
end

@main function main(; solver="all", case="pglib_opf_case78484_epigrids.m", tol=1e-4)
Comonicon.@main function main(; solver="all", case="pglib_opf_case78484_epigrids.m", tol=1e-4)
if !isdir(RESULTS_DIR)
mkpath(RESULTS_DIR)
end
Expand Down
4 changes: 2 additions & 2 deletions HybridKKT.jl/benchmarks/OPF/relaxation_convergence.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@

using Comonicon
import Comonicon

include(joinpath(@__DIR__, "..", "common.jl"))
include(joinpath(@__DIR__, "model.jl"))

const PGLIB_PATH = joinpath(artifact"PGLib_opf", "pglib-opf-23.07")
const RESULTS_DIR = joinpath(@__DIR__, "..", "..", "results", "condensed")

@main function main(; verbose::Bool=false, case="pglib_opf_case78484_epigrids.m")
Comonicon.@main function main(; verbose::Bool=false, case="pglib_opf_case78484_epigrids.m")
if !isdir(RESULTS_DIR)
mkpath(RESULTS_DIR)
end
Expand Down
18 changes: 16 additions & 2 deletions HybridKKT.jl/benchmarks/cdc/benchmark.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

using Comonicon
import Comonicon
using COPSBenchmark

include(joinpath(@__DIR__, "..", "common.jl"))
Expand Down Expand Up @@ -60,7 +60,7 @@ function run_benchmark(bench_solver, ntrials; gamma=1e7, use_gpu=false, options.
return [depth results]
end

@main function main(;
Comonicon.@main function main(;
solver="all",
verbose::Bool=false,
quick::Bool=false,
Expand Down Expand Up @@ -134,6 +134,20 @@ end
writedlm(output_file, results)
end

if (solver == "all" || solver == "cudss") && CUDA.has_cuda()
@info "[CUDA] Benchmark SparseKKTSystem+CUDSS"
results = run_benchmark(
build_cudss_solver,
ntrials;
maxit=max_iter,
use_gpu=false,
tol=tol,
print_level=print_level,
)
output_file = joinpath(RESULTS_DIR, "cops-$(flag)-madnlp-cudss-lu.csv")
writedlm(output_file, results)
end

if (solver == "all" || solver == "sckkt-cuda") && CUDA.has_cuda()
@info "[CUDA] Benchmark SparseCondensedKKTSystem+CUDSS"
results = run_benchmark(
Expand Down
12 changes: 12 additions & 0 deletions HybridKKT.jl/benchmarks/common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@ function build_ma57_solver(nlp; options...)
)
end

function build_cudss_solver(nlp; options...)
return MadNLPSolver(
nlp;
linear_solver=MadNLPGPU.CUDSSSolver,
kkt_system=MadNLP.SparseKKTSystem,
cudss_algorithm=MadNLP.LU,
equality_treatment=MadNLP.EnforceEquality,
fixed_variable_treatment=MadNLP.MakeParameter,
options...,
)
end

function build_sckkt_solver(nlp; options...)
solver = MadNLP.MadNLPSolver(
nlp;
Expand Down

0 comments on commit 4df225e

Please sign in to comment.