Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
7da52d6
profile: --measured-precisions, a 100 % row, no class column
ValentinHirschi Nov 20, 2026
98fbfdf
tests: the runtime-options read-back tests ask for thread counts ever…
ValentinHirschi Nov 20, 2026
3e5b71f
Merge origin/main 98fbfdf15 into work/measured-precisions
ValentinHirschi Nov 20, 2026
2c25bfe
profile: runtime tables per measured precision; a measured precision …
ValentinHirschi Nov 20, 2026
f44c7e6
profile: a measured precision's calls hold its own batch; the ground …
ValentinHirschi Nov 20, 2026
b9fb969
profile: the measured precisions in the ETA, --completion-time and th…
ValentinHirschi Nov 20, 2026
791d32d
loop-reduction: say why NinjaRS's lane records need no drain before a…
ValentinHirschi Nov 20, 2026
b4d05d1
runtime options: a one-line string that is no existing file is read a…
ValentinHirschi Nov 20, 2026
c3c3ea9
loop_v2 plan: read_bounded's doc paragraph above read_bounded
ValentinHirschi Nov 20, 2026
8991d65
profile: a wider measured precision read to what its reference certif…
ValentinHirschi Nov 20, 2026
1fb25fc
Merge work/mg7-507-nits: the three review nits of MadGraph7 #507
ValentinHirschi Nov 20, 2026
a2fb9c2
Merge pyAmpliCol upstream main b8d028ca1 (profile --measured-precisio…
ValentinHirschi Nov 20, 2026
b803965
pyamplicol.yml: one timing per test group of the light one-loop step
ValentinHirschi Nov 20, 2026
a4b0d65
Merge pyamplicol-import-lane-rescue (#507: test_loop_v2_process_histo…
ValentinHirschi Nov 20, 2026
3aa9026
tests: the thread-count tests wait for Symbolica's licence-check threads
ValentinHirschi Nov 21, 2026
3f11b59
profile: stage times of a first call, binary64 named in listed tables
ValentinHirschi Nov 21, 2026
1c08ef1
Merge origin/main (#507 merged) into pyamplicol-import-measured-preci…
ValentinHirschi Nov 21, 2026
4fc11c8
Merge pyAmpliCol main 1b9aada8d (pyamplicol-import)
ValentinHirschi Nov 21, 2026
1a6a4b9
CI: mount the whole checkout in the pyAmpliCol manylinux wheel job
ValentinHirschi Nov 21, 2026
f297258
CI: build the pyAmpliCol manylinux wheel from the retained sdist only
ValentinHirschi Nov 21, 2026
b4052eb
tests: two timing and environment dependences removed
ValentinHirschi Nov 21, 2026
966b588
Merge pyAmpliCol main 27d880f8e (pyamplicol-import): two test fixes
ValentinHirschi Nov 22, 2026
effe9fb
Merge remote-tracking branch 'origin/main' into pyamplicol-import-mea…
oliviermattelaer Nov 22, 2026
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
20 changes: 13 additions & 7 deletions .github/workflows/pyamplicol.yml
Original file line number Diff line number Diff line change
Expand Up @@ -449,13 +449,14 @@ jobs:
# in source-contracts: they are loop tests, which skip without a
# Symbolica that accepts the package key, and source-contracts installs
# no Symbolica.
# The stability display, wide magnitudes and tracked-precision files
# are the fast new one-loop tests of the lane-rescue / runtime-options
# import (about 20 s together). test_loop_v2_process_history.py is not
# listed: its child process uses Symbolica directly, which is refused
# without a personal licence once pytest holds the restricted thread.
# The last seven files are the fastest of the restored one-loop engine
# tests (about 70 s together).
# Two groups are listed for their speed (measured locally, one pytest
# process per group): the stability-display, wide-magnitude and
# tracked-precision files of the lane-rescue / runtime-options import
# (about 20 s), and the last seven files, the fastest of the restored
# one-loop engine tests (about 30 s). test_loop_v2_process_history.py
# is not listed: its child process uses Symbolica directly, which is
# refused without a personal licence once pytest holds the restricted
# thread.
- name: Run the light one-loop tests without SYMBOLICA_LICENSE (30 GiB RSS limit)
env:
PYAMPLICOL_REQUIRE_SYMBOLICA_LICENSE: "1"
Expand Down Expand Up @@ -886,6 +887,10 @@ jobs:
name: pyamplicol-retained-sdist
path: pyamplicol/.artifacts/retained
- name: Build and deploy-test in manylinux_2_28 x86_64
# The wheel is built from the retained sdist only (--skip-checkout-wheel),
# as the macOS wheels are. A second wheel from this checkout cannot be
# built here: its prepared models are not committed (only the sdist has
# them), and umami.h is a symlink into madspace/, outside the mount.
run: |
docker run --rm \
-v "$PWD:/io" \
Expand All @@ -910,6 +915,7 @@ jobs:
"$PY311" tools/ci/memory_watchdog.py --limit-gib 30 -- \
"$PY311" tools/release/build_release_artifacts.py \
--retained-sdist .artifacts/retained/pyamplicol-*.tar.gz \
--skip-checkout-wheel \
--output-dir .artifacts/platform
"$PY311" tools/ci/memory_watchdog.py --limit-gib 30 -- \
"$PY311" tools/release/test_deployment.py \
Expand Down
106 changes: 98 additions & 8 deletions pyamplicol/docs/user/command-line-interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -1147,6 +1147,92 @@ best-effort counts with the binary64 time, without the truth-based columns;
the header says `none (estimates only)` and the JSON's `ground_truth`
`{"arithmetic": "none", "label": "none"}`.

**Measured precisions.** `--measured-precisions` (`benchmark.measured_precisions`,
a list; on the command line space- or comma-separated,
`--measured-precisions double dd arb:60`) names the precisions whose
stability the stability run measures, each its own pair of tables in the
order given; the default is `binary64` alone (today's tables). An entry is
`binary64` (`double`, `b64`) or what `--ground-truth` accepts
(`double-double`/`dd`, `arbitrary`/`arb`, `arbitrary:DIGITS`/`arb:DIGITS`).
Each entry's points are evaluated as binary64's are, in its arithmetic: the
default checks (one default rotation; on TIRust's points also the rescaled
reduction-direction check), a refused point served best-effort, lane rescue
as that arithmetic has it (`--no-lane-rescue` turns it off). An entry below
the ground truth is read against it ("Stable digits of double-double vs
arb(60)"): its true and estimated digits capped to its own range
(double-double -log10(2^-106) = 31.91, arbitrary precision its digits) and
to what the ground truth certifies (its range; an arbitrary-precision truth
its cross-check's 2^-106, or on a point where the backends' references agree
closer the agreement they reach), the title adding "capped at what the ground
truth certifies (at least D digits)" when that is the lower. The ground truth's own precision
has its estimates-only tables ("Estimated digits of arb(60) (the ground
truth)" and "Default checks, estimates only, arb(60)"): its points are
evaluated in it once, with the default checks, and that evaluation is also
the reference of the lower precisions (its unrotated value is the plain
reference evaluation's bit for bit, verified on g g > g g g in
double-double and arb(60); a best-effort or failed point has no reference,
as before; the certification of an arbitrary-precision truth is unchanged;
with one backend and an arbitrary-precision truth its references stay the
checked evaluations). A ground truth not listed gets no table and no checks
beyond its certification above (with an arbitrary-precision truth the
cross-check between the backends and the checked re-run of a reference it
does not certify; with one backend one checked evaluation per point). An
entry above the ground truth (or listed twice) is refused before any work;
with `--ground-truth none` every entry is estimates-only. A precision not
listed is not evaluated: without binary64 in the list the stability run has
no binary64 stream (`stability` is then empty in `--json`) and the runtime
no binary64 calls, except binary64's runtime worker when another listed
precision's table shows the ground truth's multiplier and the truth itself
is not listed (the multiplier pass runs in that worker); binary64's counts
are still the start of the other precisions' calls. Each precision's
failure causes are under its own tables. The precisions given are
honoured; the stability plan and its ETA count each extra stream at a lower
bound of its point (a checked binary64 point below the ground truth, the
plain reference point for the ground truth's own) until the run measures it,
and the default budget's deadline admits points at the measured costs of
every stream. The scope rules (A and B above) count them by lower bounds
too: binary64's calls only when listed, every other precision's stream at
least two binary64 points in the runtime timing (its measuring call and
one timed call) and one binary64 point per stability point, a listed
ground truth as the reference it is (in the runtime timing its stream runs
after binary64's rows, so until then rule A sees it at one binary64 point
per call and rarely leaves a backend out for it, more output than asked,
never less); the stability plan prices a listed ground truth's stream at
its checks' evaluations per point (the point and each rotation of a plain
reference point); the whole command's ETA counts each
precision's runtime calls (its measuring point and its budget) until they
run, and `--completion-time` keeps their estimates out of binary64's share
and gives each the time left when it starts. With `--runtime`, every entry other than binary64 also gets
its own "Runtime per reduction backend, <precision>" and "Time per point and
stage, <precision>" tables, in the order given (the
ground truth's own precision too: timing needs no truth; with a list given,
binary64's runtime and checks tables are titled ", binary64" as well): per backend the
same optimistic pass as binary64's in that arithmetic, in a process of its
own (one core, or `--runtime-threads`), its stage groups from the native
stage reports of those calls and its peak RAM. It starts from binary64's
counts and budget for that backend (`--target-runtime` is each backend's
timed budget per measured precision); its one-point warm-up call (untimed)
measures its cost, and its batch falls to the largest power of two that
its calls fit in that budget, down to one point, that call its warm-up (a
`--batch-size` given is honoured: every call holds that many points). A
wider carrier's time per point depends on the points per call
(double-double on g g > g g g, NinjaRS: 0.69 s at one point, 0.57 s at
two, 0.45 s at 16), so it compares with the multiplier pass's (one point
per call where it is dear) at the same batch. Its time carries the ground
truth's multiplier against it, `(arb(60) x1.1)`, none on the ground truth's
own table. When the ground truth is listed its stream is timed once: it is
the multiplier of binary64's table and of the others (no separate
multiplier pass), and rule B leaves it in (a precision given). In `--json` its rows are `runtime_measured` (each its
`precision` record and `runtime` rows as `runtime`), absent by default. In
`--json` the other precisions' rows are under `stability_setup.measured_precisions`
(each entry its precision, `estimates_only`, `digits_cap`,
`capped_by_truth` and `stability`, the same rows as `stability`; binary64's
entry `stability: null`, its rows where they always are); the key is absent
with the default. The per-sample records (`--json`, `--samples-output`: its
`measured_precisions`) of a wider precision hold its value and sectors as
the exact decimal text of its carrier's value; every precision's records
also carry `estimate_digits_uncapped` and `true_digits_uncapped`.

**Stability.** Over N flat points (`benchmark.stability_points` /
`--stability-points`; by default as many as one minute per worker affords,
at least five; with `--completion-time` what is left of it; drawn with
Expand Down Expand Up @@ -1199,15 +1285,19 @@ reference failed has an unknown truth and is left out (shown as
"no ref."). The measured points (N in what follows) are all others.

The measured points are sorted by true digits from worst to best. At the
percentiles 1 per mil, 1 %, 10 % and 50 % the table shows the true digits of
the point of rank floor(p N) (1-based; the 50 % row is the median, the lower
middle point for an even N), and over the class of points of rank
floor(p' N) < rank <= floor(p N) (p' the previous percentile, 0 for the
first) the point count (with its failed points), the min, median and max of
|estimated - true| and the median of estimated - true (positive: the
estimate is optimistic), both over the class's points with an estimate. At
percentiles 1 per mil, 1 %, 10 %, 50 % and 100 % the table shows the true
digits of the point of rank floor(p N) (1-based; the 50 % row is the median,
the lower middle point for an even N; the 100 % row the best point), and
over the class of points of rank floor(p' N) < rank <= floor(p N) (p' the
previous percentile, 0 for the first; the classes add up to N) the min,
median and max of |estimated - true| and the median of estimated - true
(positive: the estimate is optimistic), both over the class's points with
an estimate. A class holds floor(p N) - floor(p' N) points, so the table
shows no count (`--json` keeps each class's `count` and `failed`); a class
with points without a value says so after its digits, `0.00 (2 failed)`. At
small N a class can be empty (`-`; the table prints the N a populated class
needs: 1000 measured points for the 1 per mil class, 2 for the median).
needs: 1000 measured points for the 1 per mil class, 2 for the median, 1
for the 100 % row).

A second table compares the default checks with the truth, per backend: the
measured points, those served best-effort / without a value in binary64, the points flagged unstable
Expand Down
2 changes: 1 addition & 1 deletion pyamplicol/docs/user/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ rescaled = true
| Interface | The TOML | One setting |
| --- | --- | --- |
| CLI | `pyamplicol evaluate ARTIFACT --card options.toml` (the run card) | its flag (table below) |
| Python | `Runtime.load(artifact, options=...)`: a path, a TOML text or a parsed mapping | its keyword |
| Python | `Runtime.load(artifact, options=...)`: a path, a TOML text or a parsed mapping (a one-line string is a path when it names an existing file, else TOML; neither: refused naming both) | its keyword |
| C SDK | `rusticol_virtual_set_options(handle, toml_text)`; `rusticol_virtual_open_with_options(path, process, parameters_json, r2_strategy, toml_text, &handle)` | its setter |
| C++ / Fortran / Rust SDK | `VirtualRuntime::set_options` / `set_options_file` / `with_options`; `runtime%set_options`, `runtime%load(..., options_toml=)`; `Runtime::set_options` / `set_options_file` / `open_with_options` | its setter |

Expand Down
4 changes: 3 additions & 1 deletion pyamplicol/docs/user/profiling-and-benchmarking.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,9 @@ group) with the ratio between the backends (the faster highlighted), and the
stable digits of pure binary64
against a re-run in the reference precision (`--ground-truth`: double-double
by default, or arbitrary precision) over flat points at the percentiles 1 per mil,
1 %, 10 % and 50 % (a point a backend refuses in binary64 measured with its
1 %, 10 %, 50 % and 100 % (other precisions too with `--measured-precisions`,
each its own tables, e.g. `--measured-precisions double dd --ground-truth
arb:60`; a point a backend refuses in binary64 measured with its
best-effort value at its true digits; only a point with no binary64 value
ranked at 0 digits), with the accuracy of the default estimate against
that truth (one default rotation on NinjaRS's points; one default rotation and
Expand Down
5 changes: 3 additions & 2 deletions pyamplicol/docs/user/python-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,9 @@ effect by its run-card name, as plain data (the stability checks as
"cross_backend"}` or None, as the SDKs' `options_json`); `threads` is the
effective count and `threads_requested` the requested one when it was
clamped. A tree runtime refuses, at load, every virtual option the TOML
names. A one-line `options` string without `=` is a path (a mistyped path
says that no such file exists).
names. A one-line `options` string that names an existing file is a path,
else a TOML text (`"[evaluation]"`: an empty table, no option set); one that
is neither (a mistyped path) is refused naming both readings.

`threads=N` bounds every native thread pool of the runtime, its load and
every evaluation in every carrier, to `N` workers (clamped to the cores the
Expand Down
8 changes: 8 additions & 0 deletions pyamplicol/examples/all_options.toml
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,14 @@ n_core = 10
# the runtime timing then times its multiplier even when its minimal counts
# exceed the budget.
ground_truth = "double-double"
# benchmark.measured_precisions: Loop artifacts: the precisions whose
# stability the stability run measures (`--measured-precisions`), each its
# own pair of tables in this order: "binary64" ("double", "b64"; the default
# ["binary64"]), "double-double" ("dd"), "arbitrary[:DIGITS]" ("arb"), each
# strictly below ground_truth (true digits against it) or ground_truth itself
# (its estimates only, with the default checks); with ground_truth "none"
# every entry is estimates only.
measured_precisions = ["binary64"]
# benchmark.checked: Loop artifacts: time the checked mode (`--checked`): the
# backends' own acceptance checks, a refused point served best-effort, the
# default backend as auto. Default false: one fully optimistic binary64 pass
Expand Down
27 changes: 13 additions & 14 deletions pyamplicol/rust/crates/rusticol-core/src/loop_v2/plan/binary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1882,11 +1882,7 @@ thread_local! {
static SEQUENTIAL: std::cell::Cell<bool> = const { std::cell::Cell::new(false) };
}

/// [`read_binary_with`] within the caller's thread bound: under a load's
/// bound (`plan::with_load_threads`) with the threads its work uses, inside a
/// pool's worker on that pool's threads, else sequentially on the calling
/// thread, never starting rayon's global pool (whose workers would outlive
/// the call).
/// [`read_binary_with`] within the caller's thread bound (`read_bounded`).
/// The loader's read of a stored member (`LoopProgramV4::load_with`): an
/// executor or runtime built with a thread bound starts no other threads
/// (M-FINAL MF-8G-1 item 5; the JSON load is sequential too). The model and
Expand All @@ -1895,8 +1891,11 @@ pub fn read_binary_bounded(member: &[u8], policy: FormPolicy) -> RusticolResult<
read_bounded(|| read_binary_with(member, policy))
}

/// `read` (a read of a binary member) within the caller's thread bound
/// ([`read_binary_bounded`]).
/// `read` (a read of a binary member) within the caller's thread bound:
/// under a load's bound (`plan::with_load_threads`) with the threads its work
/// uses, inside a pool's worker on that pool's threads, else sequentially on
/// the calling thread, never starting rayon's global pool (whose workers
/// would outlive the call).
pub(super) fn read_bounded<T>(read: impl FnOnce() -> RusticolResult<T>) -> RusticolResult<T> {
if rayon::current_thread_index().is_some() || super::load_bound().is_some() {
return read();
Expand Down Expand Up @@ -1934,13 +1933,13 @@ pub fn read_pool() -> Option<bool> {
/// else the bound of a load on this thread (`plan::with_load_threads`: each
/// list then decodes on the load's pool with the threads it uses,
/// [`Reader::list_threads`]); else inside a pool's worker that pool's, else
/// the global pool's, started first. rayon starts the global pool lazily at its first use and panics
/// there when a worker cannot be spawned, and never starts it after a failed
/// start (any later use panics too): the reader starts it itself, and a
/// pool that cannot start, or whose start failed before (outside this
/// reader, revealed by one caught use), makes every read of the process
/// decode on one thread, never a refusal or rayon's panic. A pool another
/// component started first is used as it is.
/// the global pool's, started first. rayon starts the global pool lazily at
/// its first use and panics there when a worker cannot be spawned, and never
/// starts it after a failed start (any later use panics too): the reader
/// starts it itself, and a pool that cannot start, or whose start failed
/// before (outside this reader, revealed by one caught use), makes every
/// read of the process decode on one thread, never a refusal or rayon's
/// panic. A pool another component started first is used as it is.
fn read_threads() -> usize {
if allocations_can_fail() || SEQUENTIAL.with(std::cell::Cell::get) {
return 1;
Expand Down
4 changes: 4 additions & 0 deletions pyamplicol/rust/loop-reduction/src/runtime/fast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ impl FastReductions {
for (index, sector) in self.sectors.iter_mut().enumerate() {
if self.active[index] {
results.push(sector.evaluate(ids, input, parameters)?);
// Taken after a successful evaluation only, which suffices:
// NinjaRS's `FastAmplitude::evaluate` forgets the thread's
// earlier records on entry (`clear_instabilities`), so those
// of a failed evaluation never reach the next one.
records.push(super::lane_status::fast_instabilities(ids.len()));
} else {
records.push(vec![None; ids.len()]);
Expand Down
5 changes: 5 additions & 0 deletions pyamplicol/rust/loop-reduction/src/runtime/reduction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@ where
)
.map_err(error)?,
);
// Taken after a successful evaluation only, which suffices:
// NinjaRS's `Amplitude::evaluate_batch_with_inputs` (every
// `evaluate_batch*` goes through it) forgets the thread's earlier
// box-Gram refusals on entry (`clear_box_gram_refusals`), so those
// of a failed evaluation never reach the next one.
refusals.push(super::lane_status::generic_refusals());
}
let mut sectors = results.into_iter();
Expand Down
4 changes: 4 additions & 0 deletions pyamplicol/rust/loop-reduction/src/runtime/v2_reduce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,10 @@ impl FastEngine {
&mut self.statuses,
)
.map_err(error)?;
// Taken after a successful evaluation only, which suffices: NinjaRS's
// `FastAmplitude::evaluate` forgets the thread's earlier records on
// entry (`clear_instabilities`), so those of a failed evaluation
// never reach the next one.
let records = super::lane_status::fast_instabilities(lanes);
Ok(self
.statuses
Expand Down
Loading
Loading