From 93dd1a42da6ac7f15dee104b1ce976c2149e15d5 Mon Sep 17 00:00:00 2001 From: Alexis Montoison Date: Fri, 5 Apr 2024 11:56:41 -0400 Subject: [PATCH] Move ordering in CudssSolverOptions --- lib/MadNLPGPU/src/cudss.jl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/MadNLPGPU/src/cudss.jl b/lib/MadNLPGPU/src/cudss.jl index 9b36cafe..218b8616 100644 --- a/lib/MadNLPGPU/src/cudss.jl +++ b/lib/MadNLPGPU/src/cudss.jl @@ -4,6 +4,7 @@ import SparseArrays @kwdef mutable struct CudssSolverOptions <: MadNLP.AbstractOptions # Use LDLᵀ by default in CUDSS as Cholesky can lead to undefined behavior. cudss_algorithm::MadNLP.LinearFactorization = MadNLP.LDL + ordering::Symbol = :default end mutable struct CUDSSSolver{T} <: MadNLP.AbstractLinearSolver{T} @@ -20,7 +21,6 @@ function CUDSSSolver( csc::CUSPARSE.CuSparseMatrixCSC{T}; opt=CudssSolverOptions(), logger=MadNLP.MadNLPLogger(), - ordering::Symbol=:default ) where T n, m = size(csc) @assert n == m @@ -45,18 +45,18 @@ function CUDSSSolver( data = CUDSS.CudssData() solver = CUDSS.CudssSolver(matrix, config, data) - if ordering != :default - if ordering == :metis + if opt.ordering != :default + if opt.ordering == :metis A = SparseMatrixCSC(csc) G = Metis.graph(A, check_hermitian=false) perm, iperm = Metis.permutation(G) cudss_set(solver, "user_perm", perm) - elseif ordering == :amd + elseif opt.ordering == :amd A = SparseMatrixCSC(csc) perm = AMD.amd(A) cudss_set(solver, "user_perm", perm) else - error("The ordering $ordering is not supported.") + error("The ordering $(opt.ordering) is not supported.") end end