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

sampler does not obey user defined number of shots #239

Closed
nonhermitian opened this issue Mar 24, 2022 · 2 comments
Closed

sampler does not obey user defined number of shots #239

nonhermitian opened this issue Mar 24, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@nonhermitian
Copy link
Contributor

Describe the bug
As a corollary to #238 it seems that no value of shots is obeyed, eg

'run_options': {'shots': 1},

still returns 10k shots

Steps to reproduce
try above

Expected behavior
User should be able to set shots

Suggested solutions

Additional Information

  • qiskit-ibm-runtime version: 0.2.0
  • Python version: 3.10
  • Operating system: OSX
@nonhermitian nonhermitian added the bug Something isn't working label Mar 24, 2022
@rathishcholarajan
Copy link
Member

I am not able to reproduce this on cloud. Seems to work fine for me against simulators. Are you running against simulators or real devices? Could you paste your code or a job id that failed to check?

from qiskit import QuantumCircuit
qc = QuantumCircuit(1)
qc.x(0)
qc.measure_all()

# Specify the program inputs here.
program_inputs = {"circuits": [qc],
                  'run_options': { "shots": 1 },
                  'circuit_indices': list(range(1))
                  }

# Specify the backend name.
options = {}

job = service.run(
    program_id="sampler",
    options=options,
    inputs=program_inputs,
)

print(job.job_id)
result = job.result()
print(result)
print(job.backend)
c8ubriqba8lh4biecgc0
{'quasi_dists': [{'1': 1.0}], 'metadata': [{'header_metadata': None, 'shots': 1}]}
<IBMBackend('ibmq_qasm_simulator')>

@nonhermitian
Copy link
Contributor Author

I think this was a different issue so closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants