microsoft / azure-quantum-python

The azure-quantum python package submits jobs to the Azure Quantum service.
https://learn.microsoft.com/azure/quantum/
MIT License
120 stars 90 forks source link

Time limit error for Rigetti Backend #416

Open gitpold opened 1 year ago

gitpold commented 1 year ago

Hi,

when playing around with the Hello World: Qiskit (with Rigetti) Jupyter notebook from the sample gallery, I am running into following problem:

When using the Aspen M3 (or M2) instead of the simulator and increasing the size of the circuit, the execution fails with the message:

Result(backend_name='rigetti.qpu.aspen-m-3', backend_version='1', qobj_id='circuit-102', job_id='6c4b4d7c-a3fa-11ed-a578-00155d791a0c', success=False, results=[ExperimentResult(shots=100, success=False, meas_level=2, data=ExperimentResultData(), header=QobjExperimentHeader(qiskit='True', name='circuit-102', num_qubits='12', metadata=None))], error_data={'code': 'InvalidInputData', 'message': 'Execution timed out.  Note: time limit: 0 seconds.'})

Code snippet used to produce the error (circuit and provider definition not shown):

from azure.quantum.target.rigetti import RigettiTarget

rigetti_simulator_backend = provider.get_backend(RigettiTarget.ASPEN_M_3)

job = rigetti_simulator_backend.run((circuit), count=100)

result = job.result()
print(result)

The problem does not seem to occur for the inital circuit given in the example, but with increasing size of the circuit this error occurs more often until it basically happens always.

Looking at the Job Management Overview it seems like the Job is already failing before it is actually running, so my thought was that the time limit in the error message could not refer to the actual execution time but to a compile time limit?

But I have seen no option to increase this limit... any ideas how to do this or what else could cause this?

Thank you!

gitpold commented 1 year ago

Interestingly there seem to have been some changes in the last few days.

Without any changes to the code, the received error message is now:

error_data={'code': 'InvalidInputData', 'message': 'Execution timed out.  Note: time limit: 10 seconds.'}

The time limit has increased from 0 seconds to 10 seconds.

Additionally I am now able to consistently run circuits succesfully, which previously failed, but further increasing the size of the circuit still leads to the error message above...

It definitly makes the impression as if this time limit mentioned in the error message is what is preventing me from executing larger quantum circuits on the Aspen M3 or M2. And while it apparently can be changed, I am not sure if or how this limit could be increased further.

l-enloe commented 1 year ago

Hi, can you share the circuit you used to help us reproduce the issue?

gitpold commented 1 year ago

Hi, thanks for getting back to this.

The following circuit is what I used for testing (not the complete circuit I would like to run):

circuit = QuantumCircuit.from_qasm_str("""OPENQASM 2.0;
include "qelib1.inc";
qreg q1[12];
creg c0[3];
h q1[0];
h q1[1];
h q1[2];
barrier q1[0],q1[1],q1[2],q1[3],q1[4],q1[5],q1[6],q1[7],q1[8],q1[9],q1[10],q1[11];
ccx q1[0],q1[11],q1[3];
ccx q1[1],q1[2],q1[11];
ccx q1[0],q1[11],q1[3];
ccx q1[1],q1[2],q1[11];
measure q1[0] -> c0[2];
measure q1[1] -> c0[1];
measure q1[2] -> c0[0];""")

In most cases this leads to the error message above after around 20 seconds. Interestingly, a few times this circuit completed successfully but only after being in the "Executing" state for mutliple hours.

I hope that helps, let me know if you need more information!