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

Add generic V1 Fake Backends, replace use in tests #10952

Merged
merged 4 commits into from Feb 1, 2024

Conversation

ElePT
Copy link
Contributor

@ElePT ElePT commented Oct 3, 2023

Summary

(3/4) --> This is the third PR of the FakeBackends refactoring epic.

This PR introduces generic V1 fake backends to replace the use of provider-specific backends in unit tests. It's part of the plan laid out in #10954.

Details and comments

Replacement chart

New                 Replaces                  Occurrences

Fake20QV1           FakeAlmaden               1
                    FakeJohannesburg          1
                    FakeMelbourne             4
                    FakePoughkeepsie          1
                    FakeRueschlikon           2
                    FakeSingapore             1
                    FakeTokyo                 1

Fake27QV1Pulse      FakeHanoi                 5
                    FakeKolkata               1
                    FakeMontreal              1
                    FakeMumbai                2
                    FakeParis                 1
                    FakeToronto               1

Fake5QV1            FakeBelem                 1
                    FakeLima                  1
                    FakeLondon                1
                    FakeOurense               2
                    FakeTenerife              3
                    FakeVigo                  2
                    FakeYorktown              4

Fake65QV1Pulse      FakeAthens                1
                    FakeManhattan             1
                    FakeParis                 3
                    FakeTokyo                 1

Fake7QV1Pulse       FakeArmonk                1
                    FakeAthens                1
                    FakeNairobi               3
                    FakeOurense               2

------------------------------------------------------

Non-V1-Replacements

FakeBackendSimple   FakeArmonk                1

FakeGeneric         FakeRueschlikon           1
                    FakeTenerife              1
                    FakeTokyo                 1

cmap                FakeAlmaden               1
                    FakeMelbourne             1
                    FakeRueschlikon           3
                    FakeTenerife              2
                    FakeTokyo                 1

TBD                 FakeMumbaiFractionalCX    2

Note that some FakeBackendV1 occurrences have been replaced directly by their coupling map or the V2 FakeGeneric backend. The FakeMumbaiFractionalCX is a mumbai-inspired test-specific backend and is not part of the deprecation/migration to provider plan. I think that we could either leave it as-is or rename it to something more general like "FakeFractionalCX".

Visualization tests (joint V1 and V2 changes): --> test/visual will be left for a follow-up

  • test/python/visualization/test_gate_map.py
  • test/visual/mpl/circuit/test_circuit_matplotlib_drawer.py
  • test/visual/mpl/graph/test_graph_matplotlib_drawer.py

Files not covered by this PR that use fake backends V1 -> to be addressed in deprecation/removal PR:

Files not covered by this PR that use fake provider -> to be addressed in removal PR: #11376

  • test/python/providers/test_backendconfiguration.py
  • test/python/tools/monitor/test_backend_monitor.py
  • test/python/providers/test_backendproperties.py

@ElePT ElePT added this to the 0.45.0 milestone Oct 3, 2023
@jakelishman jakelishman self-assigned this Oct 10, 2023
@ElePT ElePT marked this pull request as ready for review October 16, 2023 12:04
@qiskit-bot
Copy link
Collaborator

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

  • @enavarro51
  • @Qiskit/terra-core
  • @ajavadia
  • @ikkoham
  • @levbishop
  • @mtreinish
  • @nkanazawa1989
  • @t-imamichi

@coveralls
Copy link

coveralls commented Oct 17, 2023

Pull Request Test Coverage Report for Build 7733966281

Warning: This coverage report may be inaccurate.

We've detected an issue with your CI configuration that might affect the accuracy of this pull request's coverage report.
To ensure accuracy in future PRs, please see these guidelines.
A quick fix for this PR: rebase it; your next report should be accurate.

  • 0 of 67 (100.0%) changed or added relevant lines in 13 files are covered.
  • 118 unchanged lines in 12 files lost coverage.
  • Overall coverage decreased (-0.03%) to 89.452%

Files with Coverage Reduction New Missed Lines %
qiskit/transpiler/passes/layout/vf2_utils.py 1 96.34%
qiskit/primitives/containers/estimator_pub.py 2 97.53%
qiskit/primitives/containers/sampler_pub.py 2 97.01%
qiskit/transpiler/passmanager_config.py 2 95.89%
qiskit/primitives/statevector_estimator.py 3 94.55%
qiskit/init.py 4 90.48%
qiskit/transpiler/instruction_durations.py 4 90.3%
crates/qasm2/src/lex.rs 9 90.68%
qiskit/primitives/containers/bindings_array.py 9 92.37%
qiskit/primitives/containers/observables_array.py 10 90.63%
Totals Coverage Status
Change from base Build 7732338312: -0.03%
Covered Lines: 59422
Relevant Lines: 66429

💛 - Coveralls

@ElePT ElePT requested a review from a team as a code owner January 31, 2024 17:25
@ElePT ElePT added Changelog: New Feature Include in the "Added" section of the changelog on hold Can not fix yet labels Jan 31, 2024
@ElePT
Copy link
Contributor Author

ElePT commented Jan 31, 2024

I added the "on hold" label because this PR is built on top of #10918, but there was a lot of back and forth and a lot of conflicts, so I would like to wait until #10918 is merged to rebase and double check that I am not accidentally "undoing" any change from the previous PR here (but the essence is the same to it's still ready for review!).

@ElePT ElePT removed the on hold Can not fix yet label Jan 31, 2024
Copy link
Contributor

@kevinhartman kevinhartman left a comment

Choose a reason for hiding this comment

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

Looks mostly good to me, just a few minor things like copyright dates.

Thanks for all of this work! 😄

test/python/transpiler/test_instruction_durations.py Outdated Show resolved Hide resolved
test/python/providers/faulty_backends.py Outdated Show resolved Hide resolved
16: Qubit(QuantumRegister(15, "ancilla"), 12),
17: Qubit(QuantumRegister(15, "ancilla"), 13),
18: Qubit(QuantumRegister(15, "ancilla"), 14),
19: Qubit(QuantumRegister(2, "qr2"), 0),
Copy link
Contributor

Choose a reason for hiding this comment

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

What exactly makes the output different here? Is it related to how the seed is being used in the new backend?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The vf2_layout pass tries to solve a subgraph isomorphism problem. From all the possible answers to this problem, it picks the one that minimizes the gate error, which depends on the backend properties. FakeTokyo and Fake20QV1 share the coupling map (because I inject it manually) but don't have the same backend properties, and this is why the optimal solution is a bit different.

test/python/visualization/test_gate_map.py Outdated Show resolved Hide resolved
test/randomized/test_transpiler_equivalence.py Outdated Show resolved Hide resolved
Co-authored-by: Kevin Hartman <kevin@hart.mn>
@kevinhartman kevinhartman added this pull request to the merge queue Feb 1, 2024
Merged via the queue into Qiskit:main with commit 8c89df2 Feb 1, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: New Feature Include in the "Added" section of the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants