Skip to content

Update the wrappers for SuiteSparse 7 and remove cholmod_blas.h bindings #363

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

Merged
merged 7 commits into from
Mar 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 26 additions & 16 deletions gen/Manifest.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# This file is machine-generated - editing it directly is not advised

julia_version = "1.7.3"
julia_version = "1.10.0-DEV"
manifest_format = "2.0"
project_hash = "61c6ad9feab9227ef7d89383b05c518b03764044"

[[deps.ArgTools]]
uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f"
version = "1.1.1"

[[deps.Artifacts]]
uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
Expand All @@ -20,19 +21,15 @@ version = "0.4.2"

[[deps.Clang]]
deps = ["CEnum", "Clang_jll", "Downloads", "Pkg", "TOML"]
git-tree-sha1 = "b6998b85ea2abbc8a02ca1ccca9438338ed5f8e5"
git-tree-sha1 = "ac81f3ea7c53b20d64ad1609a0298d9731fbdcf8"
uuid = "40e3b903-d033-50b4-a0cc-940c62c95e31"
version = "0.15.8"
version = "0.17.3"

[[deps.Clang_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Zlib_jll", "libLLVM_jll"]
git-tree-sha1 = "8cf7e67e264dedc5d321ec87e78525e958aea057"
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "TOML", "Zlib_jll", "libLLVM_jll"]
git-tree-sha1 = "b88c99c9093f9db49a40d0715ea0e3ae5bbd91f7"
uuid = "0ee61d77-7f21-5576-8119-9fcc46b10100"
version = "12.0.1+3"

[[deps.CompilerSupportLibraries_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae"
version = "14.0.6+2"

[[deps.Dates]]
deps = ["Printf"]
Expand All @@ -41,6 +38,7 @@ uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"
[[deps.Downloads]]
deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"]
uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
version = "1.6.0"

[[deps.FileWatching]]
uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee"
Expand All @@ -58,10 +56,12 @@ version = "1.4.1"
[[deps.LibCURL]]
deps = ["LibCURL_jll", "MozillaCACerts_jll"]
uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21"
version = "0.6.3"

[[deps.LibCURL_jll]]
deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"]
uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0"
version = "7.88.1+0"

[[deps.LibGit2]]
deps = ["Base64", "NetworkOptions", "Printf", "SHA"]
Expand All @@ -70,6 +70,7 @@ uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"
[[deps.LibSSH2_jll]]
deps = ["Artifacts", "Libdl", "MbedTLS_jll"]
uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8"
version = "1.10.2+0"

[[deps.Libdl]]
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
Expand All @@ -84,20 +85,20 @@ uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
[[deps.MbedTLS_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1"
version = "2.28.2+0"

[[deps.MozillaCACerts_jll]]
uuid = "14a3606d-f60d-562e-9121-12d972cd8159"
version = "2023.1.10"

[[deps.NetworkOptions]]
uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908"

[[deps.OpenBLAS_jll]]
deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"]
uuid = "4536629a-c528-5b80-bd46-f80d51c5b363"
version = "1.2.0"

[[deps.Pkg]]
deps = ["Artifacts", "Dates", "Downloads", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"]
deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"]
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
version = "1.10.0"

[[deps.Preferences]]
deps = ["TOML"]
Expand All @@ -119,6 +120,7 @@ uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"

[[deps.SHA]]
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
version = "0.7.0"

[[deps.Serialization]]
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
Expand All @@ -129,14 +131,17 @@ uuid = "6462fe0b-24de-5631-8697-dd941f90decc"
[[deps.SuiteSparse_jll]]
deps = ["Artifacts", "Libdl", "Pkg", "libblastrampoline_jll"]
uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c"
version = "7.0.1+0"

[[deps.TOML]]
deps = ["Dates"]
uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
version = "1.0.3"

[[deps.Tar]]
deps = ["ArgTools", "SHA"]
uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e"
version = "1.10.0"

[[deps.UUIDs]]
deps = ["Random", "SHA"]
Expand All @@ -148,19 +153,24 @@ uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
[[deps.Zlib_jll]]
deps = ["Libdl"]
uuid = "83775a58-1f1d-513f-b197-d71354ab007a"
version = "1.2.13+0"

[[deps.libLLVM_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "8f36deef-c2a5-5394-99ed-8e07531fb29a"
version = "14.0.6+2"

[[deps.libblastrampoline_jll]]
deps = ["Artifacts", "Libdl", "OpenBLAS_jll"]
deps = ["Artifacts", "Libdl"]
uuid = "8e850b90-86db-534c-a0d3-1478176c7d93"
version = "5.4.0+0"

[[deps.nghttp2_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d"
version = "1.52.0+0"

[[deps.p7zip_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0"
version = "17.4.0+0"
10 changes: 2 additions & 8 deletions gen/generator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,10 @@ using SuiteSparse_jll
cd(@__DIR__)

# headers
SuiteSparse_toml = joinpath(dirname(pathof(SuiteSparse_jll)), "..", "StdlibArtifacts.toml")
SuiteSparse_dir = Pkg.Artifacts.ensure_artifact_installed("SuiteSparse", SuiteSparse_toml)

include_dir = joinpath(SuiteSparse_dir, "include") |> normpath
include_dir = joinpath(SuiteSparse_jll.artifact_dir, "include") |> normpath
cholmod_h = joinpath(include_dir, "cholmod.h")
@assert isfile(cholmod_h)

cholmod_blas_h = joinpath(include_dir, "cholmod_blas.h")
@assert isfile(cholmod_blas_h)

SuiteSparseQR_C_h = joinpath(include_dir, "SuiteSparseQR_C.h")
@assert isfile(SuiteSparseQR_C_h)

Expand Down Expand Up @@ -48,7 +42,7 @@ for target in JLLEnvs.JLL_ENV_TRIPLES
push!(args, "-DSUN64 -DLONGBLAS='long long' -D'SuiteSparse_long_max=9223372036854775801'")
end

header_files = [cholmod_h, cholmod_blas_h, SuiteSparseQR_C_h, amd_h, colamd_h, ccolamd_h, umfpack_h]
header_files = [cholmod_h, SuiteSparseQR_C_h, amd_h, colamd_h, ccolamd_h, umfpack_h]

ctx = create_context(header_files, args, options)

Expand Down
17 changes: 15 additions & 2 deletions gen/generator.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ auto_mutability = true

output_ignorelist = [
# Clang.jl cannot handle these macro correctly, skip for now.
"SuiteSparse_long_id",
"SuiteSparse_long_id",
"CHOLMOD_CUBLAS_HANDLE",
"CHOLMOD_CUDASTREAM",
"CHOLMOD_CUDAEVENT",
Expand All @@ -31,6 +31,18 @@ output_ignorelist = [
"CHOLMOD_GPU_POTRF_TIME",
"CHOLMOD_ASSEMBLE_TIME",
"CHOLMOD_ASSEMBLE_TIME2",
"SuiteSparse_long_idd",
"SUITESPARSE_COMPILER_MAJOR",
"SUITESPARSE_COMPILER_MINOR",
"SUITESPARSE_COMPILER_SUB",
"SUITESPARSE_COMPILER_NAME",
"SUITESPARSE_STDC_VERSION",
"SUITESPARSE_RESTRICT",
"SUITESPARSE_LAPACK_[A-Z]+",
"SUITESPARSE_BLAS_[A-Z]+",
"SUITESPARSE_BLAS_DNRM2",
"SUITESPARSE_BLAS_DZNRM2",
"UMFPACK_VERSION",
]

[codegen]
Expand All @@ -47,5 +59,6 @@ functionlike_macro_includelist = [
"UMFPACK_VER_CODE",
"COLAMD_VERSION_CODE",
"KLU_VERSION_CODE",
"BTF_VERSION_CODE"
"BTF_VERSION_CODE",
"CCOLAMD_VERSION_CODE"
]
5 changes: 2 additions & 3 deletions src/solvers/LibSuiteSparse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ else
const LONG_MAX = typemax(Clong)
end

## CHOLMOD
const TRUE = Int32(1)
const FALSE = Int32(0)

CCOLAMD_VERSION_CODE(main, sub) = main * 1000 + sub
const int64_t = Int64
const INT64_MAX = typemax(Int64)

const IS_LIBC_MUSL = occursin("musl", Base.BUILD_TRIPLET)
if Sys.isapple() && Sys.ARCH === :aarch64
Expand Down
Loading