1
$\begingroup$

I'm working with a program, which needs iterations of quantum computation like this

def quantum(n):
    Grover(oracle).run(QuantumInstance(...))
    #n is input size associated with oracle, 
    #and some other components are omitted.

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

Now I have to wait for hours to run this on the 16-qubit quantum computer. So is there any way to pack all computation into one round?

$\endgroup$

1 Answer 1

2
$\begingroup$

Assuming your quantum() method creates a circuit, you can run lots of circuits in one go by using the execute command. For example execute([grover_1, grover_2, grover_3], backed=my_backend).

$\endgroup$
5
  • $\begingroup$ Yes, but can I count time for each computation? $\endgroup$
    – Zaragoss
    Commented May 19, 2020 at 10:09
  • 1
    $\begingroup$ Yes this is returned as a parameter in the results object :) $\endgroup$
    – met927
    Commented May 19, 2020 at 10:16
  • $\begingroup$ I'm new in using this framework, so sorry, but it seems the algorithm Grover in aqua.algorithms is not a circuit which can be accepted by execute directly, right? Then is there any way to execute some simple methods like Grover, without touching too much circuit work? $\endgroup$
    – Zaragoss
    Commented May 19, 2020 at 11:03
  • 1
    $\begingroup$ Instead of doing grover.run() you can do grover.construct_circuit(). This will return a circuit which can then be run by execute $\endgroup$
    – met927
    Commented May 19, 2020 at 12:35
  • $\begingroup$ Update: I have just found results given by the quantum processor contain only an overall time_taken for total time, while simulators provider time counted for each circuit. So is there any way to deal with it? (Maybe this is a little off-topic, I posted another question for this issue.) $\endgroup$
    – Zaragoss
    Commented May 20, 2020 at 14:08

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.