solprop.driver.estimate#
What a run will cost, before it runs (SEP 41, S11).
estimate() reports a translated simulation’s grid, the persistent memory its
constructed backend holds, the size of its output, the cost of one right-hand-side
evaluation on the chosen backend timed after an untimed warm-up, and its integrator’s
calls per step. It does not predict the number of adaptive steps, which depends on the
physics.
Functions
|
Estimate what a simulation's run would cost, without running it. |
|
Return the bytes of one plane's field, and its noise phase, in a memory store. |
|
Return the bytes one saved plane occupies in an in-memory store. |
Classes
|
A run's cost, as far as it is known before the run. |
- class solprop.driver.estimate.RunEstimate(shape, n_planes, memory, output_bytes, backend, threads, setup, rhs, calls_per_step, total_calls)[source]#
Bases:
objectA run’s cost, as far as it is known before the run.
- Attributes:
- shapetuple of int
The state’s shape: batch, modes or transverse columns, polarisations and frequencies.
- n_planesint
The planes the run saves, the entrance included.
- memoryint
The persistent memory the constructed backend holds, its ledger’s total, bytes.
- output_bytesint
The output’s size for the requested planes and retained fields, bytes, as an in-memory store holds it (an HDF5 file adds little).
- backendstr
The backend the run would use.
- threadsobject
The backend’s thread count, as it reports it.
- setupfloat
Seconds to build the backend and take the untimed first step: compilation and transform planning.
- rhsfloat
Seconds per right-hand-side evaluation, the median of timed trial steps divided by the tableau’s stages.
- calls_per_stepint
Right-hand-side evaluations per accepted step of the integrator: six for the Runge-Kutta march (its first stage is the last’s), one for the Adams method, four for the low-storage march.
- total_callsint or None
Evaluations of a replayed fixed schedule, its steps times the calls per step;
Nonefor an adaptive run, whose step count the physics decides.
- solprop.driver.estimate.estimate(simulation, *, repeats=3)[source]#
Estimate what a simulation’s run would cost, without running it.
- Parameters:
- simulationsolprop.driver.simulation.Simulation
The simulation; it is translated if it is not already.
- repeatsint, optional
Timed trial steps after the warm-up.
- Returns:
- RunEstimate
The estimate.
- solprop.driver.estimate.field_bytes(problem)[source]#
Return the bytes of one plane’s field, and its noise phase, in a memory store.
The part of
plane_bytes()a plane that keeps no field does not hold (SEP 22).- Parameters:
- problemsolprop.translate.problem.KernelProblem
The translated problem.
- Returns:
- int
Sixteen bytes per state entry, and eight more with a noise model.
Examples
>>> from solprop.driver import Simulation >>> from solprop.driver.estimate import field_bytes >>> simulation = Simulation.from_gnlse( ... 0.11, 0.01, [0.0, 0.0, -1.183e-26], wavelength=835e-9, ... wavelength_limits=(500e-9, 2e-6), trange=1e-12, ... width=100e-15, peak_power=9.8, shape="sech", noise=None, ... ) >>> field_bytes(simulation.translate()) == 16 * simulation.translate().shape[-1] True
- solprop.driver.estimate.plane_bytes(problem)[source]#
Return the bytes one saved plane occupies in an in-memory store.
The field (complex128), the noise phase (float64) when the run carries a noise model, every statistic at its catalogued shape (float64; a statistic catalogued with a smaller shape for spatial beams is counted at the modal one, an upper bound of a few entries), and the position and the two per-plane counts.
- Parameters:
- problemsolprop.translate.problem.KernelProblem
The translated problem.
- Returns:
- int
Bytes per plane.
Examples
>>> from solprop.driver import Simulation >>> from solprop.driver.estimate import plane_bytes >>> simulation = Simulation.from_gnlse( ... 0.11, 0.01, [0.0, 0.0, -1.183e-26], wavelength=835e-9, ... wavelength_limits=(500e-9, 2e-6), trange=1e-12, ... width=100e-15, peak_power=9.8, shape="sech", ... ) >>> problem = simulation.translate() >>> plane_bytes(problem) >= 16 * problem.shape[-1] True