-
Notifications
You must be signed in to change notification settings - Fork 5
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
Increase performance via symmetry of Hessian #151
Conversation
I would say this is breaking, yes. Maybe we could just do sparse(Symmetric(sparse(...))) at the very end, that's very fast |
Should we make the change with our next breaking release though?
I've handled it manually. :) |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #151 +/- ##
==========================================
+ Coverage 91.92% 91.94% +0.02%
==========================================
Files 38 38
Lines 1498 1503 +5
==========================================
+ Hits 1377 1382 +5
Misses 121 121 ☔ View full report in Codecov by Sentry. |
Benchmark resultJudge resultBenchmark Report for /home/runner/work/SparseConnectivityTracer.jl/SparseConnectivityTracer.jlJob Properties
ResultsA ratio greater than
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoTarget
Baseline
Target resultBenchmark Report for /home/runner/work/SparseConnectivityTracer.jl/SparseConnectivityTracer.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 versioninfo
Baseline resultBenchmark Report for /home/runner/work/SparseConnectivityTracer.jl/SparseConnectivityTracer.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 versioninfo
Runtime information
|
I've never seen a single Hessian result appear in any of the hundreds of Benchmark results we've produced over the years. Maybe they get discarded because they get run with too few samples? I can't believe this PR didn't result in a performance improvement. |
If you unfold and |
Even weirder, when you check the CI logs, the Hessian benchmarks also run for the baseline branch |
I get a decent speed-up when running the This PRjulia> include("benchmark/hessian.jl")
hessbench_randomsparsity (generic function with 1 method)
julia> method = TracerSparsityDetector()
TracerSparsityDetector{SparseConnectivityTracer.GradientTracer{SparseConnectivityTracer.IndexSetGradientPattern{Int64, BitSet}}, SparseConnectivityTracer.HessianTracer{SparseConnectivityTracer.IndexSetHessianPattern{Int64, BitSet, Set{Tuple{Int64, Int64}}, false}}}()
julia> N, K = 200, 16
(200, 16)
julia> x = rand(N);
julia> f = ArrowHead(K)
ArrowHead(16)
julia> @benchmark hessian_sparsity($f, $x, $method)
BenchmarkTools.Trial: 389 samples with 1 evaluation.
Range (min … max): 11.577 ms … 16.529 ms ┊ GC (min … max): 0.00% … 23.09%
Time (median): 12.855 ms ┊ GC (median): 8.48%
Time (mean ± σ): 12.845 ms ± 548.286 μs ┊ GC (mean ± σ): 7.83% ± 3.41%
▆▆▆▆▅▆█▁▂▁▃▂
▂▄▄▆▄▇▄▄▃▃▃▁▃▂▁▁▁▂▁▂▄▄▆▄▆████████████▇▄▆▄▂▃▄▃▃▂▄▃▃▂▂▄▂▁▄▂▂▃▄ ▄
11.6 ms Histogram: frequency by time 14.1 ms <
Memory estimate: 42.39 MiB, allocs estimate: 98757.
|
Closes #34.
By only keeping track of index-tuples$(i, j)$ with $i≤j$ , the size of all "Hessian-sets" is reduced by roughly half.
As seen in #135, the size of sets plays a large role in the performance of SCT as it affects the performance of union operations.
This PR changes the output type ofhessian_sparsity
fromSparseMatrixCSC{Bool, Int64}
toSymmetric{Bool, SparseArrays.SparseMatrixCSC{Bool, Int64}}
.Is this (a) desired and (b) should this be considered breaking? (Ping @gdalle for the matrix coloring perspective)