Skip to content

Commit 671bccb

Browse files
ettersiSimon Etter
and
Simon Etter
authored
Move CHOLMOD.common_struct from Vector{UInt8} to an actual struct (JuliaLang#38919)
* Move common_struct from Vector{UInt8} to an actual struct * Compare full version numbers Co-authored-by: Simon Etter <[email protected]>
1 parent a20e547 commit 671bccb

File tree

5 files changed

+433
-211
lines changed

5 files changed

+433
-211
lines changed

deps/SuiteSparse_wrapper.c

+133-24
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
#include <string.h>
88
#include <cholmod.h>
99

10-
extern size_t jl_cholmod_common_size(void) {
11-
return sizeof(cholmod_common);
12-
}
13-
1410
extern size_t jl_cholmod_sizeof_long(void) {
1511
return sizeof(SuiteSparse_long);
1612
}
@@ -24,24 +20,137 @@ extern int jl_cholmod_version(int *ver) {
2420
return CHOLMOD_VERSION;
2521
}
2622

27-
extern void jl_cholmod_common_offsets(size_t *vv) {
28-
vv[0] = offsetof(cholmod_common, dbound);
29-
vv[1] = offsetof(cholmod_common, maxrank);
30-
vv[2] = offsetof(cholmod_common, supernodal_switch);
31-
vv[3] = offsetof(cholmod_common, supernodal);
32-
vv[4] = offsetof(cholmod_common, final_asis);
33-
vv[5] = offsetof(cholmod_common, final_super);
34-
vv[6] = offsetof(cholmod_common, final_ll);
35-
vv[7] = offsetof(cholmod_common, final_pack);
36-
vv[8] = offsetof(cholmod_common, final_monotonic);
37-
vv[9] = offsetof(cholmod_common, final_resymbol);
38-
vv[10] = offsetof(cholmod_common, prefer_zomplex);
39-
vv[11] = offsetof(cholmod_common, prefer_upper);
40-
vv[12] = offsetof(cholmod_common, print);
41-
vv[13] = offsetof(cholmod_common, precise);
42-
vv[14] = offsetof(cholmod_common, nmethods);
43-
vv[15] = offsetof(cholmod_common, selected);
44-
vv[16] = offsetof(cholmod_common, postorder);
45-
vv[17] = offsetof(cholmod_common, itype);
46-
vv[18] = offsetof(cholmod_common, dtype);
23+
// Keep this synchronized with https://github.com/JuliaLang/julia/blob/master/stdlib/SuiteSparse/src/cholmod.jl
24+
extern void jl_cholmod_method_offsets(size_t *v) {
25+
size_t offset = offsetof(cholmod_common, method[0]);
26+
v[ 0] = offsetof(cholmod_common, method[0].lnz) - offset;
27+
v[ 1] = offsetof(cholmod_common, method[0].fl) - offset;
28+
v[ 2] = offsetof(cholmod_common, method[0].prune_dense) - offset;
29+
v[ 3] = offsetof(cholmod_common, method[0].prune_dense2) - offset;
30+
v[ 4] = offsetof(cholmod_common, method[0].nd_oksep) - offset;
31+
v[ 5] = offsetof(cholmod_common, method[0].other_1) - offset;
32+
v[ 6] = offsetof(cholmod_common, method[0].nd_small) - offset;
33+
v[ 7] = offsetof(cholmod_common, method[0].other_2) - offset;
34+
v[ 8] = offsetof(cholmod_common, method[0].aggressive) - offset;
35+
v[ 9] = offsetof(cholmod_common, method[0].order_for_lu) - offset;
36+
v[10] = offsetof(cholmod_common, method[0].nd_compress) - offset;
37+
v[11] = offsetof(cholmod_common, method[0].nd_camd) - offset;
38+
v[12] = offsetof(cholmod_common, method[0].nd_components) - offset;
39+
v[13] = offsetof(cholmod_common, method[0].ordering) - offset;
40+
v[14] = offsetof(cholmod_common, method[0].other_3) - offset;
41+
}
42+
43+
// Keep this synchronized with https://github.com/JuliaLang/julia/blob/master/stdlib/SuiteSparse/src/cholmod.jl
44+
extern void jl_cholmod_common_offsets(size_t *v) {
45+
v[ 0] = offsetof(cholmod_common, dbound);
46+
v[ 1] = offsetof(cholmod_common, grow0);
47+
v[ 2] = offsetof(cholmod_common, grow1);
48+
v[ 3] = offsetof(cholmod_common, grow2);
49+
v[ 4] = offsetof(cholmod_common, maxrank);
50+
v[ 5] = offsetof(cholmod_common, supernodal_switch);
51+
v[ 6] = offsetof(cholmod_common, supernodal);
52+
v[ 7] = offsetof(cholmod_common, final_asis);
53+
v[ 8] = offsetof(cholmod_common, final_super);
54+
v[ 9] = offsetof(cholmod_common, final_ll);
55+
v[ 10] = offsetof(cholmod_common, final_pack);
56+
v[ 11] = offsetof(cholmod_common, final_monotonic);
57+
v[ 12] = offsetof(cholmod_common, final_resymbol);
58+
v[ 13] = offsetof(cholmod_common, zrelax);
59+
v[ 14] = offsetof(cholmod_common, nrelax);
60+
v[ 15] = offsetof(cholmod_common, prefer_zomplex);
61+
v[ 16] = offsetof(cholmod_common, prefer_upper);
62+
v[ 17] = offsetof(cholmod_common, quick_return_if_not_posdef);
63+
v[ 18] = offsetof(cholmod_common, prefer_binary);
64+
v[ 19] = offsetof(cholmod_common, print);
65+
v[ 20] = offsetof(cholmod_common, precise);
66+
v[ 21] = offsetof(cholmod_common, try_catch);
67+
v[ 22] = offsetof(cholmod_common, error_handler);
68+
v[ 23] = offsetof(cholmod_common, nmethods);
69+
v[ 24] = offsetof(cholmod_common, current);
70+
v[ 25] = offsetof(cholmod_common, selected);
71+
v[ 26] = offsetof(cholmod_common, method);
72+
v[ 27] = offsetof(cholmod_common, postorder);
73+
v[ 28] = offsetof(cholmod_common, default_nesdis);
74+
v[ 29] = offsetof(cholmod_common, metis_memory);
75+
v[ 30] = offsetof(cholmod_common, metis_dswitch);
76+
v[ 31] = offsetof(cholmod_common, metis_nswitch);
77+
v[ 32] = offsetof(cholmod_common, nrow);
78+
v[ 33] = offsetof(cholmod_common, mark);
79+
v[ 34] = offsetof(cholmod_common, iworksize);
80+
v[ 35] = offsetof(cholmod_common, xworksize);
81+
v[ 36] = offsetof(cholmod_common, Flag);
82+
v[ 37] = offsetof(cholmod_common, Head);
83+
v[ 38] = offsetof(cholmod_common, Xwork);
84+
v[ 39] = offsetof(cholmod_common, Iwork);
85+
v[ 40] = offsetof(cholmod_common, itype);
86+
v[ 41] = offsetof(cholmod_common, dtype);
87+
v[ 42] = offsetof(cholmod_common, no_workspace_reallocate);
88+
v[ 43] = offsetof(cholmod_common, status);
89+
v[ 44] = offsetof(cholmod_common, fl);
90+
v[ 45] = offsetof(cholmod_common, lnz);
91+
v[ 46] = offsetof(cholmod_common, anz);
92+
v[ 47] = offsetof(cholmod_common, modfl);
93+
v[ 48] = offsetof(cholmod_common, malloc_count);
94+
v[ 49] = offsetof(cholmod_common, memory_usage);
95+
v[ 50] = offsetof(cholmod_common, memory_inuse);
96+
v[ 51] = offsetof(cholmod_common, nrealloc_col);
97+
v[ 52] = offsetof(cholmod_common, nrealloc_factor);
98+
v[ 53] = offsetof(cholmod_common, ndbounds_hit);
99+
v[ 54] = offsetof(cholmod_common, rowfacfl);
100+
v[ 55] = offsetof(cholmod_common, aatfl);
101+
v[ 56] = offsetof(cholmod_common, called_nd);
102+
v[ 57] = offsetof(cholmod_common, blas_ok);
103+
v[ 58] = offsetof(cholmod_common, SPQR_grain);
104+
v[ 59] = offsetof(cholmod_common, SPQR_small);
105+
v[ 60] = offsetof(cholmod_common, SPQR_shrink);
106+
v[ 61] = offsetof(cholmod_common, SPQR_nthreads);
107+
v[ 62] = offsetof(cholmod_common, SPQR_flopcount);
108+
v[ 63] = offsetof(cholmod_common, SPQR_analyze_time);
109+
v[ 64] = offsetof(cholmod_common, SPQR_factorize_time);
110+
v[ 65] = offsetof(cholmod_common, SPQR_solve_time);
111+
v[ 66] = offsetof(cholmod_common, SPQR_flopcount_bound);
112+
v[ 67] = offsetof(cholmod_common, SPQR_tol_used);
113+
v[ 68] = offsetof(cholmod_common, SPQR_norm_E_fro);
114+
v[ 69] = offsetof(cholmod_common, SPQR_istat);
115+
v[ 70] = offsetof(cholmod_common, useGPU);
116+
v[ 71] = offsetof(cholmod_common, maxGpuMemBytes);
117+
v[ 72] = offsetof(cholmod_common, maxGpuMemFraction);
118+
v[ 73] = offsetof(cholmod_common, gpuMemorySize);
119+
v[ 74] = offsetof(cholmod_common, gpuKernelTime);
120+
v[ 75] = offsetof(cholmod_common, gpuFlops);
121+
v[ 76] = offsetof(cholmod_common, gpuNumKernelLaunches);
122+
v[ 77] = offsetof(cholmod_common, cublasHandle);
123+
v[ 78] = offsetof(cholmod_common, gpuStream);
124+
v[ 79] = offsetof(cholmod_common, cublasEventPotrf);
125+
v[ 80] = offsetof(cholmod_common, updateCKernelsComplete);
126+
v[ 81] = offsetof(cholmod_common, updateCBuffersFree);
127+
v[ 82] = offsetof(cholmod_common, dev_mempool);
128+
v[ 83] = offsetof(cholmod_common, dev_mempool_size);
129+
v[ 84] = offsetof(cholmod_common, host_pinned_mempool);
130+
v[ 85] = offsetof(cholmod_common, host_pinned_mempool_size);
131+
v[ 86] = offsetof(cholmod_common, devBuffSize);
132+
v[ 87] = offsetof(cholmod_common, ibuffer);
133+
v[ 88] = offsetof(cholmod_common, syrkStart);
134+
v[ 89] = offsetof(cholmod_common, cholmod_cpu_gemm_time);
135+
v[ 90] = offsetof(cholmod_common, cholmod_cpu_syrk_time);
136+
v[ 91] = offsetof(cholmod_common, cholmod_cpu_trsm_time);
137+
v[ 92] = offsetof(cholmod_common, cholmod_cpu_potrf_time);
138+
v[ 93] = offsetof(cholmod_common, cholmod_gpu_gemm_time);
139+
v[ 94] = offsetof(cholmod_common, cholmod_gpu_syrk_time);
140+
v[ 95] = offsetof(cholmod_common, cholmod_gpu_trsm_time);
141+
v[ 96] = offsetof(cholmod_common, cholmod_gpu_potrf_time);
142+
v[ 97] = offsetof(cholmod_common, cholmod_assemble_time);
143+
v[ 98] = offsetof(cholmod_common, cholmod_assemble_time2);
144+
v[ 99] = offsetof(cholmod_common, cholmod_cpu_gemm_calls);
145+
v[100] = offsetof(cholmod_common, cholmod_cpu_syrk_calls);
146+
v[101] = offsetof(cholmod_common, cholmod_cpu_trsm_calls);
147+
v[102] = offsetof(cholmod_common, cholmod_cpu_potrf_calls);
148+
v[103] = offsetof(cholmod_common, cholmod_gpu_gemm_calls);
149+
v[104] = offsetof(cholmod_common, cholmod_gpu_syrk_calls);
150+
v[105] = offsetof(cholmod_common, cholmod_gpu_trsm_calls);
151+
v[106] = offsetof(cholmod_common, cholmod_gpu_potrf_calls);
152+
}
153+
154+
extern size_t jl_cholmod_common_size() {
155+
return sizeof(cholmod_common);
47156
}

0 commit comments

Comments
 (0)