I want to execute multiple circuits in one round on IBM's backends, especially the 16-qubit one, to save time. For instance, execute([grover_1, grover_2, grover_3], backend).

However, I found result given by that quantum processor contain only one overall time like this:

{'backend_version': '2.1.0', 'backend_name': 'ibmq_16_melbourne', 'results': [{'header': ..., 'success': True, 'shots': 1024, 'meas_level': 2, 'data': {'counts': {}}, 'memory': False}],}, {'header': ..., 'success': True, 'shots': 1024, 'meas_level': 2, 'data': {'counts': {}}, 'memory': False}], 'qobj_id': ..., 'status': 'Successful completion', 'date': '...', 'header': {'backend_version': '2.1.0', 'backend_name': 'ibmq_16_melbourne'}, 'success': True, 'job_id': '...', 'execution_id': '...', 'time_taken': 7.73473865282683}

while simulators can provide time counted for each circuit in the result of one instance like:

{'date': '...', 'results': [{'shots': 1024, 'header': ..., 'data': {}, 'success': True, 'status': 'DONE', 'time_taken': 0.00136636000000000003, ...}, {'shots': 1024, 'header': ..., 'data': {}, 'success': True, 'status': 'DONE', 'time_taken': 0.00263673800000000008, ...}], 'header': {'backend_version': '0.1.547', 'backend_name': 'ibmq_qasm_simulator'}, 'backend_version': '0.4.1', 'job_id': '...', 'success': True, 'status': 'COMPLETED', 'qobj_id': '...', 'backend_name': 'ibmq_qasm_simulator', 'time_taken': 0.00438376, 'metadata': {..., 'time_taken': 0.00438376}}.

So anyone knows why and how to deal with the issue of counting time for each circuit executed on quantum processors without iteration which takes too much waiting time?

Or alternatively, how to make circuits executed in distinct instances queued sequentially, instead of queueing one after finishing the previous one, if I can only do something like:

for n in range(1,10):
    start = time.time()
    end = time.time()

1 Answer 1


For you first question, I do not think you can get the time_taken for each individual circuit that were sent bundled into one job. I believe, like you saw in your example, it will only show the time_taken to complete the entire job.

For your second question, it is possible to queue multiple jobs without waiting for one of them to finish. The only blocker that will not allow you to continue until it completes, is calling job.result(). If you call this and then try to submit another job, the next job will not go through until you receive the results from the previous one. However, if you do not call job.result() right away, then you can continue to submit jobs, even though the previous ones have not completed.

So, you should be able to run something similar to the following code snippet to accomplish what you want:

jobs = []
for _ in range(<num_of_iterations>):
    job = execute(circ, backend)

for j in jobs:

That should execute each job sequentially without waiting for the previous one to finish. It then stores each job in a list so you can retrieve the time_taken of each job afterwards. Though, if running through the general "open" provider, there is a 5 simultaneously queued/running jobs limit, so you will not be able to submit more than that limit at one time.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.