Package: benchq
benchqWhat is it?benchqestimates the required resources for performing a fault-tolerant computation using surface codes. It works with various inputs, such as circuits, openfermion QubitOperators, and pyscf files. Given correct input,benchqwill return a list of resources required to perform the selected algorithm such as the required number of physical qubits, error rate, wall time, etc.benchqwas developed as a part ofDARPA Quantum Benchmarking program.InstallationTo installbenchqrunpip install .from the main directory.
It's been tested with Python 3.8-3.9 on macOS and Linux. Requires Jabalizer 0.4.3.Known limitation: installation can fail because of a problem withpyscf, one of our transitive dependencies.
If you're a Windows user, please consider usingWSL. On other systems you can try installingpyscfdirectly from its git repo:pip install git+https://github.com/pyscf/pyscf@v2.0.1.Extra dependenciesJuliaIf you want to run the Graph State Compilation pipeline, you'll have to install Julia. Fortunately, benchq will install Julia automatically for you whenever it is needed if your current Julia installation is not compatible with the version of Julia that benchq requires. To avoid issues with conflicting versions,juliapkgdo not install Julia in the typical {home}/.julia directory. We instead install julia within the python version you are using (if you are using a virtualenv, it will be installed in the file containing your virtualenv).Note that runningjuliafrom the terminal may not give you access to the version of Julia that BenchQ installs. This is to prevent conflicts with other Julia installations you may have on your system. See thejuliapkgdocumentation for more information.PySCFIf you plan to use PySCF to generate Hamiltonians, use thepyscfinstall extra:pipinstall'.[pyscf]'Azure Quantum Resource EstimationTo run resource estimation using Azure Quantum Resource Estimation (QRE) tool, one needs to have Azure QRE package configured, please seethis tutorial.UsagePlease take a look at theexamplesdirectory.
We have multiple examples there:h_chain_trotter.pyshows how to use graph state compilation on a simple hydrogen chain example. (Requirespyscfinstall extra.)resource_estimate_from_qasm.pyshows how to use graph state compilation when the circuit is loaded from QASM.qsp_vlasov.pyshows how to perform resource estimation.Running benchmarksTo run the benchmarks runpytestbenchmarks/from the top-level directory of this repo. By default, this will skip some benchmarks that run extremely low. If you want to run
those too, set environmental variableSLOW_BENCHMARKSto any value, e.g.:SLOW_BENCHMARKS=1pytestbenchmarks/Our benchmarks are run automatically on each release. You can see the performance of benchq over time onbenchq's benchmark page.Development and ContributionTo install the development version, runpip install -e '.[dev]'from the main directory. (if using MacOS, you will need single quotes around the []. If using windows, or Linux, you might not need the quotes).We useGoogle-styledocstring format. If you'd like to specify types please usePEP 484type hints instead adding them to docstrings.There are codestyle-relatedGithub Actionsrunning for PRs. (TODO)If you'd like to report a bug/issue please create a new issue in this repository.If you'd like to contribute, please create a pull request tomain.Running testsUnit tests for this project can be run usingmake coveragecommand from the main directory.
Alternatively you can also runpytest ..Since tests of integration with Azure QRE require additional setup, they are disabled by default. You can enable them by setting environmental variableBENCHQ_TEST_AZUREto any value.StyleWe are using automatic tools for style and type checking. In order to make sure the code is compliant with them please run:make stylefrom the main directory (this requiresdevdependencies).