-
Notifications
You must be signed in to change notification settings - Fork 401
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Informations
- Qiskit Aer version: 1.1.0
- Python version: 3.11
- Operating system: Apple Mac M2 Air
What is the current behavior?
The circuit provided below wasn't providing accurate results for optimization level 2 and 3 on state vector simulator( Qiskit/qiskit#13116). To verify the correctness of the transpiled circuit, i tried running the circuit on AerSimulator and it resulted in Segmentation fault. The issue is reproducible on the Qiskit version 1.2.0 as well.
Steps to reproduce the problem
from qiskit_aer import StatevectorSimulator, AerSimulator
from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager
from qiskit import QuantumCircuit
from qiskit.circuit.library import CU3Gate
cu3 = CU3Gate(2.7955,5.1982,3.3315,)
cu32 = CU3Gate(-2.7955,-3.3315,-5.1982)
qc = QuantumCircuit(3)
qc.x(1)
qc.x(2)
qc.x(2)
qc.x(1)
qc.id(1)
qc.swap(0,2)
qc.csx(0,1)
qc.u(5.6631,3.9488,1.066, 2)
qc.tdg(0)
qc.p(2.8007, 1)
qc.r(0.71942,4.7156, 2)
qc.ry(1.8777, 0)
qc.rxx(4.836, 1,2)
qc.rz(3.5166, 0)
qc.r(0.6993,2.7793, 1)
qc.u(0.3461,0.42597,3.202, 2)
qc.z(1)
qc.append(cu3, [2,0])
#qc.cu3( )
qc.ry(4.7962, 0)
qc.rx(2.4125, 1)
qc.r(2.4677,3.5935, 2)
qc.r(-2.4677,3.5935, 2)
qc.rx(-2.4125, 1)
qc.ry(-4.7962, 0)
qc.append(cu32, [2,0])
qc.z(1)
qc.u(-0.3461,-3.202,-0.42597, 2)
qc.r(-0.6993,2.7793, 1)
qc.rz(-3.5166, 0)
qc.rxx(-4.836, 1,2)
qc.ry(-1.8777, 0)
qc.r(-0.71942,4.7156, 2)
qc.p(-2.8007, 1)
qc.t(0)
qc.u(-5.6631,-1.066,-3.9488, 2)
qc.csx(0,1).inverse()
qc.swap(0,2)
qc.id(1)
qc.measure_all()
print("Running circuit....")
backend = StatevectorSimulator()
runner = AerSimulator(method='matrix_product_state')
pass_manager=generate_preset_pass_manager(backend=backend, optimization_level=0)
transpiled_circuit = pass_manager.run(qc)
print(transpiled_circuit)
job = runner.run(transpiled_circuit, shots=11000)
results = job.result().get_counts()
What is the expected behavior?
Running circuit....
┌─────┐ ┌────────────┐ ┌────────────┐ ┌──────────────────────────┐ ┌────────────┐ ┌─────────────┐ »
q_0: ────────────────X─────────────■────────────────────┤ Tdg ├────────┤ Ry(1.8777) ├───────┤ Rz(3.5166) ├───────────┤ U3(2.7955,5.1982,3.3315) ├───┤ Ry(4.7962) ├──────┤ Ry(-4.7962) ├────────»
┌───┐┌───┐┌───┐ │ ┌─┴──┐ ┌──┴─────┴──┐ ┌┴────────────┤ ┌──┴────────────┴──┐ ┌───┐└────────────┬─────────────┘ ├────────────┤ ├─────────────┤ ┌───┐»
q_1: ┤ X ├┤ X ├┤ I ├─┼───────────┤ Sx ├──────────────┤ P(2.8007) ├────┤0 ├────┤ R(0.6993,2.7793) ├───┤ Z ├─────────────┼─────────────────┤ Rx(2.4125) ├──────┤ Rx(-2.4125) ├───┤ Z ├»
├───┤├───┤└───┘ │ ┌─────────┴────┴─────────┐┌───┴───────────┴───┐│ Rxx(4.836) │┌───┴──────────────────┴──┐└───┘ │ ┌──┴────────────┴──┐┌──┴─────────────┴──┐└───┘»
q_2: ┤ X ├┤ X ├──────X─┤ U(5.6631,3.9488,1.066) ├┤ R(0.71942,4.7156) ├┤1 ├┤ U(0.3461,0.42597,3.202) ├──────────────────■──────────────┤ R(2.4677,3.5935) ├┤ R(-2.4677,3.5935) ├─────»
└───┘└───┘ └────────────────────────┘└───────────────────┘└─────────────┘└─────────────────────────┘ └──────────────────┘└───────────────────┘ »
meas: 3/══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════»
»
« ┌─────────────────────────────┐ ┌─────────────┐ ┌─────────────┐ ┌───┐ »
« q_0: ┤ U3(-2.7955,-3.3315,-5.1982) ├───────┤ Rz(-3.5166) ├────────┤ Ry(-1.8777) ├─────────┤ T ├────────────────────────────────────────■───────────────────■─────────■────────────────────────■─────────────────»
« └──────────────┬──────────────┘ ┌──┴─────────────┴──┐ ├─────────────┴┐ ┌───┴───┴────┐ ┌────────────┐ ┌─┴─┐┌─────────────┐┌─┴─┐┌──────┴───────┐┌────────────┐┌─┴─┐┌─────────────┐»
« q_1: ───────────────┼───────────────────┤ R(-0.6993,2.7793) ├─────┤0 ├────┤ P(-2.8007) ├────────────┤ U(0,0,π/4) ├───────┤ X ├┤ U(0,0,-π/4) ├┤ X ├┤ U(π/2,0,π,0) ├┤ U(0,0,π/4) ├┤ X ├┤ U(0,0,-π/4) ├»
« │ ┌───┴───────────────────┴────┐│ Rxx(-4.836) │┌───┴────────────┴───┐┌───────┴────────────┴──────┐└───┘└─────────────┘└───┘└──────────────┘└────────────┘└───┘└─────────────┘»
« q_2: ───────────────■───────────────┤ U(-0.3461,-3.202,-0.42597) ├┤1 ├┤ R(-0.71942,4.7156) ├┤ U(-5.6631,-1.066,-3.9488) ├───────────────────────────────────────────────────────────────────────────»
« └────────────────────────────┘└──────────────┘└────────────────────┘└───────────────────────────┘ »
«meas: 3/═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════»
« »
« ┌────────┐ ░ ┌─┐
« q_0: ──■──┤ P(π/4) ├─X──░─┤M├──────
« ┌─┴─┐└─┬───┬──┘ │ ░ └╥┘┌─┐
« q_1: ┤ X ├──┤ I ├────┼──░──╫─┤M├───
« └───┘ └───┘ │ ░ ║ └╥┘┌─┐
« q_2: ────────────────X──░──╫──╫─┤M├
« ░ ║ ║ └╥┘
«meas: 3/══════════════════════╩══╩══╩═
« 0 1 2
[1] 6476 segmentation fault python3 bugs/issue.py
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working