Replace the C physics port with a Numba accelerator - #37
Merged
Merged
Conversation
…last C dependency
…cannot divide by zero
swissskimmilk
force-pushed
the
engine-design/numba-accelerator
branch
from
September 4, 2026 23:35
aa7d7b2 to
ce92dd5
Compare
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
Per operation: Layer-1 candidate 327 ms → 2.7 ms; chug sweep 1537 µs → 29 µs; pintle
evaluate5164 µ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.pycompare 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:
ZeroDivisionErrorwhenlayer1_max_iterations < num_restarts—iter_budgetfloored to 0Iter 8000/200incorrectly and the plot's x-axis mixed two counters and also improved legenddeepcopys of the worker payload removed (−92k calls), thought it didn't make a difference in speed, worth the cleanup