perf(state): derive n_systems from cell shape to avoid GPU-CPU sync
Merged
LI
1mo ago+27+27+01234567890123456789-6-6-0123456789
Summary
- Derive
SimState.n_systemsfrom the leading dimension ofcellinstead oftorch.uniqueonsystem_idx, so reading it no longer forces a GPU-CPU sync. - Use
state.n_systemsin the FIRE steps, as discussed in #609. - Validate constraints after
__post_init__batches the cell, so system constraint bounds are checked against the correctn_systemswhen a(3, 3)cell is passed. Add a test for this case.
Checklist
Before a pull request can be merged, the following items must be checked:
- Doc strings have been added in the Google docstring format.
- Run ruff on your code.
- Tests have been added for any new functionality or bug fixes.