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

Conversation

mtreinish
Copy link
Member

@mtreinish mtreinish commented Oct 10, 2019

Summary

This commit adds benchmarks for the converter functions. The converter
functions are normally quick to execute but are commonly used as part of
other operations. For example circuit_to_dag and dag_to_circuit get
called under the covers during transpile() calls. Individually
benchmarking the performance of them is useful so we can isolate and
track their performance, even if it's normally only a small percentage
of a larger operation. The benchmarks here just use the large qasm
circuit example as a type of worst case example because it has >3k
gates. In the future we can add additional types of circuits such as
ones with many registers, etc to try and test additional worst case edge
cases.

Details and comments

This was inspired by: Qiskit/qiskit#3176 which
should improve performance but there aren't any direct measurement of
that in the benchmark suite.

This commit adds benchmarks for the converter functions. The converter
functions are normally quick to execute but are commonly used as part of
other operations. For example circuit_to_dag and dag_to_circuit get
called under the covers during transpile() calls. Individually
benchmarking the performance of them is useful so we can isolate and
track their performance, even if it's normally only a small percentage
of a larger operation. The benchmarks here just use the large qasm
circuit example as a type of worst case example because it has >3k
gates. In the future we can add additional types of circuits such as
ones with many registers, etc to try and test additional worst case edge
cases.
@mtreinish mtreinish requested a review from kdk October 10, 2019 20:51
Copy link
Member

@kdk kdk left a comment

Choose a reason for hiding this comment

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

👍 on the concept, and I agree we should be splitting our benchmarks into synthetic benchmarks (targeting smaller components, edge cases, using our understanding of the implementation, ...) and application benchmarks (that closely cover what users commonly run).

Instead of test_eoh_qasm, can we build synthetic circuits from circuit.random.random_circuit? That way we can track with e.g. depth/width (test_eoh_qasm isn't great as either an application benchmark or a synthetic benchmark) . If there are other cases we'd like to cover (specifying a gate set so we can look at performance for gates that require many steps to reach the target basis), maybe we can add an issue in terra.

Otherwise, looks good.

@mtreinish
Copy link
Member Author

@kdk I switched this to use random_circuit in Qiskit/qiskit@95dee41 I also copied the random circuit function over so we can use it for the whole history of the converters module. As for width/depth numbers I tried to pick some values to give us wide coverage but not take too long. An iteration with asv dev took about 4min locally, depending on what you want to do we can remove some of the skips or change the parameters up as needed.

@mtreinish mtreinish merged commit a165301 into Qiskit:master Oct 15, 2019
@mtreinish mtreinish deleted the converter-benchmarks branch October 15, 2019 11:59
jakelishman pushed a commit to jakelishman/qiskit-terra that referenced this pull request Aug 1, 2023
* Add benchmarks for converter functions

This commit adds benchmarks for the converter functions. The converter
functions are normally quick to execute but are commonly used as part of
other operations. For example circuit_to_dag and dag_to_circuit get
called under the covers during transpile() calls. Individually
benchmarking the performance of them is useful so we can isolate and
track their performance, even if it's normally only a small percentage
of a larger operation.

* Pivot to use random circuit

The benchmarks now use a randomly generated circuit (with a fixed
seed for consistency) of varying sizes to test different cases. In the future
we can add additional types of circuits to try and test additional worst
case edge cases.

* Fix lint

* Fix lint for real

* Add comment about skips
jakelishman pushed a commit to jakelishman/qiskit-terra that referenced this pull request Aug 11, 2023
* Add benchmarks for converter functions

This commit adds benchmarks for the converter functions. The converter
functions are normally quick to execute but are commonly used as part of
other operations. For example circuit_to_dag and dag_to_circuit get
called under the covers during transpile() calls. Individually
benchmarking the performance of them is useful so we can isolate and
track their performance, even if it's normally only a small percentage
of a larger operation.

* Pivot to use random circuit

The benchmarks now use a randomly generated circuit (with a fixed
seed for consistency) of varying sizes to test different cases. In the future
we can add additional types of circuits to try and test additional worst
case edge cases.

* Fix lint

* Fix lint for real

* Add comment about skips
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.

2 participants