Skip to content
This repository was archived by the owner on Aug 19, 2023. It is now read-only.

Conversation

mtreinish
Copy link
Member

Summary

This commit adds an asv benchmark suite to the tests include in this
repo. This will enable us to track the performance of the overall qiskit
project over time as we make commits.

Details and comments

This commit adds an asv benchmark suite to the tests include in this
repo. This will enable us to track the performance of the overall qiskit
project over time as we make commits.
Copy link
Member

@ajavadia ajavadia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1- I don't think we should include Qasm files here. They are quite slow to load, and quite unreadable. Instead we should have python scripts that generate those circuits (like the VQE.py and State_Tomography.py performance tests in Terra). Where do these qasms come from anyway?

2- The LiH and H2 are not used anywhere so should not be included.

@mtreinish
Copy link
Member Author

For the qasms files sure I can remove those, but it's worth pointing out that they're not actually part of what is benchmarked they're just used to setup large circuit examples quickly without a lot of code. The only thing benchmarked is calling compile() on those circuits. For this role I think qasm works pretty well. As for the source of the files the pea_3_pi_8.qasm comes from the openqasm examples: https://github.com/Qiskit/openqasm/blob/master/examples/generic/pea_3_pi_8.qasm and the test_eoh_qasm.qasm file I actually got from you. IIRC you said it was generated by aqua and I've been using it to test performance fixes locally.

Yeah, I'll remove the LiH and H2 directories. I forgot to remove them when I dropped the vqe benchmark. This patch is just a port of the work I did several months ago in terra which included a vqe benchmark based on the performance test in there. (although that doesn't work anymore)

@mtreinish
Copy link
Member Author

This is mostly good to go now, it feels like it's a good starting point to build off of for more benchmarks and adding more backwards compat glue code so we can compare earlier releases to what we have today.

I'm still debugging one issue though before I remove the WIP tag. For a good portion of the commits when doing asv run over a range it raises either a ModuleNotFoundError or a AttributeError when trying to import something from qiskit (the error depends on what the import line is and what it fails to find). My assumption is that this is caused by the namespace package leaving something in place after installing and uninstalling repeatedly and something gets confused so we're left without any of the modules from terra in the qiskit namespace. But I haven't been able to confirm what the root cause is yet.

The install stage was going off the rails trying failing to install the
built wheel in certain scenarios. When this happened the empty namespace
package from qiskit-aer was leftover and when benchmarks ran there was
nothing leftover. To avoid this and simplify the install (and by
extension uninstall) configuration to just rely on the default working
behavior this commit removes the dependence on the qiskit-aer package.
The aer package wasn't even used directly in the benchmarks since we're
not actually running simulations (for obvious time reasons). Instead Aer
was just being used as a backend for the transpiler. But, there is no
reason we have to use Aer for that, and BasicAer works just as well.
@mtreinish
Copy link
Member Author

mtreinish commented Feb 27, 2019

This is looking good so far, it seems to avoid the install issues I was facing before. I'm running a quick benchmark on all terra commits from 0.7.0 to master to verify it works (on a quicker benchmark some of them can take a a while, like quantum volume) to verify there are no install issues. Once that passes without error I'll remove the WIP tag.

@mtreinish mtreinish changed the title [WIP] Add asv benchmarks Add asv benchmarks Feb 27, 2019
@mtreinish mtreinish requested a review from ajavadia February 27, 2019 20:42
ajavadia
ajavadia previously approved these changes Feb 27, 2019
@derivation derivation merged commit 3ee51a0 into Qiskit:master Mar 1, 2019
@mtreinish mtreinish deleted the add-asv-benchmarks branch March 1, 2019 13:14
jakelishman pushed a commit to jakelishman/qiskit-terra that referenced this pull request Aug 1, 2023
* Add asv benchmarks

This commit adds an asv benchmark suite to the tests include in this
repo. This will enable us to track the performance of the overall qiskit
project over time as we make commits.

* Remove H2 and LiH dirs

* Fix most, but not all, lint

* Remove commented unused code

* Add QV circuit benchmark and fix asv build and some lint

* Make lint pass

* Purity isn't in quantum_info in 0.7

* Add qft and random circuit benchmarks

* Fix issue caused by namespace package and aer sticking around

* Make depth an independent variable for qv benchmarks

* Simplify install and uninstall stage

The install stage was going off the rails trying failing to install the
built wheel in certain scenarios. When this happened the empty namespace
package from qiskit-aer was leftover and when benchmarks ran there was
nothing leftover. To avoid this and simplify the install (and by
extension uninstall) configuration to just rely on the default working
behavior this commit removes the dependence on the qiskit-aer package.
The aer package wasn't even used directly in the benchmarks since we're
not actually running simulations (for obvious time reasons). Instead Aer
was just being used as a backend for the transpiler. But, there is no
reason we have to use Aer for that, and BasicAer works just as well.

* Clear build artifacts before install

* Fix lint failures for new pylint

* Switch back to pip for wheel builds

* Fix another lint issue

* Fix hopefully the last lint issue
jakelishman pushed a commit to jakelishman/qiskit-terra that referenced this pull request Aug 11, 2023
* Add asv benchmarks

This commit adds an asv benchmark suite to the tests include in this
repo. This will enable us to track the performance of the overall qiskit
project over time as we make commits.

* Remove H2 and LiH dirs

* Fix most, but not all, lint

* Remove commented unused code

* Add QV circuit benchmark and fix asv build and some lint

* Make lint pass

* Purity isn't in quantum_info in 0.7

* Add qft and random circuit benchmarks

* Fix issue caused by namespace package and aer sticking around

* Make depth an independent variable for qv benchmarks

* Simplify install and uninstall stage

The install stage was going off the rails trying failing to install the
built wheel in certain scenarios. When this happened the empty namespace
package from qiskit-aer was leftover and when benchmarks ran there was
nothing leftover. To avoid this and simplify the install (and by
extension uninstall) configuration to just rely on the default working
behavior this commit removes the dependence on the qiskit-aer package.
The aer package wasn't even used directly in the benchmarks since we're
not actually running simulations (for obvious time reasons). Instead Aer
was just being used as a backend for the transpiler. But, there is no
reason we have to use Aer for that, and BasicAer works just as well.

* Clear build artifacts before install

* Fix lint failures for new pylint

* Switch back to pip for wheel builds

* Fix another lint issue

* Fix hopefully the last lint issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants