Skip to content

Replace the C physics port with a Numba accelerator - #37

Merged
swissskimmilk merged 20 commits into
mainfrom
engine-design/numba-accelerator
Sep 5, 2026
Merged

swissskimmilk merged 20 commits into
mainfrom
engine-design/numba-accelerator

Conversation

@swissskimmilk

@swissskimmilk swissskimmilk commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Replaces the hand-written C physics work with Numba, which is a method compiling Python inner heavy math loops into fast code.

Benchmarks

One full Layer-1 run, same config, pinned seed, 21 workers, interleaved, 3 reps:

median vs Python
pure Python 131.8 s 1x
C port (deleted here) 4.67 s 28x
this branch 1.61 s 82x

Per operation: Layer-1 candidate 327 ms → 2.7 ms; chug sweep 1537 µs → 29 µs; pintle evaluate 5164 µs → 262 µs. Accelerator source ~6,760 lines C + glue → 1,929 lines Python/Numba.

Coverage

Added support for pintle in the accelerated path. Didn't both with regen or film cuz never used.

Correctness

tests/test_numba_ab_parity.py compare the accelerated and Python paths live, field by field, across 3 configs. Worst divergence 2.5e-9; suite asserts 1e-6, so we good.

Also in this PR

Found while testing, independent of the migration:

  • CEA cache read 73x per run. and would decompress constantly, got a lot of speed savings by getting it into memory
  • ZeroDivisionError when layer1_max_iterations < num_restartsiter_budget floored to 0
  • Layer-1 plot/counter fixes. Progress read Iter 8000/200 incorrectly and the plot's x-axis mixed two counters and also improved legend
  • Two redundant deepcopys of the worker payload removed (−92k calls), thought it didn't make a difference in speed, worth the cleanup

@swissskimmilk
swissskimmilk force-pushed the engine-design/numba-accelerator branch from aa7d7b2 to ce92dd5 Compare September 4, 2026 23:35
@swissskimmilk swissskimmilk changed the title Replace the C physics port with a Numba accelerator (faster, a third the code, adds pintle) Replace the C physics port with a Numba accelerator Sep 4, 2026
@swissskimmilk
swissskimmilk merged commit d4d5b31 into main Sep 5, 2026
13 checks passed
@swissskimmilk
swissskimmilk deleted the engine-design/numba-accelerator branch September 5, 2026 02:14
Carlsaurus added a commit that referenced this pull request Sep 12, 2026
feed-twin/ and lib/feedtwin/ -- the cockpit and the physics core it and
EngineDesign import -- had never been committed on any branch; they existed
only as untracked files in one working directory. Same for the docs tree,
the benchmark script, the stability solver package and the CI workflow.
Build trees, per-app user data and engine run output are now ignored so
they never come along.

Also the deployment and config edits that were sitting uncommitted (the
feed-twin service in docker-compose and the Caddyfile, the flush guard in
the document store and its test, the EngineDesign frontend tweaks), the
Phase 2 physics work (burst/safety-factor trip, gas-derived wall film, Cd
valve models, line_mass), and the start of the centerline sketch model.

EngineDesign/engine/native is left out on purpose: the C port was replaced
by the Numba accelerator in #37 and the local copy is a leftover.
Carlsaurus added a commit that referenced this pull request Sep 12, 2026
feed-twin/ and lib/feedtwin/ -- the cockpit and the physics core it and
EngineDesign import -- had never been committed on any branch; they existed
only as untracked files in one working directory. Same for the docs tree,
the benchmark script, the stability solver package and the CI workflow.
Build trees, per-app user data and engine run output are now ignored so
they never come along.

Also the deployment and config edits that were sitting uncommitted (the
feed-twin service in docker-compose and the Caddyfile, the flush guard in
the document store and its test, the EngineDesign frontend tweaks), the
Phase 2 physics work (burst/safety-factor trip, gas-derived wall film, Cd
valve models, line_mass), and the start of the centerline sketch model.

EngineDesign/engine/native is left out on purpose: the C port was replaced
by the Numba accelerator in #37 and the local copy is a leftover.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant