bench_lite is a benchmark harness for atomistic simulation software. It runs the same workloads — relaxation, molecular dynamics, constrained dynamics, Monte Carlo sampling, transition-state searches and phonon calculations — across native simulation backends and machine-learned potentials, and records comparable, machine-readable results.
This is the 0.2 architecture: one polymorphic execution core, one typed task configuration, one thin campaign loop and one config-driven CLI.
- Core: one implementation per
(package, workflow)cell. It owns native input adaptation, execution topology, timing, device synchronisation, native output and unsupported/error decisions. - TaskConfig: one typed configuration per workflow.
stepslives in the base class; task-specific parameters live only in the matching subclass. - CoreReport: the single result object the campaign loop reads. It carries
normal_usageandexecute_onlytiming, chunk counts, step counts, peak memory, canonical output and native artifacts. - Campaign: matrix expansion, dataset/batch construction, trials, resume, recording, aggregation and report/plot entry points.
The loop never asks a core about capabilities. A core either handles a runtime
situation internally or returns unsupported.
python -m pip install -e ".[test]"Required: numpy, torch, matplotlib, pyyaml. Native backends are optional and are imported lazily by their cores.
bench_lite list
bench_lite list --matrix
bench_lite show ASE:mdEach core may define an optional self-written comments string. list shows
one line; show prints the full text, task-config fields, timing default and
promoted fields. Comments are not required.
run is controlled by a config file; there are no per-run flags for matrix
axes, device, steps, optimizers or io modes.
bench_lite run -f smoke.yml
bench_lite run -f smoke.yml -o results/smoke
bench_lite run -f /path/to/third_party.yml-f accepts:
- a path to a YAML/JSON file;
- a config name resolved through
BENCH_LITE_CONFIG_PATH.
BENCH_LITE_CONFIG_PATH is an OS-path-separated directory list (os.pathsep,
: on POSIX). If unset, it defaults to the package presets/ directory:
export BENCH_LITE_CONFIG_PATH=/my/configs:/shared/configs
bench_lite run -f full.ymlPresets and third-party configs are equal; there is no --preset switch.
Discover configs without importing torch:
bench_lite --help # search path + names + block counts
bench_lite list configs # parse/validate all configs
bench_lite list configs --jsonbench_lite run -f smoke.yml -o results/smoke
bench_lite run -f full.yml -o results/fullA single-case run is simply a matrix block with one cell; see
presets/single_case.yml. The run writes:
results/smoke/
logs/run.log UTC START/END timestamps
config.resolved.json resolved config + output
aggregates.csv one row per requested prefix/cell
raw_chunks.jsonl one row per native unit
<subdir>/... block outputs
postprocess/ created by a report block or `report --csv`
figures/ created by a plots block or `plot`
run logs the start and end time in logs/run.log; concat uses those times
to decide which run is newest.
version: 1
description: example
run:
device: cpu
dtype: float64
seed: 20260723
trials: 1
warmups: 1
output: results/example
scratch: /tmp/bench_lite
resume: false
only: [opt]
outputs:
results_csv: true
results_jsonl: true
summary_csv: true
plugins:
model_paths: []
core_paths: []
blocks:
- job: opt_toy
io_modes: [io_off, dumper_only]
subdir: opt
- matrix:
name: scaling
kind: toy
terms: [relaxation]
packages: [ASE, BUCToolkit]
models: [harmonic]
toy_sample_count: 8
toy_schemes: [small]
toy_batch_sizes: [1, 4, 8]
toy_steps: 50
subdir: scaling
- report: true
- plots: true
presets: [0, 1, 7]jobblocks expand a preset plus overrides.matrixblocks give explicit axes.reportwrites postprocess tables.plotsselects presets (all,0-3,1,3-5, ...).regressionrunsdoctor(and pytest whenpytest: true).- Relative input/model/core plugin paths are resolved against the config file; output/scratch paths are relative to the working directory.
Presets live in presets/: smoke, toy, practical, full,
qualification, io_sweep, optimizer_sweep, batch_scaling, single_case.
bench_lite concat --inputs results/part1 results/part2 --output-dir results/merged
bench_lite concat --inputs results/part1 results/part2 --output-dir results/merged -y- aggregate rows are matched by a key including seed, task config, dataset, batch, trial, io mode, device and dtype;
- conflicts are resolved interactively by default;
-ykeeps the newest run automatically;- “newest” is determined from
logs/run.logSTART/END timestamps, then file mtime; - raw units are merged from the selected runs;
concat_summary.jsonrecords inputs, times, conflicts and counts;- old
results.csvfiles are not imported.
bench_lite report --output-root results/merged
bench_lite report --output-root results/merged --details --by package
bench_lite report --output-root results/merged --metric execute_only
bench_lite report --output-root results/merged --json
bench_lite report --output-root results/merged --csvreport prints an ASCII table by default and does not import torch. --csv
writes postprocess/*.csv and postprocess/summary.json.
bench_lite plot list
bench_lite plot all --output-root results/merged
bench_lite plot 0-3 --output-root results/merged
bench_lite plot 1,3-5 --output-root results/merged
bench_lite plot table --input results/merged/aggregates.csv \
--x requested_batch_size --y normal_usage_elapsed_s --series package| ID | Name | Content |
|---|---|---|
| 0 | term-elapsed | per-term elapsed and speed-up |
| 1 | term-step | per-term time/step and step speed-up |
| 2 | backend-overview | status, scaling, memory, IO overhead |
| 3 | backend-accuracy | constraint accuracy, phonon support, pass rates |
| 4 | backend-practical | practical heatmap, scaling, model comparison |
| 5 | io-overhead | paired IO overhead |
| 6 | memory-scaling | peak memory versus batch |
| 7 | status-failures | status and failure reasons |
plot defaults to each core's declared timing metric (normal_usage unless
declared otherwise). Use --timing-scope execute_only to compare only native
loops, or normal_usage explicitly.
Serial cores execute the largest requested batch once and expose a read-only
serial_samples sequence. The loop records all requested sizes, skips native
execution for all but the largest, then emits prefix rows from the one run:
requested: 1, 8, 16, 32
native: one execution at 32
aggregates: four prefix rows
raw_chunks: one row per native unit
Batch cores still execute once per requested batch. Frequency datasets run sequentially once.
Cores measure their own time; the loop only reads the report.
normal_usage: includes native setup that a normal user of the backend would perform, plus the native execute/optimise/MD loop.execute_only: the native loop only.- Both exclude harness-side canonical→native conversion, model/checkpoint loading, warmup, readback, validation and reporting.
- Cores synchronise the device before stopping the timer and report phase
times (
adapt,warmup,prepare,execute,readback,cleanup) for audit.
Practical model loading is cached per model/device/dtype. With the default
warmup_runs>=1 it happens during the excluded warmup phase; with
warmup_runs=0 it is part of normal_usage (but never execute_only).
Create a module under bench_lite/cores/ or point run.plugins.core_paths at
a plugin file/directory:
from bench_lite.core.core import register_core
from bench_lite.core.schema import Workflow
from bench_lite.core.task_config import MDTaskConfig
from bench_lite.cores.base import AdapterCore, InputRequirements
@register_core
class MyBackendMDCore(AdapterCore):
package = "MyBackend"
workflow = Workflow.MD
task_config = MDTaskConfig
adapter_path = "mypkg.bench.md:MyMDAdapter"
execution_mode = "batch"
requirements = InputRequirements()
comments = "MyBackend MD uses the native batched integrator."The native adapter implements prepare / execute / read_native_output / cleanup. Runtime checks live in the core, not in the campaign loop.
bench_lite test
# or
python -m pytest bench_lite/tests -qBackend-agnostic tests cover core API/schema, campaign config/loop, serial prefix reuse, concat/report, plotting presets and external core plugins. Backend-specific tests are not part of the default suite.
| Variable | Purpose |
|---|---|
| BENCH_LITE_CONFIG_PATH | config search path (default presets/ in the package) |
| BENCH_LITE_MODEL_ROOT | pretrained model/checkpoint directory |
| BENCH_LITE_DATA_ROOT | input-structure directory |
| BENCH_LITE_MODEL_PATH | additional model plugin directories |
| BENCH_LITE_SCRATCH_ROOT | native work directory (default /dev/shm/bench_lite/...) |
| BENCH_LITE_OUTPUT_ROOT | default campaign output root |
| BENCH_LITE_EQV2_* | EquiformerV2 model class/config/checkpoint/structure |
BENCH_LITE_SCRATCH_ROOT should be set on systems without a writable
/dev/shm.