solprop.driver.batch#

Prepare compatible fixed-schedule scan members without changing their backend.

Functions

compatible_groups(members, size)

Group adjacent compatible points with bounded resident translation products.

refuse_mixed_guides(problems)

Refuse a formed group whose members are not the same general modal guide.

shared_table_bytes(problems)

Count host array storage once across shared translated member records.

split_observation(observation, statistics, ...)

Separate fields, statistics and error histories into ordinary saved planes.

Classes

BatchMember(index, simulation)

Bind a global scan index to its independently translated simulation.

class solprop.driver.batch.BatchMember(index, simulation)[source]#

Bases: object

Bind a global scan index to its independently translated simulation.

Attributes:
indexint

Zero-based global scan index, retained after grouping and output splitting.

simulationSimulation

Member with its own input, noise, parameter tables and backend selection.

index: int#
simulation: Simulation#
solprop.driver.batch.compatible_groups(members, size)[source]#

Group adjacent compatible points with bounded resident translation products.

Parameters:
membersiterable of BatchMember

Members in scan dispatch order. Their global indices are never renumbered.

sizeint

Maximum positive number of members per group.

Yields:
tuple of BatchMember

A full batch, a group ended by a layout change, or the final partial batch.

Raises:
DriverError

If size is invalid, an index is negative, a member is unsupported, or a formed group mixes general modal guides (refuse_mixed_guides(), which every yielded group passes through).

solprop.driver.batch.refuse_mixed_guides(problems)[source]#

Refuse a formed group whose members are not the same general modal guide.

The defence the descriptor cannot give. _signature separates two guides into different groups, so this never fires on a group compatible_groups() built; it fires on one assembled by hand or by a future grouping rule, where a silently mixed group would propagate one guide’s channels against another’s reference and nothing downstream would say so.

Parameters:
problemscollections.abc.Sequence

The members’ translated problems, in group order.

Raises:
DriverError

Naming the field at which two members part company.

solprop.driver.batch.shared_table_bytes(problems)[source]#

Count host array storage once across shared translated member records.

Parameters:
problemsiterable of KernelProblem

Translations whose resident host allocations are being admitted.

Returns:
int

Unique backing-array bytes. This excludes native workspace and outputs, which must be added from the backend ledger and retention plan separately.

solprop.driver.batch.split_observation(observation, statistics, *, histories)[source]#

Separate fields, statistics and error histories into ordinary saved planes.

Each member retains its own error norms. The shared lockstep history describes the attempted positions and acceptance decisions, and is never substituted for a member’s diagnostic history. No field or statistic gains a new storage axis.

The field of every returned plane is the backend’s internal, vacuum-normalised modal amplitude, not the interface amplitude in true sqrt(W). This function splits an observation and nothing else; the conversion b = sqrt(w) a at the interface is solprop.driver.run._power_observation, which a run applies to the observation before any plane is stored. A caller that wants stored units must convert first and split the converted observation.

Parameters:
observationsolprop.backends.protocol.Observation

Host state with the leading batch axis and shared attempt itinerary.

statisticsmapping of str to numpy.ndarray

Saved-plane statistics, each with leading axis n_batch.

historiessequence of solprop.backends.protocol.StepHistory

One history per member, with that member’s error norms. Every itinerary must match the observation, including rejected attempts.

Returns:
tuple of solprop.output.schema.SavedPlane

One plane per member, in batch order, preserving species and other axes.

Raises:
DriverError

If the observation carries no field, a member history is missing, itineraries differ, or any statistic lacks the required batch axis. Validation completes before any plane is returned.