solprop.backends.batch#

Establish fixed-schedule lockstep with independent backend workspaces.

This runner is the correctness baseline for fused batch kernels. It executes the selected backend’s existing kernels for each member at each shared step. It does not amortise GPU kernel launches and is not a device-batching performance claim.

Classes

LockstepRunner(members)

Advance loaded member workspaces through one shared fixed-schedule march.

class solprop.backends.batch.LockstepRunner(members)[source]#

Bases: StepDriver[tuple[object, …]]

Advance loaded member workspaces through one shared fixed-schedule march.

Each workspace retains its own parameter tables, noise, error estimate and statistics storage hooks. The maximum norm is a batch diagnostic only: fixed replay does not use it to change any member’s schedule. Member observations carry their own error histories, never that maximum.

The caller validates layout compatibility and admits memory before constructing this runner. Ownership of the loaded workspaces transfers to the runner after successful construction; close releases every member.

Parameters:
memberssequence of solprop.backends.driver.StepDriver

Nonempty sequence of loaded singleton backends with the same name and fixed schedule. All must be at the entrance with no previously attempted steps.

Raises:
BackendError

If members mix backends, lack a common fixed schedule, are already advanced, or have different save planes or periodic-statistics requests.

available_device_memory()[source]#

Read the selected device’s free bytes through its first member.

Returns:
int or None

Free device bytes, or None for a host batch.

close()[source]#

Release every member workspace and the common march state.

member_metadata()[source]#

Return each member’s resolved policies with the shared batch strategy.

Returns:
tuple of dict

Complete backend provenance in member order.

memory_ledger()[source]#

Name each member’s workspace allocations separately.

Returns:
dict of str to int

Backend allocation bytes under member-prefixed names. Shared translation products are accounted separately by the common driver’s host budget.

metadata()[source]#

Describe the lockstep execution strategy without implying fused kernels.

Returns:
dict

Selected backend, member count and workspace strategy.

observe(*, field=True)[source]#

Refuse an observation that would substitute a shared member history.

Parameters:
fieldbool, optional

Unused: the observation is refused either way.

Raises:
BackendError

Always; use observe_members to retain each member’s error norms.

observe_members()[source]#

Drain each member’s host observation and its own diagnostic history.

Returns:
tuple of solprop.backends.protocol.Observation

Singleton observations in batch order, with unchanged field shapes and independently retained periodic rows.

stats(spec)[source]#

Collect member statistics with a leading batch axis.

Parameters:
specsolprop.stats.StatsSpec

Names and windows evaluated independently by each member.

Returns:
dict of str to numpy.ndarray

Host statistics concatenated on their existing batch axes.