solprop.backends.host.group_session#
The NumPy reference’s group session (SEP 47 section 6.7).
HostGroupSession is the GroupSession that
serves every numpy_ref group, in both precisions, and HostPreparedGroup is
the prepared group a reference backend returns from prepare_group. The group loads
each member from its start and hands the loaded members to the reference’s group runner
(HostGroup, or its member-axis arithmetic
NumpyBatchBackend in binary64, the choice the
reference’s registry row makes through solprop.backends.registry.select_batch()),
which advances every member through each step of the common fixed schedule in turn.
The session presents that march through the group protocol: one window per save plane,
each member’s own events, tickets, counters and outcome, and the failure distinction of
SEP 47 section 6.7.
Why the runner, rather than one HostSession
per member. The native group composes one native session per member
(solprop_native.group.NativeGroupSession), each advancing a whole window before the
next. The reference group keeps its runner because what it must preserve is the
runner’s, and composed member sessions would change all three:
Its arithmetic. A binary64 group evaluates its stages on arrays with a leading member axis (
NumpyBatchBackend), whose reductions are ordered differently from a lone run’s: a member and its lone run agree to rounding, not bitwise (tests/backends/test_batch_lockstep.py). Member sessions would run the lone path and change every binary64 group’s result.Its failure positions. Members take each common step in turn, so a failure in one member ends the group with the members ahead of it in flight at that step’s end (poisoned) and those behind it at the step’s start (SEP 47 section 6.7). Member sessions advancing whole windows in turn would leave the members ahead committed at the window’s end instead.
Its precision rule. The runner refuses a group of mixed precisions and runs single-precision members each on its own binary32 trial (
HostGroup,lockstep_runner).
Each member’s boundary monitor is still its own: a stop ends that member alone while
the others go on (member_stops).
Classes
|
The reference's |
|
A prepared group of reference members (SEP 47 section 6.7). |
- class solprop.backends.host.group_session.HostGroupSession(members, problems, requests, starts, *, stop=None)[source]#
Bases:
objectThe reference’s
GroupSession.As the batched scan always has, the first advance gives every member its boundary monitor before the launch plane is reported, so that a launch a monitor refuses ends that member at once.
- Parameters:
- memberscollections.abc.Sequence of solprop.backends.protocol.Backend
One constructed reference backend per member, all of one backend. Once the group is constructed it owns them and closes them with itself; a construction that fails leaves them to the caller.
- problemscollections.abc.Sequence of solprop.translate.problem.PropagationProblem
Each member’s independently translated problem.
- requestscollections.abc.Sequence of solprop.translate.run_request.RunRequest
Each member’s run request, with its own fresh boundary monitor; their save planes and statistics are the group’s common schedule.
- startscollections.abc.Sequence of solprop.backends.session.Start
Each member’s start: its entrance, with no method history or monitor to continue. The group takes each start’s field.
- stopsolprop.log.StopFlag or None, optional
A group-wide stop token, polled before every common step.
- Raises:
- solprop.backends.session.SessionError
If the sequences differ in length or are empty, or if a start is not a fresh entrance.
- solprop.exceptions.BackendError
If the runner refuses the members (
select_batch): another backend, or another schedule, planes, precision or periodic statistics.
- acknowledge(receipt)[source]#
Release the pending batch and allow advancing past it.
- Parameters:
- receiptsolprop.backends.events.Receipt
The pending batch’s receipt.
- advance()[source]#
Run every running member through the next common window, and report it.
- Returns:
- solprop.backends.events.GroupBatch
Each member’s events in the window.
- execution_record(member)[source]#
Return one member’s execution facts, with the group’s strategy.
- Parameters:
- memberint
The member’s position.
- Returns:
- collections.abc.Mapping
Its backend provenance.
- export(member, ticket, recipe, out=None)[source]#
Fill a destination with one member’s converted field at a pending ticket.
- Parameters:
- memberint
The member’s position.
- ticketsolprop.backends.events.ExportTicket
A ticket of the pending batch, for this member: its position is the member’s own.
- recipesolprop.backends.export.ExportRecipe
The conversion.
- outnumpy.ndarray or None, optional
The destination; a new array by default.
- Returns:
- numpy.ndarray
The member’s converted field.
- property finished: bool[source]#
Return whether the group’s terminal batch was issued.
- Returns:
- bool
True once every member has ended.
- member_status(member)[source]#
Return one member’s committed position, counters and outcome.
- Parameters:
- memberint
The member’s position.
- Returns:
- solprop.backends.session.SessionStatus
Its status; a member that ended reports its own outcome while the group goes on.
- monitor_record(member)[source]#
Return one member’s boundary-monitor record.
- Parameters:
- memberint
The member’s position.
- Returns:
- collections.abc.Mapping or None
Its record as it closed or as it stands, or
Nonewhen unwatched.
- noise_phase(member, ticket)[source]#
Return one member’s noise phase at a pending ticket.
- Parameters:
- memberint
The member’s position.
- ticketsolprop.backends.events.ExportTicket
A ticket of the pending batch.
- Returns:
- numpy.ndarray or None
The phase, shape
(n_modes, n_pol, n_omega), orNonewithout noise.
- class solprop.backends.host.group_session.HostPreparedGroup(members, problems, requests)[source]#
Bases:
objectA prepared group of reference members (SEP 47 section 6.7).
Each
start()opens oneHostGroupSessionover the members.- Parameters:
- memberscollections.abc.Sequence of solprop.backends.protocol.Backend
One constructed reference backend per member, all of one backend; they stay the caller’s until a started group owns them.
- problemscollections.abc.Sequence of solprop.translate.problem.PropagationProblem
Each member’s independently translated problem.
- requestscollections.abc.Sequence of solprop.translate.run_request.RunRequest
Each member’s run request.
- property backend: str[source]#
Return the registered name of the backend that prepared it.
- Returns:
- str
The first member’s registered name.
- start(starts, *, stop=None)[source]#
Start the group over the reference’s group runner.
- Parameters:
- startscollections.abc.Sequence of solprop.backends.session.Start
Each member’s entrance; the group takes their fields.
- stopsolprop.log.StopFlag or None, optional
A group-wide stop token.
- Returns:
- HostGroupSession
The started group.