Use show_time for sparse AD backends#326
Conversation
|
I also tested it with the example in the documentation: julia> @elapsed begin
nlp = ADNLPModel!(f, xi, lvar, uvar, [1], [1], T[1], c!, lcon, ucon; hessian_backend = ADNLPModels.EmptyADbackend, show_time=true)
end
gradient backend ADNLPModels.ForwardDiffADGradient: 2.3452e-5 seconds;
hprod backend ADNLPModels.ForwardDiffADHvprod: 0.000875063 seconds;
jprod backend ADNLPModels.ForwardDiffADJprod: 2.0362e-5 seconds;
jtprod backend ADNLPModels.ForwardDiffADJtprod: 2.1778e-5 seconds;
• Sparsity pattern detection of the Jacobian: 1.114339083 seconds.
• Coloring of the sparse Jacobian: 0.005564487 seconds.
• Allocation of the AD buffers for the sparse Jacobian: 4.063e-6 seconds.
jacobian backend ADNLPModels.SparseADJacobian: 1.120131293 seconds;
hessian backend ADNLPModels.EmptyADbackend: 6.645e-6 seconds;
ghjvprod backend ADNLPModels.ForwardDiffADGHjvprod: 3.881e-6 seconds.
1.126924784julia> @elapsed begin
Is = Vector{Int}(undef, 4 * (N - 1))
Js = Vector{Int}(undef, 4 * (N - 1))
Vs = ones(Bool, 4 * (N - 1))
for i = 1:(N - 1)
Is[((i - 1) * 4 + 1):(i * 4)] = [i; i; i; i]
Js[((i - 1) * 4 + 1):(i * 4)] = [i; i + 1; N + i; N + i + 1]
end
J = sparse(Is, Js, Vs, N - 1, n)
end
0.161432748julia> @elapsed begin
Is = Vector{Int}(undef, 4 * (N - 1))
Js = Vector{Int}(undef, 4 * (N - 1))
Vs = ones(Bool, 4 * (N - 1))
for i = 1:(N - 1)
Is[((i - 1) * 4 + 1):(i * 4)] = [i; i; i; i]
Js[((i - 1) * 4 + 1):(i * 4)] = [i; i + 1; N + i; N + i + 1]
end
J = sparse(Is, Js, Vs, N - 1, n)
jac_back = ADNLPModels.SparseADJacobian(n, f, N - 1, c!, J, show_time=true);
nlp = ADNLPModel!(f, xi, lvar, uvar, [1], [1], T[1], c!, lcon, ucon; hessian_backend = ADNLPModels.EmptyADbackend, jacobian_backend = jac_back);
end
• Coloring of the sparse Jacobian: 0.005673536 seconds.
• Allocation of the AD buffers for the sparse Jacobian: 3.4547e-5 seconds.
0.191296527 |
|
@amontoison do you mean that it shows how much time is spent for the automatic detection? PS. side note: recent PR in ADNLPModels fail on buildkite; I have a rough idea of what is does (it's not free, AFAIR), what is the benefit in you case? do you recommend it? |
|
@jbcaillau |
|
Buildkite is free if you request your packages to be part of JuliaGPU CI buildkite: We can have CI with GPU for free on all platforms (NVIDIA, AMD, Intel, Apple). It's why I installed on it Krylov.jl, MadNLP.jl, ExaModels.jl, etc... I also use buildkite to test some extensions like Enzyme / Zygote in ADNLPModels.jl. |
|
If you use GPU in your packages, I highly recommend it! |
Benchmark resultJudge resultBenchmark Report for /home/runner/work/ADNLPModels.jl/ADNLPModels.jlJob Properties
ResultsA ratio greater than
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoTargetBaselineTarget resultBenchmark Report for /home/runner/work/ADNLPModels.jl/ADNLPModels.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoBaseline resultBenchmark Report for /home/runner/work/ADNLPModels.jl/ADNLPModels.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoRuntime information
|
Benchmark resultJudge resultBenchmark Report for /home/runner/work/ADNLPModels.jl/ADNLPModels.jlJob Properties
ResultsA ratio greater than
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoTargetBaselineTarget resultBenchmark Report for /home/runner/work/ADNLPModels.jl/ADNLPModels.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoBaseline resultBenchmark Report for /home/runner/work/ADNLPModels.jl/ADNLPModels.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoRuntime information
|
Benchmark resultJudge resultBenchmark Report for /home/runner/work/ADNLPModels.jl/ADNLPModels.jlJob Properties
ResultsA ratio greater than
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoTargetBaselineTarget resultBenchmark Report for /home/runner/work/ADNLPModels.jl/ADNLPModels.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoBaseline resultBenchmark Report for /home/runner/work/ADNLPModels.jl/ADNLPModels.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoRuntime information
|
Benchmark resultJudge resultBenchmark Report for /home/runner/work/ADNLPModels.jl/ADNLPModels.jlJob Properties
ResultsA ratio greater than
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoTargetBaselineTarget resultBenchmark Report for /home/runner/work/ADNLPModels.jl/ADNLPModels.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoBaseline resultBenchmark Report for /home/runner/work/ADNLPModels.jl/ADNLPModels.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoRuntime information
|
close #325
cc @PierreMartinon @jbcaillau
It helps determine how much time you can gain by detecting the sparsity pattern yourself.