benchset 0.0.4__tar.gz → 0.0.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. {benchset-0.0.4 → benchset-0.0.6}/Cargo.lock +1 -1
  2. {benchset-0.0.4 → benchset-0.0.6}/Cargo.toml +1 -1
  3. {benchset-0.0.4 → benchset-0.0.6}/PKG-INFO +174 -18
  4. {benchset-0.0.4 → benchset-0.0.6}/Package.swift +2 -2
  5. {benchset-0.0.4 → benchset-0.0.6}/README.md +173 -17
  6. {benchset-0.0.4 → benchset-0.0.6}/Sources/Benchset/Benchset.swift +66 -1
  7. {benchset-0.0.4 → benchset-0.0.6}/benchset/__init__.py +2 -0
  8. {benchset-0.0.4 → benchset-0.0.6}/benchset/_native.py +4 -1
  9. {benchset-0.0.4 → benchset-0.0.6}/benchset/api.py +4 -3
  10. {benchset-0.0.4 → benchset-0.0.6}/benchset/cli.py +40 -27
  11. {benchset-0.0.4 → benchset-0.0.6}/benchset/models.py +33 -0
  12. {benchset-0.0.4 → benchset-0.0.6}/benchset.egg-info/PKG-INFO +174 -18
  13. {benchset-0.0.4 → benchset-0.0.6}/benchset.egg-info/SOURCES.txt +9 -0
  14. {benchset-0.0.4 → benchset-0.0.6}/include/benchset.h +31 -0
  15. {benchset-0.0.4 → benchset-0.0.6}/native/src/ffi.rs +10 -3
  16. {benchset-0.0.4 → benchset-0.0.6}/native/src/ffi_reference_tests.rs +29 -3
  17. {benchset-0.0.4 → benchset-0.0.6}/native/src/ffi_tests.rs +23 -0
  18. {benchset-0.0.4 → benchset-0.0.6}/native/src/lib.rs +81 -4
  19. {benchset-0.0.4 → benchset-0.0.6}/native/src/runtime_tests.rs +132 -45
  20. benchset-0.0.6/native/src/suite_ffi.rs +243 -0
  21. benchset-0.0.6/native/src/suite_ffi_tests.rs +477 -0
  22. benchset-0.0.6/native/src/suite_tests.rs +207 -0
  23. {benchset-0.0.4 → benchset-0.0.6}/pyproject.toml +1 -1
  24. {benchset-0.0.4 → benchset-0.0.6}/scripts/build_native.py +7 -1
  25. benchset-0.0.6/scripts/cargo.py +11 -0
  26. {benchset-0.0.4 → benchset-0.0.6}/scripts/check_source_install.py +19 -0
  27. {benchset-0.0.4 → benchset-0.0.6}/scripts/package_native.py +21 -6
  28. {benchset-0.0.4 → benchset-0.0.6}/scripts/release.py +5 -2
  29. {benchset-0.0.4 → benchset-0.0.6}/setup.py +9 -3
  30. {benchset-0.0.4 → benchset-0.0.6}/tests/swift/BenchsetTests.swift +342 -35
  31. {benchset-0.0.4 → benchset-0.0.6}/tests/test_benchset.py +9 -1
  32. {benchset-0.0.4 → benchset-0.0.6}/tests/test_build.py +31 -3
  33. benchset-0.0.6/tests/test_build_native.py +80 -0
  34. {benchset-0.0.4 → benchset-0.0.6}/tests/test_cli.py +160 -38
  35. {benchset-0.0.4 → benchset-0.0.6}/tests/test_errors.py +1 -1
  36. benchset-0.0.6/tests/test_native_coverage.py +280 -0
  37. benchset-0.0.6/tests/test_packaging.py +188 -0
  38. {benchset-0.0.4 → benchset-0.0.6}/tests/test_reference.py +22 -6
  39. {benchset-0.0.4 → benchset-0.0.6}/tests/test_reference_artifacts.py +369 -33
  40. {benchset-0.0.4 → benchset-0.0.6}/tests/test_reference_native.py +8 -2
  41. benchset-0.0.6/tests/test_release.py +687 -0
  42. {benchset-0.0.4 → benchset-0.0.6}/tests/test_semantics.py +89 -12
  43. benchset-0.0.6/tests/test_setup.py +208 -0
  44. {benchset-0.0.4 → benchset-0.0.6}/tests/test_signals.py +7 -0
  45. benchset-0.0.6/tests/test_suite.py +179 -0
  46. {benchset-0.0.4 → benchset-0.0.6}/tests/test_version.py +28 -4
  47. {benchset-0.0.4 → benchset-0.0.6}/tests/typing/reference_positive.py +13 -2
  48. {benchset-0.0.4 → benchset-0.0.6}/tests/typing/test_reference_types.py +2 -0
  49. benchset-0.0.4/tests/test_release.py +0 -358
  50. {benchset-0.0.4 → benchset-0.0.6}/LICENSE +0 -0
  51. {benchset-0.0.4 → benchset-0.0.6}/MANIFEST.in +0 -0
  52. {benchset-0.0.4 → benchset-0.0.6}/benchset/__main__.py +0 -0
  53. {benchset-0.0.4 → benchset-0.0.6}/benchset/py.typed +0 -0
  54. {benchset-0.0.4 → benchset-0.0.6}/benchset/reference.py +0 -0
  55. {benchset-0.0.4 → benchset-0.0.6}/benchset.egg-info/dependency_links.txt +0 -0
  56. {benchset-0.0.4 → benchset-0.0.6}/benchset.egg-info/entry_points.txt +0 -0
  57. {benchset-0.0.4 → benchset-0.0.6}/benchset.egg-info/requires.txt +0 -0
  58. {benchset-0.0.4 → benchset-0.0.6}/benchset.egg-info/top_level.txt +0 -0
  59. {benchset-0.0.4 → benchset-0.0.6}/examples/native/c.c +0 -0
  60. {benchset-0.0.4 → benchset-0.0.6}/examples/native/rust.rs +0 -0
  61. {benchset-0.0.4 → benchset-0.0.6}/examples/native/swift.swift +0 -0
  62. {benchset-0.0.4 → benchset-0.0.6}/include/module.modulemap +0 -0
  63. {benchset-0.0.4 → benchset-0.0.6}/native/reference-calibration.json +0 -0
  64. {benchset-0.0.4 → benchset-0.0.6}/native/src/kernel.rs +0 -0
  65. {benchset-0.0.4 → benchset-0.0.6}/native/src/kernel_tests.rs +0 -0
  66. {benchset-0.0.4 → benchset-0.0.6}/native/src/reference.rs +0 -0
  67. {benchset-0.0.4 → benchset-0.0.6}/native/src/reference_tests.rs +0 -0
  68. {benchset-0.0.4 → benchset-0.0.6}/rust-toolchain.toml +0 -0
  69. {benchset-0.0.4 → benchset-0.0.6}/scripts/__init__.py +0 -0
  70. {benchset-0.0.4 → benchset-0.0.6}/scripts/build_backend.py +0 -0
  71. {benchset-0.0.4 → benchset-0.0.6}/scripts/check_native_coverage.py +0 -0
  72. {benchset-0.0.4 → benchset-0.0.6}/scripts/version.py +0 -0
  73. {benchset-0.0.4 → benchset-0.0.6}/setup.cfg +0 -0
  74. {benchset-0.0.4 → benchset-0.0.6}/tests/__init__.py +0 -0
  75. {benchset-0.0.4 → benchset-0.0.6}/tests/helpers.py +0 -0
  76. {benchset-0.0.4 → benchset-0.0.6}/tests/swift/ReferenceTests.swift +0 -0
  77. {benchset-0.0.4 → benchset-0.0.6}/tests/test_resources.py +0 -0
  78. {benchset-0.0.4 → benchset-0.0.6}/tests/typing/__init__.py +0 -0
  79. {benchset-0.0.4 → benchset-0.0.6}/tests/typing/reference_negative.py +0 -0
@@ -4,4 +4,4 @@ version = 3
4
4
 
5
5
  [[package]]
6
6
  name = "benchset"
7
- version = "0.0.4"
7
+ version = "0.0.6"
@@ -1,7 +1,7 @@
1
1
  [package]
2
2
  name = "benchset"
3
3
  # Generated from [project].version in pyproject.toml by scripts/version.py.
4
- version = "0.0.4"
4
+ version = "0.0.6"
5
5
  edition = "2021"
6
6
  rust-version = "1.74"
7
7
  description = "Embeddable sustained scalar CPU benchmarks with a C ABI"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: benchset
3
- Version: 0.0.4
3
+ Version: 0.0.6
4
4
  Summary: Sustained scalar CPU benchmarks with an embeddable Rust core
5
5
  Author-email: Evgeniy Blinov <zheni-b@yandex.ru>
6
6
  Project-URL: Source, https://github.com/mutating/benchset
@@ -45,6 +45,10 @@ Higher is faster. Each completed result also includes a **Pi equivalent**:
45
45
  its throughput divided by the same benchmark's sustained Raspberry Pi 5 score.
46
46
  `0.5` means half the Pi's throughput, `1.0` equal throughput, and `2.0` twice
47
47
  the Pi's throughput. The CLI prints both iterations/s and `Pi equivalent`.
48
+ The full suite also returns **aggregated scores**. Its **Full Pi equivalent** is
49
+ the geometric mean of the individual Pi equivalents, with equal weights.
50
+ See [Full-suite score](#full-suite-score) for the formula, availability rules
51
+ and the field to read in each interface.
48
52
 
49
53
  This README describes the current source tree. For changes not yet published,
50
54
  use `pip install .` or the local Rust/Swift dependencies described below.
@@ -95,8 +99,9 @@ suite stops after a failed or cancelled benchmark.
95
99
  Each result is flushed immediately, including when stdout is redirected.
96
100
  Progress fits the terminal width and is cleared before the result. Output
97
101
  uses `× pi` and `—` when the stream supports them, with `x pi` and `-` as
98
- fallbacks for restrictive encodings. A closed stdout pipe exits with code 1
99
- without a traceback.
102
+ fallbacks for restrictive encodings. Streams configured with `backslashreplace`
103
+ may emit Unicode escape sequences instead. A closed stdout pipe exits with
104
+ code 1 without a traceback.
100
105
 
101
106
  For example, a completed result at half the reference throughput includes
102
107
  these lines (illustrative values; other fields and samples are omitted):
@@ -112,6 +117,60 @@ Pi equivalent : 0.5 × pi
112
117
  The multiplier uses the full-precision native score, before display rounding.
113
118
  An unavailable multiplier is displayed as `—` (`-` in the fallback format).
114
119
 
120
+ ## Full-suite score
121
+
122
+ Run the complete suite to obtain its overall score:
123
+
124
+ | Interface | Run the suite | Read the Full Pi equivalent |
125
+ |---|---|---|
126
+ | CLI | `benchset` or `benchset --bench all` | Final `Full Pi equivalent` line |
127
+ | Python | `suite = run_all(...)` (module-level function) | `suite.aggregated_scores.pi_equivalent` |
128
+ | Rust | `let suite = benchset::run_all(options, &cancellation, callback);` | `suite.aggregated_scores.pi_equivalent` |
129
+ | Swift | `let suite = try runner.runAll(...)` | `suite.aggregatedScores.piEquivalent` |
130
+ | C / C++ | `benchset_run_all(...)`, then `benchset_suite_result(...)` | `suite.aggregated_scores.pi_equivalent` when `has_pi_equivalent != 0` |
131
+
132
+ For each benchmark, let `r = score / that_benchmark_reference_score`.
133
+ For positive ratios, the full score is `exp(sum(ln(r)) / benchmark_count)`.
134
+ With the current two benchmarks this is mathematically
135
+ `sqrt(r_single_core * r_multi_core)`. Each benchmark has equal weight,
136
+ independently of its worker count or measurement duration. The resulting
137
+ multiplier is dimensionless; individual `score` fields remain iterations/s.
138
+
139
+ The implementations use natural logarithms and `exp` on the original,
140
+ unrounded double-precision ratios. Log space avoids intermediate overflow or
141
+ underflow from multiplying ratios. Any consistent logarithm base and its
142
+ inverse give the same mathematical result; ordinary floating-point rounding
143
+ still applies. For example, `0.5` and `2.0` produce exactly `1.0`, and `1.0`
144
+ and `4.0` produce `2.0`. The first example's CLI summary is:
145
+
146
+ ```text
147
+ Full Pi equivalent : 1 × pi
148
+ ```
149
+
150
+ A full score requires exactly `single_core` then `multi_core`, both with
151
+ `completed` status and a present, finite, nonnegative Pi equivalent. Completed
152
+ unstable results participate. After validating the complete set, any zero ratio
153
+ makes the full score `0.0`. Zero is a valid score: check `is not None` in Python,
154
+ `Some` in Rust, `if let` in Swift, or the presence flag in C.
155
+
156
+ An incomplete, failed or cancelled suite has no aggregate: `None` in
157
+ Python/Rust, `nil` in Swift, or a zero presence flag in C. When a benchmark
158
+ fails or is cancelled, a returned suite retains the completed prefix and the
159
+ first unsuccessful result. Results assembled by callers must also have the
160
+ complete order, without duplicates or
161
+ extra entries. Use `SuiteResult.from_results(tuple_of_results)` in Python,
162
+ `SuiteResult::new(results)` in Rust, or `SuiteResult(results: results)` in Swift
163
+ to calculate the aggregate from their stored individual Pi equivalents.
164
+ Python's direct `SuiteResult(results, aggregated_scores)` constructor stores
165
+ the supplied fields; it does not calculate an aggregate.
166
+
167
+ The CLI prints the summary on stdout after success or stderr after
168
+ failure/cancellation, using `—` (`-` in the fallback format) when unavailable.
169
+ An interrupted CLI call suppresses the aggregate even if its final native
170
+ result had already completed. Selecting only one benchmark prints no suite
171
+ summary. Progress fractions belong to the benchmark currently running and
172
+ restart for the next benchmark.
173
+
115
174
  ## Python API
116
175
 
117
176
  Python 3.8–3.15, including free-threaded CPython, is supported. The wrapper uses
@@ -126,7 +185,15 @@ if result.success:
126
185
  else:
127
186
  print(result.status, result.reason)
128
187
 
129
- results = run_all(warmup_seconds=120, measurement_seconds=60)
188
+ suite = run_all(warmup_seconds=120, measurement_seconds=60)
189
+ results = suite.results # Tuple[BenchmarkResult, ...]
190
+ full_pi = suite.aggregated_scores.pi_equivalent
191
+ if full_pi is not None:
192
+ print(f'Full Pi equivalent: {full_pi} x pi')
193
+ else:
194
+ for item in results:
195
+ if not item.success:
196
+ print(item.benchmark, item.status, item.reason)
130
197
  print(result.reference_run.started_at, result.reference_run.results)
131
198
  ```
132
199
 
@@ -149,12 +216,22 @@ with ThreadPoolExecutor(max_workers=1) as pool:
149
216
  Callbacks execute on the thread calling `run`, approximately ten times per
150
217
  second and on observed phase transitions. A very short phase can finish before
151
218
  the coordinator reports it, so callback sequences may omit that phase.
152
- Callbacks receive the benchmark name, phase,
219
+ Callbacks receive one `Progress` object containing the benchmark name, phase,
153
220
  worker count, overall fraction, phase elapsed/target time and completed
154
221
  iterations in that phase. Dispatch UI updates to the UI thread yourself and
155
222
  return promptly. A Python callback exception cancels the workload and produces
156
223
  a failed result; it does not propagate through C.
157
224
 
225
+ `run_all()` returns an immutable `SuiteResult`, with `results` (a tuple of
226
+ individual results in execution order) and `aggregated_scores: AggregatedScores`.
227
+ The current aggregate is `pi_equivalent: Optional[float]`; see
228
+ [Full-suite score](#full-suite-score) for its calculation and availability.
229
+ `dataclasses.asdict(suite)` produces `{"results": ..., "aggregated_scores":
230
+ {"pi_equivalent": ...}}`, including the individual results' nested calibration
231
+ records. `dataclasses.asdict(result)` also works for a single benchmark.
232
+ Consumers that previously iterated over `run_all()` directly should now iterate
233
+ over `run_all().results`.
234
+
158
235
  `BenchmarkRunner.cancel()` is thread-safe and requests cancellation without
159
236
  waiting for the active call to finish. After `run()` returns, all native workers
160
237
  are joined and the runner can be reused. Concurrent
@@ -354,9 +431,12 @@ settings are comparable.
354
431
 
355
432
  ## Embed in Rust
356
433
 
434
+ Source consumers need Rust 1.74 or newer. Published native binaries use the
435
+ pinned release toolchain described under [Publishing](#publishing).
436
+
357
437
  ```toml
358
438
  [dependencies]
359
- benchset = "0.0.4"
439
+ benchset = "0.0.6"
360
440
  # For changes from a local source checkout, use:
361
441
  # benchset = { path = "../benchset" }
362
442
  ```
@@ -372,11 +452,23 @@ if let (Some(score), Some(equivalent)) = (result.score, result.pi_equivalent) {
372
452
  println!("{:?}: {}", result.status, result.reason);
373
453
  }
374
454
  println!("Reference warmup: {} s", result.reference_run.warmup_seconds);
455
+
456
+ let suite_cancellation = Cancellation::default();
457
+ let suite = benchset::run_all(Options::default(), &suite_cancellation, |benchmark, progress| {
458
+ println!("{}: {}", benchmark.name(), progress.fraction);
459
+ });
460
+ if let Some(full_pi) = suite.aggregated_scores.pi_equivalent {
461
+ println!("Full Pi equivalent: {full_pi} x pi");
462
+ } else {
463
+ println!("Full Pi equivalent unavailable");
464
+ }
465
+ // suite.results contains the individual BenchmarkResult values in order.
375
466
  ```
376
467
 
377
- The cancellation token can be cloned and cancelled from another thread. It is
378
- sticky: create a new token for a new call. A short runnable example is in
379
- `examples/native/rust.rs`.
468
+ The cancellation token can be cloned and cancelled from another thread. Once
469
+ cancelled, it stays cancelled; create a fresh token for a subsequent uncancelled
470
+ call. The suite uses the same token across both benchmarks. A short runnable
471
+ example is in `examples/native/rust.rs`.
380
472
 
381
473
  ## Embed through C ABI
382
474
 
@@ -422,6 +514,37 @@ string is valid for the loaded library's lifetime. Progress pointers are
422
514
  borrowed only during the callback. Do not free a handle while it is in use or
423
515
  throw/unwind through a C callback. Invalid configuration produces a failed result.
424
516
 
517
+ For a full suite, create a `BenchsetSuiteHandle` with `benchset_suite_create()`
518
+ and call `benchset_run_all(handle, &config, callback, context)`. The benchmark
519
+ selector is ignored; warmup and measurement settings apply to each benchmark.
520
+ The callback receives `BenchsetSuiteProgress`, containing the benchmark ID and
521
+ its progress. `benchset_run_all` returns the final individual result's status.
522
+ After the call, `benchset_suite_result(handle, &suite, sizeof(suite))`
523
+ fills a `BenchsetSuiteResult` with `results`, `result_count` and
524
+ `aggregated_scores`, returning 1 on success or 0 if the getter fails.
525
+ The immutable result array is borrowed until the handle is freed.
526
+ Check `suite.aggregated_scores.has_pi_equivalent` before reading its
527
+ `pi_equivalent` value. Read individual results with `benchset_suite_result_at`
528
+ (V3 format), and diagnostics with `benchset_suite_sample` and
529
+ `benchset_suite_reason`. Use `benchset_suite_cancel` and `benchset_suite_free`
530
+ for cancellation and cleanup. The same single-use and lifetime rules apply.
531
+
532
+ For example, using the initialized `config` above and no progress callback:
533
+
534
+ ```c
535
+ BenchsetSuiteHandle *suite_handle = benchset_suite_create();
536
+ if (!suite_handle) return 1;
537
+ benchset_run_all(suite_handle, &config, NULL, NULL);
538
+ BenchsetSuiteResult suite;
539
+ if (benchset_suite_result(suite_handle, &suite, sizeof(suite)) &&
540
+ suite.aggregated_scores.has_pi_equivalent != 0) {
541
+ printf("Full Pi equivalent: %.12g x pi\n", suite.aggregated_scores.pi_equivalent);
542
+ } else {
543
+ printf("Full Pi equivalent unavailable\n");
544
+ }
545
+ benchset_suite_free(suite_handle);
546
+ ```
547
+
425
548
  The C ABI version remains 1. The additive, size-checked
426
549
  `benchset_reference_machine`, `benchset_reference_run` and indexed
427
550
  `benchset_reference_result` getters need no handle. Their
@@ -458,7 +581,9 @@ also be required. Obtain their list with
458
581
  `cargo rustc --release -- --print=native-static-libs`. Dynamic consumers must
459
582
  ship the matching platform library with their application. Source consumers
460
583
  control their compiler/toolchain settings; use our release artifacts for a
461
- consistent build policy.
584
+ consistent build policy. The macOS dynamic library uses the install name
585
+ `@rpath/libbenchset.dylib`; add its directory to your application's runtime
586
+ search path (for example, `-Wl,-rpath,/path/to/benchset/lib` when linking).
462
587
 
463
588
  ## Embed in Swift on macOS
464
589
 
@@ -471,7 +596,7 @@ the same repository. Rust is not required by the consumer.
471
596
  For a Swift manifest, add:
472
597
 
473
598
  ```swift
474
- .package(url: "https://github.com/mutating/benchset.git", .exact("0.0.4"))
599
+ .package(url: "https://github.com/mutating/benchset.git", .exact("0.0.6"))
475
600
  ```
476
601
 
477
602
  Add `.product(name: "Benchset", package: "benchset")` to your target's
@@ -497,9 +622,24 @@ if let score = result.score, let equivalent = result.piEquivalent {
497
622
  print(result.status, result.reason as Any)
498
623
  }
499
624
  print(result.referenceRun.startedAt, result.referenceRun.warmupSeconds)
500
- // Another thread may call runner.cancel() while run is active.
625
+ let suite = try runner.runAll(warmupSeconds: 120, measurementSeconds: 60) { benchmark, progress in
626
+ print(benchmark, progress.fraction)
627
+ }
628
+ if let fullPi = suite.aggregatedScores.piEquivalent {
629
+ print("Full Pi equivalent: \(fullPi) x pi")
630
+ } else {
631
+ print("Full Pi equivalent unavailable")
632
+ }
633
+ // suite.results contains the individual BenchmarkResult values in order.
634
+ // Another thread may call runner.cancel() while run or runAll is active.
501
635
  ```
502
636
 
637
+ `runAll` keeps the runner reserved across both benchmarks; cancellation also
638
+ applies between its native handles. Native failure/cancellation returns the
639
+ results obtained so far with a `nil` aggregate. Wrapper errors such as allocation
640
+ failure or an unavailable native result throw `BenchsetError`; that call returns
641
+ no `SuiteResult`.
642
+
503
643
  To build the Apple package from source:
504
644
 
505
645
  ```sh
@@ -528,15 +668,28 @@ are not part of the initial prebuilt matrix.
528
668
  python -m venv .venv
529
669
  # Activate the virtual environment using your shell's normal command.
530
670
  pip install -r requirements_dev.txt 'skelet>=0.0.21' wheel setuptools
531
- pip install .
532
- python scripts/build_native.py
533
- python -m pytest
534
- cargo test -- --test-threads=1
671
+ pip install -e .
672
+ python -m pytest tests
535
673
  python -m build
674
+ # Native development commands additionally require Cargo on PATH:
675
+ python scripts/build_native.py
676
+ cargo test --locked -- --test-threads=1
536
677
  ```
537
678
 
538
- `scripts/build_native.py` makes the source Python package usable without an
539
- installation. Release wheels are platform-specific but interpreter-independent
679
+ The editable install builds the native library and installs Python dependencies
680
+ and package metadata. `scripts/build_native.py` rebuilds the library beside the
681
+ Python source; it requires Cargo on PATH and does not install Python package
682
+ metadata. Imports still need that metadata because the version is read through
683
+ `importlib.metadata`. After changing the package version, reinstall the Python
684
+ package so its metadata and native library agree. Python-only development can
685
+ use `pip install -e .` to build with the private Rust bootstrap; it does not put
686
+ Cargo on the shell's PATH for standalone native commands.
687
+
688
+ Build and native packaging commands honor `CARGO_TARGET_DIR`; relative paths
689
+ are resolved against the project directory. The frozen-crate verification uses
690
+ the same Cargo output directory.
691
+
692
+ Release wheels are platform-specific but interpreter-independent
540
693
  (`py3-none-<platform>`). The sdist includes the native source. Tests validate
541
694
  correctness, result accounting, progress, cancellation and API/CLI behavior;
542
695
  they do not enforce speed thresholds in CI.
@@ -555,6 +708,9 @@ The [test matrix](tests/coverage-plan.md) combines five independent reviews and
555
708
  covers measurement accounting, statistical boundaries, cancellation, reentry,
556
709
  callback failures, C ABI validation, ownership and CLI behavior. Tests use
557
710
  controlled initialization failures instead of exhausting machine resources.
711
+ Full-suite tests also cover complete ordering, geometric means of unrounded
712
+ ratios, zero/invalid/extreme values, early stopping, serialization and the
713
+ aggregate's presence in each public interface.
558
714
 
559
715
  Python coverage includes statements and branches, including CLI subprocesses;
560
716
  CI installs a coverage startup hook for those subprocesses. Rust and Swift each
@@ -9,8 +9,8 @@ let package = Package(
9
9
  products: [.library(name: "Benchset", targets: ["Benchset"])],
10
10
  targets: [
11
11
  .binaryTarget(name: "CBenchset",
12
- url: "https://github.com/mutating/benchset/releases/download/v0.0.4/Benchset.xcframework.zip",
13
- checksum: "0e6643b1daa58773a93aec6b4228b2d81580f058dc5348609457363a9b5ec4ae"),
12
+ url: "https://github.com/mutating/benchset/releases/download/v0.0.6/Benchset.xcframework.zip",
13
+ checksum: "989e592027e5e5e072a2d7a1ebc7971f12d7e41b6ced25e6d0ea37ce8043602d"),
14
14
  .target(name: "Benchset", dependencies: ["CBenchset"]),
15
15
  .testTarget(name: "BenchsetTests", dependencies: ["Benchset"], path: "tests/swift")
16
16
  ]
@@ -11,6 +11,10 @@ Higher is faster. Each completed result also includes a **Pi equivalent**:
11
11
  its throughput divided by the same benchmark's sustained Raspberry Pi 5 score.
12
12
  `0.5` means half the Pi's throughput, `1.0` equal throughput, and `2.0` twice
13
13
  the Pi's throughput. The CLI prints both iterations/s and `Pi equivalent`.
14
+ The full suite also returns **aggregated scores**. Its **Full Pi equivalent** is
15
+ the geometric mean of the individual Pi equivalents, with equal weights.
16
+ See [Full-suite score](#full-suite-score) for the formula, availability rules
17
+ and the field to read in each interface.
14
18
 
15
19
  This README describes the current source tree. For changes not yet published,
16
20
  use `pip install .` or the local Rust/Swift dependencies described below.
@@ -61,8 +65,9 @@ suite stops after a failed or cancelled benchmark.
61
65
  Each result is flushed immediately, including when stdout is redirected.
62
66
  Progress fits the terminal width and is cleared before the result. Output
63
67
  uses `× pi` and `—` when the stream supports them, with `x pi` and `-` as
64
- fallbacks for restrictive encodings. A closed stdout pipe exits with code 1
65
- without a traceback.
68
+ fallbacks for restrictive encodings. Streams configured with `backslashreplace`
69
+ may emit Unicode escape sequences instead. A closed stdout pipe exits with
70
+ code 1 without a traceback.
66
71
 
67
72
  For example, a completed result at half the reference throughput includes
68
73
  these lines (illustrative values; other fields and samples are omitted):
@@ -78,6 +83,60 @@ Pi equivalent : 0.5 × pi
78
83
  The multiplier uses the full-precision native score, before display rounding.
79
84
  An unavailable multiplier is displayed as `—` (`-` in the fallback format).
80
85
 
86
+ ## Full-suite score
87
+
88
+ Run the complete suite to obtain its overall score:
89
+
90
+ | Interface | Run the suite | Read the Full Pi equivalent |
91
+ |---|---|---|
92
+ | CLI | `benchset` or `benchset --bench all` | Final `Full Pi equivalent` line |
93
+ | Python | `suite = run_all(...)` (module-level function) | `suite.aggregated_scores.pi_equivalent` |
94
+ | Rust | `let suite = benchset::run_all(options, &cancellation, callback);` | `suite.aggregated_scores.pi_equivalent` |
95
+ | Swift | `let suite = try runner.runAll(...)` | `suite.aggregatedScores.piEquivalent` |
96
+ | C / C++ | `benchset_run_all(...)`, then `benchset_suite_result(...)` | `suite.aggregated_scores.pi_equivalent` when `has_pi_equivalent != 0` |
97
+
98
+ For each benchmark, let `r = score / that_benchmark_reference_score`.
99
+ For positive ratios, the full score is `exp(sum(ln(r)) / benchmark_count)`.
100
+ With the current two benchmarks this is mathematically
101
+ `sqrt(r_single_core * r_multi_core)`. Each benchmark has equal weight,
102
+ independently of its worker count or measurement duration. The resulting
103
+ multiplier is dimensionless; individual `score` fields remain iterations/s.
104
+
105
+ The implementations use natural logarithms and `exp` on the original,
106
+ unrounded double-precision ratios. Log space avoids intermediate overflow or
107
+ underflow from multiplying ratios. Any consistent logarithm base and its
108
+ inverse give the same mathematical result; ordinary floating-point rounding
109
+ still applies. For example, `0.5` and `2.0` produce exactly `1.0`, and `1.0`
110
+ and `4.0` produce `2.0`. The first example's CLI summary is:
111
+
112
+ ```text
113
+ Full Pi equivalent : 1 × pi
114
+ ```
115
+
116
+ A full score requires exactly `single_core` then `multi_core`, both with
117
+ `completed` status and a present, finite, nonnegative Pi equivalent. Completed
118
+ unstable results participate. After validating the complete set, any zero ratio
119
+ makes the full score `0.0`. Zero is a valid score: check `is not None` in Python,
120
+ `Some` in Rust, `if let` in Swift, or the presence flag in C.
121
+
122
+ An incomplete, failed or cancelled suite has no aggregate: `None` in
123
+ Python/Rust, `nil` in Swift, or a zero presence flag in C. When a benchmark
124
+ fails or is cancelled, a returned suite retains the completed prefix and the
125
+ first unsuccessful result. Results assembled by callers must also have the
126
+ complete order, without duplicates or
127
+ extra entries. Use `SuiteResult.from_results(tuple_of_results)` in Python,
128
+ `SuiteResult::new(results)` in Rust, or `SuiteResult(results: results)` in Swift
129
+ to calculate the aggregate from their stored individual Pi equivalents.
130
+ Python's direct `SuiteResult(results, aggregated_scores)` constructor stores
131
+ the supplied fields; it does not calculate an aggregate.
132
+
133
+ The CLI prints the summary on stdout after success or stderr after
134
+ failure/cancellation, using `—` (`-` in the fallback format) when unavailable.
135
+ An interrupted CLI call suppresses the aggregate even if its final native
136
+ result had already completed. Selecting only one benchmark prints no suite
137
+ summary. Progress fractions belong to the benchmark currently running and
138
+ restart for the next benchmark.
139
+
81
140
  ## Python API
82
141
 
83
142
  Python 3.8–3.15, including free-threaded CPython, is supported. The wrapper uses
@@ -92,7 +151,15 @@ if result.success:
92
151
  else:
93
152
  print(result.status, result.reason)
94
153
 
95
- results = run_all(warmup_seconds=120, measurement_seconds=60)
154
+ suite = run_all(warmup_seconds=120, measurement_seconds=60)
155
+ results = suite.results # Tuple[BenchmarkResult, ...]
156
+ full_pi = suite.aggregated_scores.pi_equivalent
157
+ if full_pi is not None:
158
+ print(f'Full Pi equivalent: {full_pi} x pi')
159
+ else:
160
+ for item in results:
161
+ if not item.success:
162
+ print(item.benchmark, item.status, item.reason)
96
163
  print(result.reference_run.started_at, result.reference_run.results)
97
164
  ```
98
165
 
@@ -115,12 +182,22 @@ with ThreadPoolExecutor(max_workers=1) as pool:
115
182
  Callbacks execute on the thread calling `run`, approximately ten times per
116
183
  second and on observed phase transitions. A very short phase can finish before
117
184
  the coordinator reports it, so callback sequences may omit that phase.
118
- Callbacks receive the benchmark name, phase,
185
+ Callbacks receive one `Progress` object containing the benchmark name, phase,
119
186
  worker count, overall fraction, phase elapsed/target time and completed
120
187
  iterations in that phase. Dispatch UI updates to the UI thread yourself and
121
188
  return promptly. A Python callback exception cancels the workload and produces
122
189
  a failed result; it does not propagate through C.
123
190
 
191
+ `run_all()` returns an immutable `SuiteResult`, with `results` (a tuple of
192
+ individual results in execution order) and `aggregated_scores: AggregatedScores`.
193
+ The current aggregate is `pi_equivalent: Optional[float]`; see
194
+ [Full-suite score](#full-suite-score) for its calculation and availability.
195
+ `dataclasses.asdict(suite)` produces `{"results": ..., "aggregated_scores":
196
+ {"pi_equivalent": ...}}`, including the individual results' nested calibration
197
+ records. `dataclasses.asdict(result)` also works for a single benchmark.
198
+ Consumers that previously iterated over `run_all()` directly should now iterate
199
+ over `run_all().results`.
200
+
124
201
  `BenchmarkRunner.cancel()` is thread-safe and requests cancellation without
125
202
  waiting for the active call to finish. After `run()` returns, all native workers
126
203
  are joined and the runner can be reused. Concurrent
@@ -320,9 +397,12 @@ settings are comparable.
320
397
 
321
398
  ## Embed in Rust
322
399
 
400
+ Source consumers need Rust 1.74 or newer. Published native binaries use the
401
+ pinned release toolchain described under [Publishing](#publishing).
402
+
323
403
  ```toml
324
404
  [dependencies]
325
- benchset = "0.0.4"
405
+ benchset = "0.0.6"
326
406
  # For changes from a local source checkout, use:
327
407
  # benchset = { path = "../benchset" }
328
408
  ```
@@ -338,11 +418,23 @@ if let (Some(score), Some(equivalent)) = (result.score, result.pi_equivalent) {
338
418
  println!("{:?}: {}", result.status, result.reason);
339
419
  }
340
420
  println!("Reference warmup: {} s", result.reference_run.warmup_seconds);
421
+
422
+ let suite_cancellation = Cancellation::default();
423
+ let suite = benchset::run_all(Options::default(), &suite_cancellation, |benchmark, progress| {
424
+ println!("{}: {}", benchmark.name(), progress.fraction);
425
+ });
426
+ if let Some(full_pi) = suite.aggregated_scores.pi_equivalent {
427
+ println!("Full Pi equivalent: {full_pi} x pi");
428
+ } else {
429
+ println!("Full Pi equivalent unavailable");
430
+ }
431
+ // suite.results contains the individual BenchmarkResult values in order.
341
432
  ```
342
433
 
343
- The cancellation token can be cloned and cancelled from another thread. It is
344
- sticky: create a new token for a new call. A short runnable example is in
345
- `examples/native/rust.rs`.
434
+ The cancellation token can be cloned and cancelled from another thread. Once
435
+ cancelled, it stays cancelled; create a fresh token for a subsequent uncancelled
436
+ call. The suite uses the same token across both benchmarks. A short runnable
437
+ example is in `examples/native/rust.rs`.
346
438
 
347
439
  ## Embed through C ABI
348
440
 
@@ -388,6 +480,37 @@ string is valid for the loaded library's lifetime. Progress pointers are
388
480
  borrowed only during the callback. Do not free a handle while it is in use or
389
481
  throw/unwind through a C callback. Invalid configuration produces a failed result.
390
482
 
483
+ For a full suite, create a `BenchsetSuiteHandle` with `benchset_suite_create()`
484
+ and call `benchset_run_all(handle, &config, callback, context)`. The benchmark
485
+ selector is ignored; warmup and measurement settings apply to each benchmark.
486
+ The callback receives `BenchsetSuiteProgress`, containing the benchmark ID and
487
+ its progress. `benchset_run_all` returns the final individual result's status.
488
+ After the call, `benchset_suite_result(handle, &suite, sizeof(suite))`
489
+ fills a `BenchsetSuiteResult` with `results`, `result_count` and
490
+ `aggregated_scores`, returning 1 on success or 0 if the getter fails.
491
+ The immutable result array is borrowed until the handle is freed.
492
+ Check `suite.aggregated_scores.has_pi_equivalent` before reading its
493
+ `pi_equivalent` value. Read individual results with `benchset_suite_result_at`
494
+ (V3 format), and diagnostics with `benchset_suite_sample` and
495
+ `benchset_suite_reason`. Use `benchset_suite_cancel` and `benchset_suite_free`
496
+ for cancellation and cleanup. The same single-use and lifetime rules apply.
497
+
498
+ For example, using the initialized `config` above and no progress callback:
499
+
500
+ ```c
501
+ BenchsetSuiteHandle *suite_handle = benchset_suite_create();
502
+ if (!suite_handle) return 1;
503
+ benchset_run_all(suite_handle, &config, NULL, NULL);
504
+ BenchsetSuiteResult suite;
505
+ if (benchset_suite_result(suite_handle, &suite, sizeof(suite)) &&
506
+ suite.aggregated_scores.has_pi_equivalent != 0) {
507
+ printf("Full Pi equivalent: %.12g x pi\n", suite.aggregated_scores.pi_equivalent);
508
+ } else {
509
+ printf("Full Pi equivalent unavailable\n");
510
+ }
511
+ benchset_suite_free(suite_handle);
512
+ ```
513
+
391
514
  The C ABI version remains 1. The additive, size-checked
392
515
  `benchset_reference_machine`, `benchset_reference_run` and indexed
393
516
  `benchset_reference_result` getters need no handle. Their
@@ -424,7 +547,9 @@ also be required. Obtain their list with
424
547
  `cargo rustc --release -- --print=native-static-libs`. Dynamic consumers must
425
548
  ship the matching platform library with their application. Source consumers
426
549
  control their compiler/toolchain settings; use our release artifacts for a
427
- consistent build policy.
550
+ consistent build policy. The macOS dynamic library uses the install name
551
+ `@rpath/libbenchset.dylib`; add its directory to your application's runtime
552
+ search path (for example, `-Wl,-rpath,/path/to/benchset/lib` when linking).
428
553
 
429
554
  ## Embed in Swift on macOS
430
555
 
@@ -437,7 +562,7 @@ the same repository. Rust is not required by the consumer.
437
562
  For a Swift manifest, add:
438
563
 
439
564
  ```swift
440
- .package(url: "https://github.com/mutating/benchset.git", .exact("0.0.4"))
565
+ .package(url: "https://github.com/mutating/benchset.git", .exact("0.0.6"))
441
566
  ```
442
567
 
443
568
  Add `.product(name: "Benchset", package: "benchset")` to your target's
@@ -463,9 +588,24 @@ if let score = result.score, let equivalent = result.piEquivalent {
463
588
  print(result.status, result.reason as Any)
464
589
  }
465
590
  print(result.referenceRun.startedAt, result.referenceRun.warmupSeconds)
466
- // Another thread may call runner.cancel() while run is active.
591
+ let suite = try runner.runAll(warmupSeconds: 120, measurementSeconds: 60) { benchmark, progress in
592
+ print(benchmark, progress.fraction)
593
+ }
594
+ if let fullPi = suite.aggregatedScores.piEquivalent {
595
+ print("Full Pi equivalent: \(fullPi) x pi")
596
+ } else {
597
+ print("Full Pi equivalent unavailable")
598
+ }
599
+ // suite.results contains the individual BenchmarkResult values in order.
600
+ // Another thread may call runner.cancel() while run or runAll is active.
467
601
  ```
468
602
 
603
+ `runAll` keeps the runner reserved across both benchmarks; cancellation also
604
+ applies between its native handles. Native failure/cancellation returns the
605
+ results obtained so far with a `nil` aggregate. Wrapper errors such as allocation
606
+ failure or an unavailable native result throw `BenchsetError`; that call returns
607
+ no `SuiteResult`.
608
+
469
609
  To build the Apple package from source:
470
610
 
471
611
  ```sh
@@ -494,15 +634,28 @@ are not part of the initial prebuilt matrix.
494
634
  python -m venv .venv
495
635
  # Activate the virtual environment using your shell's normal command.
496
636
  pip install -r requirements_dev.txt 'skelet>=0.0.21' wheel setuptools
497
- pip install .
498
- python scripts/build_native.py
499
- python -m pytest
500
- cargo test -- --test-threads=1
637
+ pip install -e .
638
+ python -m pytest tests
501
639
  python -m build
640
+ # Native development commands additionally require Cargo on PATH:
641
+ python scripts/build_native.py
642
+ cargo test --locked -- --test-threads=1
502
643
  ```
503
644
 
504
- `scripts/build_native.py` makes the source Python package usable without an
505
- installation. Release wheels are platform-specific but interpreter-independent
645
+ The editable install builds the native library and installs Python dependencies
646
+ and package metadata. `scripts/build_native.py` rebuilds the library beside the
647
+ Python source; it requires Cargo on PATH and does not install Python package
648
+ metadata. Imports still need that metadata because the version is read through
649
+ `importlib.metadata`. After changing the package version, reinstall the Python
650
+ package so its metadata and native library agree. Python-only development can
651
+ use `pip install -e .` to build with the private Rust bootstrap; it does not put
652
+ Cargo on the shell's PATH for standalone native commands.
653
+
654
+ Build and native packaging commands honor `CARGO_TARGET_DIR`; relative paths
655
+ are resolved against the project directory. The frozen-crate verification uses
656
+ the same Cargo output directory.
657
+
658
+ Release wheels are platform-specific but interpreter-independent
506
659
  (`py3-none-<platform>`). The sdist includes the native source. Tests validate
507
660
  correctness, result accounting, progress, cancellation and API/CLI behavior;
508
661
  they do not enforce speed thresholds in CI.
@@ -521,6 +674,9 @@ The [test matrix](tests/coverage-plan.md) combines five independent reviews and
521
674
  covers measurement accounting, statistical boundaries, cancellation, reentry,
522
675
  callback failures, C ABI validation, ownership and CLI behavior. Tests use
523
676
  controlled initialization failures instead of exhausting machine resources.
677
+ Full-suite tests also cover complete ordering, geometric means of unrounded
678
+ ratios, zero/invalid/extreme values, early stopping, serialization and the
679
+ aggregate's presence in each public interface.
524
680
 
525
681
  Python coverage includes statements and branches, including CLI subprocesses;
526
682
  CI installs a coverage startup hook for those subprocesses. Rust and Swift each