Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix asv installation configuration #11222

Merged
merged 1 commit into from
Nov 9, 2023
Merged

Conversation

jakelishman
Copy link
Member

Summary

Previously, the uninstall component of the asv configuration was attempting to uninstall the package qiskit. This is the name of the project, but it's not the name of the relevant Python package, and so was not being uninstalled correctly. This meant that asv's managed environments would retain the previous build, unless the updating the commit changed the version number of the package.

This behaviour caused our tracking bot to be benchmarking the state of the package only at the commit points that bump version numbers on main. Typically, this means it was only ever benchmarking the release-candidate versions of the package since we migrated from the metapackage.

Details and comments

I was able to use this locally to correctly detect changes in the time_circuit_copy benchmark between #10314 and #11040, with the uninstall working correctly:

Benchmarks that have improved:

       before           after         ratio
     [bcf5ce49]       [a8812159]
     <0.45.0rc1~33>       <0.45.0rc1~13>
-         418±6μs          117±3μs     0.28  circuit_construction.CircuitConstructionBench.time_circuit_copy(14, 128)
-        462±30ms          110±1ms     0.24  circuit_construction.CircuitConstructionBench.time_circuit_copy(14, 131072)
-      6.80±0.3ms      1.66±0.04ms     0.24  circuit_construction.CircuitConstructionBench.time_circuit_copy(14, 2048)
-         114±3ms         33.3±3ms     0.29  circuit_construction.CircuitConstructionBench.time_circuit_copy(14, 32768)
-        99.5±9μs        36.4±10μs     0.37  circuit_construction.CircuitConstructionBench.time_circuit_copy(14, 8)
-      27.0±0.8ms       6.88±0.2ms     0.26  circuit_construction.CircuitConstructionBench.time_circuit_copy(14, 8192)
-        342±20μs          112±6μs     0.33  circuit_construction.CircuitConstructionBench.time_circuit_copy(2, 128)
-         355±6ms          122±3ms     0.34  circuit_construction.CircuitConstructionBench.time_circuit_copy(2, 131072)
-     4.97±0.08ms      1.69±0.02ms     0.34  circuit_construction.CircuitConstructionBench.time_circuit_copy(2, 2048)
-      82.5±0.8ms       30.9±0.2ms     0.37  circuit_construction.CircuitConstructionBench.time_circuit_copy(2, 32768)
-      32.2±0.3μs         18.8±1μs     0.58  circuit_construction.CircuitConstructionBench.time_circuit_copy(2, 8)
-      21.4±0.2ms       7.32±0.5ms     0.34  circuit_construction.CircuitConstructionBench.time_circuit_copy(2, 8192)
-         486±5μs          132±4μs     0.27  circuit_construction.CircuitConstructionBench.time_circuit_copy(20, 128)
-         437±3ms          122±3ms     0.28  circuit_construction.CircuitConstructionBench.time_circuit_copy(20, 131072)
-      6.94±0.5ms      1.75±0.08ms     0.25  circuit_construction.CircuitConstructionBench.time_circuit_copy(20, 2048)
-       109±0.8ms         28.1±1ms     0.26  circuit_construction.CircuitConstructionBench.time_circuit_copy(20, 32768)
-         133±6μs       40.1±0.5μs     0.30  circuit_construction.CircuitConstructionBench.time_circuit_copy(20, 8)
-      26.4±0.2ms       7.54±0.2ms     0.29  circuit_construction.CircuitConstructionBench.time_circuit_copy(20, 8192)
-         430±5μs          124±4μs     0.29  circuit_construction.CircuitConstructionBench.time_circuit_copy(5, 128)
-        432±20ms          110±2ms     0.25  circuit_construction.CircuitConstructionBench.time_circuit_copy(5, 131072)
-      6.63±0.5ms      1.70±0.05ms     0.26  circuit_construction.CircuitConstructionBench.time_circuit_copy(5, 2048)
-         103±3ms         27.1±1ms     0.26  circuit_construction.CircuitConstructionBench.time_circuit_copy(5, 32768)
-        41.4±2μs       17.8±0.4μs     0.43  circuit_construction.CircuitConstructionBench.time_circuit_copy(5, 8)
-      25.2±0.4ms       6.79±0.4ms     0.27  circuit_construction.CircuitConstructionBench.time_circuit_copy(5, 8192)
-        457±80μs          121±7μs     0.27  circuit_construction.CircuitConstructionBench.time_circuit_copy(8, 128)
-        439±30ms          112±5ms     0.25  circuit_construction.CircuitConstructionBench.time_circuit_copy(8, 131072)
-      7.08±0.5ms      1.70±0.02ms     0.24  circuit_construction.CircuitConstructionBench.time_circuit_copy(8, 2048)
-         108±8ms         27.5±1ms     0.26  circuit_construction.CircuitConstructionBench.time_circuit_copy(8, 32768)
-        59.1±2μs       22.5±0.8μs     0.38  circuit_construction.CircuitConstructionBench.time_circuit_copy(8, 8)
-        27.2±2ms       6.84±0.2ms     0.25  circuit_construction.CircuitConstructionBench.time_circuit_copy(8, 8192)

Benchmarks that have stayed the same:

       before           after         ratio
     [bcf5ce49]       [a8812159]
     <0.45.0rc1~33>       <0.45.0rc1~13>
          127±8μs          109±2μs    ~0.86  circuit_construction.CircuitConstructionBench.time_circuit_copy(1, 128)
          113±5ms          112±4ms     0.99  circuit_construction.CircuitConstructionBench.time_circuit_copy(1, 131072)
      1.78±0.09ms      1.69±0.03ms     0.95  circuit_construction.CircuitConstructionBench.time_circuit_copy(1, 2048)
       26.2±0.8ms       26.7±0.9ms     1.02  circuit_construction.CircuitConstructionBench.time_circuit_copy(1, 32768)
       16.9±0.7μs       16.0±0.2μs     0.95  circuit_construction.CircuitConstructionBench.time_circuit_copy(1, 8)
         7.33±1ms       6.80±0.2ms     0.93  circuit_construction.CircuitConstructionBench.time_circuit_copy(1, 8192)

Previously, the `uninstall` component of the asv configuration was
attempting to uninstall the package `qiskit`.  This _is_ the name of the
project, but it's not the name of the relevant Python package, and so
was not being uninstalled correctly.  This meant that asv's managed
environments would retain the previous build, unless the updating the
commit changed the version number of the package.

This behaviour caused our tracking bot to be benchmarking the state of
the package only at the commit points that bump version numbers on
`main`.  Typically, this means it was only ever benchmarking the
release-candidate versions of the package since we migrated from the
metapackage.
@jakelishman jakelishman added type: qa Issues and PRs that relate to testing and code quality Changelog: None Do not include in changelog labels Nov 9, 2023
@jakelishman jakelishman requested a review from a team as a code owner November 9, 2023 14:19
@qiskit-bot
Copy link
Collaborator

One or more of the the following people are requested to review this:

  • @Qiskit/terra-core

],
"branches": ["main"],
"dvcs": "git",
"environment_type": "virtualenv",
"show_commit_url": "http://github.com/Qiskit/qiskit-terra/commit/",
"show_commit_url": "http://github.com/Qiskit/qiskit/commit/",
Copy link
Member

Choose a reason for hiding this comment

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

This technically still worked because of the redirects :) but it's better to do this I agree

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah for sure, and at the time that the asv benchmarks were merged in, the repo hadn't yet been renamed so it wasn't ready to be replaced then.

@@ -4,20 +4,19 @@
"project_url": "https://qiskit.org",
"repo": ".",
"install_command": [
"in-dir={env_dir} python -mpip install {wheel_file}[all] python-constraint qiskit-experiments==0.3.0"
"in-dir={env_dir} python -m pip install {wheel_file}[all] python-constraint qiskit-experiments==0.3.0"
Copy link
Member

Choose a reason for hiding this comment

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

Do you think it makes sense to have a matrix here for the experiments version and python-constraint: https://asv.readthedocs.io/en/stable/asv.conf.json.html#matrix? This pattern was used in the original asv benchmarks that I added back in 2019 but back then asv didn't have support for reasoning about third-part dependencies explicitly like this, so having a pinned install in the install command was the only pattern to enable this.

Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't know about that, but it looks good. It gets potentially hairy with qiskit-experiments, because that has a transitive dependency on Terra, and matrix requirements apparently get installed before the main project. The current form forces version resolution to happen all at once, which is a bit more stable, I suppose.

Copy link
Member

Choose a reason for hiding this comment

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

That makes sense, let's just leave this for now. I don't think we even need qiskit-experiments here anymore. I'll push up a separate PR to remove it.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 6813062893

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 6 unchanged lines in 2 files lost coverage.
  • Overall coverage remained the same at 86.952%

Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/lex.rs 3 91.67%
qiskit/pulse/library/waveform.py 3 93.75%
Totals Coverage Status
Change from base Build 6801884624: 0.0%
Covered Lines: 74356
Relevant Lines: 85514

💛 - Coveralls

@mtreinish mtreinish added this pull request to the merge queue Nov 9, 2023
Merged via the queue into Qiskit:main with commit ed08ca3 Nov 9, 2023
13 checks passed
@jakelishman jakelishman deleted the fix-asv branch November 10, 2023 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: None Do not include in changelog type: qa Issues and PRs that relate to testing and code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants