It is a simple 5 bit circuit, but it has 20,000 lines of QASM code. I try to put it in the composer, but the "Saving..." beside the file name will stay there for hours. I never saw its completion.

"Saving..." usually transition to "Saved" in a few seconds if the file has 100 lines of code.

Has anybody succeeded in running a large file? How long do you have to wait to see the "Saved"?

• No, I have never run that large of a qasm code through the IBM's composer. But it seems like your circuit is super long. I don't think you can even execute too long of a circuit on the hardware because you might run into repetition time error, essentially what it means is the time taken to execute your circuit is longer than the qubit's coherence time... – KAJ226 Mar 20 at 22:13
• Did you loading it on IBM Quantum Lab. – luciano Mar 21 at 15:23
• @luciano I think the IBM Quantum Lab is pure Python. Right? I am only interested in QASM and the real quantum hardware. So, I suppose I have to use the Composer. – Emscripten Fan Mar 21 at 16:19
• You can load qasm and run it on real hardware with the IBM Quantum Lab, using Qiskit. – luciano Mar 21 at 19:06
• @luciano But, my very problem is that the Composer does not allow me to load 20,000 lines of QASM code. The IBM website refuses to save it. So, I don't have a chance to turn the QASM code to Qiskit. If you are one of the IBM Quantum guys, could you please check the website? It appears to me the business logic of the execution will kick in immediately before the file is saved. I think the correct logic is to compile it and let the user execute it on the real quantum computer. It takes too long for the classical computer to simulate those 20,000 lines of code. – Emscripten Fan Mar 21 at 19:59

Indeed, the composer does not support such a deep circuit. While, the error is counterintuitive (I reported that to the the composer developers already) it kind of makes sense that you are unable to load a circuit with ~20K gates. The composer is useful for toy examples and to simulate the circuit "live" in the browser. As you noticed, simulating the situation you are describing is impractical.

More generally, the situation you are describing is not practical on real hardware neither. As explained, 20K gates is a lot for the current state of the art of quantum hardware.

In any case, I suggest you to use IBM Quantum Lab for non-toy situations.

Here is how to load a QASM file and run it in real hardware using the IBM Quantum Lab:

1. Upload your QASM file (long.qasm in my case) to the environment:

2. In the notebook (the default has many useful imports already), load the file:

circuit = QuantumCircuit.from_qasm_file('long.qasm')  # Creates a circuit from the QASM file
sum(circuit.count_ops().values())  # Total amount of gates to be sure that's your big circuit

1. Get the least busy device that is not a simulator and have enough qubits to execute your circuit (5 in this case)
from qiskit.providers.ibmq import least_busy
least_busy_device = least_busy(provider.backends(
simulator=False, filters=lambda b: b.configuration().n_qubits >= 5))

1. Execute the circuit in the device:
job = execute(circuit, least_busy_device)

1. Take a look to the results:
counts = job.result().get_counts()  # This might take some time, since your job will be in the queue.
plot_histogram(counts)

1. You will probably see a lot of noise, because of decoherence.
• Thanks, sir! Now, this is the coolest thing I have ever tried in my entire computing career. Decoherence does not bother me because my whole purpose is to study the behaviors of a real quantum device in the lab, not just in the Hilbert space:-) – Emscripten Fan Mar 22 at 0:48