Repository navigation
Keep solver state axes structured - #13
Open
rogeriojorge wants to merge 5 commits into
Open
rogeriojorge wants to merge 5 commits into
rogeriojorge wants to merge 5 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
rogeriojorge
marked this pull request as ready for review
July 13, 2026 03:20
This was referenced Jul 13, 2026
rogeriojorge
force-pushed
the
agent/structure-diffrax-state
branch
from
September 26, 2026 21:11
369c3b3 to
1dc9820
Compare
This was referenced Sep 26, 2026
Three species with unequal (Nn, Nm, Np) check that flat Hermite index s*Nn*Nm*Np + p*Nn*Nm + m*Nn + n maps to state[s, p, m, n], and a fixed-step run restarted from a saved (Ck, Fk) snapshot matches the uninterrupted run.
rogeriojorge
force-pushed
the
agent/structure-diffrax-state
branch
from
October 3, 2026 14:31
1dc9820 to
94616d8
Compare
This was referenced Oct 3, 2026
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.
Problem
The Diffrax state is one flat vector: every RHS call slices/reshapes it and concatenates the derivatives, and the species/Hermite axes are invisible to the compiler (a prerequisite for sharding).
Change (
_simulation.py)The state is the tuple
(Ck, Fk)with shapes(Ns, Np, Nm, Nn, Ny, Nx//2+1, Nz)and(6, Ny, Nx//2+1, Nz). OutputCk/Fklayout is unchanged. API note: the publicode_systemnow takes and returns the tuple instead of a flat vector.Evidence (tested SHA of the code change d5edbc4, rebased on main ab87385; local, Python 3.12.9, JAX 0.11.2, diffrax 0.7.2)
Same script run in a main worktree and a branch worktree; RHS (flattened) and
Ck/Fktrajectories, Tsit5, fixed and adaptive steps,max|diff| = 0(bitwise identical) for:Earlier timing on Orszag-Tang (from the original PR): 65x65 / 6^3, 50 steps, 9.74 s -> 9.03 s; 129x129 / 8^3, 10 steps, 22.7 s -> 21.5 s, peak 2.77 -> 2.62 GB (not re-measured here).
Tests
test_solver_state_keeps_species_and_hermite_axes: integratory0/RHS shapes (fails on main).test_structured_state_maps_flat_hermite_index_to_species_p_m_n: 3 species, unequal orders, flat indexs*Nn*Nm*Np + p*Nn*Nm + m*Nn + n->state[s,p,m,n].test_continuation_from_output_matches_single_run: restart from a saved(Ck, Fk)matches the uninterrupted fixed-step run to 1e-13.python -m pytest -n 2 -q testsat head 53777eb: 11 passed.No dependencies. Conflicts trivially with #9/#12/#55 in the
simulationoutput block.