phanerozoic commited on
Commit
b1e48cf
·
verified ·
1 Parent(s): e641abc

Standardize card: usage-first

Browse files
Files changed (2) hide show
  1. CARD.md +26 -20
  2. README.md +26 -20
CARD.md CHANGED
@@ -14,6 +14,31 @@ and `b` (`[n, c]`) are integer; the solution is returned as
14
  [fp128-emu](https://huggingface.co/phanerozoic/fp128-emu). The reference
15
  baseline is FLINT's `fmpq_mat.solve`.
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  ## How it works
18
 
19
  Dixon (1982) recovers the exact solution from a p-adic expansion: with
@@ -54,7 +79,7 @@ by the integer identity `A @ N == d * b` (numerators `N`, common denominator
54
  `d`) at larger sizes; a planted integer solution and a scaled-Hilbert system
55
  with dense denominators are included. Results are deterministic.
56
 
57
- ## Timing
58
 
59
  Median wall-clock of the full solve (batched inverse, lift, reconstruction)
60
  against FLINT `fmpq_mat.solve` on the same host, 24-bit integer entries. Ratio
@@ -79,25 +104,6 @@ of the GPU inverse, lift, and CPU reconstruction, so it is faster there; the
79
  crossover for single-RHS is near `n = 256`. Verified additionally on L4
80
  (sm_89), where the same ordering holds with smaller multipliers.
81
 
82
- ## Usage
83
-
84
- ```python
85
- import torch
86
- from kernels import get_kernel
87
-
88
- es = get_kernel("phanerozoic/exact-solve", version=1, trust_remote_code=True)
89
-
90
- A = torch.randint(-10**6, 10**6, (256, 256), dtype=torch.int64, device="cuda")
91
- b = torch.randint(-10**6, 10**6, (256, 1), dtype=torch.int64, device="cuda")
92
- X = es.solve(A, b) # [256][1] list of fractions.Fraction (exact)
93
- ```
94
-
95
- `version` selects the release branch; `trust_remote_code` is required by
96
- `kernels` for publishers without the trusted-publisher mark. `b` may have
97
- multiple columns (multiple right-hand sides). `solve` returns `None` if `A` is
98
- singular over the rationals. `gmpy2` accelerates the reconstruction and is
99
- recommended.
100
-
101
  ## Requirements and limits
102
 
103
  - NVIDIA GPU with compute capability 8.0+ and torch with INT8 tensor-core GEMM.
 
14
  [fp128-emu](https://huggingface.co/phanerozoic/fp128-emu). The reference
15
  baseline is FLINT's `fmpq_mat.solve`.
16
 
17
+ ## Usage
18
+
19
+ ```python
20
+ import torch
21
+ from kernels import get_kernel
22
+
23
+ es = get_kernel("phanerozoic/exact-solve", version=1, trust_remote_code=True)
24
+
25
+ A = torch.randint(-10**6, 10**6, (256, 256), dtype=torch.int64, device="cuda")
26
+ b = torch.randint(-10**6, 10**6, (256, 1), dtype=torch.int64, device="cuda")
27
+ X = es.solve(A, b) # [256][1] list of fractions.Fraction (exact)
28
+ ```
29
+
30
+ `version` selects the release branch; `trust_remote_code` is required by
31
+ `kernels` for publishers without the trusted-publisher mark. `b` may have
32
+ multiple columns (multiple right-hand sides). `solve` returns `None` if `A` is
33
+ singular over the rationals. `gmpy2` accelerates the reconstruction and is
34
+ recommended.
35
+
36
+ ## API
37
+
38
+ | Symbol | Purpose |
39
+ |---|---|
40
+ | `solve(A, b)` | exact rational solution of `A x = b`: `[n][c]` nested lists of `fractions.Fraction`; `None` if `A` is singular over the rationals |
41
+
42
  ## How it works
43
 
44
  Dixon (1982) recovers the exact solution from a p-adic expansion: with
 
79
  `d`) at larger sizes; a planted integer solution and a scaled-Hilbert system
80
  with dense denominators are included. Results are deterministic.
81
 
82
+ ## Measured
83
 
84
  Median wall-clock of the full solve (batched inverse, lift, reconstruction)
85
  against FLINT `fmpq_mat.solve` on the same host, 24-bit integer entries. Ratio
 
104
  crossover for single-RHS is near `n = 256`. Verified additionally on L4
105
  (sm_89), where the same ordering holds with smaller multipliers.
106
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  ## Requirements and limits
108
 
109
  - NVIDIA GPU with compute capability 8.0+ and torch with INT8 tensor-core GEMM.
README.md CHANGED
@@ -14,6 +14,31 @@ and `b` (`[n, c]`) are integer; the solution is returned as
14
  [fp128-emu](https://huggingface.co/phanerozoic/fp128-emu). The reference
15
  baseline is FLINT's `fmpq_mat.solve`.
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  ## How it works
18
 
19
  Dixon (1982) recovers the exact solution from a p-adic expansion: with
@@ -54,7 +79,7 @@ by the integer identity `A @ N == d * b` (numerators `N`, common denominator
54
  `d`) at larger sizes; a planted integer solution and a scaled-Hilbert system
55
  with dense denominators are included. Results are deterministic.
56
 
57
- ## Timing
58
 
59
  Median wall-clock of the full solve (batched inverse, lift, reconstruction)
60
  against FLINT `fmpq_mat.solve` on the same host, 24-bit integer entries. Ratio
@@ -79,25 +104,6 @@ of the GPU inverse, lift, and CPU reconstruction, so it is faster there; the
79
  crossover for single-RHS is near `n = 256`. Verified additionally on L4
80
  (sm_89), where the same ordering holds with smaller multipliers.
81
 
82
- ## Usage
83
-
84
- ```python
85
- import torch
86
- from kernels import get_kernel
87
-
88
- es = get_kernel("phanerozoic/exact-solve", version=1, trust_remote_code=True)
89
-
90
- A = torch.randint(-10**6, 10**6, (256, 256), dtype=torch.int64, device="cuda")
91
- b = torch.randint(-10**6, 10**6, (256, 1), dtype=torch.int64, device="cuda")
92
- X = es.solve(A, b) # [256][1] list of fractions.Fraction (exact)
93
- ```
94
-
95
- `version` selects the release branch; `trust_remote_code` is required by
96
- `kernels` for publishers without the trusted-publisher mark. `b` may have
97
- multiple columns (multiple right-hand sides). `solve` returns `None` if `A` is
98
- singular over the rationals. `gmpy2` accelerates the reconstruction and is
99
- recommended.
100
-
101
  ## Requirements and limits
102
 
103
  - NVIDIA GPU with compute capability 8.0+ and torch with INT8 tensor-core GEMM.
 
14
  [fp128-emu](https://huggingface.co/phanerozoic/fp128-emu). The reference
15
  baseline is FLINT's `fmpq_mat.solve`.
16
 
17
+ ## Usage
18
+
19
+ ```python
20
+ import torch
21
+ from kernels import get_kernel
22
+
23
+ es = get_kernel("phanerozoic/exact-solve", version=1, trust_remote_code=True)
24
+
25
+ A = torch.randint(-10**6, 10**6, (256, 256), dtype=torch.int64, device="cuda")
26
+ b = torch.randint(-10**6, 10**6, (256, 1), dtype=torch.int64, device="cuda")
27
+ X = es.solve(A, b) # [256][1] list of fractions.Fraction (exact)
28
+ ```
29
+
30
+ `version` selects the release branch; `trust_remote_code` is required by
31
+ `kernels` for publishers without the trusted-publisher mark. `b` may have
32
+ multiple columns (multiple right-hand sides). `solve` returns `None` if `A` is
33
+ singular over the rationals. `gmpy2` accelerates the reconstruction and is
34
+ recommended.
35
+
36
+ ## API
37
+
38
+ | Symbol | Purpose |
39
+ |---|---|
40
+ | `solve(A, b)` | exact rational solution of `A x = b`: `[n][c]` nested lists of `fractions.Fraction`; `None` if `A` is singular over the rationals |
41
+
42
  ## How it works
43
 
44
  Dixon (1982) recovers the exact solution from a p-adic expansion: with
 
79
  `d`) at larger sizes; a planted integer solution and a scaled-Hilbert system
80
  with dense denominators are included. Results are deterministic.
81
 
82
+ ## Measured
83
 
84
  Median wall-clock of the full solve (batched inverse, lift, reconstruction)
85
  against FLINT `fmpq_mat.solve` on the same host, 24-bit integer entries. Ratio
 
104
  crossover for single-RHS is near `n = 256`. Verified additionally on L4
105
  (sm_89), where the same ordering holds with smaller multipliers.
106
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  ## Requirements and limits
108
 
109
  - NVIDIA GPU with compute capability 8.0+ and torch with INT8 tensor-core GEMM.