From 75eaa18eaf8f568975cba48e0cc3cbd5b54dab1d Mon Sep 17 00:00:00 2001 From: Ian Butterworth Date: Fri, 16 May 2025 23:33:23 -0400 Subject: [PATCH 1/2] fix libsuitesparseconfig bug --- src/solvers/cholmod.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/solvers/cholmod.jl b/src/solvers/cholmod.jl index 557412cb..dfcbd5bb 100644 --- a/src/solvers/cholmod.jl +++ b/src/solvers/cholmod.jl @@ -37,7 +37,7 @@ import SparseArrays: AbstractSparseMatrix, SparseMatrixCSC, indtype, sparse, spz import ..increment, ..increment! using ..LibSuiteSparse -import ..LibSuiteSparse: TRUE, FALSE, CHOLMOD_INT, CHOLMOD_LONG +import ..LibSuiteSparse: TRUE, FALSE, CHOLMOD_INT, CHOLMOD_LONG, libsuitesparseconfig # # itype defines the types of integer used: # CHOLMOD_INT, # all integer arrays are int From fac1548b9a4d76684fa25e7bb67d150b1122902a Mon Sep 17 00:00:00 2001 From: Ian Butterworth Date: Fri, 16 May 2025 23:34:35 -0400 Subject: [PATCH 2/2] lazily init cholmod --- src/solvers/cholmod.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/solvers/cholmod.jl b/src/solvers/cholmod.jl index dfcbd5bb..41b03e32 100644 --- a/src/solvers/cholmod.jl +++ b/src/solvers/cholmod.jl @@ -174,10 +174,12 @@ function newcommon(; print = 0) # no printing from CHOLMOD by default end function getcommon(::Type{Int32}) + init_once() return get!(newcommon, task_local_storage(), :cholmod_common)::Ref{cholmod_common} end function getcommon(::Type{Int64}) + init_once() return get!(newcommon_l, task_local_storage(), :cholmod_common_l)::Ref{cholmod_common} end @@ -185,7 +187,7 @@ getcommon() = getcommon(Int) const BUILD_VERSION = VersionNumber(CHOLMOD_MAIN_VERSION, CHOLMOD_SUB_VERSION, CHOLMOD_SUBSUB_VERSION) -function __init__() +const init_once = Base.OncePerProcess{Nothing}() do try ### Check if the linked library is compatible with the Julia code if Libdl.dlsym_e(Libdl.dlopen("libcholmod"), :cholmod_version) != C_NULL