gbskernels 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gbskernels-0.2.0/CHANGELOG.md +36 -0
- gbskernels-0.2.0/CITATION.cff +11 -0
- gbskernels-0.2.0/LICENSE +202 -0
- gbskernels-0.2.0/MANIFEST.in +15 -0
- gbskernels-0.2.0/PKG-INFO +255 -0
- gbskernels-0.2.0/README.md +233 -0
- gbskernels-0.2.0/bench/__init__.py +7 -0
- gbskernels-0.2.0/bench/_inputs.py +348 -0
- gbskernels-0.2.0/bench/_provenance.py +104 -0
- gbskernels-0.2.0/bench/accuracy.py +182 -0
- gbskernels-0.2.0/bench/accuracy_permanent.py +169 -0
- gbskernels-0.2.0/bench/calibrate_auto.py +159 -0
- gbskernels-0.2.0/bench/crossover.py +195 -0
- gbskernels-0.2.0/bench/kernel_footprint.py +120 -0
- gbskernels-0.2.0/bench/plot_crossover.py +94 -0
- gbskernels-0.2.0/bench/repeated_ab.py +127 -0
- gbskernels-0.2.0/bench/sampler_throughput.py +165 -0
- gbskernels-0.2.0/bench/throughput.py +229 -0
- gbskernels-0.2.0/bench/throughput_end_to_end.py +204 -0
- gbskernels-0.2.0/bench/throughput_gpu.py +126 -0
- gbskernels-0.2.0/bench/tightness.py +174 -0
- gbskernels-0.2.0/bench/walrus_baseline.py +148 -0
- gbskernels-0.2.0/bindings/CMakeLists.txt +65 -0
- gbskernels-0.2.0/bindings/README.md +45 -0
- gbskernels-0.2.0/bindings/gbskernels_ext.cpp +391 -0
- gbskernels-0.2.0/core/CMakeLists.txt +151 -0
- gbskernels-0.2.0/core/README.md +55 -0
- gbskernels-0.2.0/core/bench_kernels.cu +416 -0
- gbskernels-0.2.0/core/certified.cu +623 -0
- gbskernels-0.2.0/core/certified_dd.cu +283 -0
- gbskernels-0.2.0/core/certified_rounding.cuh +54 -0
- gbskernels-0.2.0/core/check_certified.cu +385 -0
- gbskernels-0.2.0/core/check_haf_coop.cu +68 -0
- gbskernels-0.2.0/core/check_haf_small.cu +63 -0
- gbskernels-0.2.0/core/check_hafnian.cu +115 -0
- gbskernels-0.2.0/core/check_hafnian_dd.cu +142 -0
- gbskernels-0.2.0/core/check_host_api.cu +162 -0
- gbskernels-0.2.0/core/check_lhaf_coop.cu +67 -0
- gbskernels-0.2.0/core/check_loop_hafnian.cu +76 -0
- gbskernels-0.2.0/core/check_loop_hafnian_dd.cu +142 -0
- gbskernels-0.2.0/core/check_permanent.cu +98 -0
- gbskernels-0.2.0/core/check_permanent_coop.cu +97 -0
- gbskernels-0.2.0/core/check_permanent_dd.cu +158 -0
- gbskernels-0.2.0/core/check_permanent_warp.cu +92 -0
- gbskernels-0.2.0/core/check_repeated.cu +249 -0
- gbskernels-0.2.0/core/check_sampler_draw.cu +79 -0
- gbskernels-0.2.0/core/check_sampler_gather.cu +73 -0
- gbskernels-0.2.0/core/check_sampler_haf_varn.cu +79 -0
- gbskernels-0.2.0/core/check_sampler_session.cu +109 -0
- gbskernels-0.2.0/core/check_session.cu +125 -0
- gbskernels-0.2.0/core/check_tor_coop.cu +70 -0
- gbskernels-0.2.0/core/check_tor_recursive.cu +323 -0
- gbskernels-0.2.0/core/check_torontonian.cu +97 -0
- gbskernels-0.2.0/core/check_torontonian_dd.cu +104 -0
- gbskernels-0.2.0/core/check_torontonian_real_chol.cu +93 -0
- gbskernels-0.2.0/core/dd.cuh +164 -0
- gbskernels-0.2.0/core/hafnian.cu +305 -0
- gbskernels-0.2.0/core/hafnian_dd.cu +118 -0
- gbskernels-0.2.0/core/host_api.cu +643 -0
- gbskernels-0.2.0/core/loop_hafnian.cu +238 -0
- gbskernels-0.2.0/core/loop_hafnian_dd.cu +124 -0
- gbskernels-0.2.0/core/permanent.cu +141 -0
- gbskernels-0.2.0/core/permanent_coop.cu +103 -0
- gbskernels-0.2.0/core/permanent_coop.cuh +60 -0
- gbskernels-0.2.0/core/permanent_dd.cu +84 -0
- gbskernels-0.2.0/core/permanent_warp.cu +63 -0
- gbskernels-0.2.0/core/preflight/cuda/cuComplex.h +39 -0
- gbskernels-0.2.0/core/preflight/cuda/cuda_runtime.h +75 -0
- gbskernels-0.2.0/core/preflight/cuda/curand_kernel.h +46 -0
- gbskernels-0.2.0/core/preflight/run_preflight.sh +211 -0
- gbskernels-0.2.0/core/repeated.cu +354 -0
- gbskernels-0.2.0/core/sampler_draw.cu +61 -0
- gbskernels-0.2.0/core/sampler_gather.cu +57 -0
- gbskernels-0.2.0/core/sampler_session.cu +128 -0
- gbskernels-0.2.0/core/subset_engine.cuh +81 -0
- gbskernels-0.2.0/core/tor_recursive.cu +624 -0
- gbskernels-0.2.0/core/torontonian.cu +294 -0
- gbskernels-0.2.0/core/torontonian_dd.cu +98 -0
- gbskernels-0.2.0/cpu_ref/__init__.py +50 -0
- gbskernels-0.2.0/cpu_ref/certified.py +499 -0
- gbskernels-0.2.0/cpu_ref/dd.py +114 -0
- gbskernels-0.2.0/cpu_ref/diagnostics.py +170 -0
- gbskernels-0.2.0/cpu_ref/hafnian.py +134 -0
- gbskernels-0.2.0/cpu_ref/loop_hafnian.py +120 -0
- gbskernels-0.2.0/cpu_ref/permanent.py +194 -0
- gbskernels-0.2.0/cpu_ref/repeated.py +228 -0
- gbskernels-0.2.0/cpu_ref/tor_recursive.py +101 -0
- gbskernels-0.2.0/cpu_ref/torontonian.py +69 -0
- gbskernels-0.2.0/docs/DESIGN.md +371 -0
- gbskernels-0.2.0/docs/benchmark_protocol.md +113 -0
- gbskernels-0.2.0/docs/confirmatory_v2.md +333 -0
- gbskernels-0.2.0/docs/confirmatory_v2_design_spec.template.json +153 -0
- gbskernels-0.2.0/docs/confirmatory_v2_plan.template.json +136 -0
- gbskernels-0.2.0/docs/device_resident_contract.md +141 -0
- gbskernels-0.2.0/docs/exploratory_exposure_manifest.template.json +197 -0
- gbskernels-0.2.0/envs/Dockerfile +48 -0
- gbskernels-0.2.0/envs/README.md +22 -0
- gbskernels-0.2.0/envs/rental_4090.md +137 -0
- gbskernels-0.2.0/envs/rental_datacenter.md +85 -0
- gbskernels-0.2.0/examples/gbs_demo.py +109 -0
- gbskernels-0.2.0/examples/jiuzhang/README.md +76 -0
- gbskernels-0.2.0/examples/jiuzhang/absolute_predictive_checks.py +226 -0
- gbskernels-0.2.0/examples/jiuzhang/analyze_refusals.py +437 -0
- gbskernels-0.2.0/examples/jiuzhang/audit_selection_population.py +72 -0
- gbskernels-0.2.0/examples/jiuzhang/build_exclusion_ledger.py +905 -0
- gbskernels-0.2.0/examples/jiuzhang/calibration_normalizer_replicates.py +178 -0
- gbskernels-0.2.0/examples/jiuzhang/campaign_confirmatory_v2.py +657 -0
- gbskernels-0.2.0/examples/jiuzhang/click_count_dist.npy +0 -0
- gbskernels-0.2.0/examples/jiuzhang/coherence_family.py +137 -0
- gbskernels-0.2.0/examples/jiuzhang/confirmatory_common.py +221 -0
- gbskernels-0.2.0/examples/jiuzhang/confirmatory_contract.py +730 -0
- gbskernels-0.2.0/examples/jiuzhang/confirmatory_design.py +821 -0
- gbskernels-0.2.0/examples/jiuzhang/confirmatory_inference.py +1381 -0
- gbskernels-0.2.0/examples/jiuzhang/confirmatory_release.py +623 -0
- gbskernels-0.2.0/examples/jiuzhang/dd_frontier_20260708T105821Z.json +92 -0
- gbskernels-0.2.0/examples/jiuzhang/dd_validate.py +81 -0
- gbskernels-0.2.0/examples/jiuzhang/jiuzhang1_frontier_20260707T164417Z.json +364 -0
- gbskernels-0.2.0/examples/jiuzhang/jiuzhang_frontier.py +150 -0
- gbskernels-0.2.0/examples/jiuzhang/joint_normalizer_replicates.py +151 -0
- gbskernels-0.2.0/examples/jiuzhang/make_precision_wall.py +107 -0
- gbskernels-0.2.0/examples/jiuzhang/prepare_registration_v2.py +206 -0
- gbskernels-0.2.0/examples/jiuzhang/q7_construction.py +211 -0
- gbskernels-0.2.0/examples/jiuzhang/reconstruction_replicates.py +651 -0
- gbskernels-0.2.0/examples/jiuzhang/registration_readiness_v2.py +372 -0
- gbskernels-0.2.0/examples/jiuzhang/select_confirmatory_v2.py +876 -0
- gbskernels-0.2.0/gbskernels/__init__.py +846 -0
- gbskernels-0.2.0/gbskernels.egg-info/PKG-INFO +255 -0
- gbskernels-0.2.0/gbskernels.egg-info/SOURCES.txt +194 -0
- gbskernels-0.2.0/gbskernels.egg-info/dependency_links.txt +1 -0
- gbskernels-0.2.0/gbskernels.egg-info/requires.txt +2 -0
- gbskernels-0.2.0/gbskernels.egg-info/top_level.txt +5 -0
- gbskernels-0.2.0/highprec_ref/__init__.py +16 -0
- gbskernels-0.2.0/highprec_ref/hafnian.py +46 -0
- gbskernels-0.2.0/highprec_ref/loop_hafnian.py +38 -0
- gbskernels-0.2.0/highprec_ref/permanent.py +85 -0
- gbskernels-0.2.0/highprec_ref/torontonian.py +46 -0
- gbskernels-0.2.0/pyproject.toml +73 -0
- gbskernels-0.2.0/sampling/__init__.py +18 -0
- gbskernels-0.2.0/sampling/boson_sampling.py +90 -0
- gbskernels-0.2.0/sampling/gbs.py +301 -0
- gbskernels-0.2.0/sampling/sampler.py +446 -0
- gbskernels-0.2.0/scripts/README.md +26 -0
- gbskernels-0.2.0/scripts/gpu_session.sh +277 -0
- gbskernels-0.2.0/scripts/launch_session.sh +86 -0
- gbskernels-0.2.0/scripts/session.py +207 -0
- gbskernels-0.2.0/setup.cfg +4 -0
- gbskernels-0.2.0/tests/test_absolute_predictive_checks_v2.py +44 -0
- gbskernels-0.2.0/tests/test_bench_accuracy.py +95 -0
- gbskernels-0.2.0/tests/test_bench_calibrate_auto.py +47 -0
- gbskernels-0.2.0/tests/test_bench_crossover.py +74 -0
- gbskernels-0.2.0/tests/test_bench_provenance.py +70 -0
- gbskernels-0.2.0/tests/test_bench_throughput.py +45 -0
- gbskernels-0.2.0/tests/test_bench_walrus_baseline.py +57 -0
- gbskernels-0.2.0/tests/test_calibration_normalizer_replicates_v2.py +35 -0
- gbskernels-0.2.0/tests/test_certified.py +416 -0
- gbskernels-0.2.0/tests/test_coherence_family.py +63 -0
- gbskernels-0.2.0/tests/test_confirmatory_design_v2.py +348 -0
- gbskernels-0.2.0/tests/test_confirmatory_inference_v2.py +666 -0
- gbskernels-0.2.0/tests/test_confirmatory_registration_v2.py +281 -0
- gbskernels-0.2.0/tests/test_confirmatory_release_v2.py +547 -0
- gbskernels-0.2.0/tests/test_confirmatory_run_v2.py +310 -0
- gbskernels-0.2.0/tests/test_confirmatory_selection_v2.py +329 -0
- gbskernels-0.2.0/tests/test_cuda_preflight.py +40 -0
- gbskernels-0.2.0/tests/test_dd_arithmetic.py +91 -0
- gbskernels-0.2.0/tests/test_exclusion_ledger_v2.py +310 -0
- gbskernels-0.2.0/tests/test_gbs_layer4.py +128 -0
- gbskernels-0.2.0/tests/test_gbs_sampler.py +145 -0
- gbskernels-0.2.0/tests/test_gpu_bindings.py +399 -0
- gbskernels-0.2.0/tests/test_hafnian_highprec.py +64 -0
- gbskernels-0.2.0/tests/test_hafnian_layer1.py +83 -0
- gbskernels-0.2.0/tests/test_hafnian_layer2_3.py +89 -0
- gbskernels-0.2.0/tests/test_highprec_ref.py +81 -0
- gbskernels-0.2.0/tests/test_joint_normalizer_replicates_v2.py +27 -0
- gbskernels-0.2.0/tests/test_kernel_footprint.py +43 -0
- gbskernels-0.2.0/tests/test_layer1_combinatorial.py +83 -0
- gbskernels-0.2.0/tests/test_layer2_thewalrus.py +33 -0
- gbskernels-0.2.0/tests/test_layer3_properties.py +75 -0
- gbskernels-0.2.0/tests/test_layer5_cancellation.py +120 -0
- gbskernels-0.2.0/tests/test_layer5_engineering.py +71 -0
- gbskernels-0.2.0/tests/test_loop_hafnian.py +134 -0
- gbskernels-0.2.0/tests/test_precision_auto.py +99 -0
- gbskernels-0.2.0/tests/test_reconstruction_replicates_v2.py +329 -0
- gbskernels-0.2.0/tests/test_refusal_analysis_v2.py +260 -0
- gbskernels-0.2.0/tests/test_registration_readiness_v2.py +238 -0
- gbskernels-0.2.0/tests/test_repeated.py +394 -0
- gbskernels-0.2.0/tests/test_sampler_precision_cutoff.py +104 -0
- gbskernels-0.2.0/tests/test_sampler_resident.py +137 -0
- gbskernels-0.2.0/tests/test_sampling_bosonsampling.py +57 -0
- gbskernels-0.2.0/tests/test_sampling_displaced.py +91 -0
- gbskernels-0.2.0/tests/test_sampling_gpu_backend.py +110 -0
- gbskernels-0.2.0/tests/test_sampling_threshold_tor.py +70 -0
- gbskernels-0.2.0/tests/test_threshold_O_xxpp.py +141 -0
- gbskernels-0.2.0/tests/test_tightness.py +25 -0
- gbskernels-0.2.0/tests/test_tor_recursive.py +135 -0
- gbskernels-0.2.0/tests/test_torontonian.py +117 -0
- gbskernels-0.2.0/tests/test_workspace_bucketing.py +205 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.2.0] - 2026-07-22
|
|
4
|
+
|
|
5
|
+
### Important Correction
|
|
6
|
+
|
|
7
|
+
- Replace the legacy Jiuzhang state reconstruction with the published
|
|
8
|
+
paired-source Q7 construction and the exact real xxpp threshold-torontonian
|
|
9
|
+
matrix. The two v0.1 frontier JSON files remain historical artifacts and are
|
|
10
|
+
rejected by the current figure tooling.
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- A fail-closed Jiuzhang confirmatory-v2 workflow covering exposure-ledger
|
|
15
|
+
audit, outcome-blind design, immutable public registration and beacon-derived
|
|
16
|
+
selection, content-addressed evaluation, refusal recovery,
|
|
17
|
+
reconstruction/calibration uncertainty, joint normalizer replicates,
|
|
18
|
+
absolute predictive checks, simultaneous coherence-grid inference, and
|
|
19
|
+
hash-verified release bundles.
|
|
20
|
+
- Canonical registration, design, and exposure templates plus focused contract
|
|
21
|
+
and regression tests for the workflow and exact xxpp construction.
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
|
|
25
|
+
- Harden certified recursive-torontonian bounds with directed downward
|
|
26
|
+
subtraction, sound double-double magnitude bounds, and explicit
|
|
27
|
+
double-double-to-FP64 collapse residual accounting, plus a dedicated
|
|
28
|
+
enclosure gate.
|
|
29
|
+
|
|
30
|
+
### Scope
|
|
31
|
+
|
|
32
|
+
- This release provides code, templates, and validation contracts. It contains
|
|
33
|
+
no completed v2 registration or new scientific outcome; external calibration,
|
|
34
|
+
public timestamp/beacon evidence, and acquisition inputs remain required.
|
|
35
|
+
|
|
36
|
+
[0.2.0]: https://github.com/chaofanzhougit/GBSKernels/compare/v0.1.1...v0.2.0
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
message: "If you use this software, please cite it as below."
|
|
3
|
+
title: "GBSKernels: a GPU-native, batched library of photonic sampling matrix functions"
|
|
4
|
+
version: 0.2.0
|
|
5
|
+
date-released: 2026-07-22
|
|
6
|
+
license: Apache-2.0
|
|
7
|
+
repository-code: "https://github.com/chaofanzhougit/GBSKernels"
|
|
8
|
+
authors:
|
|
9
|
+
- given-names: Chaofan
|
|
10
|
+
family-names: Zhou
|
|
11
|
+
email: chaofanzhou97@gmail.com
|
gbskernels-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Source distribution contents: the CPU library packages are declared in
|
|
2
|
+
# pyproject; this adds the CUDA sources, bindings, examples, docs, and the
|
|
3
|
+
# session tooling so the sdist is a complete, buildable source release.
|
|
4
|
+
graft core
|
|
5
|
+
graft bindings
|
|
6
|
+
graft examples
|
|
7
|
+
graft docs
|
|
8
|
+
graft scripts
|
|
9
|
+
graft envs
|
|
10
|
+
include LICENSE README.md CHANGELOG.md CITATION.cff pyproject.toml
|
|
11
|
+
prune core/build
|
|
12
|
+
prune core/build_prof
|
|
13
|
+
prune bindings/build
|
|
14
|
+
prune bindings/build_host
|
|
15
|
+
global-exclude __pycache__ *.pyc *.so *.o
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gbskernels
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: GPU-native, batched library of photonic sampling matrix functions (hafnian, loop hafnian, permanent, torontonian).
|
|
5
|
+
Author-email: Chaofan Zhou <chaofanzhou97@gmail.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/chaofanzhougit/GBSKernels
|
|
8
|
+
Project-URL: Documentation, https://github.com/chaofanzhougit/GBSKernels#readme
|
|
9
|
+
Project-URL: Issues, https://github.com/chaofanzhougit/GBSKernels/issues
|
|
10
|
+
Keywords: quantum,photonics,gaussian-boson-sampling,hafnian,permanent,torontonian,loop-hafnian,gpu,cuda,numerical-methods
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
16
|
+
Requires-Python: >=3.12
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: numpy>=1.26
|
|
20
|
+
Requires-Dist: mpmath>=1.3
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
# GBSKernels
|
|
24
|
+
|
|
25
|
+
A GPU-native, batched library of the #P-hard matrix functions behind photonic
|
|
26
|
+
quantum sampling — the **permanent, hafnian, loop hafnian, and torontonian** —
|
|
27
|
+
with an explicit floating-point accuracy model that ranges from native double
|
|
28
|
+
precision to rigorous a-posteriori error bounds.
|
|
29
|
+
|
|
30
|
+
Gaussian boson sampling and its displaced- and threshold-detector variants, and
|
|
31
|
+
standard boson sampling, reduce computationally to evaluating *large batches of
|
|
32
|
+
independent, medium-sized* instances of these four functions. Each is an
|
|
33
|
+
alternating signed sum whose value can be many orders of magnitude smaller than
|
|
34
|
+
its terms, so it is cancellation-prone in floating point: both throughput and
|
|
35
|
+
*known* accuracy matter. GBSKernels targets exactly this workload — batched-first
|
|
36
|
+
kernels on CPU and CUDA, every function validated against independent
|
|
37
|
+
combinatorial ground truth, and a precision model in which the accuracy of every
|
|
38
|
+
result is either measured or provably bounded.
|
|
39
|
+
|
|
40
|
+
GBSKernels is designed to **complement**
|
|
41
|
+
[The Walrus](https://github.com/XanaduAI/thewalrus), the canonical CPU/C++
|
|
42
|
+
reference implementation, rather than to replace it: a GPU-native, batched
|
|
43
|
+
companion with an explicit accuracy characterization. The Walrus is used here as
|
|
44
|
+
one of several independent test oracles.
|
|
45
|
+
|
|
46
|
+
> **Status.** The CPU library is complete and `pip`-installable (pure Python,
|
|
47
|
+
> `numpy` + `mpmath` only). Historical release validation covers NVIDIA hardware
|
|
48
|
+
> (RTX 4090, A100); the v0.2 changes pass the CPU host-shim gates and still require
|
|
49
|
+
> a fresh on-device validation session. This is pre-1.0 software and the public
|
|
50
|
+
> API may change.
|
|
51
|
+
|
|
52
|
+
Version 0.2.0 adds the fail-closed Jiuzhang confirmatory workflow and corrects
|
|
53
|
+
the real threshold-torontonian construction used by the Jiuzhang examples. See
|
|
54
|
+
the [changelog](CHANGELOG.md) for the release scope and compatibility notes.
|
|
55
|
+
|
|
56
|
+
## Installation
|
|
57
|
+
|
|
58
|
+
Not yet on PyPI; install from source. The CPU backend needs only `numpy` +
|
|
59
|
+
`mpmath`; the CUDA extension is a separate, optional build (see
|
|
60
|
+
[`bindings/README.md`](bindings/README.md)):
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
uv build # -> dist/gbskernels-*.whl, then pip install it
|
|
64
|
+
# pip install gbskernels # planned once published to PyPI
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Quick start
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
import numpy as np
|
|
71
|
+
import gbskernels
|
|
72
|
+
|
|
73
|
+
A = np.array([[1., 2.], [3., 4.]])
|
|
74
|
+
gbskernels.perm(A) # (10+0j)
|
|
75
|
+
|
|
76
|
+
# The API is batched-first: one call evaluates a stack of matrices.
|
|
77
|
+
rng = np.random.default_rng(0)
|
|
78
|
+
stack = rng.standard_normal((4096, 8, 8))
|
|
79
|
+
stack = stack + stack.transpose(0, 2, 1) # symmetric, as the hafnian needs
|
|
80
|
+
|
|
81
|
+
gbskernels.haf_batched(stack) # double precision (default)
|
|
82
|
+
gbskernels.haf_batched(stack, precision="auto") # double precision + cancellation guard
|
|
83
|
+
gbskernels.haf_batched(stack, backend="gpu") # CUDA, if the extension is built
|
|
84
|
+
gbskernels.haf(stack[0], precision="ref") # arbitrary-precision reference
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
A short guided tour — closed-form checks, the `auto` tier catching real
|
|
88
|
+
double-precision cancellation, a GBS distribution, and a sampling run — runs
|
|
89
|
+
with wheel dependencies only:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
python examples/gbs_demo.py
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Precision model
|
|
96
|
+
|
|
97
|
+
Precision is always an explicit tier, so the accuracy of a result is never left
|
|
98
|
+
implicit:
|
|
99
|
+
|
|
100
|
+
| Tier | Description |
|
|
101
|
+
|---|---|
|
|
102
|
+
| `"fp64"` (default) | Native double precision — the throughput path, with a measured accuracy boundary. |
|
|
103
|
+
| `"dd"` | Double-double arithmetic carried internally through the cancelling sum (a GPU tier); recovers a correct double-precision result where plain double precision cancels. |
|
|
104
|
+
| `"ref"` | Arbitrary-precision reference (`mpmath`); the accuracy ground truth. |
|
|
105
|
+
| `"auto"` | Double precision plus a per-evaluation cancellation indicator; evaluations flagged as risky are recomputed in a higher tier (`mpmath` on CPU, double-double on GPU). The indicator is a calibrated heuristic, not a certificate. |
|
|
106
|
+
| `"certified"` | The double-precision value together with a **rigorous a-posteriori error bound**: `\|value − exact\| ≤ abs_error_bound`, a running error bound in the standard model of floating-point arithmetic (on the GPU, the bound arithmetic uses per-instruction directed rounding). Available for all four functions on CPU and GPU. With `rtol=`, a failed certified-fp64 bound escalates to the arbitrary-precision reference; GPU permanent and hafnian first try a certified double-double bound. The reference result is flagged as non-certified. `tor_single(..., dd=True)` provides a separate certified-double-double large-torontonian path. |
|
|
107
|
+
|
|
108
|
+
## Features
|
|
109
|
+
|
|
110
|
+
- **All four functions, batched, on CPU and CUDA.** Field-standard algorithms
|
|
111
|
+
(Glynn/BB–FG for the permanent, the power-trace form for the hafnian and loop
|
|
112
|
+
hafnian, subset-determinant inclusion–exclusion for the torontonian), each with
|
|
113
|
+
an independent naive reference used for verification.
|
|
114
|
+
- **A measured accuracy boundary.** The double-precision–vs–double-double
|
|
115
|
+
crossover is characterized for every function against an arbitrary-precision
|
|
116
|
+
reference, on physical and adversarial inputs.
|
|
117
|
+
- **Certified evaluation.** Every value can be returned with a rigorous error
|
|
118
|
+
bound whose enclosure of the true value is a hard test invariant — verified on
|
|
119
|
+
closed forms, random ensembles, and adversarial cancellation families.
|
|
120
|
+
- **A device-resident workspace.** `gbskernels.Workspace` evaluates ragged
|
|
121
|
+
batches with a persistent stream, pinned staging, and a zero-copy DLPack output
|
|
122
|
+
that CuPy / PyTorch / JAX can consume without a device-to-host copy
|
|
123
|
+
([`docs/device_resident_contract.md`](docs/device_resident_contract.md)).
|
|
124
|
+
- **A conditional GBS sampler** (`sampling/`) that draws photon-number samples by
|
|
125
|
+
the chain rule, evaluating each mode's batch of hafnians on the GPU, validated
|
|
126
|
+
distributionally (total-variation distance below 0.03 against both the exact
|
|
127
|
+
distribution and The Walrus, and a chi-square goodness-of-fit p > 10⁻³ against
|
|
128
|
+
The Walrus).
|
|
129
|
+
- **Structure-aware kernels** for the sampling workload: a repeated-row
|
|
130
|
+
finite-difference sieve for the loop hafnian, and a recursive prefix-Cholesky
|
|
131
|
+
torontonian — including a single-large mode that splits one evaluation across
|
|
132
|
+
the GPU to dimension 64 (32 modes).
|
|
133
|
+
- **A fail-closed confirmatory workflow** for the public Jiuzhang example,
|
|
134
|
+
covering exposure audit, frozen design, future-beacon selection,
|
|
135
|
+
content-addressed evaluation, refusal recovery, simultaneous coherence-grid
|
|
136
|
+
inference, predictive checks, and release verification
|
|
137
|
+
([protocol](docs/confirmatory_v2.md),
|
|
138
|
+
[tools](examples/jiuzhang/README.md)). The repository ships templates and
|
|
139
|
+
validation contracts, not a fabricated registration or completed v2 outcome.
|
|
140
|
+
|
|
141
|
+
## Verification
|
|
142
|
+
|
|
143
|
+
Verification is treated as the deliverable ([`docs/DESIGN.md`](docs/DESIGN.md), §8).
|
|
144
|
+
Five layers are exercised by the test suite on every commit:
|
|
145
|
+
|
|
146
|
+
1. **Independent combinatorial ground truth** — perfect-matching counts and
|
|
147
|
+
closed forms (`perm(J_n) = n!`, `haf(J_{2n}) = (2n−1)!!`, …), sharing no code
|
|
148
|
+
with any existing library.
|
|
149
|
+
2. **Differential testing against The Walrus** across sizes, seeds, and
|
|
150
|
+
real/complex inputs.
|
|
151
|
+
3. **Property-based invariants** (Hypothesis): scaling, permutation, transpose,
|
|
152
|
+
the loop-hafnian → hafnian reduction, and others.
|
|
153
|
+
4. **Statistical / end-to-end validation** — the kernels compute GBS
|
|
154
|
+
distributions that sum to one and match The Walrus per pattern in all three
|
|
155
|
+
detector regimes.
|
|
156
|
+
5. **Numerical-accuracy characterization** against the arbitrary-precision
|
|
157
|
+
reference, including adversarial cancellation families that defeat double
|
|
158
|
+
precision and must survive double-double.
|
|
159
|
+
|
|
160
|
+
The Jiuzhang v2 tooling adds workflow-contract tests for canonical hashing,
|
|
161
|
+
registration timing, exclusion-ledger completeness, selection, immutable run
|
|
162
|
+
reduction, refusal recovery, inference, reconstruction, and release assembly.
|
|
163
|
+
|
|
164
|
+
The development discipline is CPU-first: host-shim-compatible CUDA kernels are
|
|
165
|
+
compiled and run through the CPU pre-flight (part of the test suite), then the
|
|
166
|
+
full source set is checked on-device against independent CPU references before
|
|
167
|
+
any throughput result is considered publishable. Device-only variants such as
|
|
168
|
+
the warp-specialized permanent are covered by the on-device gates; profiler
|
|
169
|
+
diagnostics collected before those gates remain provisional until they pass.
|
|
170
|
+
|
|
171
|
+
## Performance
|
|
172
|
+
|
|
173
|
+
The library is batched-first: throughput comes from evaluating thousands of
|
|
174
|
+
independent instances per launch, and the benchmark harness reports where the
|
|
175
|
+
CPU wins (small single evaluations) as plainly as where the GPU wins (large
|
|
176
|
+
batches), always alongside the accuracy each point was measured at. The
|
|
177
|
+
structure-aware kernels give substantial speedups in their regimes — the
|
|
178
|
+
recursive torontonian over the LU form, and the finite-difference sieve over the
|
|
179
|
+
expanded power-trace at repeated-row patterns. Raw benchmark data is written,
|
|
180
|
+
append-only, to `results/`; the protocol is described in
|
|
181
|
+
[`docs/benchmark_protocol.md`](docs/benchmark_protocol.md).
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
python -m bench.accuracy # the accuracy boundary, all four functions
|
|
185
|
+
python -m bench.throughput --func perm --sizes 4,6,8,10
|
|
186
|
+
bash scripts/gpu_session.sh # full on-device session (on a CUDA host)
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Scope and limitations
|
|
190
|
+
|
|
191
|
+
These are correctness-first kernels with a deliberately narrow scope:
|
|
192
|
+
|
|
193
|
+
- **One evaluation per GPU thread** is the default mapping. Warp/block-cooperative
|
|
194
|
+
variants exist and are dispatched only where they measurably win (the
|
|
195
|
+
cooperative permanent); for the hafnian, loop hafnian, and torontonian the
|
|
196
|
+
per-thread linear algebra is memory-bound, and the cooperative strategy does
|
|
197
|
+
not help them.
|
|
198
|
+
- **The four functions do not share a single subset-enumeration engine.** Only
|
|
199
|
+
the permanent uses the Gray-code delta walk; the others enumerate masks
|
|
200
|
+
independently, because their per-subset work is memory-bound.
|
|
201
|
+
- **Fixed size limits** (per-thread buffers): permanent ≤ 28, hafnian ≤ 20 (DD
|
|
202
|
+
≤ 16), loop hafnian ≤ 20 (DD ≤ 14), torontonian 2n ≤ 24. Larger inputs raise on
|
|
203
|
+
`backend="gpu"`; use the CPU backend. The single-large recursive torontonian
|
|
204
|
+
extends to dimension 64.
|
|
205
|
+
- **The double-double tier is internal**: kernels carry double-double through the
|
|
206
|
+
cancelling summation and collapse to `complex128` on output — they recover a
|
|
207
|
+
correct double-precision answer under cancellation rather than exposing
|
|
208
|
+
extended-precision results. The double-double torontonian is real-input only.
|
|
209
|
+
- **The sampler is pure-state and hybrid host-orchestrated** (the host drives the
|
|
210
|
+
chain rule; the GPU evaluates each step's batch of hafnians). A fully
|
|
211
|
+
on-device variant is available but limited to double precision within a
|
|
212
|
+
submatrix-size cap.
|
|
213
|
+
- **Single GPU, CUDA only** — no multi-GPU, ROCm, or automatic differentiation.
|
|
214
|
+
|
|
215
|
+
## Repository layout
|
|
216
|
+
|
|
217
|
+
```
|
|
218
|
+
gbskernels/ batched-first Python API (the public surface)
|
|
219
|
+
cpu_ref/ independent CPU reference implementations (double + double-double)
|
|
220
|
+
highprec_ref/ arbitrary-precision reference (mpmath)
|
|
221
|
+
core/ CUDA C++: subset-enumeration utilities, the kernels, on-device gates
|
|
222
|
+
bindings/ nanobind extension exposing the GPU backend to Python
|
|
223
|
+
sampling/ boson-sampling orchestration and the conditional GBS sampler
|
|
224
|
+
examples/ runnable CPU demo plus Jiuzhang reproduction and v2 workflow tools
|
|
225
|
+
tests/ the five-layer verification suite
|
|
226
|
+
bench/ accuracy and throughput harnesses
|
|
227
|
+
scripts/ envs/ scripted GPU-session runner and container definitions
|
|
228
|
+
docs/ design, benchmark/device contracts, and v2 protocol/templates
|
|
229
|
+
results/ append-only validation, gate, benchmark, and profiler artifacts
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## Development
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
uv sync # Python 3.12 environment, dependencies, editable install
|
|
236
|
+
uv run pytest # the CPU verification suite
|
|
237
|
+
uv run pytest -m layer1 # the independent combinatorial ground truth
|
|
238
|
+
uv run pytest -m "not slow" # the fast tier
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
Building the CUDA extension requires `nvcc` and is a separate, optional step
|
|
242
|
+
([`bindings/README.md`](bindings/README.md)); the pure-Python wheel never
|
|
243
|
+
requires it. The full design rationale — algorithms, precision strategy, and the
|
|
244
|
+
verification contract — is in [`docs/DESIGN.md`](docs/DESIGN.md).
|
|
245
|
+
|
|
246
|
+
## Relationship to The Walrus
|
|
247
|
+
|
|
248
|
+
GBSKernels would not exist without [The Walrus](https://github.com/XanaduAI/thewalrus),
|
|
249
|
+
which remains the canonical reference implementation and this library's primary
|
|
250
|
+
differential oracle. The scope here is deliberately narrower: the four batched
|
|
251
|
+
kernels and their precision characterization.
|
|
252
|
+
|
|
253
|
+
## License
|
|
254
|
+
|
|
255
|
+
[Apache-2.0](LICENSE).
|