solprop.backends.numba_cpu.low_storage#
The low-storage RK4IP march’s register kernels and resident engine on numba_cpu.
SEP 24 phase 2
(docs/dev/seps/archive/sep-0024-low-storage-interaction-picture-runge-kutta.md,
sections 4.3 and 6.6). NumbaLowStorage is the backend’s own
LowStorageEngine: it holds the accumulator B
and the stage register C beside the state A and, tabulating, the flow table,
and makes a step’s four passes through the route’s own source pipeline with no
Runge-Kutta buffer – no stage rows, accumulators, accept buffer, recycled stage,
propagator pair or exponent.
Each pass is three parts:
The input. One traversal reads one register, adds the
modifiednoise draw at the pass’s position and writes the pipeline’s input: the padded modal spectrum, the general route’s coarse lab field, the Cartesian transverse scratch or the planar column volume. On the separable kinds the draw’s phasez Im Dis formed per element from the operator’s one-dimensional arrays, so no rotated copy is held.The core. The route’s transforms, response columns and in-stage absorber, shared with the Runge-Kutta march (
NumbaCpuBackend._free_passand its siblings), leave the source in frequency.The finish. One traversal forms the source at each element (the prefactor, the window, the absorber term) and folds it into the registers with the half-step flows (
define_bodies’low_storage_fold). The flows come from the table or, on the separable kinds when recomputing, from the same per-element body that gives the prefactor. The last pass also writes one partial of the accepted state’s squared norm per column, summed by the engine.
The in-stage exchange (section 4.3). A Cartesian or line pass under an in-stage absorber evaluates twice from the same input, the material response and then the absorber’s term. The first finish folds the material source and, in the same traversal, re-forms the input in the transverse scratch from the register it came from, so the material output never needs a row of its own; the second finish folds the absorber’s term. The modal, general and planar routes form both terms from one input (the planar volume carries the absorber’s half), so their passes make one finish.
The elided stage register (Q4). A Cartesian or line pass that reads its input
once – a material response and no in-stage absorber – needs no C: the finish of
each of the first three passes writes the next pass’s input, noise and all, straight
into the transverse scratch (S <- A + h/2 S + eta(z_m) and its siblings), which
saves one state volume and the next pass’s input traversal
(solprop.backends.memory.low_storage_stage_register()).
Kernels are specialised by closure constant where a flag decides what is read –
the noise, the crop’s contiguity, the in-stage absorber term, the column threading –
and take the pass, the fold mode, the term and the flow treatment as arguments: those
branches are invariant over the traversal. The column loop is a prange in the
parallel variants, which are never disk-cached (docs/dev/backends.md section 3.2);
each element’s arithmetic is the same in either, and the norm is two-stage, one partial
per column.
Functions
|
Form |
|
Form |
|
Compile the Cartesian and line routes' register input, finish and table. |
|
Compile the modal routes' register input and finish. |
|
Compile the hybrid planar route's register input, finish and table. |
Classes
|
The Cartesian and line routes' register input, finish and flow table. |
|
The modal and general routes' register input and finish. |
|
The resident low-storage engine: the four register passes on the route's kernels. |
|
The hybrid planar route's register input, finish and flow table. |
- class solprop.backends.numba_cpu.low_storage.FreeKernels(input, fold, table)[source]#
Bases:
NamedTupleThe Cartesian and line routes’ register input, finish and flow table.
- Attributes:
- inputcallable
One register plus the rotated noise, into the transverse scratch.
- foldcallable
The material or absorber source folded into the registers, with the exchange’s re-formed input.
- tablecallable
exp(distance D)at every element, one volume.
- class solprop.backends.numba_cpu.low_storage.ModalKernels(input, fold)[source]#
Bases:
NamedTupleThe modal and general routes’ register input and finish.
- Attributes:
- inputcallable
One register plus the drawn noise, padded onto the fine grid.
- foldcallable
The source at each element folded into the registers.
- class solprop.backends.numba_cpu.low_storage.NumbaLowStorage(backend, method)[source]#
Bases:
objectThe resident low-storage engine: the four register passes on the route’s kernels.
numba_cpu’sLowStorageEngine(SEP 24 section 6.6): the backend’s state isA, updated in place, and this engine holdsB,C(unless it is elided, Q4) and the flows, allocated at construction so that the backend’s ledger names them before the first step.The flows. Tabulating a constant operator holds one volume,
exp(h_t D / 2)for the keyh_toftable_steps()(the step’s run’s mean, SEP 24 Q10), built from the operator’s origin as the host engine builds it and rebuilt only when the key changes. A varying modal operator’sPandQare formed once per step into two held volumes. Recomputing, the Cartesian, line and planar finishes formexp(h D / 2)per element from the same body that gives the prefactor and hold nothing; a modal route forms the step’sP, thenQover it before pass 3, in one held scratch volume (low_storage_flow_scratch()). A modal flow is exponentiated per element from the terms ofPhi(exponentiate_terms()), so no exponent array exists outside the ledger either.The stiffness indicator (SEP 24 Q11, decided in phase 2) is not formed:
stiffnessis NaN, which silences the march’s warning. A resident engine holdsF2andF3exactly butg1andF2only as2 (C - A) / h, which onnumpy_ref’s slopes agreed with the exact indicator to 1e-7 relative on a soliton and departed only on a nearly linear step, far below 2.785; but on the routes the march is for, the Cartesian and line kinds,Cis elided (Q4) or the slope is split between the exchange’s two evaluations, and recovering it would take the volume the march exists to save. The phase 2 report records the measurement.- Parameters:
- backendsolprop.backends.numba_cpu.backend.NumbaCpuBackend
The backend whose state, plans and route this engine steps.
- methodsolprop.stepper.low_storage.LowStorageRungeKutta
The march.
- Attributes:
- stiffnessfloat
Always NaN: not formed on this backend.
- atomicbool
Always
False: each pass is its own compiled call, between which a signal may arrive.
- class solprop.backends.numba_cpu.low_storage.SlabKernels(input, fold, table)[source]#
Bases:
NamedTupleThe hybrid planar route’s register input, finish and flow table.
- Attributes:
- inputcallable
One register plus the rotated noise, into the column volume.
- foldcallable
Both halves’ source folded into the registers.
- tablecallable
exp(distance D)at every element, one volume.
- solprop.backends.numba_cpu.low_storage.exponentiate_forward(exponent, out)[source]#
Form
exp(dPhi)alone, from one realexpand onesincos.- Parameters:
- exponentnumpy.ndarray
dPhi, complex, shape(n_columns, n_omega).- outnumpy.ndarray
Written with
exp(dPhi); may be exponent itself.
- solprop.backends.numba_cpu.low_storage.exponentiate_terms(weights, terms, out)[source]#
Form
exp(sum_t w_t Phi_t)per element, with no exponent array.The weighted sum is
solprop.translate.stage.combine’s, accumulated element by element: a single term weighted by one is the term itself, and a single term’s product is one rounding, so a constant operator’sD (z1 - z0)is formed as there.- Parameters:
- weightsnumpy.ndarray
The bundle’s
phi_delta, float64,(n_terms,).- termsnumpy.ndarray
The terms of
Phi, complex,(n_terms, n_columns, n_omega).- outnumpy.ndarray
Written with the flow,
(n_columns, n_omega).
- solprop.backends.numba_cpu.low_storage.make_free_kernels(*, noise, parallel)[source]#
Compile the Cartesian and line routes’ register input, finish and table.
- Parameters:
- noisebool
Whether the
modifiednoise draw is added to every input.- parallelbool
Whether independent columns execute in parallel.
- Returns:
- FreeKernels
The compiled kernels.
- solprop.backends.numba_cpu.low_storage.make_modal_kernels(*, contiguous, noise, absorber, parallel)[source]#
Compile the modal routes’ register input and finish.
- Parameters:
- contiguousbool
Whether the crop index is the leading block of the fine spectrum.
- noisebool
Whether the
modifiednoise draw is added to every input.- absorberbool
Whether the in-stage absorber’s term is added to the source.
- parallelbool
Whether independent columns execute in parallel.
- Returns:
- ModalKernels
The compiled pair.
- solprop.backends.numba_cpu.low_storage.make_slab_kernels(*, noise, parallel)[source]#
Compile the hybrid planar route’s register input, finish and table.
- Parameters:
- noisebool
Whether the
modifiednoise draw is added to every input.- parallelbool
Whether independent columns execute in parallel.
- Returns:
- SlabKernels
The compiled kernels.