solprop.backends.sessions#

The run layer’s one door to a backend’s sessions (SEP 47 phases 2 to 5).

start_session() starts a run through the backend’s own preparation shape (SEP 47 section 5.2), backend.prepare(problem, request).start(start, ...), so a backend chooses its session and nothing here names one. The NumPy reference’s prepared execution opens its own session (solprop.backends.host.session.HostSession, over solprop.backends.host.driver.HostDriver); a native backend’s (solprop_native.session.NativePrepared) opens the native execution session (solprop_native.session.NativeSession), on a CPU or a device build alike, which refuses by name, before the start is loaded, what it does not run.

start_group() is the door for a group of compatible members (SEP 47 section 6.7), through the same shape: the group’s first member prepares the group, members[0].prepare_group(members, problems, requests).start(starts, ...), so a backend chooses its group and nothing here names one either. The native backend’s (solprop_native.group.NativePreparedGroup) opens the native group session (solprop_native.group.NativeGroupSession, one native session per member), on a CPU or a device build, which refuses by name what it does not run (solprop_native.group.refusal); the reference’s opens its own group (solprop.backends.host.group_session.HostGroupSession).

Functions

start_group(members, problems, requests, ...)

Start the group that advances compatible members through one fixed schedule.

start_session(backend, problem, request, ...)

Start the session that serves backend for one run.

solprop.backends.sessions.start_group(members, problems, requests, starts, *, stop=None)[source]#

Start the group that advances compatible members through one fixed schedule.

Parameters:
memberscollections.abc.Sequence of solprop.backends.protocol.Backend

One constructed backend per member, all of one backend; the group owns them once constructed.

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.

startscollections.abc.Sequence of solprop.backends.session.Start

Each member’s entrance.

stopsolprop.log.StopFlag or None, optional

A group-wide stop token.

Returns:
solprop.backends.session.GroupSession

The group the backend’s prepared group opens (prepare_group()): the reference’s own group for reference members, and the native group session for native members.

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 backend runs no group, or refuses this one.

solprop.backends.sessions.start_session(backend, problem, request, start, *, listener=None, started=None, stop=None, owns=True)[source]#

Start the session that serves backend for one run.

Parameters:
backendsolprop.backends.protocol.Backend

The backend, constructed for problem. A backend reused from an earlier run is loaded again from start, which restores everything a march reads.

problemsolprop.translate.problem.PropagationProblem

The translated problem.

requestsolprop.translate.run_request.RunRequest

The run’s policies.

startsolprop.backends.session.Start

Where the run starts; the session takes its field.

listenercallable or None, optional

Called with each attempt as it is made, for a progress reporter.

startedcallable or None, optional

Called with the start, the end and the plane count when propagation begins.

stopsolprop.log.StopFlag or None, optional

The run’s stop token.

ownsbool, optional

Whether closing the session closes the backend.

Returns:
solprop.backends.session.RunSession

The session the backend’s prepared execution opens: the native session (solprop_native.session.NativeSession) for a native backend, and a HostSession for a reference backend.