Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
bench_support.H File Reference

Shared harness for the cellular-automata performance-gate anchors. More...

#include <algorithm>
#include <chrono>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <fstream>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
Include dependency graph for bench_support.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Aleph::CA::Bench::Bench_Result
 Outcome of one measured anchor benchmark. More...
 

Namespaces

namespace  Aleph
 Main namespace for Aleph-w library functions.
 
namespace  Aleph::CA
 
namespace  Aleph::CA::Bench
 

Functions

std::string Aleph::CA::Bench::compiler_string ()
 Describe the compiler that produced the running binary.
 
std::string Aleph::CA::Bench::cpu_string ()
 Read the CPU model name advertised by the host.
 
std::size_t Aleph::CA::Bench::resolve_repeats (const std::size_t fallback)
 Resolve the number of timed repetitions for one anchor.
 
template<typename Work >
Bench_Result Aleph::CA::Bench::measure (std::string name, const double processed_cells, std::size_t repeats, Work &&work)
 Time a kernel with one warmup pass plus a median of timed passes.
 
void Aleph::CA::Bench::emit_json (const Bench_Result &result, std::ostream &out=std::cout)
 Print one benchmark result as a single structured JSON object.
 

Detailed Description

Shared harness for the cellular-automata performance-gate anchors.

This header is local to benchmarks/: it is perf-gate tooling, not part of the installed Aleph API. Every anchor benchmark times its kernel with the same warmup-plus-median protocol and emits a single line of structured JSON so the perf_gate.py orchestrator can parse it deterministically:

{"name":"gol_1024","wall_ns":123456789,"cells_per_sec":1.234e8,
"compiler":"gcc 13.2.0","cpu":"Intel(R) Core(TM) ..."}

The median of several timed repetitions (after one untimed warmup) absorbs the run-to-run jitter of shared CI runners, which is why the perf gate can key on a single number per benchmark.

Definition in file bench_support.H.