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

SamplerV2 will not adhere to options dictionary passed. #2242

Open
MarcoBarroca opened this issue Oct 2, 2024 · 0 comments
Open

SamplerV2 will not adhere to options dictionary passed. #2242

MarcoBarroca opened this issue Oct 2, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@MarcoBarroca
Copy link

MarcoBarroca commented Oct 2, 2024

Informations

  • Qiskit Aer version: 0.15.1
  • Python version: 3.10.5
  • Operating system: Linux_x86

What is the current behavior?

When using SamplerV2 and passing an options dictionary like so:

from qiskit_aer.primitives import SamplerV2
from qiskit_aer import AerSimulator 
from qiskit import transpile
from qiskit.primitives import BackendSamplerV2

service = QiskitRuntimeService()
backend = service.least_busy(min_num_qubits=127)

simulator = AerSimulator(method='statevector').from_backend(backend)
# sampler=SamplerV2(options={"backend_options":{'method':'statevector','device':'GPU'},#,'blocking_enable':True,'blocking_qubits':6,'cuStateVec_enable':True,'batched_shots_gpu':True,"batched_shots_gpu_max_qubits":16,"shot_branching_enable":True},
#                            "run_options":{}}).from_backend(backend)

options={
    "backend_options":{'method':'statevector','device':'GPU'},#,'blocking_enable':True,'blocking_qubits':6,'cuStateVec_enable':True,'batched_shots_gpu':True,"batched_shots_gpu_max_qubits":16,"shot_branching_enable":True},
    "run_options":{}
}

sampler=SamplerV2(options=options).from_backend(backend)

Options are not being passed to the sampler object. They can be checked with

sampler._backend._options

Currently, options need to be manually set using sampler._backend.set_options(method='statevector',device="GPU") after the object is created.

Steps to reproduce the problem

The code above should reproduce it.

What is the expected behavior?

Options should be passed to the sampler object instead of requiring the user to set options manually afterward.

Suggested solutions

Unsure what is causing the issue.

@MarcoBarroca MarcoBarroca added the bug Something isn't working label Oct 2, 2024
@MarcoBarroca MarcoBarroca changed the title SimulatorV2 will not adhere to options dictionary passed. SamplerV2 will not adhere to options dictionary passed. Oct 2, 2024
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

1 participant