question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fake Backends don't pass options to underlying simulator

See original GitHub issue

Environment

  • Qiskit Terra version: 0.19.x (and main)
  • Python version: 3.10
  • Operating system: linux

What is happening?

The options object from in the fake backends don’t get passed down to the underlying simulator.

How can we reproduce the issue?

from qiskit.circuit import QuantumCircuit
from qiskit import execute
from qiskit.test.mock import FakeQuito

backend = FakeQuito()
circuit = QuantumCircuit(2)
circuit.h(0)
circuit.cx(0, 1)
circuit.measure_all()
backend.set_options(shots=100)
job = execute(circuit, backend)
result = job.result()
counts = result.get_counts()
print(sum(counts.values())

What should happen?

100 should print not 1024

Any suggestions?

In the run() method defined in https://github.com/Qiskit/qiskit-terra/blob/main/qiskit/test/mock/fake_backend.py#L118 we should copy self.options and set the internal simulator backend object’s options attribute to be that copy. This will propagate any changes made by the user to the options to the underlying simulation when we call the internal simulator backend’s run() method.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
javabstercommented, Jan 10, 2022

Assigned to you @bopardikarsoham! Remember to read the contributing guidelines and let us know if you have any questions!

I think the unfinished sentence in “What is happening” is just a typo and there should be enough in the rest of the description for you to get started 😄

0reactions
1ucian0commented, Feb 4, 2022

assigning you @VaibhavSanjay. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

AerSimulator - Qiskit
Configurable Options. The AerSimulator supports multiple simulation methods and configurable options for each simulation method. · Simulating an IBMQ Backend.
Read more >
Running on Backends — pytket-manual documentation
Each Backend object is aware of the restrictions of the underlying device or simulator, encoding them as a collection of Predicate s.
Read more >
Source code for snntoolbox.simulation.backends.inisim.ttfs
coding: utf-8 -*- """INI time-to-first-spike simulator backend. This module defines the layer objects used to create a spiking neural network for our ...
Read more >
caf.backends — basf2 release-06-00-03 documentation
args = tuple() # If our generator finishes before the subjobs we use empty argument tuples generating = False else: args = tuple()...
Read more >
CLI Arguments - Appium
Flag Default Description ‑‑shell null Enter REPL mode ‑‑ipa null (IOS‑only) abs path to compiled .ipa file ‑a , ‑‑address 0.0.0.0 IP Address to listen on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found