From 2d762b3593499ccf35e7ef0cc4baaaf3cdb20ce6 Mon Sep 17 00:00:00 2001 From: "Viral B. Shah" <744411+ViralBShah@users.noreply.github.com> Date: Sat, 2 Nov 2024 12:09:45 -0400 Subject: [PATCH] Manual commit for PR #550 to backport to 1.10 (#577) * Disable nested dissection (from #550) * Update CI for Julia 1.10 --------- Co-authored-by: Viral B. Shah --- .github/workflows/ci.yml | 23 +++++++++++++---------- src/solvers/cholmod.jl | 28 ++++++++++++++++++---------- 2 files changed, 31 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index faeaf424..5a9fad11 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,24 +22,26 @@ jobs: fail-fast: false matrix: version: - - '~1.10.0-0' + - '1.10' os: - ubuntu-latest - - macOS-latest - windows-latest arch: - x64 - - x86 - exclude: + include: - os: macOS-latest + arch: aarch64 + version: '1.10' + - os: ubuntu-latest arch: x86 + version: '1.10' steps: - - uses: actions/checkout@v2 - - uses: julia-actions/setup-julia@v1 + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} - - uses: actions/cache@v1 + - uses: actions/cache@v4 env: cache-name: cache-artifacts with: @@ -55,17 +57,18 @@ jobs: env: SPARSEARRAYS_AQUA_TEST: true - uses: julia-actions/julia-processcoverage@v1 - - uses: codecov/codecov-action@v1 + - uses: codecov/codecov-action@v4 with: file: lcov.info + token: ${{ secrets.CODECOV_TOKEN }} + docs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: julia-actions/setup-julia@latest with: - # version: '1.6' - version: 'nightly' + version: '1.10' - name: Generate docs run: | julia --color=yes -e 'write("Project.toml", replace(read("Project.toml", String), r"uuid = .*?\n" =>"uuid = \"3f01184e-e22b-5df5-ae63-d93ebab69eaf\"\n"));' diff --git a/src/solvers/cholmod.jl b/src/solvers/cholmod.jl index 731eaa3f..97ca426e 100644 --- a/src/solvers/cholmod.jl +++ b/src/solvers/cholmod.jl @@ -1258,25 +1258,33 @@ end ## Compute that symbolic factorization only function symbolic(A::Sparse{<:VTypes, Ti}; - perm::Union{Nothing,AbstractVector{<:Integer}}=nothing, - postorder::Bool=isnothing(perm)||isempty(perm), userperm_only::Bool=true) where Ti + perm::Union{Nothing,AbstractVector{<:Integer}}=nothing, + postorder::Bool=isnothing(perm)||isempty(perm), + userperm_only::Bool=true, + nested_dissection::Bool=false) where Ti sA = unsafe_load(pointer(A)) sA.stype == 0 && throw(ArgumentError("sparse matrix is not symmetric/Hermitian")) - @cholmod_param postorder = postorder begin - if perm === nothing || isempty(perm) # TODO: deprecate empty perm - return analyze(A) - else # user permutation provided - if userperm_only # use perm even if it is worse than AMD - @cholmod_param nmethods = 1 begin + # The default is to just use AMD. Use nested dissection only if explicitly asked for. + # https://github.com/JuliaSparse/SparseArrays.jl/issues/548 + # https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/26ababc7f3af725c5fb9168a1b94850eab74b666/CHOLMOD/Include/cholmod.h#L555-L574 + @cholmod_param nmethods = (nested_dissection ? 0 : 2) begin + @cholmod_param postorder = postorder begin + if perm === nothing || isempty(perm) # TODO: deprecate empty perm + return analyze(A) + else # user permutation provided + if userperm_only # use perm even if it is worse than AMD + @cholmod_param nmethods = 1 begin + return analyze_p(A, Ti[p-1 for p in perm]) + end + else return analyze_p(A, Ti[p-1 for p in perm]) end - else - return analyze_p(A, Ti[p-1 for p in perm]) end end end + end function cholesky!(F::Factor{Tv}, A::Sparse{Tv};