Informations
- Qiskit Aer version: qiskit==1.4.1, qiskit-aer==0.17.0, qiskit-ibm-runtime==0.38.0
- Python version: Python 3.12.6
- Operating system: macOS Sequoia 15.3.2
What is the current behavior?
While testing a program with the FakeBoeblingenV2 (fake) backend, which supports the X gate, I encountered the following error message:
Traceback (most recent call last):
File ".../test_qiskit_FakeBoeblingenV2.py", line 43, in <module>
result = job.result()# bug
^^^^^^^^^^^^
File ".../venv/lib/python3.12/site-packages/qiskit_aer/jobs/utils.py", line 38, in _wrapper
return func(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../venv/lib/python3.12/site-packages/qiskit_aer/jobs/aerjob.py", line 96, in result
return self._future.result(timeout=timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/python@3.12/3.12.6/Frameworks/Python.framework/Versions/3.12/lib/python3.12/concurrent/futures/_base.py", line 449, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/python@3.12/3.12.6/Frameworks/Python.framework/Versions/3.12/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/usr/local/Cellar/python@3.12/3.12.6/Frameworks/Python.framework/Versions/3.12/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../venv/lib/python3.12/site-packages/qiskit_aer/backends/aerbackend.py", line 454, in _execute_circuits_job
aer_circuits, idx_maps = assemble_circuits(circuits, self.configuration().basis_gates)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../venv/lib/python3.12/site-packages/qiskit_aer/backends/aer_compiler.py", line 1080, in assemble_circuits
*[assemble_circuit(circuit, basis_gates_set) for circuit in circuits]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../venv/lib/python3.12/site-packages/qiskit_aer/backends/aer_compiler.py", line 749, in assemble_circuit
num_of_aer_ops += _assemble_op(
^^^^^^^^^^^^^
File ".../venv/lib/python3.12/site-packages/qiskit_aer/backends/aer_compiler.py", line 1047, in _assemble_op
raise AerError(f"unknown instruction: {name}")
qiskit_aer.aererror.AerError: 'unknown instruction: x'
Steps to reproduce the problem
You can run the following minimal working example:
from qiskit import qasm2
from qiskit_aer import AerSimulator
from qiskit_ibm_runtime.fake_provider import FakeBoeblingenV2
# device backend information
backend = FakeBoeblingenV2()
simulator = AerSimulator.from_backend(backend)
# the X gate is supported
config = backend.configuration()
for instruction in config.supported_instructions:
print(f"{instruction}")
#u2
#x
#u3
#u1
#reset
#acquire
#id
#play
#delay
#setf
#cx
#measure
#shiftf
# a circuit with X gates
circ_str = """OPENQASM 2.0;
include "qelib1.inc";
opaque delay(t) q;
qreg q[2];
creg cr[1];
u3(1.570796326794897, 0, 0) q[1];
x q[0];
barrier q[0], q[1];
id q[1];
x q[0];
barrier q[0], q[1];
u3(1.570796326794897, 0, 0) q[1];
x q[0];
barrier q[0], q[1];
measure q[1] -> cr[0];"""
circ_qasm = qasm2.loads(circ_str, custom_instructions = qasm2.LEGACY_CUSTOM_INSTRUCTIONS)
print(circ_qasm)
# ┌───┐ ░ ┌───┐ ░ ┌───┐ ░
# q_0: ─────┤ X ├──────░─┤ X ├─░──────┤ X ├──────░────
# ┌────┴───┴────┐ ░ ├───┤ ░ ┌────┴───┴────┐ ░ ┌─┐
# q_1: ┤ U3(π/2,0,0) ├─░─┤ I ├─░─┤ U3(π/2,0,0) ├─░─┤M├
# └─────────────┘ ░ └───┘ ░ └─────────────┘ ░ └╥┘
#cr: 1/═════════════════════════════════════════════╩═
# 0
job = simulator.run(circ_qasm, shots = 1024)
print(f"simulator.run is fine")
result = job.result()# qiskit_aer.aererror.AerError: 'unknown instruction: x'
print(f"job.result is not fine?")
counts = result.get_counts(0)
print(f"{counts = }")
What is the expected behavior?
I would like to retrieve the output count from the job result.
Informations
What is the current behavior?
While testing a program with the FakeBoeblingenV2 (fake) backend, which supports the X gate, I encountered the following error message:
Steps to reproduce the problem
You can run the following minimal working example:
What is the expected behavior?
I would like to retrieve the output count from the job result.