Skip to content

Commit a15fe4b

Browse files
authored
Merge SuiteSparse into SparseArrays to prepare for excision from base (#95)
* simple copy of SuiteSparse * fix uuid * fix project.toml * remove one level of modules * fix tests * fix doctests
1 parent 60d701c commit a15fe4b

33 files changed

+47039
-3
lines changed

Project.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@ name = "SparseArrays"
22
uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
33

44
[deps]
5+
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
6+
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
57
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
68
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
9+
Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
10+
SuiteSparse_jll = "bea87d4a-7f5b-5778-9afe-8cc45184846c"
711

812
[extras]
913
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"

gen/Manifest.toml

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
# This file is machine-generated - editing it directly is not advised
2+
3+
julia_version = "1.8.0-beta3"
4+
manifest_format = "2.0"
5+
project_hash = "61c6ad9feab9227ef7d89383b05c518b03764044"
6+
7+
[[deps.ArgTools]]
8+
uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f"
9+
version = "1.1.1"
10+
11+
[[deps.Artifacts]]
12+
uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
13+
14+
[[deps.Base64]]
15+
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
16+
17+
[[deps.BinaryProvider]]
18+
deps = ["Libdl", "Logging", "SHA"]
19+
git-tree-sha1 = "ecdec412a9abc8db54c0efc5548c64dfce072058"
20+
uuid = "b99e7846-7c00-51b0-8f62-c81ae34c0232"
21+
version = "0.5.10"
22+
23+
[[deps.CEnum]]
24+
git-tree-sha1 = "62847acab40e6855a9b5905ccb99c2b5cf6b3ebb"
25+
uuid = "fa961155-64e5-5f13-b03f-caf6b980ea82"
26+
version = "0.2.0"
27+
28+
[[deps.Clang]]
29+
deps = ["BinaryProvider", "CEnum", "DataStructures", "Libdl"]
30+
git-tree-sha1 = "461757522a8e312a2394efbf83668cef58469ca4"
31+
uuid = "40e3b903-d033-50b4-a0cc-940c62c95e31"
32+
version = "0.9.2"
33+
34+
[[deps.CompilerSupportLibraries_jll]]
35+
deps = ["Artifacts", "Libdl"]
36+
uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae"
37+
version = "0.5.2+0"
38+
39+
[[deps.DataStructures]]
40+
deps = ["InteractiveUtils", "OrderedCollections"]
41+
git-tree-sha1 = "88d48e133e6d3dd68183309877eac74393daa7eb"
42+
uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
43+
version = "0.17.20"
44+
45+
[[deps.Dates]]
46+
deps = ["Printf"]
47+
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"
48+
49+
[[deps.Downloads]]
50+
deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"]
51+
uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
52+
version = "1.6.0"
53+
54+
[[deps.FileWatching]]
55+
uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee"
56+
57+
[[deps.InteractiveUtils]]
58+
deps = ["Markdown"]
59+
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
60+
61+
[[deps.LibCURL]]
62+
deps = ["LibCURL_jll", "MozillaCACerts_jll"]
63+
uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21"
64+
version = "0.6.3"
65+
66+
[[deps.LibCURL_jll]]
67+
deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"]
68+
uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0"
69+
version = "7.81.0+0"
70+
71+
[[deps.LibGit2]]
72+
deps = ["Base64", "NetworkOptions", "Printf", "SHA"]
73+
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"
74+
75+
[[deps.LibSSH2_jll]]
76+
deps = ["Artifacts", "Libdl", "MbedTLS_jll"]
77+
uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8"
78+
version = "1.10.2+0"
79+
80+
[[deps.Libdl]]
81+
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
82+
83+
[[deps.Logging]]
84+
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"
85+
86+
[[deps.Markdown]]
87+
deps = ["Base64"]
88+
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
89+
90+
[[deps.MbedTLS_jll]]
91+
deps = ["Artifacts", "Libdl"]
92+
uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1"
93+
version = "2.28.0+0"
94+
95+
[[deps.MozillaCACerts_jll]]
96+
uuid = "14a3606d-f60d-562e-9121-12d972cd8159"
97+
version = "2022.2.1"
98+
99+
[[deps.NetworkOptions]]
100+
uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908"
101+
version = "1.2.0"
102+
103+
[[deps.OpenBLAS_jll]]
104+
deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"]
105+
uuid = "4536629a-c528-5b80-bd46-f80d51c5b363"
106+
version = "0.3.20+0"
107+
108+
[[deps.OrderedCollections]]
109+
git-tree-sha1 = "85f8e6578bf1f9ee0d11e7bb1b1456435479d47c"
110+
uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
111+
version = "1.4.1"
112+
113+
[[deps.Pkg]]
114+
deps = ["Artifacts", "Dates", "Downloads", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"]
115+
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
116+
version = "1.8.0"
117+
118+
[[deps.Printf]]
119+
deps = ["Unicode"]
120+
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
121+
122+
[[deps.REPL]]
123+
deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"]
124+
uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
125+
126+
[[deps.Random]]
127+
deps = ["SHA", "Serialization"]
128+
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
129+
130+
[[deps.SHA]]
131+
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
132+
version = "0.7.0"
133+
134+
[[deps.Serialization]]
135+
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
136+
137+
[[deps.Sockets]]
138+
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"
139+
140+
[[deps.SuiteSparse_jll]]
141+
deps = ["Artifacts", "Libdl", "Pkg", "libblastrampoline_jll"]
142+
uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c"
143+
version = "5.10.1+0"
144+
145+
[[deps.TOML]]
146+
deps = ["Dates"]
147+
uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
148+
version = "1.0.0"
149+
150+
[[deps.Tar]]
151+
deps = ["ArgTools", "SHA"]
152+
uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e"
153+
version = "1.10.0"
154+
155+
[[deps.UUIDs]]
156+
deps = ["Random", "SHA"]
157+
uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
158+
159+
[[deps.Unicode]]
160+
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
161+
162+
[[deps.Zlib_jll]]
163+
deps = ["Libdl"]
164+
uuid = "83775a58-1f1d-513f-b197-d71354ab007a"
165+
version = "1.2.12+1"
166+
167+
[[deps.libblastrampoline_jll]]
168+
deps = ["Artifacts", "Libdl", "OpenBLAS_jll"]
169+
uuid = "8e850b90-86db-534c-a0d3-1478176c7d93"
170+
version = "5.1.0+0"
171+
172+
[[deps.nghttp2_jll]]
173+
deps = ["Artifacts", "Libdl"]
174+
uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d"
175+
version = "1.41.0+1"
176+
177+
[[deps.p7zip_jll]]
178+
deps = ["Artifacts", "Libdl"]
179+
uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0"
180+
version = "16.2.1+1"

gen/Project.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[deps]
2+
Clang = "40e3b903-d033-50b4-a0cc-940c62c95e31"
3+
SuiteSparse_jll = "bea87d4a-7f5b-5778-9afe-8cc45184846c"

gen/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# How to auto-generate the wrappers
2+
3+
1. `cd` to this directory
4+
2. run `julia --project generator.jl`, then you could find the updated wrappers in the `lib` folder
5+
6+
## How to upgrade Clang.jl
7+
8+
1. `cd` to this directory
9+
2. run `julia --project` and then in the Julia REPL, run `pkg> up`

gen/generator.jl

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#! /bin/bash julia --project generator.jl
2+
using Pkg
3+
using Pkg.Artifacts
4+
using Clang.Generators
5+
using Clang.Generators.JLLEnvs
6+
using SuiteSparse_jll
7+
8+
cd(@__DIR__)
9+
10+
# headers
11+
SuiteSparse_toml = joinpath(dirname(pathof(SuiteSparse_jll)), "..", "StdlibArtifacts.toml")
12+
SuiteSparse_dir = Pkg.Artifacts.ensure_artifact_installed("SuiteSparse", SuiteSparse_toml)
13+
14+
include_dir = joinpath(SuiteSparse_dir, "include") |> normpath
15+
cholmod_h = joinpath(include_dir, "cholmod.h")
16+
@assert isfile(cholmod_h)
17+
18+
cholmod_blas_h = joinpath(include_dir, "cholmod_blas.h")
19+
@assert isfile(cholmod_blas_h)
20+
21+
SuiteSparseQR_C_h = joinpath(include_dir, "SuiteSparseQR_C.h")
22+
@assert isfile(SuiteSparseQR_C_h)
23+
24+
umfpack_h = joinpath(include_dir, "umfpack.h")
25+
@assert isfile(umfpack_h)
26+
27+
amd_h = joinpath(include_dir, "amd.h")
28+
@assert isfile(amd_h)
29+
30+
colamd_h = joinpath(include_dir, "colamd.h")
31+
@assert isfile(colamd_h)
32+
33+
ccolamd_h = joinpath(include_dir, "ccolamd.h")
34+
@assert isfile(ccolamd_h)
35+
36+
# load common option
37+
options = load_options(joinpath(@__DIR__, "generator.toml"))
38+
39+
# run generator for all platforms
40+
for target in JLLEnvs.JLL_ENV_TRIPLES
41+
@info "processing $target"
42+
43+
options["general"]["output_file_path"] = joinpath(@__DIR__, "..", "lib", "$target.jl")
44+
45+
args = get_default_args(target)
46+
push!(args, "-I$include_dir")
47+
if startswith(target, "x86_64") || startswith(target, "powerpc64le") || startswith(target, "aarch64")
48+
push!(args, "-DSUN64 -DLONGBLAS='long long' -D'SuiteSparse_long_max=9223372036854775801'")
49+
end
50+
51+
header_files = [cholmod_h, cholmod_blas_h, SuiteSparseQR_C_h, amd_h, colamd_h, ccolamd_h, umfpack_h]
52+
53+
ctx = create_context(header_files, args, options)
54+
55+
build!(ctx)
56+
end

gen/generator.toml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
[general]
2+
library_name = "libcholmod"
3+
library_names = { "SuiteSparseQR_C.h" = "libspqr", "umfpack.*.h" = "libumfpack", "amd.h" = "libamd", "colamd.h" = "libcolamd", "ccolamd.h" = "libccolamd", "cholmod_camd.h" = "libcholmod"}
4+
5+
use_julia_native_enum_type = true
6+
use_deterministic_symbol = true
7+
auto_mutability = true
8+
9+
output_ignorelist = [
10+
# Clang.jl cannot handle these macro correctly, skip for now.
11+
"SuiteSparse_long_id",
12+
"CHOLMOD_CUBLAS_HANDLE",
13+
"CHOLMOD_CUDASTREAM",
14+
"CHOLMOD_CUDAEVENT",
15+
# useless macros
16+
"CHOLMOD_CPU_GEMM_CALLS",
17+
"CHOLMOD_CPU_SYRK_CALLS",
18+
"CHOLMOD_CPU_TRSM_CALLS",
19+
"CHOLMOD_CPU_POTRF_CALLS",
20+
"CHOLMOD_GPU_GEMM_CALLS",
21+
"CHOLMOD_GPU_SYRK_CALLS",
22+
"CHOLMOD_GPU_TRSM_CALLS",
23+
"CHOLMOD_GPU_POTRF_CALLS",
24+
"CHOLMOD_CPU_GEMM_TIME",
25+
"CHOLMOD_CPU_SYRK_TIME",
26+
"CHOLMOD_CPU_TRSM_TIME",
27+
"CHOLMOD_CPU_POTRF_TIME",
28+
"CHOLMOD_GPU_GEMM_TIME",
29+
"CHOLMOD_GPU_SYRK_TIME",
30+
"CHOLMOD_GPU_TRSM_TIME",
31+
"CHOLMOD_GPU_POTRF_TIME",
32+
"CHOLMOD_ASSEMBLE_TIME",
33+
"CHOLMOD_ASSEMBLE_TIME2",
34+
]
35+
36+
[codegen]
37+
use_ccall_macro = true
38+
39+
[codegen.macro]
40+
macro_mode = "basic"
41+
42+
functionlike_macro_includelist = [
43+
"SUITESPARSE_VER_CODE",
44+
"CHOLMOD_VER_CODE",
45+
"SPQR_VER_CODE",
46+
"AMD_VERSION_CODE",
47+
"UMFPACK_VER_CODE",
48+
"COLAMD_VERSION_CODE",
49+
"KLU_VERSION_CODE",
50+
"BTF_VERSION_CODE"
51+
]

0 commit comments

Comments
 (0)