pnps.memory#

Estimate a run’s memory before launching it.

The unit is the field volume, F = 16 n_y n_x n_omega bytes: one complex128 copy of the propagated state (5.27 GiB at the 768 x 768 x 600 production shape). A run holds:

  • solprop’s backend, buffer by buffer, from its own ledger (solprop.backends.protocol.Backend.memory_ledger());

  • the translated problem’s copy of the placeholder input, a single broadcast row;

  • the formed input of each delay point, one F while solprop copies it in;

  • with the host reduction, solprop’s copy of each saved plane, one F per plane while it is reduced;

  • the host reducer’s per-row partial sums and this package’s setup tables, small.

The planes and the formed input are never alive together, so the peak is the persistent part plus one F.

solprop has no estimate that does not build the backend (its ADR-065: memory is bounded by the scheduler, not checked in advance), so forming this one builds the backend, reads its ledger and closes it. Run it where the job will run: a configuration that does not fit fails here as the run would.

Functions

memory_budget(setup, zsave, h_target, *[, ...])

Estimate the memory of a run before launching it.

Classes

MemoryBudget(backend, field_volume, engine, ...)

A run's memory, by part, in bytes.

class pnps.memory.MemoryBudget(backend, field_volume, engine, problem_input, formed_input, plane_copy, reducer, setup, exact_masks=0, exact_input=0, exact_plane=0)[source]#

Bases: object

A run’s memory, by part, in bytes.

Attributes:
backendstr

The solprop backend the estimate is for ("auto" resolved).

field_volumeint

One complex128 copy of the state, 16 n_y n_x n_omega bytes.

enginecollections.abc.Mapping

solprop’s persistent bytes by buffer (the backend’s memory_ledger()).

problem_inputint

The translated problem’s copy of the placeholder input.

formed_inputint

One delay point’s formed input, transient.

plane_copyint

solprop’s host copy of a saved plane with the host reduction, transient; 0 when solprop’s statistics reduce the planes.

reducerint

The host reducer’s buffers.

setupint

This package’s setup tables (the input former, the spectra, the absorber).

exact_masksint

With Config.exact_windows, the windows’ exact hard-disc masks, held for the life of the bridge; 0 otherwise.

exact_inputint

With Config.exact_windows, the input state the run holds for the subtraction of the linear part, a field volume; 0 otherwise.

exact_planeint

With Config.exact_windows, each plane’s transient linear part and nonlinear part, two field volumes; 0 otherwise.

backend: str#
field_volume: int#
engine: Mapping[str, int]#
problem_input: int#
formed_input: int#
plane_copy: int#
reducer: int#
setup: int#
exact_masks: int = 0#
exact_input: int = 0#
exact_plane: int = 0#
property engine_total: int[source]#

Return solprop’s persistent bytes.

Returns:
int

The sum of engine.

property persistent: int[source]#

Return the bytes held for the life of a bridge.

Returns:
int

The engine, the problem’s input copy, the reducer, the setup and the exact windows’ masks.

property peak: int[source]#

Return the largest number of bytes held at once.

Returns:
int

persistent plus the input the exact windows hold, plus the larger transient: the formed input, or a plane’s host copy with the exact windows’ parts of it (they are never alive together).

property volumes: float[source]#

Return the peak in field volumes.

Returns:
float

peak divided by field_volume.

report()[source]#

Return the budget as a short table, GiB and field volumes.

Returns:
str

One line per part and the peak.

pnps.memory.memory_budget(setup, zsave, h_target, *, backend='auto', node_budget=None, reduction=None)[source]#

Estimate the memory of a run before launching it.

Takes the arguments of pnps.bridge.build_bridge() that decide memory, translates the configuration as it does, and builds the backend for its ledger, closing it again before returning.

Parameters:
setupSetup

The configuration (pnps.setup.build_setup()).

zsavearray_like

Save positions in m.

h_targetfloat

Largest step of the replayed schedule, m.

backendstr, optional

The solprop backend registry name; "auto" resolves as solprop resolves it.

node_budgetint or None, optional

The per-chunk memory budget of solprop in bytes; None takes the configuration’s.

reduction{“auto”, “host”, “solprop”} or None, optional

Where planes are reduced; None takes the configuration’s.

Returns:
MemoryBudget

The parts, their peak and its size in field volumes.