neurocuda 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.
Files changed (65) hide show
  1. neurocuda-0.2.0/CLAUDE.md +74 -0
  2. neurocuda-0.2.0/LICENSE +21 -0
  3. neurocuda-0.2.0/MANIFEST.in +15 -0
  4. neurocuda-0.2.0/PKG-INFO +825 -0
  5. neurocuda-0.2.0/README.md +777 -0
  6. neurocuda-0.2.0/examples/convert_resnet.py +133 -0
  7. neurocuda-0.2.0/examples/debug_cartpole_gap.py +356 -0
  8. neurocuda-0.2.0/examples/demo.py +129 -0
  9. neurocuda-0.2.0/examples/demo_a_multiseed.py +276 -0
  10. neurocuda-0.2.0/examples/demo_a_perception.py +417 -0
  11. neurocuda-0.2.0/examples/demo_a_snn_direct.py +313 -0
  12. neurocuda-0.2.0/examples/demo_b_control.py +445 -0
  13. neurocuda-0.2.0/examples/demo_b_conversion.py +345 -0
  14. neurocuda-0.2.0/examples/demo_b_conversion_v2.py +350 -0
  15. neurocuda-0.2.0/examples/demo_b_conversion_v3.py +447 -0
  16. neurocuda-0.2.0/examples/demo_b_conversion_v4.py +431 -0
  17. neurocuda-0.2.0/examples/demo_c_robotics_perception.py +353 -0
  18. neurocuda-0.2.0/examples/final_validation.py +210 -0
  19. neurocuda-0.2.0/examples/iftune_demo_a.py +211 -0
  20. neurocuda-0.2.0/examples/prep_nmnist.py +60 -0
  21. neurocuda-0.2.0/examples/qcfs_pipeline.py +252 -0
  22. neurocuda-0.2.0/examples/resnet_pipeline.py +311 -0
  23. neurocuda-0.2.0/examples/test_converter_5d.py +185 -0
  24. neurocuda-0.2.0/examples/train_qcfs_scratch.py +82 -0
  25. neurocuda-0.2.0/examples/train_sew_resnet.py +238 -0
  26. neurocuda-0.2.0/examples/validate.py +245 -0
  27. neurocuda-0.2.0/models.py +324 -0
  28. neurocuda-0.2.0/neurocuda/__init__.py +39 -0
  29. neurocuda-0.2.0/neurocuda/backends/__init__.py +19 -0
  30. neurocuda-0.2.0/neurocuda/backends/cpu.py +44 -0
  31. neurocuda-0.2.0/neurocuda/backends/gpu.py +50 -0
  32. neurocuda-0.2.0/neurocuda/backends/loihi.py +144 -0
  33. neurocuda-0.2.0/neurocuda/compiler.py +96 -0
  34. neurocuda-0.2.0/neurocuda/converter.py +573 -0
  35. neurocuda-0.2.0/neurocuda/export/__init__.py +12 -0
  36. neurocuda-0.2.0/neurocuda/export/fpga_pipeline.py +317 -0
  37. neurocuda-0.2.0/neurocuda/export/nir_exporter.py +258 -0
  38. neurocuda-0.2.0/neurocuda/export/verilog_export.py +284 -0
  39. neurocuda-0.2.0/neurocuda/finetune.py +55 -0
  40. neurocuda-0.2.0/neurocuda/ir.py +162 -0
  41. neurocuda-0.2.0/neurocuda/neurobench.py +229 -0
  42. neurocuda-0.2.0/neurocuda/qcfs.py +122 -0
  43. neurocuda-0.2.0/neurocuda/utils.py +75 -0
  44. neurocuda-0.2.0/neurocuda.egg-info/PKG-INFO +825 -0
  45. neurocuda-0.2.0/neurocuda.egg-info/SOURCES.txt +63 -0
  46. neurocuda-0.2.0/neurocuda.egg-info/dependency_links.txt +1 -0
  47. neurocuda-0.2.0/neurocuda.egg-info/requires.txt +25 -0
  48. neurocuda-0.2.0/neurocuda.egg-info/top_level.txt +2 -0
  49. neurocuda-0.2.0/pyproject.toml +59 -0
  50. neurocuda-0.2.0/reproduce.py +875 -0
  51. neurocuda-0.2.0/requirements.txt +15 -0
  52. neurocuda-0.2.0/results/fpga_validation.json +106 -0
  53. neurocuda-0.2.0/results/gate3_results.md +22 -0
  54. neurocuda-0.2.0/results/ground_truth.md +29 -0
  55. neurocuda-0.2.0/setup.cfg +4 -0
  56. neurocuda-0.2.0/setup.py +54 -0
  57. neurocuda-0.2.0/tests/conftest.py +128 -0
  58. neurocuda-0.2.0/tests/test_compiler.py +137 -0
  59. neurocuda-0.2.0/tests/test_converter.py +332 -0
  60. neurocuda-0.2.0/tests/test_device.py +208 -0
  61. neurocuda-0.2.0/tests/test_lava_equivalence.py +56 -0
  62. neurocuda-0.2.0/tests/test_loihi_bitaccurate.py +214 -0
  63. neurocuda-0.2.0/tests/test_models.py +225 -0
  64. neurocuda-0.2.0/tests/test_nir.py +182 -0
  65. neurocuda-0.2.0/tests/test_utils.py +204 -0
@@ -0,0 +1,74 @@
1
+ # CLAUDE.md — NeuroCUDA
2
+
3
+ ## PRIME DIRECTIVE — HONESTY RULES (read before every task)
4
+
5
+ 1. **A failed run is a bug, never a "finding."** If a published method produces bad results, your implementation is broken. Investigate. Do not claim you discovered the method doesn't work.
6
+ 2. **Full test set only.** CIFAR-10 = 10,000 images. Never report 500-image subsets as results.
7
+ 3. **≥3 seeds.** Every number is mean ± std. Single runs are not results.
8
+ 4. **Label hardware precisely.** "Loihi 2 simulator validated against Lava" — never "Loihi 3" or "silicon" unless physically run on it.
9
+ 5. **Gate failure = STOP.** Do not proceed. Do not relabel the target.
10
+ 6. **Report failures first.** "Gate 2 FAILED. Cause: X. Options: Y."
11
+ 7. **No marketing language.** No "world-class," "nobody has done this," "🔥." Just measurements.
12
+
13
+ ## Project Identity
14
+
15
+ **NeuroCUDA is a systems/tooling contribution.** A pip-installable compiler that takes PyTorch models and deploys them across GPU, CPU, Loihi 2 simulator, and FPGA through one API call.
16
+
17
+ **Goal:** Build an honest, working seed. NOT beat SOTA accuracy. NOT claim novel science.
18
+
19
+ ## Current State (June 19, 2026)
20
+
21
+ ### Real Numbers (full test set, need multi-seed verification)
22
+ - MLP/MNIST: ANN 97.8%, SNN 97.4%, gap 0.4% (1 seed)
23
+ - StrongCNN/CIFAR-10: ANN 80.4%, SNN 74.3%, gap 6.0% (1 seed, convert + FT)
24
+ - SEW-ResNet/CIFAR-10: 67.7% at T=8 (direct SNN, 50 epochs, 1 seed)
25
+ - ResNet/CIFAR-10: ANN 92.1%, SNN 70.1%, gap 22.0% (convert + FT, 1 seed)
26
+
27
+ ### What Works
28
+ - Multi-backend deployment: GPU/CPU/Loihi ≤1.2% deviation
29
+ - Loihi 2 bit-accurate validation: 0/256K spike deviations
30
+ - BN folding: lossless
31
+ - Post-conversion fine-tuning: +7-52% gain
32
+
33
+ ### Known Bugs
34
+ - QCFS: λ frozen at ~1.0 for layers 1-2 (gradient/learning-rate bug)
35
+ - Weight normalization: destroys ANN accuracy (implementation error)
36
+ - "Spike-density trap" and "QCFS non-generalization" are bugs, not discoveries
37
+
38
+ ## The Gates
39
+
40
+ ### GATE 1 — Ground Truth
41
+ Re-measure everything on full test set, 3 seeds. Produce honest baseline table.
42
+
43
+ ### GATE 2 — Fix Base ANN
44
+ Train ResNet-18 on CIFAR-10 to ≥93% (solved problem, standard recipe).
45
+
46
+ ### GATE 3 — Fix Converter (QCFS)
47
+ Initialize from pretrained ANN. Separate higher LR on λ. Gap ≤5%.
48
+
49
+ ### GATE 4 — Re-test Methods
50
+ Re-run per-channel, SPIKE-NORM, weight-norm on fixed pipeline.
51
+
52
+ ### GATE 5 — NeuroBench
53
+ Standard-format, multi-seed, multi-backend reporting.
54
+
55
+ ### GATE 6 — Ship
56
+ Clean README, reproducible benchmarks, honest paper.
57
+
58
+ ## NON-Goals
59
+ - Do NOT chase SOTA accuracy
60
+ - Do NOT claim physical silicon without physical silicon
61
+ - Do NOT describe bugs as discoveries
62
+ - Do NOT add scope until Gates 1-6 pass
63
+
64
+ ## Reporting Format
65
+ After each gate:
66
+ ```
67
+ GATE N — PASS/FAIL
68
+ Headline: <metric> = <mean> ± <std> (3 seeds, full test set)
69
+ Target: <target>
70
+ Changes: <1-3 bullets>
71
+ Surprises: <honest>
72
+ Verified: YES/NO
73
+ Next: YES/NO — if NO, why
74
+ ```
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 NeuroCUDA
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,15 @@
1
+ include README.md
2
+ include LICENSE
3
+ include requirements.txt
4
+ include CLAUDE.md
5
+ include reproduce.py
6
+ recursive-include examples *.py
7
+ recursive-include tests *.py
8
+ recursive-include results *.md *.csv *.json
9
+ prune .venv
10
+ prune __pycache__
11
+ prune .git
12
+ prune .claude
13
+ prune checkpoints
14
+ prune data
15
+ prune cache