Skip to content

altaris/pauli-coloring-benchmark

Repository files navigation

Pauli Coloring Benchmark

Python 3.13 License Code style Documentation

How to do the thing?

Prep. work

  1. Install uv.

    curl -LsSf https://astral.sh/uv/install.sh | sh
  2. Install dependencies:

    uv sync
  3. Build binaries (requires gcc). This is only required if you want to use the degree_c reordering method.

    make dll
  4. Build the index. This is a SQlite3 file that lists all the Hamiltonian from all the hdf5 files present in the HamLib website.

    uv run python -m pcb build-index out/index.db
  5. Download the Hamiltonian ZIP files.

    uv run python -m pcb download out/index.db out/ham
    # it is also possible to apply a filter to only download files in a given subdirectory
    uv run python -m pcb download out/index.db out/ham --prefix binaryoptimization/maxcut

Reordering benchmark

  1. Run the benchmark.

    uv run python -m pcb benchmark-reorder out/index.db out/ham out/reordering
    # or
    uv run python -m pcb benchmark-reorder out/index.db out/ham out/reordering --n-jobs 32 --methods none,saturation,misra_gries --prefix binaryoptimization/maxcut
  2. You can obtain temporary consolidated results during the benchmark by running:

    uv run python -m pcb consolidate out/reordering

    This is automatically done at the end of the benchmark.

Simulation benchmark

Once the reordering benchmark is done, you can run the QAOA simulation benchmark to see if reordered circuits produce better ground states (approximations).

  1. Run the benchmark.

    uv run python -m pcb benchmark-simulate out/ham out/reordering out/simulation
    # or
    uv run python -m pcb benchmark-simulate out/ham out/reordering out/simulation --n-jobs 8 --methods none,saturation,misra_gries --prefix binaryoptimization/maxcut --max-qubits 8 --max-terms 32 --qaoa-n-shots 1024 --qaoa-n-steps 2 --qaoa-max-iter 128
  2. Like for the reordering benchmark, you can obtain temporary consolidated results during the benchmark by running:

    uv run python -m pcb consolidate out/simulation

    This is automatically done at the end of the benchmark.

More help

uv run python -m pcb --help