代码封装
Some checks failed
Build wheels / build (ubuntu-latest, 3.11) (push) Has been cancelled
Build wheels / build (ubuntu-latest, 3.12) (push) Has been cancelled
Build wheels / build (ubuntu-latest, 3.13) (push) Has been cancelled
Tests / check (push) Has been cancelled
Tests / build (ubuntu-latest, 3.11) (push) Has been cancelled
Tests / build (ubuntu-latest, 3.12) (push) Has been cancelled
Tests / build (ubuntu-latest, 3.13) (push) Has been cancelled

This commit is contained in:
2026-05-18 22:58:57 +08:00
parent eed42dcfa9
commit f93c95b3a1
56 changed files with 3414 additions and 5849 deletions

View File

@@ -28,15 +28,24 @@ Currently, the supported tensor network libraries are:
## CPU expectation benchmarks
The current CPU expectation entrypoint is:
Use the library APIs directly:
```sh
python -u benchmark_cpu_expectation.py --ansatz mps --nqubits 40 --nlayers 10 --bond 2048 --circuits brickwall_cnot --observables ring_xz
```py
import qibotn
records = qibotn.run_cpu_benchmark_cases(
ansatz="mps",
nqubits=40,
nlayers=10,
bond=2048,
circuits=("brickwall_cnot",),
observables=("ring_xz",),
)
```
Use `--ansatz tn` for the generic TN path and `--mpi` under `mpiexec` for MPI runs.
Reusable circuit and observable builders live in `src/qibotn/benchmark_cases.py`; execution logic lives in `src/qibotn/expectation_runner.py`.
For Vidal/MPS 1D-chain scale tests, use `run_vidal_mps_cases.sh`.
For generic TN use `ansatz="tn"`. Contest/custom runners are available as
`qibotn.run_contest_tn_case`, `qibotn.run_custom_tn_expectation`,
`qibotn.run_contest_mps_case`, and `qibotn.run_vidal_validation_cases`.
## Installation