Skip to main content

enigma.benchmark

enigma.benchmark.bench(fn, *args, repeat=50, warmup=5, label=None)

Wall-clock time a callable over repeat runs. Returns a BenchResult with .min_us, .median_us, .mean_us, .stdev_us.

enigma.benchmark.bench_gpu(prepared, grid, threads, *, repeat=50, warmup=5, label=None)

Time a PreparedKernel using GPU timestamps. Returns BenchResult.

enigma.benchmark.format_bench_result(r, *, throughput_gbps=None)

One-line formatted string for printing benchmark tables.

BenchResult

enigma.testing

Test utilities for conditional test execution. Set ENIGMA_FORCE_NO_METAL=1 to force-disable Metal detection for testing.