mcframework.benchmark.benchmark_run#
- mcframework.benchmark.benchmark_run(sim: MonteCarloSimulation, n: int, spec: BackendSpec, *, n_workers: int | None = None, repeats: int = 1, seed: int = 42, warmup: bool = False) BenchmarkResult | None[source]#
Time one (backend, size) cell.
Runs the workload
repeatstimes and keeps the best (minimum) wall-clock time, which is the standard way to suppress scheduler/GC noise.- Parameters:
- sim
MonteCarloSimulation Simulation to benchmark.
- n
int Number of draws.
- spec
BackendSpec Backend/device to use.
- n_workers
int, optional Worker count for parallel backends.
- repeats
int, default 1 Number of timed repetitions; the minimum time is reported.
- seed
int, default 42 Seed applied before each repetition for reproducibility.
- warmup
bool, defaultFalse If True, run once and return
None(used to prime pools/JIT/caches).
- sim
- Returns:
BenchmarkResultorNoneNonefor warmup runs or if the backend raised (e.g. Torch missing).
Notes
ponytail:best-of-N is the simple denoiser here; it does not capture variance or per-operator cost. Upgrade path for kernel-level detail ismcframework.profiling.