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

Inconsistent transpile execution. #13615

Open
keriksson-rosenqvist opened this issue Jan 6, 2025 · 0 comments
Open

Inconsistent transpile execution. #13615

keriksson-rosenqvist opened this issue Jan 6, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@keriksson-rosenqvist
Copy link

Environment

  • Qiskit version: 1.3.1
  • Qiskit_AER version: 0.15.1
  • Python version: 3.10.14
  • Operating system: Ubuntu 22.04

What is happening?

Transpiling the same non-trivial circuit arbitrarily fails/passes with no change to setup.
The example below is one somewhat short version that causes the issue, there may be simpler ones that also cause the issue but I have not come across any as of yet.

How can we reproduce the issue?

Small working example.

from qiskit import QuantumCircuit, transpile, qasm2, QiskitError
from qiskit_aer.backends import AerSimulator
from qiskit_aer.backends.backendconfiguration import AerBackendConfiguration

aer_config = AerBackendConfiguration.from_dict(AerSimulator._DEFAULT_CONFIGURATION | {"open_pulse": False})
qasm_sim = AerSimulator(aer_config)
cmap = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 20], [20, 21], [21, 22], [22, 23], [23, 24], [24, 25], [25, 26], [26, 27], [27, 28], [28, 29], [29, 30], [30, 31], [31, 32], [32, 33], [33, 34], [34, 0]]
qasm_string = """OPENQASM 2.0;
include "qelib1.inc";

qreg node[16];
creg cr[15];
u3(0.5*pi,0.0*pi,1.0*pi) node[0];
h node[1];
u3(0.0*pi,-0.5*pi,1.0*pi) node[2];
u3(3.5*pi,1.0*pi,0.5*pi) node[7];
u3(3.5*pi,1.0*pi,0.5*pi) node[8];
u3(3.5*pi,-0.5*pi,4.0*pi) node[9];
u3(0.5*pi,0.0*pi,1.0*pi) node[10];
u3(0.0*pi,-0.5*pi,1.0*pi) node[13];
h node[14];
h node[0];
h node[2];
cx node[9],node[10];
h node[13];
cx node[0],node[1];
h node[9];
h node[10];
cx node[13],node[14];
h node[0];
cx node[1],node[2];
h node[13];
h node[14];
u3(3.5*pi,1.0*pi,0.5*pi) node[0];
h node[1];
h node[2];
cx node[13],node[14];
measure node[0] -> cr[9];
cx node[1],node[2];
h node[13];
h node[14];
measure node[1] -> cr[12];
cx node[2],node[3];
cx node[13],node[14];
h node[2];
h node[3];
h node[14];
cx node[2],node[3];
cx node[14],node[15];
h node[2];
h node[3];
h node[14];
u3(3.5*pi,1.0*pi,0.5*pi) node[15];
measure node[15] -> cr[3];
cx node[2],node[3];
cx node[13],node[14];
measure node[2] -> cr[4];
cx node[3],node[4];
h node[13];
h node[14];
h node[3];
h node[4];
cx node[13],node[14];
cx node[3],node[4];
h node[13];
h node[14];
h node[3];
h node[4];
cx node[13],node[14];
cx node[3],node[4];
h node[13];
measure node[3] -> cr[2];
cx node[4],node[5];
cx node[12],node[13];
h node[4];
h node[5];
h node[12];
h node[13];
cx node[4],node[5];
cx node[12],node[13];
h node[4];
h node[5];
h node[12];
cx node[13],node[14];
cx node[4],node[5];
cx node[11],node[12];
h node[13];
h node[14];
cx node[5],node[6];
h node[11];
h node[12];
cx node[13],node[14];
h node[5];
h node[6];
cx node[11],node[12];
h node[13];
h node[14];
cx node[5],node[6];
h node[11];
h node[12];
cx node[13],node[14];
h node[5];
h node[6];
cx node[11],node[12];
h node[14];
measure node[14] -> cr[5];
cx node[5],node[6];
h node[11];
h node[12];
u3(0.5*pi,0.0*pi,1.0*pi) node[5];
cx node[11],node[12];
cx node[10],node[11];
cx node[12],node[13];
h node[10];
h node[11];
h node[12];
h node[13];
cx node[10],node[11];
cx node[12],node[13];
h node[10];
h node[11];
h node[12];
h node[13];
cx node[10],node[11];
cx node[12],node[13];
cx node[9],node[10];
cx node[11],node[12];
h node[13];
measure node[13] -> cr[7];
h node[9];
h node[10];
h node[11];
h node[12];
cx node[9],node[10];
cx node[11],node[12];
h node[9];
h node[10];
h node[11];
h node[12];
cx node[9],node[10];
cx node[11],node[12];
h node[9];
cx node[10],node[11];
cx node[8],node[9];
cx node[7],node[8];
cx node[8],node[9];
cx node[7],node[8];
cx node[6],node[7];
cx node[8],node[9];
h node[6];
h node[7];
h node[9];
cx node[6],node[7];
cx node[9],node[10];
h node[6];
h node[7];
cx node[10],node[11];
cx node[6],node[7];
cx node[9],node[10];
h node[11];
h node[6];
cx node[7],node[8];
u3(0.5*pi,0.0*pi,1.0*pi) node[11];
h node[7];
h node[8];
h node[11];
cx node[7],node[8];
cx node[11],node[12];
h node[7];
h node[8];
h node[11];
h node[12];
cx node[7],node[8];
cx node[11],node[12];
h node[7];
h node[8];
h node[11];
h node[12];
cx node[8],node[9];
cx node[11],node[12];
h node[8];
h node[9];
cx node[10],node[11];
h node[12];
measure node[12] -> cr[0];
u3(0.5*pi,0.0*pi,1.0*pi) node[8];
cx node[8],node[9];
h node[8];
h node[9];
cx node[9],node[10];
cx node[10],node[11];
cx node[9],node[10];
h node[11];
measure node[11] -> cr[10];
h node[9];
h node[10];
cx node[9],node[10];
measure node[10] -> cr[13];
h node[9];
cx node[8],node[9];
h node[8];
h node[9];
cx node[8],node[9];
h node[8];
h node[9];
cx node[8],node[9];
cx node[7],node[8];
h node[9];
measure node[9] -> cr[1];
h node[7];
h node[8];
cx node[7],node[8];
h node[7];
h node[8];
cx node[7],node[8];
cx node[6],node[7];
h node[8];
measure node[8] -> cr[8];
h node[6];
h node[7];
cx node[6],node[7];
h node[6];
h node[7];
cx node[6],node[7];
h node[6];
h node[7];
measure node[7] -> cr[11];
cx node[5],node[6];
measure node[6] -> cr[6];
measure node[5] -> cr[14];
"""

circ = qasm2.loads(qasm_string)

passed = 0
failed = 0
for i in range(10):
    try:
        transpile(circ, qasm_sim, coupling_map=cmap)
        passed += 1
    except QiskitError as exc:
        print(exc)
        failed += 1
print(f"Transpile passed: {passed} times, and failed {failed} times")

What should happen?

The transpilation of this worked consistently with qiskit v1.2.4 and should do so with version 1.3.x as well.

Any suggestions?

No response

@keriksson-rosenqvist keriksson-rosenqvist added the bug Something isn't working label Jan 6, 2025
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