Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions benchmarks/ab.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ def same_work(
) -> bool | None:
"""Whether both builds took one and the same (accepted, rejected) steps.

``None`` when a repetition did not count its steps (a group on ``Batch``, which
watches no point's run): nothing was compared, which is not a match.
``None`` when a repetition did not count its steps: nothing was compared, which
is not a match.
"""
if any(None in steps for steps in baseline | candidate):
return None
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ def build(configuration: Record) -> Simulation:
"fields": fields,
"field_planes": (len(itinerary),) if fields == "planes" else (),
}
if case.workload in ("scan", "group"):
if case.workload == "scan":
# A scan keeps the fields run_scan asks for; its points keep the default.
del observed["fields"], observed["field_planes"]
chosen = integrator(configuration["stepper"])
Expand Down
6 changes: 5 additions & 1 deletion benchmarks/device_split.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,10 @@ def launch() -> object:


def _calls(nx: int, steps: int, planes: int) -> dict[str, Any]:
from solprop_native._core import ( # noqa: PLC0415 # pyright: ignore[reportMissingImports, reportMissingModuleSource]
_testing,
)

specs = {"none": StatsSpec(names=())}
specs.update(
(name, StatsSpec(names=(name,)))
Expand Down Expand Up @@ -298,7 +302,7 @@ def _calls(nx: int, steps: int, planes: int) -> dict[str, Any]:
# host's azimuthal average of a Gaussian's fluence takes on this machine.
widths = {
"moments": _timed(
lambda: state.spatial_statistics(32, 0.5 * EPS0 * C, 0.0), 5
lambda: _testing.spatial_statistics(state, 32, 0.5 * EPS0 * C, 0.0), 5
),
"host_average": _timed(
lambda: cartesian_fluence_widths(
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/exercises.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def mismatch(pressure: float) -> float:


def fiber(index: int = 0, *, noise: bool = False) -> Simulation:
"""Keep one member of the lockstep fixture, including its periodic statistics."""
"""Build the fibre exercise, including its periodic statistics."""
return Simulation.from_gnlse(
0.11 * (index + 1),
1e-3,
Expand Down
4 changes: 0 additions & 4 deletions benchmarks/native_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@

_TIMED = frozenset(
{
"adams_march_run",
"rk_march_run",
"statistics",
"spatial_statistics",
"field_to_host",
"advance",
"export",
Expand Down
21 changes: 4 additions & 17 deletions benchmarks/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
native backend unless asked otherwise (SEP 38). The ``tracking`` set is what
``python -m benchmarks track`` times by default; every other case runs only when named.
The ``sep47`` set is SEP 47 section 7.2's matrix of short windows: each case holds the
events it measures (periodic rows, snapshots, a group's members, repeated inputs, saved
or field-free planes, a wide coupled flow) and finishes in seconds.
events it measures (periodic rows, snapshots, repeated inputs, saved or field-free
planes, a wide coupled flow) and finishes in seconds.
"""

from __future__ import annotations
Expand Down Expand Up @@ -44,7 +44,7 @@
WIDTHS = ("1", "production")
SEED = 20261027
"""The noise seed every case fixes, so that its repeats take the same steps."""
WORKLOADS = ("run", "with_input", "scan", "group")
WORKLOADS = ("run", "with_input", "scan")
OUTPUTS = ("memory", "hdf5")
_OPTIONAL = {
"workload": "run",
Expand Down Expand Up @@ -102,8 +102,7 @@ class Case:
What one timed repetition is (SEP 47 section 7.2): ``"run"``, one run of the
case; ``"with_input"``, three runs of it with other inputs through
``Simulation.with_input``; ``"scan"``, a four-point ``run_scan`` on ``Local``
derived from the case with ``with_input``; ``"group"``, the same four points
on ``Batch(4)``, which needs a fixed `step`.
derived from the case with ``with_input``.
output : str
Where a ``"run"`` writes: ``"memory"`` or ``"hdf5"``, a file in the worker's
scratch directory.
Expand Down Expand Up @@ -141,8 +140,6 @@ def __post_init__(self) -> None:
raise SuiteError(f"{self.name}: unknown workload or output")
if self.fields not in ("all", "planes", "none"):
raise SuiteError(f"{self.name}: unknown field retention {self.fields}")
if self.workload == "group" and self.step is None:
raise SuiteError(f"{self.name}: a group replays a fixed step")
if self.snapshots is not None and (
self.workload != "run" or self.output != "hdf5" or self.snapshots < 0
):
Expand Down Expand Up @@ -679,16 +676,6 @@ def configuration(
fields="none",
**_SESSION,
),
Case(
"group_batch",
1,
("sep47",),
source="scan_local on Batch(4), replaying ten 1.6 mm steps",
workload="group",
fields="none",
step=1.6e-3,
**_SESSION,
),
*(
Case(
f"{base}_{kept}_{output}",
Expand Down
27 changes: 12 additions & 15 deletions benchmarks/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later

"""Build SEP 47's fibre windows and run its repeated, scanned and grouped workloads.
"""Build SEP 47's fibre windows and run its repeated and scanned workloads.

The ``sep47`` set's cases on one fibre (SEP 47 section 7.2): the N = 3 soliton of
``gnlse_soliton`` (its dispersion, nonlinearity, 100 fs sech launch and time grid,
Expand All @@ -20,10 +20,7 @@
step planes becomes possible once SEP 47 schedules snapshots independently;
- ``with_input_repeat``: three runs of other inputs through ``Simulation.with_input``;
- ``scan_local``: four points derived from the case with ``with_input``, on ``Local``,
each run watched to count its steps;
- ``group_batch``: the same four points on ``Batch(4)``, replaying ten 1.6 mm steps
with the split-step collar, which a fixed step this long needs. ``Batch`` watches no
point's run, so its steps are left uncounted except by the structural counters.
each run watched to count its steps.

Import this module only after the worker has configured its scientific runtimes.
"""
Expand All @@ -41,7 +38,7 @@
from benchmarks.records import Record, SuiteError
from benchmarks.registry import CASES
from solprop.driver import Simulation
from solprop.driver.executors import Batch, Local
from solprop.driver.executors import Local
from solprop.driver.scan import Scan, run_scan
from solprop.log import NullReporter, NullScanReporter, ProgressReporter
from solprop.output import MemoryOutput
Expand Down Expand Up @@ -181,7 +178,7 @@ def repetition(
Parameters
----------
workload : str
``"with_input"``, ``"scan"`` or ``"group"`` (``benchmarks.registry.Case``).
``"with_input"`` or ``"scan"`` (``benchmarks.registry.Case``).
simulation : solprop.driver.Simulation
The case, as built.
scratch : pathlib.Path
Expand All @@ -192,9 +189,8 @@ def repetition(
Returns
-------
dict
Accepted and rejected steps summed over the runs, where they are watched
(``None`` for a group, whose ``Batch`` watches no point's run); whether the
last plane of every run is finite (its field, or for a field-free scan its
Accepted and rejected steps summed over the runs; whether the last plane of
every run is finite (its field, or for a field-free scan its
statistics); the position reached and the runs made.
numpy.ndarray or None
The last run's final field, or ``None`` for a scan.
Expand All @@ -219,15 +215,15 @@ def repetition(
"finite": final is not None and bool(np.all(np.isfinite(final))),
}
return record, final
if workload not in ("scan", "group"):
if workload != "scan":
raise SuiteError(f"unknown workload {workload}")
watch = _Watch()
path = scratch / f"{workload}.h5"
result = run_scan(
Scan(f"sep47_{workload}", scale=list(SCALES)),
lambda point: simulation.with_input(launch(float(point.values["scale"]))), # pyright: ignore[reportArgumentType] - a scale variable
output=path,
executor=Batch(len(SCALES)) if workload == "group" else Local(),
executor=Local(),
fields=fields, # pyright: ignore[reportArgumentType] - a registry field retention
progress=watch,
)
Expand All @@ -237,10 +233,11 @@ def repetition(
finite = [
_finite_statistics(read_point(path, index)) for index in range(len(SCALES))
]
watched = len(watch.runs) == len(SCALES)
if len(watch.runs) != len(SCALES):
raise SuiteError(f"the {workload} watched {len(watch.runs)} runs")
record = {
"accepted": sum(run.accepted for run in watch.runs) if watched else None,
"rejected": sum(run.rejected for run in watch.runs) if watched else None,
"accepted": sum(run.accepted for run in watch.runs),
"rejected": sum(run.rejected for run in watch.runs),
"z": float(simulation.settings.save_planes[-1]),
"runs": len(SCALES),
"finite": None if None in finite else all(finite),
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
constructs its backend, runs an untimed warm-up over the first part of the guide, then
times complete runs through the driver's own loop, each restarted from the translated
launch with the boundary monitor ``Simulation.run`` attaches, or the case's workload of
repeated inputs, a scan or a group (``benchmarks.registry.Case``). Asked to count, it
repeated inputs or a scan (``benchmarks.registry.Case``). Asked to count, it
then makes one more repetition with the native adapter's structural counters on
(SEP 47 section 7.3), reported apart so that counting costs no timed repetition
anything. It prints one JSON event per line; the last is the receipt.
Expand Down
1 change: 0 additions & 1 deletion changelog.d/241-reference-coupled-batch.changed.md

This file was deleted.

2 changes: 1 addition & 1 deletion changelog.d/benchmark-sep47-matrix.added.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
The benchmark harness has a `sep47` set of short windows for SEP 47's performance matrix: statistics rows at every step under `Multistep()` and `RungeKutta()`, snapshot controllers idle, sparse and at every endpoint, repeated `with_input` runs, a four-point scan on `Local` and the same points on `Batch(4)`, saved and field-free radial and Cartesian planes in memory and in HDF5, and coupled flows of 4 and 17 channels. `track --counters` and `ab --counters` add one separately reported run per worker with structural counters from the native backend, counted the same way whether the native execution session or the transitional driver session serves the run: its returns to Python by cause, native march calls, attempts, planes, statistics rows, transverse-edge reads, the fields copied to the host and loaded into the native state, and their bytes.
The benchmark harness has a `sep47` set of short windows for SEP 47's performance matrix: statistics rows at every step under `Multistep()` and `RungeKutta()`, snapshot controllers idle, sparse and at every endpoint, repeated `with_input` runs, a four-point scan on `Local`, saved and field-free radial and Cartesian planes in memory and in HDF5, and coupled flows of 4 and 17 channels. `track --counters` and `ab --counters` add one separately reported run per worker with structural counters from the native backend, counted the same way whether the native execution session or the transitional driver session serves the run: its returns to Python by cause, native march calls, attempts, planes, statistics rows, transverse-edge reads, the fields copied to the host and loaded into the native state, and their bytes.
1 change: 0 additions & 1 deletion changelog.d/group-admission-transactional.fixed.md

This file was deleted.

2 changes: 1 addition & 1 deletion changelog.d/scan-cgroup-memory.fixed.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
`Pool` and `Batch` scans now size their workers from the tightest control-group memory limit on the process's own path (version 1 and 2), not the root group's, so a scan under a systemd slice or other cgroup manager without Slurm variables is no longer admitted against the whole machine. An unreadable or malformed limit file, and a malformed `SOLPROP_SCAN_CPU_OFFSET` or `SOLPROP_SCAN_CPU_COUNT`, now raise `DriverError` naming the file or variable instead of a bare `OSError` or `ValueError` (#170).
`Pool` scans now size their workers from the tightest control-group memory limit on the process's own path (version 1 and 2), not the root group's, so a scan under a systemd slice or other cgroup manager without Slurm variables is no longer admitted against the whole machine. An unreadable or malformed limit file, and a malformed `SOLPROP_SCAN_CPU_OFFSET` or `SOLPROP_SCAN_CPU_COUNT`, now raise `DriverError` naming the file or variable instead of a bare `OSError` or `ValueError` (#170).
7 changes: 3 additions & 4 deletions changelog.d/sep-0047-descriptor-contract.breaking.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ alias. The nominal leading batch axis is gone: `PropagationProblem.shape`,
`noise_phase`, `Backend.stats()`, the periodic rows of `StepStats` and
`ResponseBudgetError.field` are all `(n_modes, n_pol, n_omega)`-shaped with no batch
axis, `Initial.batch_params`, `Flags.single_batch` and `assemble(batch_params=...)` are
removed, `assemble` refuses a stacked field, and `RunEstimate.shape` has three entries. A
group of trajectories is a sequence of member problems, as a batched scan already runs
them; `solprop.driver.batch.split_observation` and `plane_from_observation(member=...)`
are removed. A march snapshot's stored state keeps its leading axis of one on disk, and
removed, `assemble` refuses a stacked field, and `RunEstimate.shape` has three entries.
`solprop.driver.batch.split_observation` and `plane_from_observation(member=...)` are
removed. A march snapshot's stored state keeps its leading axis of one on disk, and
existing files stay readable. The route-specific optional fields `transform`, `flux`,
`transverse`, `tdse` and `current_numerator` move into a closed union, `problem.route`,
from the new module `solprop.translate.routes`: a `ModalRoute`, a `GeneralRoute` or a
Expand Down
1 change: 0 additions & 1 deletion changelog.d/sep-0047-native-groups.changed.md

This file was deleted.

2 changes: 1 addition & 1 deletion changelog.d/sep-0047-native-session-device.changed.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
On a GPU build (CUDA or HIP) of the native backend, runs are now admitted to the native execution session as on a CPU build ([SEP 47](docs/dev/seps/archive/sep-0047-run-ownership.md)): Adams and the embedded Runge-Kutta tableaux, adaptive or replayed, the low-storage replay, dense output (`interpolate_planes`), the modal, general and spatial routes (radial, Cartesian, line and planar, with their statistics and fluence widths), saved planes, periodic statistics rows, step planes, the temporal boundary monitor and a free-space run's transverse edge with a requested collar's current, the input and modified noise models and resumed Adams history. A `Batch` scan's group of native points is admitted to the native group session on a GPU build too, and a coupled flow wider than 16 channels or with bins off its eigenbasis route to the native Adams march, rather than solprop's Python march with a `HostMarchWarning`, so its fields differ from before at the rounding level; a bin off the route takes its matrix functions from the scaled Taylor series and squaring of the augmented exponential, and a step whose exponent there would need more than 30 squarings is refused by name, as on a CPU build. These have been run on an NVIDIA A40 (CUDA), where the session takes the same steps, statistics and fields as the backend's own march on the same device (dense Runge-Kutta planes and the transverse edge's ramp sums within rounding bounds); HIP and data-centre NVIDIA evidence is to follow, and they are not yet qualified on either vendor. A saved plane's field crosses from the device once, into its destination, with no extra host copy.
On a GPU build (CUDA or HIP) of the native backend, runs are now admitted to the native execution session as on a CPU build ([SEP 47](docs/dev/seps/archive/sep-0047-run-ownership.md)): Adams and the embedded Runge-Kutta tableaux, adaptive or replayed, the low-storage replay, dense output (`interpolate_planes`), the modal, general and spatial routes (radial, Cartesian, line and planar, with their statistics and fluence widths), saved planes, periodic statistics rows, step planes, the temporal boundary monitor and a free-space run's transverse edge with a requested collar's current, the input and modified noise models and resumed Adams history. A coupled flow wider than 16 channels or with bins off its eigenbasis route to the native Adams march, rather than solprop's Python march with a `HostMarchWarning`, so its fields differ from before at the rounding level; a bin off the route takes its matrix functions from the scaled Taylor series and squaring of the augmented exponential, and a step whose exponent there would need more than 30 squarings is refused by name, as on a CPU build. These have been run on an NVIDIA A40 (CUDA), where the session takes the same steps, statistics and fields as the backend's own march on the same device (dense Runge-Kutta planes and the transverse edge's ramp sums within rounding bounds); HIP and data-centre NVIDIA evidence is to follow, and they are not yet qualified on either vendor. A saved plane's field crosses from the device once, into its destination, with no extra host copy.
Loading
Loading