Repository navigation
small_kkt_large_factor: k = 50 only with MKL Pardiso, k = 10 elsewhere - #561
Merged
Merged
Conversation
The test is there for MKL Pardiso's PARDISO_MIN_THREADED_NNZ branch (#538): the symbolic phase is redone on MKL's threads when a small KKT matrix has a large factor. Only MKL has that branch, but every backend solved the 2500 x 2500 instance. Under Valgrind that was 10.3 of the job's 27 minutes (478 s dense, 137 s CG, 2 s QDLDL), and about 23 s of the Windows dense step. MKL Pardiso keeps k = 50: the KKT matrix has 1.7e4 nonzeros and AMD's factor 1.27e5, a 2.5x margin over the 5e4 threshold for Pardiso's own ordering, which the test cannot see. The other backends solve the same problem at k = 10. The backend is fixed at link time (scs_get_lin_sys_method, as other tests use it). On the Mac the suite covers the same library lines and branches with either size on QDLDL, CG, dense and Accelerate, and the test takes under 3 ms on each (was 37, 934, 1228 and 52 ms). The residual line now prints the backend and k, so the MKL jobs' logs show k = 50. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bodono
marked this pull request as ready for review
November 24, 2026 18:44
bodono
added a commit
that referenced
this pull request
Nov 24, 2026
master adds #558 (eigCG deflation in the GPU indirect solver, shared linsys/eigcg.{c,h}, test_deflation.h) and #561 (small_kkt_large_factor size per backend). One conflict, test/run_tests.c MU_TOTAL_TESTS: this branch had 108 (106 + test_g_rollback, test_factor_rollback), master 109 (106 + test_eigcg_gram_factor, test_eigcg_core, test_lin_sys_deflation). Both sides' tests are kept, so it is 111, the number of mu_run_test calls in all_tests(). Everything else merged without conflict (docs/src/linear_solver/index.rst, include/glbopts.h: the two sides edit different paragraphs). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
small_kkt_large_factor(#538) exists for one branch of the MKL Pardiso backend, but every backend solved its 2500 x 2500 instance. It now solves k = 50 (n = m = 2500) only with MKL Pardiso, and the same problem at k = 10 (n = m = 100) everywhere else.Request (maintainer, 2026-11-24): "Let's make the valgrind test faster as you suggest".
Why
PARDISO_MIN_THREADED_NNZ(5e4 nonzeros) gets its symbolic phase on one thread. If the factor Pardiso then reports (iparm[17]) has 5e4 nonzeros or more, the handle is released and the symbolic phase is redone on MKL's threads (linsys/mkl/direct/private.c). The test checks that the solve is still right after that. No other backend has this branch.82a5383fit took 10.3 of the Valgrind job's 27.2 minutes (dense 478 s, CG 137 s, QDLDL 2 s), more than any other test there. The job had taken 11-13 minutes before MKL Pardiso: run small linear systems on one thread #538 merged. It also took about 23 s of the Windows dense step's 28-32 s (inferred from a gap in the log, because Windows output is fully buffered), and 12.3 s of the simulated GPU CG run's 61 s.What changes
Only
test/problems/small_kkt_large_factor.hchanges:k = strstr(scs_get_lin_sys_method(), "mkl") ? 50 : 10. The backend is fixed when the test binary is linked, so each binary always runs the same instance. Other tests already branch on the method string this way. Onlysparse-direct-mkl-pardisocontains "mkl".small_kkt_large_factor: sparse-direct-mkl-pardiso, k = 50: ...), so the MKL jobs' logs show which instance ran.No other test, workflow or setting changes, and
MU_TOTAL_TESTSstays the same.Why MKL keeps k = 50
The branch needs two things: the KKT matrix below 5e4 nonzeros, and Pardiso's factor at or above 5e4. The KKT matrix has 7k^2 - 4k nonzeros, which is below 5e4 up to k = 84. The factor comes from Pardiso's own nested dissection ordering (
iparm[1] = 3). That cannot be computed without MKL, and it can change with the MKL version. Here is AMD's factor, computed with SCS's bundled AMD on the same pattern:By AMD, the smallest k that takes the branch is 35. Pardiso's ordering is different, so its smallest k cannot be derived here. Keeping k = 50 keeps #538's exact instance, with a margin of about 2.5x over the threshold. MKL is not run under Valgrind or on Windows in CI, so the large instance costs nothing in those jobs.
What k = 10 loses on the other backends
Nothing measured:
src/andlinsys/for the whole suite, master against this branch. QDLDL, CG, dense and Accelerate each cover the same library lines (6140, 5196, 4778 and 4854), and no branch that was taken before is lost.CUDSS_MIN_PRODUCT_NNZ. Both sizes (660 and 17,300 KKT nonzeros) fall on the same side of it at its default (6e4) and in the CI build that sets it to 0. GPU CG has no size rule.Measurements
Mac M4 with Apple clang: median of 3 interleaved runs, with per-test times from line timestamps.
Expected in CI: the Valgrind/Mac ratios measured per test on master are about 55-75x for QDLDL, 45-145x for CG and 400-1000x for dense. At those ratios the test costs under 1 s under Valgrind. Measured in this PR's CI: the Valgrind job took 14m42s (PR run) and 16m48s (push run), against 27.2 min on master, and the Windows dense step took 8 s or less, against 28-32 s.
Verification
sparse-direct-mkl-pardiso, k = 50(residual 3.2e-15, as before). The CMake MKL jobs also run it, throughctest, which prints nothing for passing tests.🤖 Generated with Claude Code