Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --all -- --check
- name: Check the generated result index
run: python3 scripts/gen_index.py --check
- run: cargo clippy --locked --all-targets -- -D warnings
- run: cargo test --release --locked
- name: smoke Fourier elementwise
Expand All @@ -30,4 +32,14 @@ jobs:
run: >
BENCH_NS=2 BENCH_RUNS=1 BENCH_WARMUPS=0
BENCH_INPUT_CACHE_DIR=/tmp/smoke-cache OUT_DIR=/tmp/smoke/raw
EXPORT_HDF5=/tmp/smoke-export
cargo run --release --locked --bin mpo_mpo_aniso_patched
- uses: julia-actions/setup-julia@v2
with:
version: "1"
- name: Julia cross-check of the MPO contraction inputs
# Reads the HDF5 the smoke step exported and evaluates it in ITensors.jl
# against the closed form the instance approximates.
run: |
julia --project=julia -e 'using Pkg; Pkg.instantiate()'
julia --project=julia julia/check_mpo_mpo.jl /tmp/smoke-export 2
6 changes: 5 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ single-core profile stays the reference, and the two profiles are never merged.

## Results

Files under `result/<profile>/` are generated by `scripts/run_all.sh <profile>` and committed deliberately. Do not edit them manually. Probe runs belong under `/tmp`. One profile belongs to one physical machine and contains no hostname.
Files under `result/<profile>/<rev12>/` are generated by
`scripts/run_all.sh <profile>` and committed deliberately. `result/INDEX.md` is
generated by `scripts/gen_index.py`. Do not edit either by hand. Probe runs
belong under `/tmp`. One profile directory belongs to one physical machine and
contains no hostname.

## Input cache

Expand Down
56 changes: 39 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,17 @@ Reproducible benchmarks for tensor network algorithms in [tensor4all-rs](https:/

## Results

Every committed sweep is a directory under [`result/`](result/), one per hardware
profile. Each holds `run.yaml` (machine, revisions, thread count and CPU set),
`raw/` (one JSON record per case, arm and instance) and the generated
`report.md`. Read the reports:

| Profile | Machine | Threads | tensor4all-rs | Report |
| --- | --- | ---: | --- | --- |
| `linux-ryzen-ai-9-hx-470` | AMD Ryzen AI 9 HX 470, 12 physical cores | 1 | `a515738` | [report.md](result/linux-ryzen-ai-9-hx-470/report.md) |
| `linux-ryzen-ai-9-hx-470-4t` | the same machine, CPUs 0-3 | 4 | `a515738` | [report.md](result/linux-ryzen-ai-9-hx-470-4t/report.md) |
| `linux-epyc-7713p` | AMD EPYC 7713P | 1 | `9e9aeda` | [report.md](result/linux-epyc-7713p/report.md) |

The one-thread profile is the reference configuration, and each report repeats
the machine, revisions, thread count and CPU set in its header. The `-4t`
profile is scaling evidence only: read it against the one-thread profile of the
same machine, never instead of it. [`result/README.md`](result/README.md)
describes the layout.
[`result/INDEX.md`](result/INDEX.md) lists every recorded sweep: one row per
(hardware profile, measured tensor4all-rs revision), each linking to that
sweep's generated `report.md`. It is generated by `scripts/gen_index.py`, so it
cannot drift from the tree, and CI fails when it is out of date.

A sweep is a directory `result/<profile>/<rev12>/` holding `run.yaml` (machine,
revisions, thread count and CPU set), `raw/` (one JSON record per case, arm and
instance) and the `report.md` those records generate. The one-thread profile of
each machine is the reference configuration; its optional `-<n>t` scaling sweep
is read against it, never instead of it. [`result/README.md`](result/README.md)
has the layout.

## Maintained cases

Expand Down Expand Up @@ -66,6 +61,32 @@ Case 3 compares global TreeTN fit with patched chain-TreeTN fit. Its reference i

Input construction, cache I/O, global input compression, format conversion, patch preparation, output conversion, and accuracy evaluation are outside timed regions.

## Julia cross-check

Case 3 exports its two input QTTs on request, and `julia/check_mpo_mpo.jl`
evaluates them in ITensors.jl against the closed form the interpolative
construction approximates. This is the one place where an artifact written by
tensor4all-rs is read back and contracted by an independent implementation.

```bash
BENCH_NS=2 OUT_DIR=/tmp/smoke/raw EXPORT_HDF5=/tmp/smoke-export \
cargo run --release --locked --bin mpo_mpo_aniso_patched
julia --project=julia -e 'using Pkg; Pkg.instantiate()'
julia --project=julia julia/check_mpo_mpo.jl /tmp/smoke-export 2
```

`EXPORT_HDF5` writes `instance-n<N>.h5` (the fused site-dimension-4 QTTs as
ITensorMPS `MPS` groups `f` and `g`) and `instance-n<N>.json` (the analytic
mixtures, the box, `r` and the tolerances) into that directory. The script
asserts the case name before reading, because the Gaussian cases once shared
these file names.

It prints the largest sampled relative deviation and gates at `1e-4`,
overridable with `CHECK_THRESHOLD`. At the default instances that deviation is
between `5e-6` and `9e-6`, which is the scale of the `1e-6` input truncation: the
check catches a broken export or a wrong index convention, not an accuracy
bound. CI runs it on the `N = 2` smoke instance.

## Running

Requirements are Rust, HDF5, and a BLAS/LAPACK implementation. A complete single-core run is:
Expand Down Expand Up @@ -114,7 +135,8 @@ cargo fmt --all -- --check
cargo test --release
cargo clippy --locked --all-targets -- -D warnings
cargo check --locked --all-targets
python3 scripts/report.py result/<profile>
python3 scripts/report.py result/<profile>/<rev12>
python3 scripts/gen_index.py --check
git diff --check
```

Expand Down
Loading
Loading